Overview
Comment:Patch du ticket [76931fcb17] (solde dans le grand livre)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a3d37baef8c5f7d0591a4dfcafc0d9fdfbc7c689
User & Date: bohwaz on 2014-06-30 23:48:24
Other Links: manifest | tags
References
2014-06-30
23:49 Fixed ticket [76931fcb17]: Amélioration du grand livre plus 5 other changes artifact: 9c2aeb1b3f user: bohwaz
Context
2014-07-01
00:09
Application patch ticket [29871886d9] : corrections comptes passif ET actif dans bilan check-in: 2b920e5efa user: bohwaz tags: trunk
2014-06-30
23:48
Patch du ticket [76931fcb17] (solde dans le grand livre) check-in: a3d37baef8 user: bohwaz tags: trunk
2014-06-10
11:01
Mieux avec fakeroot check-in: c06885d8f3 user: bohwaz tags: trunk
Changes

Modified src/include/class.compta_exercices.php from [b79696ceb1] to [e40c0ae693].

   330    330               $livre['classes'][$classe][$parent]['comptes'][$compte]['journal'] = $db->simpleStatementFetch(
   331    331                   'SELECT *, strftime(\'%s\', date) AS date FROM (
   332    332                       SELECT * FROM compta_journal WHERE compte_debit = :compte AND id_exercice = '.(int)$exercice.'
   333    333                       UNION
   334    334                       SELECT * FROM compta_journal WHERE compte_credit = :compte AND id_exercice = '.(int)$exercice.'
   335    335                       )
   336    336                   ORDER BY date, numero_piece, id;', SQLITE3_ASSOC, ['compte' => $compte]);
          337  +
          338  +            $solde = 0.0;
          339  +            foreach ($livre['classes'][$classe][$parent]['comptes'][$compte]['journal'] as &$ligne)
          340  +            {
          341  +                if ($ligne["compte_credit"] == $compte)
          342  +                {
          343  +                    $solde += $ligne['montant'];
          344  +                }
          345  +                else
          346  +                {
          347  +                    $solde -= $ligne['montant'];
          348  +                }
          349  +                $ligne['solde'] = $solde;
          350  +            }
   337    351   
   338    352               $debit = (float) $db->simpleQuerySingle(
   339    353                   'SELECT SUM(montant) FROM compta_journal WHERE compte_debit = ? AND id_exercice = '.(int)$exercice.';',
   340    354                   false, $compte);
   341    355   
   342    356               $credit = (float) $db->simpleQuerySingle(
   343    357                   'SELECT SUM(montant) FROM compta_journal WHERE compte_credit = ? AND id_exercice = '.(int)$exercice.';',
   344    358                   false, $compte);
   345    359   
   346    360               $livre['classes'][$classe][$parent]['comptes'][$compte]['debit'] = $debit;
   347    361               $livre['classes'][$classe][$parent]['comptes'][$compte]['credit'] = $credit;
          362  +            $livre['classes'][$classe][$parent]['comptes'][$compte]['solde'] = $credit - $debit;
   348    363   
   349    364               $livre['classes'][$classe][$parent]['total'] += $debit;
   350    365               $livre['classes'][$classe][$parent]['total'] -= $credit;
   351    366   
   352    367               $livre['debit'] += $debit;
   353    368               $livre['credit'] += $credit;
   354    369           }

Modified src/templates/admin/compta/exercices/grand_livre.tpl from [b6dd238c6f] to [961c7b63da].

    11     11   
    12     12   {foreach from=$comptes item="compte" key="code"}
    13     13       {foreach from=$compte.comptes item="souscompte" key="souscode"}
    14     14       <table class="list">
    15     15           <caption><h4>{$souscode|escape} — {$souscode|get_nom_compte|escape}</h4></caption>
    16     16           <colgroup>
    17     17               <col width="15%" />
    18         -            <col width="65%" />
           18  +            <col width="55%" />
           19  +            <col width="10%" />
    19     20               <col width="10%" />
    20     21               <col width="10%" />
    21     22           </colgroup>
    22     23           <thead>
    23     24               <tr>
    24     25                   <td>Date</td>
    25     26                   <th>Intitulé</th>
    26         -                <td>Débit</td>
    27         -                <td>Crédit</td>
           27  +                <td class="money">Débit</td>
           28  +                <td class="money">Crédit</td>
           29  +                <td class="money">Solde</td>
    28     30               </tr>
    29     31           </thead>
    30     32           <tbody>
    31     33           {foreach from=$souscompte.journal item="ligne"}
    32     34               <tr>
    33     35                   <td>{$ligne.date|date_fr:'d/m/Y'|escape}</td>
    34     36                   <th>{$ligne.libelle|escape}</th>
    35         -                <td>{if $ligne.compte_debit == $souscode}{$ligne.montant|html_money}{/if}</td>
    36         -                <td>{if $ligne.compte_credit == $souscode}{$ligne.montant|html_money}{/if}</td>
           37  +                <td class="money">{if $ligne.compte_debit == $souscode}{$ligne.montant|html_money}{/if}</td>
           38  +                <td class="money">{if $ligne.compte_credit == $souscode}{$ligne.montant|html_money}{/if}</td>
           39  +                <td class="money">{$ligne.solde|html_money}</td>
    37     40               </tr>
    38     41           {/foreach}
    39     42           </tbody>
    40     43           <tfoot>
    41     44               <tr>
    42     45                   <td></td>
    43     46                   <th>Solde final</th>
    44         -                <td>{if $souscompte.debit > 0}{$souscompte.debit|html_money}{/if}</td>
    45         -                <td>{if $souscompte.credit > 0}{$souscompte.credit|html_money}{/if}</td>
           47  +                <td class="money">{if $souscompte.debit > 0}{$souscompte.debit|html_money}{/if}</td>
           48  +                <td class="money">{if $souscompte.credit > 0}{$souscompte.credit|html_money}{/if}</td>
           49  +                <td class="money">{$souscompte.solde|html_money}</td>
    46     50               </tr>
    47     51           </tfoot>
    48     52       </table>
    49     53       {/foreach}
    50     54   
    51     55       <table class="list">
    52     56           <colgroup>

Modified src/www/admin/static/admin.css from [218216a26b] to [da51915e76].

   515    515       width: 80%;
   516    516   }
   517    517   
   518    518   #rapport td, #rapport th {
   519    519       padding: 0.2em 0.5em;
   520    520       text-align: left;
   521    521   }
          522  +
          523  +#rapport td.money, #rapport th.money {
          524  +    text-align: right;
          525  +}
   522    526   
   523    527   #rapport .compte th {
   524    528       font-weight: normal;
   525    529   }
   526    530   
   527    531   #rapport table table td {
   528    532       text-align: right;