Comment: | Implement account journals |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
b0ad011f2b0f80cc71194c3f6f9b75dd |
User & Date: | bohwaz on 2020-10-04 01:00:56 |
Other Links: | branch diff | manifest | tags |
2020-10-08
| ||
13:47 | Simplified view for favorite accounts check-in: 5d47c23bff user: bohwaz tags: dev | |
2020-10-04
| ||
01:00 | Implement account journals check-in: b0ad011f2b user: bohwaz tags: dev | |
2020-10-03
| ||
23:52 | Current year selector check-in: 27040058bc user: bohwaz tags: dev | |
Modified src/include/lib/Garradin/Entities/Accounting/Account.php from [780b8fe6ec] to [91265d91fc].
︙ | ︙ | |||
93 94 95 96 97 98 99 | 'code' => 'required|string|alpha_num|max:10', 'label' => 'required|string|max:200', 'description' => 'string|max:2000', 'position' => 'required|integer', 'type' => 'numeric|min:0', 'type_parent' => 'numeric|min:0', ]; | | > > > > > > > > > > > > > > > > > > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | 'code' => 'required|string|alpha_num|max:10', 'label' => 'required|string|max:200', 'description' => 'string|max:2000', 'position' => 'required|integer', 'type' => 'numeric|min:0', 'type_parent' => 'numeric|min:0', ]; public function getJournal(int $year_id) { $db = DB::getInstance(); $rows = $db->get('SELECT l.debit, l.credit, t.id, t.date, t.reference, l.reference AS line_reference, t.label, l.label AS line_label FROM acc_transactions_lines l INNER JOIN acc_transactions t ON t.id = l.id_transaction WHERE l.id_account = ? AND t.id_year = ? ORDER BY t.date;', $this->id(), $year_id); $sum = 0; foreach ($rows as &$row) { $sum += ($row->credit - $row->debit); $row->running_sum = $sum; $row->date = \DateTime::createFromFormat('Y-m-d', $row->date); } return $rows; } } |
Modified src/templates/acc/accounts/index.tpl from [fc4604d6f2] to [65f07d7bc0].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 | <li><a href="{$admin_url}acc/accounts/new.php"><strong>Ajouter un compte</strong></a></li> <li><a href="{$admin_url}acc/charts/">Plans comptables</a></li> <li><a href="{$admin_url}acc/charts/import.php">Importer un plan comptable</a></li> {/if} </ul> </nav> {foreach from=$accounts_grouped key="group_name" item="accounts"} | > > | < > > | | | | | | | | | > | > | 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 | <li><a href="{$admin_url}acc/accounts/new.php"><strong>Ajouter un compte</strong></a></li> <li><a href="{$admin_url}acc/charts/">Plans comptables</a></li> <li><a href="{$admin_url}acc/charts/import.php">Importer un plan comptable</a></li> {/if} </ul> </nav> <table class="list"> {foreach from=$accounts_grouped key="group_name" item="accounts"} <tbody> <tr><td colspan="4"><h2 class="ruler">{$group_name}</h2></td></tr> {foreach from=$accounts item="account"} <tr> <td class="num">{$account.code}</td> <th>{$account.label}</th> <td class="desc">{$account.description}</td> <td class="actions"> {linkbutton shape="menu" label="Journal" href="acc/accounts/journal.php?id=%d"|args:$account.id} {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton shape="edit" label="Modifier" href="acc/accounts/edit.php?id=%d"|args:$account.id} {linkbutton shape="delete" label="Supprimer" href="acc/accounts/delete.php?id=%d"|args:$account.id} {/if} </td> </tr> {/foreach} </tbody> {/foreach} </table> {include file="admin/_foot.tpl"} |
Modified src/templates/acc/accounts/journal.tpl from [f69dd30f9f] to [8544eb6953].
|
| < | < < < < < < < < < | < < < < < < < < < < < < < < < < < > | > | | | | > | | < | < < | | | | 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 | {include file="admin/_head.tpl" title="Journal : %s - %s"|args:$account.code:$account.label current="acc/accounts" body_id="rapport"} {include file="acc/_year_select.tpl"} <table class="list"> <colgroup> <col width="3%" /> <col width="12%" /> <col width="10%" /> <col width="10%" /> <col width="12%" /> <col /> <col width="6%" /> </colgroup> <thead> <tr> <td>N°</td> <td>Date</td> <td>Débit</td> <td>Crédit</td> <td>Solde cumulé</td> <th>Libellé</th> <td></td> </tr> </thead> <tbody> {foreach from=$journal item="line"} <tr> <td class="num"><a href="{$admin_url}acc/transactions/details.php?id={$line.id}">{$line.id}</a></td> <td>{$line.date|date_fr:'d/m/Y'}</td> <td class="money">{if $line.debit}{$line.debit|escape|html_money}{/if}</td> <td class="money">{if $line.credit}{$line.credit|escape|html_money}{/if}</td> <td class="money">{$line.running_sum|escape|html_money}</td> <th>{$line.label}</th> <td class="actions"> {linkbutton href="acc/transactions/details.php?id=%d"|args:$line.id label="Détails" shape="search"} </td> </tr> {/foreach} </tbody> <tfoot> <tr> <td colspan="4">Solde</td> <td class="money">{$sum|escape|html_money}</td> <td colspan="2"></td> </tr> </tfoot> </table> {include file="admin/_foot.tpl"} |
Modified src/templates/acc/transactions/details.tpl from [7ee5310677] to [809eeeb477].
︙ | ︙ | |||
78 79 80 81 82 83 84 | <td>Libellé</td> <td>Référence</td> </tr> </thead> <tbody> {foreach from=$transaction->getLinesWithAccounts() item="line"} <tr> | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | <td>Libellé</td> <td>Référence</td> </tr> </thead> <tbody> {foreach from=$transaction->getLinesWithAccounts() item="line"} <tr> <td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$line.id_account}">{$line.account_code}</a></td> <td>{$line.account_name}</td> <td>{$line.debit|escape|html_money} {$config.monnaie}</td> <td>{$line.credit|escape|html_money} {$config.monnaie}</td> <td>{$line.label}</td> <td>{$line.reference}</td> </tr> {/foreach} </tbody> </table> {include file="admin/_foot.tpl"} |
Modified src/www/admin/acc/_inc.php from [107e998848] to [f0ce7f3624].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 | $current_year_id = $current_year->id(); } if ($session->get('acc_year') != $current_year_id) { $session->set('acc_year', $current_year_id); } $tpl->assign('current_year', $current_year); | > > | 29 30 31 32 33 34 35 36 37 38 39 | $current_year_id = $current_year->id(); } if ($session->get('acc_year') != $current_year_id) { $session->set('acc_year', $current_year_id); } define('Garradin\CURRENT_YEAR_ID', $current_year->id()); $tpl->assign('current_year', $current_year); |
Modified src/www/admin/acc/accounts/journal.php from [768483fe88] to [65fdccc77d].
1 2 3 4 5 | <?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; | > > | | < | > < | | | < > | < < < | | | < | | 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 | <?php namespace Garradin; use Garradin\Accounting\Accounts; require_once __DIR__ . '/../_inc.php'; $account = Accounts::get((int) qg('id')); if (!$account) { throw new UserException("Le compte demandé n'existe pas."); } $journal = $account->getJournal(CURRENT_YEAR_ID); $sum = 0; if (count($journal)) { $sum = end($journal)->running_sum; } /* if (($compte->position & Compta\Comptes::ACTIF) || ($compte->position & Compta\Comptes::CHARGE)) { $tpl->assign('credit', '-'); $tpl->assign('debit', '+'); } else { $tpl->assign('credit', '+'); $tpl->assign('debit', '-'); } */ $tpl->assign('account', $account); $tpl->assign('journal', $journal); $tpl->assign('sum', $sum); $tpl->display('acc/accounts/journal.tpl'); |
Modified src/www/admin/acc/accounts/selector.php from [01a96e578f] to [718b4549cb].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | case 'thirdparty': $types = [Account::TYPE_THIRD_PARTY]; break; default: break; } $accounts = $chart->accounts(); if ($_GET['target'] == 'all') { $tpl->assign('accounts', $accounts->listAll()); } else { $tpl->assign('grouped_accounts', $accounts->listCommonGrouped($types)); } $tpl->display('acc/accounts/selector.tpl'); | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | case 'thirdparty': $types = [Account::TYPE_THIRD_PARTY]; break; default: break; } $chart = $current_year->chart(); $accounts = $chart->accounts(); if ($_GET['target'] == 'all') { $tpl->assign('accounts', $accounts->listAll()); } else { $tpl->assign('grouped_accounts', $accounts->listCommonGrouped($types)); } $tpl->display('acc/accounts/selector.tpl'); |
Modified src/www/admin/acc/transactions/new.php from [7b543b1ef8] to [14e6d0faa8].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | $file->linkTo(Fichiers::LIEN_COMPTA, $transaction->id()); } // Link members if (null !== f('users') && is_array(f('users'))) { $transaction->updateLinkedUsers(array_keys(f('users'))); } Utils::redirect(Utils::getSelfURL(false) . '?ok=' . $transaction->id()); } catch (UserException $e) { $form->addError($e->getMessage()); } } | > > | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | $file->linkTo(Fichiers::LIEN_COMPTA, $transaction->id()); } // Link members if (null !== f('users') && is_array(f('users'))) { $transaction->updateLinkedUsers(array_keys(f('users'))); } $session->set('acc_last_date', f('date')); Utils::redirect(Utils::getSelfURL(false) . '?ok=' . $transaction->id()); } catch (UserException $e) { $form->addError($e->getMessage()); } } $tpl->assign('date', $session->get('acc_last_date') ?: $current_year->start_date->format('d/m/Y')); $tpl->assign('ok', (int) qg('ok')); $tpl->assign('lines', $lines); $tpl->assign('analytical_accounts', ['' => '-- Aucun'] + $accounts->listAnalytical()); $tpl->display('acc/transactions/new.tpl'); |
Modified src/www/admin/acc/years/new.php from [2a28b1fe7e] to [0d7b0db29f].
︙ | ︙ | |||
11 12 13 14 15 16 17 | if (f('new') && $form->check('acc_years_new')) { try { $year = new Year; $year->importForm(); $year->save(); | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | if (f('new') && $form->check('acc_years_new')) { try { $year = new Year; $year->importForm(); $year->save(); Utils::redirect(ADMIN_URL . 'acc/years/balance.php?id=' . $year->id()); } catch (UserException $e) { $form->addError($e->getMessage()); } } $new_dates = Years::getNewYearDates(); $tpl->assign('start_date', $new_dates[0]); $tpl->assign('end_date', $new_dates[1]); $tpl->assign('charts', (new Charts)->listByCountry()); $tpl->display('acc/years/new.tpl'); |
Modified src/www/admin/static/admin.css from [6299f74d89] to [4a6fc84d32].
︙ | ︙ | |||
1191 1192 1193 1194 1195 1196 1197 | margin-top: .8em; } dl.list dd.desc { color: #666; } | < < < < < | 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 | margin-top: .8em; } dl.list dd.desc { color: #666; } table.accounts { width: 100%; } table.accounts .actions { text-align: right; } table.accounts tbody tr td:first-child { font-family: monospace; } table.accounts th { font-weight: normal; } table.accounts .account-level-1 th { font-size: 1.6em; } table.accounts .account-level-2 th { padding-left: 1em; font-size: 1.3em; } table.accounts .account-level-3 th { padding-left: 2em; } |
︙ | ︙ |