Overview
Comment: | Permettre de sélectionner l'exercice affiché dans un journal (patch de @adresse riseup) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
b9a3899c0197942c5c155a315d17e2d4 |
User & Date: | bohwaz on 2019-09-20 23:44:14 |
Other Links: | manifest | tags |
Context
2019-09-23
| ||
20:03 | Cohérence format de liste membres, corrige [37b3fab88e63a975dbce0c1c0402892ae642044f] check-in: 6b5ef651c6 user: bohwaz tags: trunk | |
2019-09-20
| ||
23:44 | Permettre de sélectionner l'exercice affiché dans un journal (patch de @adresse riseup) check-in: b9a3899c01 user: bohwaz tags: trunk, stable | |
2019-09-18
| ||
00:08 | Permettre de désactiver le second facteur d'un membre tiers, ainsi que la clé PGP associée check-in: e1f7caf375 user: bohwaz tags: trunk, stable | |
Changes
Modified src/include/lib/Garradin/Compta/Journal.php from [602c41aa91] to [88e9a2c624].
︙ | ︙ | |||
31 32 33 34 35 36 37 | { if (is_null($id)) return true; return DB::getInstance()->test('compta_exercices', 'cloture = 0 AND id = ?', (int)$id); } | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | { if (is_null($id)) return true; return DB::getInstance()->test('compta_exercices', 'cloture = 0 AND id = ?', (int)$id); } public function getSolde($id_compte, $inclure_sous_comptes = false, $exercice = null) { $db = DB::getInstance(); $exercice = (int) $exercice ?: $this->_getCurrentExercice(); $compte = $inclure_sous_comptes ? 'LIKE \'' . $db->escapeString(trim($id_compte)) . '%\'' : '= \'' . $db->escapeString(trim($id_compte)) . '\''; $debit = 'COALESCE((SELECT SUM(montant) FROM compta_journal WHERE compte_debit '.$compte.' AND id_exercice = '.(int)$exercice.'), 0)'; $credit = 'COALESCE((SELECT SUM(montant) FROM compta_journal WHERE compte_credit '.$compte.' AND id_exercice = '.(int)$exercice.'), 0)'; |
︙ | ︙ | |||
57 58 59 60 61 62 63 | { $query = $credit . ' - ' . $debit; } return $db->firstColumn('SELECT ' . $query . ';'); } | | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | { $query = $credit . ' - ' . $debit; } return $db->firstColumn('SELECT ' . $query . ';'); } public function getJournalCompte($compte, $inclure_sous_comptes = false, $exercice = null) { $db = DB::getInstance(); $position = $db->firstColumn('SELECT position FROM compta_comptes WHERE id = ?;', $compte); $exercice = (int) $exercice ?: $this->_getCurrentExercice(); $compte = $inclure_sous_comptes ? 'LIKE \'' . $db->escapeString(trim($compte)) . '%\'' : '= \'' . $db->escapeString(trim($compte)) . '\''; // L'actif et les charges augmentent au débit, le passif et les produits au crédit if (($position & Comptes::ACTIF) || ($position & Comptes::CHARGE)) { |
︙ | ︙ |
Modified src/templates/admin/compta/comptes/journal.tpl from [fb49e7b354] to [03e8b58484].
1 2 3 4 5 | {if null !== $suivi} {include file="admin/_head.tpl" title="Journal : %s - %s"|args:$compte.id:$compte.libelle current="compta/banques" body_id="rapport"} <ul class="actions"> <li><a href="{$admin_url}compta/banques/">Comptes bancaires</a></li> | | > > > > > > > > > > > > > > > > > | 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 | {if null !== $suivi} {include file="admin/_head.tpl" title="Journal : %s - %s"|args:$compte.id:$compte.libelle current="compta/banques" body_id="rapport"} <ul class="actions"> <li><a href="{$admin_url}compta/banques/">Comptes bancaires</a></li> <li{if $compte.id == Compta\Comptes::CAISSE} class="current"{/if}><a href="{$admin_url}compta/comptes/journal.php?id={$id_caisse}&suivi">Journal de caisse</a></li> <li{if $compte.id == Compta\Comptes::CHEQUE_A_ENCAISSER} class="current"{/if}><a href="{$admin_url}compta/comptes/journal.php?id={$id_cheque_a_encaisser}&suivi">Chèques à encaisser</a></li> <li{if $compte.id == Compta\Comptes::CARTE_A_ENCAISSER} class="current"{/if}><a href="{$admin_url}compta/comptes/journal.php?id={$id_carte_a_encaisser}&suivi">Paiements par carte à encaisser</a></li> </ul> {else} {include file="admin/_head.tpl" title="Journal : %s - %s"|args:$compte.id:$compte.libelle current="compta/gestion" body_id="rapport"} {/if} {if count($exercices)} <form action="{$self_url_no_qs}" method="get" class="shortFormRight"> <fieldset> <legend><label for="f_exercice">Afficher le journal de l'exercice suivant :</label></legend> <p> <select name="exercice" id="f_exercice" onchange="this.form.submit();"> {foreach from=$exercices item="exercice"} <option value="{$exercice.id}"{if $exercice_selectionne == $exercice.id} selected="selected"{/if}>{$exercice.libelle}</option> {/foreach} </select> <input type="hidden" name="id" value="{$compte.id}" /> {if null !== $suivi}<input type="hidden" name="suivi" value=""/>{/if} <noscript><input type="submit" value="Afficher"/></noscript> </p> </fieldset> </form> {/if} <table class="list"> <colgroup> <col width="3%" /> <col width="3%" /> <col width="12%" /> <col width="10%" /> |
︙ | ︙ |
Modified src/www/admin/compta/comptes/journal.php from [82a2dbba77] to [768483fe88].
︙ | ︙ | |||
8 9 10 11 12 13 14 | if (!$compte) { throw new UserException("Le compte demandé n'existe pas."); } $journal = new Compta\Journal; | > > > > | > > > | | 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 | if (!$compte) { throw new UserException("Le compte demandé n'existe pas."); } $journal = new Compta\Journal; // Récupération de l'exercice courant et sélectionné $exercices = new Compta\Exercices; $exercice = (int) qg('exercice') ?: $exercices->getCurrent()->id; $solde = $journal->getSolde($compte->id, false, $exercice); 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('exercices', $exercices->getList()); $tpl->assign('exercice_selectionne', $exercice); $tpl->assign('compte', $compte); $tpl->assign('solde', $solde); $tpl->assign('journal', $journal->getJournalCompte($compte->id, false, $exercice)); $tpl->assign('suivi', qg('suivi')); $tpl->display('admin/compta/comptes/journal.tpl'); |