Overview
SHA1:97082b4ba5cc5fae3af96f7bb8be2b6e8b516b96
Date: 2013-09-15 12:28:46
User: bohwaz
Comment:Bugfix: comptes dupliqués si credit ET debit sont != de 0, corrigé avec un SUM+GROUP BY, probablement pas très élégant
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2013-09-18
16:12
[8259014f34] Un peu de promo (user: bohwaz, tags: trunk)
2013-09-15
12:28
[97082b4ba5] Bugfix: comptes dupliqués si credit ET debit sont != de 0, corrigé avec un SUM+GROUP BY, probablement pas très élégant (user: bohwaz, tags: trunk)
05:33
[4a3e135481] Gérons l'affichage de la monnaie par CSS car money_format n'accepte pas les chaînes de plus de 1 caractère (user: bohwaz, tags: trunk)
Changes

Modified src/include/class.compta_exercices.php from [6b8be88ed3] to [874f7123e8].

373
374
375
376
377
378
379
380
381
382
383
384
385
386
387

388
389
390
391
392
393
394
    {
        $db = DB::getInstance();

        $charges    = array('comptes' => array(), 'total' => 0.0);
        $produits   = array('comptes' => array(), 'total' => 0.0);
        $resultat   = 0.0;

        $res = $db->prepare('SELECT compte, debit, credit
            FROM
                (SELECT compte_debit AS compte, SUM(montant) AS debit, 0 AS credit
                    FROM compta_journal WHERE id_exercice = '.(int)$exercice.' GROUP BY compte_debit
                UNION
                SELECT compte_credit AS compte, 0 AS debit, SUM(montant) AS credit
                    FROM compta_journal WHERE id_exercice = '.(int)$exercice.' GROUP BY compte_credit)
            WHERE compte LIKE \'6%\' OR compte LIKE \'7%\'

            ORDER BY base64(compte) COLLATE BINARY ASC;'
            )->execute();

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            list($compte, $debit, $credit) = $row;
            $classe = substr($compte, 0, 1);







|







>







373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
    {
        $db = DB::getInstance();

        $charges    = array('comptes' => array(), 'total' => 0.0);
        $produits   = array('comptes' => array(), 'total' => 0.0);
        $resultat   = 0.0;

        $res = $db->prepare('SELECT compte, SUM(debit), SUM(credit)
            FROM
                (SELECT compte_debit AS compte, SUM(montant) AS debit, 0 AS credit
                    FROM compta_journal WHERE id_exercice = '.(int)$exercice.' GROUP BY compte_debit
                UNION
                SELECT compte_credit AS compte, 0 AS debit, SUM(montant) AS credit
                    FROM compta_journal WHERE id_exercice = '.(int)$exercice.' GROUP BY compte_credit)
            WHERE compte LIKE \'6%\' OR compte LIKE \'7%\'
            GROUP BY compte
            ORDER BY base64(compte) COLLATE BINARY ASC;'
            )->execute();

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            list($compte, $debit, $credit) = $row;
            $classe = substr($compte, 0, 1);