Comment: | Implement journal of transactions for a given user |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
cb235d75caaddd836f0732fd5327eaaf |
User & Date: | bohwaz on 2020-10-12 20:20:45 |
Other Links: | branch diff | manifest | tags |
2020-10-13
| ||
00:15 | Store type, status, and related transaction ID to be able to treat pay-offs of debts and credits check-in: 6e6f939c1f user: bohwaz tags: dev | |
2020-10-12
| ||
20:20 | Implement journal of transactions for a given user check-in: cb235d75ca user: bohwaz tags: dev | |
2020-10-11
| ||
17:24 | Add: reconcile bank accounts check-in: 1467749329 user: bohwaz tags: dev | |
Modified src/include/lib/Garradin/Accounting/Reports.php from [2a2f38b03f] to [9d73ee8a74].
︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 | if (!empty($criterias['year'])) { $where[] = sprintf('t.id_year = %d', $criterias['year']); } if (!empty($criterias['position'])) { $where[] = sprintf('a.position = %d', $criterias['position']); } if (!count($where)) { throw new \LogicException('Unknown criteria'); } return implode(' AND ', $where); } | > > > > | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | if (!empty($criterias['year'])) { $where[] = sprintf('t.id_year = %d', $criterias['year']); } if (!empty($criterias['position'])) { $where[] = sprintf('a.position = %d', $criterias['position']); } if (!empty($criterias['user'])) { $where[] = sprintf('t.id IN (SELECT id_transaction FROM acc_transactions_users WHERE id_user = %d)', $criterias['user']); } if (!count($where)) { throw new \LogicException('Unknown criteria'); } return implode(' AND ', $where); } |
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | } if (null === $account) { $account = (object) [ 'code' => $accounts[$row->id_account]->code, 'label' => $accounts[$row->id_account]->label, 'id' => $row->id_account, 'sum' => 0, 'debit' => 0, 'credit'=> 0, 'lines' => [], ]; } | > | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | } if (null === $account) { $account = (object) [ 'code' => $accounts[$row->id_account]->code, 'label' => $accounts[$row->id_account]->label, 'id' => $row->id_account, 'id_year' => $row->id_year, 'sum' => 0, 'debit' => 0, 'credit'=> 0, 'lines' => [], ]; } |
︙ | ︙ |
Modified src/include/lib/Garradin/Accounting/Transactions.php from [31e7097a5b] to [ffa01ec420].
︙ | ︙ | |||
34 35 36 37 38 39 40 | $st->bindValue(':id', (int)$row->id_line, \SQLITE3_INTEGER); $st->bindValue(':r', !empty($checked[$row->id_line]) ? 1 : 0, \SQLITE3_INTEGER); $st->execute(); } $db->commit(); } | | > > > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 | $st->bindValue(':id', (int)$row->id_line, \SQLITE3_INTEGER); $st->bindValue(':r', !empty($checked[$row->id_line]) ? 1 : 0, \SQLITE3_INTEGER); $st->execute(); } $db->commit(); } static public function countForUser(int $user_id) { return DB::getInstance()->count('acc_transactions_users', 'id_user = ?', $user_id); } } |
Deleted src/include/lib/Garradin/Compta/Rapports.php version [a084b49432].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted src/include/lib/Garradin/Compta/Rapprochement.php version [21098b9dae].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified src/templates/acc/accounts/journal.tpl from [1bacd73b13] to [731b6129a1].
︙ | ︙ | |||
42 43 44 45 46 47 48 | <td>Date</td> {if $simple_view} <td>Mouvement</td> {else} <td class="money">Débit</td> <td class="money">Crédit</td> {/if} | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <td>Date</td> {if $simple_view} <td>Mouvement</td> {else} <td class="money">Débit</td> <td class="money">Crédit</td> {/if} <td class="money">Solde cumulé</td> <th>Libellé</th> <td></td> </tr> </thead> <tbody> {foreach from=$journal item="line"} <tr> |
︙ | ︙ |
Added src/templates/acc/reports/_journal.tpl version [abf9f601be].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <table class="list multi"> <thead> <tr> <td>Réf.</td> <td>Date</td> <th>Libellé</th> <td>Comptes</td> <td class="money">Débit</td> <td class="money">Crédit</td> <td>Libellé ligne</td> <td>Réf. ligne</td> </tr> </thead> {foreach from=$journal item="transaction"} <tbody> <tr> <td rowspan="{$transaction.lines|count}" class="num"><a href="{$admin_url}acc/transactions/details.php?id={$transaction.id}">{if $transaction.reference}{$transaction.reference}{else}#{$transaction.id}{/if}</a></td> <td rowspan="{$transaction.lines|count}">{$transaction.date|date_fr:'d/m/Y'}</td> <th rowspan="{$transaction.lines|count}">{$transaction.label}</th> {foreach from=$transaction.lines item="line"} <td>{$line.account_code} - {$line.account_label}</td> <td class="money">{$line.debit|escape|html_money}</td> <td class="money">{$line.credit|escape|html_money}</td> <td>{$line.label}</td> <td>{$line.reference}</td> </tr> <tr> {/foreach} </tr> </tbody> {/foreach} </table> |
Modified src/templates/acc/reports/journal.tpl from [9a7ab0a227] to [3acd31bc55].
1 2 3 4 | {include file="admin/_head.tpl" title="Journal général" current="acc/years"} {include file="acc/reports/_header.tpl" current="journal"} | < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 | {include file="admin/_head.tpl" title="Journal général" current="acc/years"} {include file="acc/reports/_header.tpl" current="journal"} {include file="acc/reports/_journal.tpl"} <p class="help">Toutes les opérations sont libellées en {$config.monnaie}.</p> {include file="admin/_foot.tpl"} |
Modified src/templates/acc/reports/ledger.tpl from [ccab234a1b] to [cb3ca0899c].
1 2 3 4 5 6 7 | {include file="admin/_head.tpl" title="Grand livre" current="acc/years"} {include file="acc/reports/_header.tpl" current="ledger"} {foreach from=$ledger item="account"} <table class="list"> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {include file="admin/_head.tpl" title="Grand livre" current="acc/years"} {include file="acc/reports/_header.tpl" current="ledger"} {foreach from=$ledger item="account"} <table class="list"> <caption><h4><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&year={$account.id_year}">{$account.code} — {$account.label}</h4></caption> <colgroup> <col width="5%" /> <col width="5%" /> <col width="10%" /> <col width="50%" /> <col width="10%" /> <col width="10%" /> |
︙ | ︙ |
Added src/templates/acc/transactions/user.tpl version [8a93cb715e].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | {include file="admin/_head.tpl" title="Écritures liées à un membre : %s"|args:$transaction_user.identite current="acc/accounts"} {include file="acc/reports/_journal.tpl"} <h2 class="ruler">Solde des comptes</h2> <p class="alert">Cette liste représente le solde des comptes uniquement pour les écritures liées à un membre, et ce sur tous les exercices réunis.</p> <table class="list"> <thead> <tr> <td>Numéro</td> <th>Compte</th> <td class="money">Solde</td> </tr> </thead> <tbody> {foreach from=$balance item="account"} <tr> <td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}">{$account.code}</a></td> <th>{$account.label}</th> <td class="money">{$account.sum|raw|html_money:false}</td> </tr> {/foreach} </tbody> </table> {include file="admin/_foot.tpl"} |
Modified src/templates/admin/membres/fiche.tpl from [105b33a9e1] to [51a40f5eca].
︙ | ︙ | |||
15 16 17 18 19 20 21 | <dt> {if $nb_activites == 1} {$nb_activites} cotisation enregistrée {elseif $nb_activites} {$nb_activites} cotisations enregistrées {else} Aucune cotisation enregistrée | | | | 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 | <dt> {if $nb_activites == 1} {$nb_activites} cotisation enregistrée {elseif $nb_activites} {$nb_activites} cotisations enregistrées {else} Aucune cotisation enregistrée {/if} </dt> <dd> <a href="{$admin_url}membres/cotisations.php?id={$membre.id}">Voir l'historique</a> </dd> {if $session->canAccess('membres', Membres::DROIT_ECRITURE)} <dd><form method="get" action="{$admin_url}membres/cotisations/ajout.php"><input type="submit" value="Enregistrer une cotisation →" /><input type="hidden" name="id" value="{$membre.id}" /></form></dd> {if !empty($nb_operations)} <dt>Écritures comptables</dt> <dd>{$nb_operations} écritures comptables — <a href="{$admin_url}acc/transactions/user.php?id={$membre.id}">Voir la liste des écritures liées à ce membre</a> </dd> {/if} {/if} </dl> <aside class="describe"> <dl class="describe"> |
︙ | ︙ |
Added src/www/admin/acc/transactions/user.php version [7d6ef4bfc0].
> > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <?php namespace Garradin; use Garradin\Accounting\Reports; require_once __DIR__ . '/../../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ACCES); $u = (new Membres)->get((int)qg('id')); if (!$u) { throw new UserException('Ce membre n\'existe pas'); } $criterias = ['user' => $u->id]; $tpl->assign('balance', Reports::getClosingSumsWithAccounts($criterias)); $tpl->assign('journal', Reports::getJournal($criterias)); $tpl->assign('transaction_user', $u); $tpl->display('acc/transactions/user.tpl'); |
Modified src/www/admin/membres/fiche.php from [113fb90286] to [a816ec58fa].
1 2 3 4 5 6 7 8 9 10 | <?php namespace Garradin; require_once __DIR__ . '/_inc.php'; qv(['id' => 'required|numeric']); $id = (int) qg('id'); $membre = $membres->get($id); | > > | 1 2 3 4 5 6 7 8 9 10 11 12 | <?php namespace Garradin; use Garradin\Accounting\Transactions; require_once __DIR__ . '/_inc.php'; qv(['id' => 'required|numeric']); $id = (int) qg('id'); $membre = $membres->get($id); |
︙ | ︙ | |||
22 23 24 25 26 27 28 | $categorie = $cats->get($membre->id_categorie); $tpl->assign('categorie', $categorie); $cotisations = new Membres\Cotisations; $tpl->assign('nb_activites', $cotisations->countForMember($membre->id)); | | < < | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | $categorie = $cats->get($membre->id_categorie); $tpl->assign('categorie', $categorie); $cotisations = new Membres\Cotisations; $tpl->assign('nb_activites', $cotisations->countForMember($membre->id)); if ($session->canAccess('compta', Membres::DROIT_ACCES)) { $tpl->assign('nb_operations', Transactions::countForUser($membre->id)); } $tpl->assign('membre', $membre); $tpl->display('admin/membres/fiche.tpl'); |