Overview
Comment:Application patch ticket [29871886d9] : corrections comptes passif ET actif dans bilan
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2b920e5efa0ac85f03418836c29d605629086da2
User & Date: bohwaz on 2014-07-01 00:09:57
Other Links: manifest | tags
Context
2014-10-10
15:17
Possibilité d'ajouter ses propres filtres check-in: 89a224e3b0 user: bohwaz tags: trunk
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
Changes

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

449
450
451
452
453
454
455
456

457
458
459
460
461
462
463
464
    public function getBilan($exercice)
    {
        $db = DB::getInstance();

        $include = [Compta_Comptes::ACTIF, Compta_Comptes::PASSIF,
            Compta_Comptes::PASSIF | Compta_Comptes::ACTIF];

        $actif      = ['comptes' => [], 'total' => 0.0];

        $passif     = ['comptes' => [], 'total' => 0.0];

        $resultat = $this->getCompteResultat($exercice);

        if ($resultat['resultat'] >= 0)
        {
            $passif['comptes']['12'] = [
                'comptes'   =>  ['120' => $resultat['resultat']],







|
>
|







449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
    public function getBilan($exercice)
    {
        $db = DB::getInstance();

        $include = [Compta_Comptes::ACTIF, Compta_Comptes::PASSIF,
            Compta_Comptes::PASSIF | Compta_Comptes::ACTIF];

        $actif           = ['comptes' => [], 'total' => 0.0];
        $passif          = ['comptes' => [], 'total' => 0.0];
        $actif_ou_passif = ['comptes' => [], 'total' => 0.0];

        $resultat = $this->getCompteResultat($exercice);

        if ($resultat['resultat'] >= 0)
        {
            $passif['comptes']['12'] = [
                'comptes'   =>  ['120' => $resultat['resultat']],
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
        {
            list($compte, $debit, $credit, $position) = $row;
            $parent = substr($compte, 0, 2);
            $classe = $compte[0];

            if (($position & Compta_Comptes::ACTIF) && ($position & Compta_Comptes::PASSIF))
            {
                $solde = $debit - $credit;

                if ($solde > 0)
                    $position = 'actif';
                elseif ($solde < 0)
                    $position = 'passif';
                else
                    continue;

                $solde = abs($solde);
            }
            else if ($position & Compta_Comptes::ACTIF)
            {
                $position = 'actif';
                $solde = $debit - $credit;
            }
            else if ($position & Compta_Comptes::PASSIF)







<
<
<
|
<
<
<
<
<
|







495
496
497
498
499
500
501



502





503
504
505
506
507
508
509
510
        {
            list($compte, $debit, $credit, $position) = $row;
            $parent = substr($compte, 0, 2);
            $classe = $compte[0];

            if (($position & Compta_Comptes::ACTIF) && ($position & Compta_Comptes::PASSIF))
            {



                $position = 'actif_ou_passif';





                $solde = $debit - $credit;
            }
            else if ($position & Compta_Comptes::ACTIF)
            {
                $position = 'actif';
                $solde = $debit - $credit;
            }
            else if ($position & Compta_Comptes::PASSIF)
537
538
539
540
541
542
543


































544
545
546
547
548
549
550
            $solde = round($solde, 2);
            ${$position}['comptes'][$parent]['comptes'][$compte] += $solde;
            ${$position}['total'] += $solde;
            ${$position}['comptes'][$parent]['solde'] += $solde;
        }

        $res->finalize();



































        // Suppression des soldes nuls
        foreach ($passif['comptes'] as $parent=>$p)
        {
            if ($p['solde'] == 0)
            {
                unset($passif['comptes'][$parent]);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
            $solde = round($solde, 2);
            ${$position}['comptes'][$parent]['comptes'][$compte] += $solde;
            ${$position}['total'] += $solde;
            ${$position}['comptes'][$parent]['solde'] += $solde;
        }

        $res->finalize();

        foreach ($actif_ou_passif['comptes'] as $parent=>$p)
        {
            foreach ($p['comptes'] as $compte=>$solde)
            {
                if ($solde > 0)
                {
                    $position = 'actif';
                }
                else if ($solde < 0)
                {
                    $position = 'passif';
                    $solde = -$solde;
                }
                else
                {
                    continue;
                }

                if (!isset(${$position}['comptes'][$parent]))
                {
                    ${$position}['comptes'][$parent] = ['comptes' => [], 'solde' => 0];
                }

                if (!isset(${$position}['comptes'][$parent]['comptes'][$compte]))
                {
                    ${$position}['comptes'][$parent]['comptes'][$compte] = 0;
                }

                ${$position}['comptes'][$parent]['comptes'][$compte] += $solde;
                ${$position}['total'] += $solde;
                ${$position}['comptes'][$parent]['solde'] += $solde;
            }
        }

        // Suppression des soldes nuls
        foreach ($passif['comptes'] as $parent=>$p)
        {
            if ($p['solde'] == 0)
            {
                unset($passif['comptes'][$parent]);