Comment: | Use TableTo* to export HTML statement table to ODS/CSV, refactor statement table to be in a single HTML table |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA3-256: |
fa279fb6691d62c3b535b34fe5bcd2f8 |
User & Date: | bohwaz on 2023-03-27 02:05:41 |
Other Links: | manifest | tags |
2023-03-27
| ||
02:17 | Use a caption for tables, and include volunteering in export check-in: a7f0ec74d4 user: bohwaz tags: trunk, stable | |
02:05 | Use TableTo* to export HTML statement table to ODS/CSV, refactor statement table to be in a single HTML table check-in: fa279fb669 user: bohwaz tags: trunk, stable | |
2023-03-24
| ||
13:37 | Fix CSS check-in: a1d412084d user: bohwaz tags: trunk, stable | |
Modified src/include/lib/Garradin/Accounting/Reports.php from [9a3d384a70] to [cb5eff4048].
︙ | ︙ | |||
403 404 405 406 407 408 409 | $balance2 += $row->balance2 ?? 0; $change += $row->change ?? 0; } return (object) compact('label', 'balance', 'balance2', 'change'); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | $balance2 += $row->balance2 ?? 0; $change += $row->change ?? 0; } return (object) compact('label', 'balance', 'balance2', 'change'); } /** * Statement / Compte de résultat */ static public function getStatement(array $criterias): \stdClass { $out = new \stdClass; |
︙ | ︙ |
Modified src/include/lib/Garradin/CSV.php from [24543f871a] to [7fb4eaf2ff].
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php namespace Garradin; use KD2\Office\Calc\Writer as ODSWriter; class CSV { /** * Convert a file to CSV if required (and if CALC_CONVERT_COMMAND is set) */ static public function convertUploadIfRequired(string $path, bool $delete_original = false): string { | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php namespace Garradin; use KD2\Office\Calc\Writer as ODSWriter; use KD2\HTML\TableExport; class CSV { /** * Convert a file to CSV if required (and if CALC_CONVERT_COMMAND is set) */ static public function convertUploadIfRequired(string $path, bool $delete_original = false): string { |
︙ | ︙ | |||
208 209 210 211 212 213 214 215 216 217 218 219 220 221 | elseif ('ods' == $format) { self::toODS(... array_slice(func_get_args(), 1)); } else { throw new \InvalidArgumentException('Unknown export format'); } } static protected function rowToArray($row, ?callable $row_map_callback) { if (null !== $row_map_callback) { call_user_func_array($row_map_callback, [&$row]); } | > > > > > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | elseif ('ods' == $format) { self::toODS(... array_slice(func_get_args(), 1)); } else { throw new \InvalidArgumentException('Unknown export format'); } } static public function exportHTML(string $format, string $html, string $name = 'Export'): void { $css = file_get_contents(ROOT . '/www/admin/static/styles/06-tables-export.css'); TableExport::download($format, $name, $html, $css); } static protected function rowToArray($row, ?callable $row_map_callback) { if (null !== $row_map_callback) { call_user_func_array($row_map_callback, [&$row]); } |
︙ | ︙ |
Modified src/include/lib/Garradin/Template.php from [e6a08fd537] to [e57b6b42e6].
︙ | ︙ | |||
311 312 313 314 315 316 317 | <span class="menu-btn %s"> <b data-icon="↷" class="btn">Export</b> <span>%s %s %s</span> </span>', htmlspecialchars($params['class'] ?? ''), $this->widgetLinkButton(['href' => $params['href'] . 'csv', 'label' => 'Export CSV', 'shape' => 'export']), $this->widgetLinkButton(['href' => $params['href'] . 'ods', 'label' => 'Export LibreOffice', 'shape' => 'export']), | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | <span class="menu-btn %s"> <b data-icon="↷" class="btn">Export</b> <span>%s %s %s</span> </span>', htmlspecialchars($params['class'] ?? ''), $this->widgetLinkButton(['href' => $params['href'] . 'csv', 'label' => 'Export CSV', 'shape' => 'export']), $this->widgetLinkButton(['href' => $params['href'] . 'ods', 'label' => 'Export LibreOffice', 'shape' => 'export']), CALC_CONVERT_COMMAND && ($params['xlsx'] ?? null) !== false ? $this->widgetLinkButton(['href' => $params['href'] . 'xlsx', 'label' => 'Export Excel', 'shape' => 'export']) : '' ); } protected function passwordChangeInput(array $params) { $out = $this->formInput(array_merge($params, [ 'type' => 'password', |
︙ | ︙ |
Modified src/include/lib/dependencies.list from [e1caf96633] to [c4b1073f99].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | KD2/FossilInstaller.php KD2/Garbage2xhtml.php KD2/Graphics/Image.php KD2/Graphics/QRCode.php KD2/Graphics/SVG/Pie.php KD2/Graphics/SVG/Plot.php KD2/Graphics/SVG/Bar.php KD2/HTTP.php KD2/Mail_Message.php KD2/Office/Calc/Writer.php KD2/Security.php KD2/Security_OTP.php KD2/SimpleDiff.php KD2/SkrivLite.php KD2/Smartyer.php KD2/SMTP.php KD2/Translate.php KD2/UserSession.php KD2/ZipWriter.php Parsedown.php | > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | KD2/FossilInstaller.php KD2/Garbage2xhtml.php KD2/Graphics/Image.php KD2/Graphics/QRCode.php KD2/Graphics/SVG/Pie.php KD2/Graphics/SVG/Plot.php KD2/Graphics/SVG/Bar.php KD2/HTML/CSSParser.php KD2/HTML/TableExport.php KD2/HTML/TableToCSV.php KD2/HTML/TableToODS.php KD2/HTTP.php KD2/Mail_Message.php KD2/Office/Calc/Writer.php KD2/Security.php KD2/Security_OTP.php KD2/SimpleDiff.php KD2/SkrivLite.php KD2/Smartyer.php KD2/SMTP.php KD2/Translate.php KD2/UserSession.php KD2/ZipWriter.php Parsedown.php |
Modified src/templates/acc/reports/_header.tpl from [a7d655c5cc] to [b6273893d1].
1 2 3 4 | <div class="year-header"> <nav class="tabs noprint"> {if !empty($year)} <aside> | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | <div class="year-header"> <nav class="tabs noprint"> {if !empty($year)} <aside> {if $current == 'statement'} {exportmenu href="%s&export="|args:$self_url class="menu-btn-right" xlsx=false} {/if} {if !$criterias.before && !$criterias.compare_year && !empty($allow_compare) && !empty($other_years)} {linkbutton shape="list-ol" href="#" id="compareFormButton" label="Comparer" onclick="var a = $('#compareForm'); a.disabled = false; g.toggle(a, true); this.remove(); var a = $('#filterFormButton'); a ? a.remove() : null; return false;"} {/if} {if !$criterias.compare_year && !empty($allow_filter) && !$criterias.before && !$criterias.after} {linkbutton shape="search" href="#" id="filterFormButton" label="Filtrer" onclick="var a = $('#filterForm'); a.disabled = false; g.toggle(a, true); this.remove(); var a = $('#compareFormButton'); a ? a.remove() : null; return false;"} {/if} |
︙ | ︙ |
Modified src/templates/acc/reports/_statement.tpl from [1459d6fb88] to [e1f43b53d1].
1 | <table class="statement"> | > > > > > | > > > > > > > > > > | > > > > > | | > > > > > > | > | < > > > > > | > > > > > > > > > | | > > > > > > > | > > > > > > > > > > | | | | | > > | > | < | < | | < < | | < | | < | | < < | | | < | < | | < < | | < | | < | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | <?php $colspan = empty($year2) ? 3 : 5; $max = max(count($statement->body_left), count($statement->body_right)); ?> <table class="statement"> <thead> <tr> <th colspan="{$colspan}" class="colspan">{$statement.caption_left}</th> <td class="spacer"></td> <th colspan="{$colspan}" class="colspan">{$statement.caption_right}</th> </tr> {if !empty($year2)} <tr> <td></td> <td></td> <td class="money" width="10%">{$year->label_years()}</td> <td class="money" width="10%">{$year2->label_years()}</td> <td class="money" width="10%">Écart</td> <td class="spacer"></td> <td></td> <td></td> <td class="money" width="10%">{$year->label_years()}</td> <td class="money" width="10%">{$year2->label_years()}</td> <td class="money" width="10%">Écart</td> </tr> {/if} </thead> <tbody> <?php for ($i = 0; $i < $max; $i++): $row = $statement->body_left[$i] ?? null; $class = $i % 2 == 0 ? 'odd' : 'even'; ?> <tr class="{$class}"> {if $row} <td class="num"> {if !empty($year) && $row.id} {link href="!acc/accounts/journal.php?id=%d&year=%d"|args:$row.id,$year.id label=$row.code} {else} {$row.code} {/if} </td> <th>{$row.label}</th> <td class="money">{$row.balance|raw|money:false}</td> {if isset($year2)} <td class="money">{$row.balance2|raw|money:false}</td> <td class="money">{$row.change|raw|money:false:true}</td> {/if} {else} <td colspan="{$colspan}" class="colspan"></td> {/if} <td class="spacer"></td> <?php $row = $statement->body_right[$i] ?? null; ?> {if $row} <td class="num"> {if !empty($year) && $row.id} {link href="!acc/accounts/journal.php?id=%d&year=%d"|args:$row.id,$year.id label=$row.code} {else} {$row.code} {/if} </td> <th>{$row.label}</th> <td class="money">{$row.balance|raw|money:false}</td> {if isset($year2)} <td class="money">{$row.balance2|raw|money:false}</td> <td class="money">{$row.change|raw|money:false:true}</td> {/if} {else} <td colspan="{$colspan}" class="colspan"></td> {/if} </tr> <?php endfor; ?> </tbody> <tfoot> <tr class="spacer"><td colspan="{if !empty($year2)}11{else}7{/if}" class="colspan"></td></tr> <?php $max = max(count($statement->foot_left), count($statement->foot_right)); ?> <?php for ($i = 0; $i < $max; $i++): $row = $statement->foot_left[$i] ?? null; $class = $i % 2 == 0 ? 'odd' : 'even'; ?> <tr class="{$class}"> {if $row} <th colspan="2">{$row.label}</th> <td class="money" width="10%">{$row.balance|raw|money:false}</td> {if $row.balance2 || $row.change} <td class="money" width="10%">{$row.balance2|raw|money:false}</td> <td class="money" width="10%">{$row.change|raw|money:false:true}</td> {/if} {else} <td colspan="{$colspan}" class="colspan"></td> {/if} <td class="spacer"></td> <?php $row = $statement->foot_right[$i] ?? null; ?> {if $row} <th colspan="2">{$row.label}</th> <td class="money" width="10%">{$row.balance|raw|money:false}</td> {if $row.balance2 || $row.change} <td class="money" width="10%">{$row.balance2|raw|money:false}</td> <td class="money" width="10%">{$row.change|raw|money:false:true}</td> {/if} {else} <td colspan="{$colspan}" class="colspan"></td> {/if} </tr> <?php endfor; ?> </tfoot> </table> |
Modified src/templates/acc/reports/statement.tpl from [ce00f74231] to [11d703c3db].
1 2 3 4 5 6 | {include file="admin/_head.tpl" title="%sCompte de résultat"|args:$project_title current="acc/years"} {include file="acc/reports/_header.tpl" current="statement" title="Compte de résultat" allow_compare=true allow_filter=true} <p class="help noprint">Le compte de résultat indique les recettes (produits) et dépenses (charges), ainsi que le résultat réalisé.</p> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | {include file="admin/_head.tpl" title="%sCompte de résultat"|args:$project_title current="acc/years"} {include file="acc/reports/_header.tpl" current="statement" title="Compte de résultat" allow_compare=true allow_filter=true} <p class="help noprint">Le compte de résultat indique les recettes (produits) et dépenses (charges), ainsi que le résultat réalisé.</p> {include file="acc/reports/_statement.tpl" statement=$general} {if !empty($volunteering.body_left) || !empty($volunteering.body_right)} <h2 class="ruler">Contributions bénévoles en nature</h2> {include file="acc/reports/_statement.tpl" statement=$volunteering header=false caption1="Emplois des contributions volontaires en nature" caption2="Contributions volontaires en nature"} {/if} <p class="help">Toutes les écritures sont libellées en {$config.monnaie}.</p> {include file="admin/_foot.tpl"} |
Modified src/www/admin/acc/reports/statement.php from [4f16f80d95] to [ecfebbb935].
1 2 3 4 5 6 7 8 9 10 11 | <?php namespace Garradin; use Garradin\Accounting\Reports; use Garradin\Accounting\Years; use Garradin\Entities\Accounting\Account; require_once __DIR__ . '/_inc.php'; if ($f = qg('export')) { | > > > > > | > > < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php namespace Garradin; use Garradin\Accounting\Reports; use Garradin\Accounting\Years; use Garradin\Entities\Accounting\Account; require_once __DIR__ . '/_inc.php'; $general = Reports::getStatement($criterias + ['exclude_type' => [Account::TYPE_VOLUNTEERING_REVENUE, Account::TYPE_VOLUNTEERING_EXPENSE]]); $volunteering = Reports::getVolunteeringStatement($criterias, $general); if ($f = qg('export')) { $tpl->assign('statement', $general); $table = $tpl->fetch('acc/reports/_statement.tpl'); CSV::exportHTML($f, $table, 'Compte de résultat'); return; } $tpl->assign(compact('general', 'volunteering')); if (!empty($criterias['year'])) { $years = Years::listAssocExcept($criterias['year']); $tpl->assign('other_years', count($years) ? [null => '-- Ne pas comparer'] + $years : $years); } $tpl->display('acc/reports/statement.tpl'); |
Modified src/www/admin/static/admin.css from [18c59b252b] to [8d4155645a].
1 2 3 4 5 6 | @import url("styles/00-reset.css"); @import url("styles/01-layout.css"); @import url("styles/02-common.css"); @import url("styles/03-forms.css"); @import url("styles/04-dialogs.css"); @import url("styles/05-navigation.css"); | | > | 1 2 3 4 5 6 7 8 9 | @import url("styles/00-reset.css"); @import url("styles/01-layout.css"); @import url("styles/02-common.css"); @import url("styles/03-forms.css"); @import url("styles/04-dialogs.css"); @import url("styles/05-navigation.css"); @import url("styles/06-tables-export.css"); @import url("styles/07-tables.css"); @import url("styles/10-accounting.css"); |
Modified src/www/admin/static/styles/07-tables.css from [3a60ef01c4] to [568bcc7aac].
︙ | ︙ |
Modified src/www/admin/static/styles/10-accounting.css from [bc4e3094e2] to [6860641160].
︙ | ︙ | |||
40 41 42 43 44 45 46 | padding: .2rem .5rem; } nav.acc-year h4 { font-weight: normal; } | < < < < < < < < < < < < < < < < < < < < < < < < < < | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | padding: .2rem .5rem; } nav.acc-year h4 { font-weight: normal; } .year-header { text-align: center; margin-bottom: .8em; padding-bottom: .5em; border-bottom: 1pt solid var(--gBorderColor); } |
︙ | ︙ | |||
206 207 208 209 210 211 212 | .transaction-details-container { max-width: 60rem; } .transaction-details-container nav { text-align: center; } | > > > > > > > > > > > > | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | .transaction-details-container { max-width: 60rem; } .transaction-details-container nav { text-align: center; } table.statement td, table.statement th { border: 1px solid rgba(var(--gSecondColor), 0.5); } table.statement tbody tr.even td, table.statement tbody tr.even th { background: rgba(var(--gSecondColor), 0.1); } table.statement tfoot td, table.statement tfoot th { background: rgba(var(--gSecondColor), 0.2); } |