Comment: | Implement: list of transactions created by a user |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
d8894bb1ef25fae7f4f5213a27dde2ad |
User & Date: | bohwaz on 2020-10-14 00:28:08 |
Other Links: | branch diff | manifest | tags |
2020-10-14
| ||
01:00 | Fix opening balance credits and debits check-in: dad85b0427 user: bohwaz tags: dev | |
00:28 | Implement: list of transactions created by a user check-in: d8894bb1ef user: bohwaz tags: dev | |
00:27 | Fix: issue with amounts less that 1,00 check-in: a3fae2b39a user: bohwaz tags: dev | |
Modified src/include/lib/Garradin/Accounting/Reports.php from [9d73ee8a74] to [fd0f7f6398].
︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 | 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); } | > > > > | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | 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 (!empty($criterias['creator'])) { $where[] = sprintf('t.id_creator = %d', $criterias['creator']); } if (!count($where)) { throw new \LogicException('Unknown criteria'); } return implode(' AND ', $where); } |
︙ | ︙ |
Modified src/include/lib/Garradin/Accounting/Transactions.php from [ffa01ec420] to [89df683976].
︙ | ︙ | |||
35 36 37 38 39 40 41 | $st->bindValue(':r', !empty($checked[$row->id_line]) ? 1 : 0, \SQLITE3_INTEGER); $st->execute(); } $db->commit(); } | | | > > > > > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | $st->bindValue(':r', !empty($checked[$row->id_line]) ? 1 : 0, \SQLITE3_INTEGER); $st->execute(); } $db->commit(); } static public function countForUser(int $user_id): int { return DB::getInstance()->count('acc_transactions_users', 'id_user = ?', $user_id); } static public function countForCreator(int $user_id): int { return DB::getInstance()->count('acc_transactions', 'id_creator = ?', $user_id); } } |
Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [01ff4fbe4d] to [18fc086a4a].
︙ | ︙ | |||
184 185 186 187 188 189 190 | // Remove flag if (self::TYPE_PAYOFF == $this->type && $this->_related) { $status = $this->_related->status; $status &= ~self::STATUS_WAITING; $status |= self::STATUS_PAID; $this->_related->set('status', $status ); $this->_related->save(); | < | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | // Remove flag if (self::TYPE_PAYOFF == $this->type && $this->_related) { $status = $this->_related->status; $status &= ~self::STATUS_WAITING; $status |= self::STATUS_PAID; $this->_related->set('status', $status ); $this->_related->save(); } return true; } public function delete(): bool { |
︙ | ︙ |
Modified src/include/lib/Garradin/Template.php from [3273e6c94d] to [7a56549b09].
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | return Utils::date_fr($format, $ts); }); $this->register_modifier('html_money', function ($number, bool $hide_empty = true): string { if ($hide_empty && !$number) { return ''; } return sprintf('<b class="money">%s</b>', Utils::money_format($number, ',', ' ', $hide_empty)); }); $this->register_modifier('format_wiki', function ($str) { $str = Utils::SkrivToHTML($str); $str = Squelette_Filtres::typo_fr($str); return $str; | > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | return Utils::date_fr($format, $ts); }); $this->register_modifier('html_money', function ($number, bool $hide_empty = true): string { if ($hide_empty && !$number) { return ''; } return sprintf('<b class="money">%s</b>', Utils::money_format($number, ',', ' ', $hide_empty)); }); $this->register_modifier('format_wiki', function ($str) { $str = Utils::SkrivToHTML($str); $str = Squelette_Filtres::typo_fr($str); return $str; |
︙ | ︙ |
Modified src/templates/acc/reports/_journal.tpl from [abf9f601be] to [21fc8fe8ba].
︙ | ︙ | |||
15 16 17 18 19 20 21 | <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> | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <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|raw|html_money}</td> <td class="money">{$line.credit|raw|html_money}</td> <td>{$line.label}</td> <td>{$line.reference}</td> </tr> <tr> {/foreach} </tr> </tbody> {/foreach} </table> |
Added src/templates/acc/transactions/creator.tpl version [75918e5101].
> > > > > | 1 2 3 4 5 | {include file="admin/_head.tpl" title="Écritures crées par %s"|args:$transaction_creator.identite current="acc/accounts"} {include file="acc/reports/_journal.tpl"} {include file="admin/_foot.tpl"} |
Modified src/templates/acc/transactions/user.tpl from [8a93cb715e] to [443a9f6b64].
|
| | | 1 2 3 4 5 6 7 8 | {include file="admin/_head.tpl" title="Écritures liées à %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> |
︙ | ︙ |
Modified src/templates/admin/membres/fiche.tpl from [51a40f5eca] to [2694db1aec].
︙ | ︙ | |||
22 23 24 25 26 27 28 | {/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> | > > | | > > > | | < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | {/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} {if $session->canAccess('membres', Membres::DROIT_ACCES)} {if !empty($transactions_linked)} <dt>Écritures comptables liées</dt> <dd><a href="{$admin_url}acc/transactions/user.php?id={$membre.id}">{$transactions_linked} écritures comptables liées à ce membre</a></dd> {/if} {if !empty($transactions_created)} <dt>Écritures comptables créées</dt> <dd><a href="{$admin_url}acc/transactions/creator.php?id={$membre.id}">{$transactions_created} écritures comptables créées par ce membre</a></dd> {/if} {/if} </dl> <aside class="describe"> <dl class="describe"> <dt>Catégorie</dt> |
︙ | ︙ |
Added src/www/admin/acc/transactions/creator.php version [5ea9d63a0d].
> > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?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 = ['creator' => $u->id]; $tpl->assign('journal', Reports::getJournal($criterias)); $tpl->assign('transaction_creator', $u); $tpl->display('acc/transactions/creator.tpl'); |
Modified src/www/admin/membres/fiche.php from [a816ec58fa] to [1ff0192a35].
︙ | ︙ | |||
25 26 27 28 29 30 31 | $tpl->assign('categorie', $categorie); $cotisations = new Membres\Cotisations; $tpl->assign('nb_activites', $cotisations->countForMember($membre->id)); if ($session->canAccess('compta', Membres::DROIT_ACCES)) { | | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | $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('transactions_linked', Transactions::countForUser($membre->id)); $tpl->assign('transactions_created', Transactions::countForCreator($membre->id)); } $tpl->assign('membre', $membre); $tpl->display('admin/membres/fiche.tpl'); |
Modified src/www/admin/static/admin.css from [f3af71a4a4] to [b41fc487e9].
︙ | ︙ | |||
1214 1215 1216 1217 1218 1219 1220 | margin: .2em 0 .4em 1em; } aside.describe { width: 20em; float: right; margin: .5em; | < < | < > | > > | > > > > | 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | margin: .2em 0 .4em 1em; } aside.describe { width: 20em; float: right; margin: .5em; background: rgba(var(--gSecondColor), 0.2); border-radius: .5em; border: 2px solid rgba(var(--gSecondColor), 0.5); padding: .5em; z-index: 200; color: #666; } aside.describe dl.describe { display: block; } aside.describe dl.describe dt { text-align: left; font-weight: bold; color: #000; } #orderFields fieldset { position: relative; min-height: 2em; transition: all 1s; overflow: hidden; |
︙ | ︙ |