[0000081] Trial Balance again minor changes.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 10 Nov 2008 22:35:53 +0000 (22:35 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 10 Nov 2008 22:35:53 +0000 (22:35 +0000)
CHANGELOG.txt
gl/inquiry/gl_trial_balance.php
reporting/rep708.php

index deb6b82381e5a7da9e9e5353bf7a5024e065a72c..f57c9db535277c59b25911a2de3b1dbdf1b09bf9 100644 (file)
@@ -19,6 +19,11 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+10-Nov-2008 Joe Hunt
+! [0000081] Trial Balance again minor changes.
+$ /gl/inquiry/gl_trial_balance.php
+  /reporting/rep708.php
+
 07-Nov-2008 Joe Hunt
 ! [0000081] Changed Trial Balance to show all debits and credits (option to only show balances)
 $ /gl/inquiry/gl_trial_balance.php
index 4f44d5b3aaef499bcc4613977b5a39dc46c8e186..8d1ad8bcba2d79aae5827baa231e750b244c2ba7 100644 (file)
@@ -97,7 +97,7 @@ function display_trial_balance()
        $k = 0;
 
        $accounts = get_gl_accounts();
-
+       $pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0;
        $begin = begin_fiscalyear();
        if (date1_greater_date2($begin, $_POST['TransFromDate']))
                $begin = $_POST['TransFromDate'];
@@ -121,6 +121,7 @@ function display_trial_balance()
                        display_debit_or_credit_cells($prev['balance']);
                        display_debit_or_credit_cells($curr['balance']);
                        display_debit_or_credit_cells($tot['balance']);
+                       
                }
                else
                {
@@ -130,30 +131,39 @@ function display_trial_balance()
                        amount_cell($curr['credit']);
                        amount_cell($tot['debit']);
                        amount_cell($tot['credit']);
+                       $pdeb += $prev['debit'];
+                       $pcre += $prev['credit'];
+                       $cdeb += $curr['debit'];
+                       $ccre += $curr['credit'];
+                       $tdeb += $tot['debit'];
+                       $tcre += $tot['credit'];
                }       
+               $pbal += $prev['balance'];
+               $cbal += $curr['balance'];
+               $tbal += $tot['balance'];
                end_row();
        }
 
-       $prev = get_balance(null, $begin, $_POST['TransFromDate'], false, false);
-       $curr = get_balance(null, $_POST['TransFromDate'], $_POST['TransToDate'], true, true);
-       $tot = get_balance(null, $begin, $_POST['TransToDate'], false, true);
+       //$prev = get_balance(null, $begin, $_POST['TransFromDate'], false, false);
+       //$curr = get_balance(null, $_POST['TransFromDate'], $_POST['TransToDate'], true, true);
+       //$tot = get_balance(null, $begin, $_POST['TransToDate'], false, true);
        if (!check_value('Balance'))
        {
                start_row("class='inquirybg' style='font-weight:bold'");
                label_cell(_("Total") ." - ".$_POST['TransToDate'], "colspan=2");
-               amount_cell($prev['debit']);
-               amount_cell($prev['credit']);
-               amount_cell($curr['debit']);
-               amount_cell($curr['credit']);
-               amount_cell($tot['debit']);
-               amount_cell($tot['credit']);
+               amount_cell($pdeb);
+               amount_cell($pcre);
+               amount_cell($cdeb);
+               amount_cell($ccre);
+               amount_cell($tdeb);
+               amount_cell($tcre);
                end_row();
        }       
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_("Ending Balance") ." - ".$_POST['TransToDate'], "colspan=2");
-       display_debit_or_credit_cells($prev['balance']);
-       display_debit_or_credit_cells($curr['balance']);
-       display_debit_or_credit_cells($tot['balance']);
+       display_debit_or_credit_cells($pbal);
+       display_debit_or_credit_cells($cbal);
+       display_debit_or_credit_cells($tbal);
        end_row();
 
        end_table(1);
index 2c8ebb32084c0c9fd81a5f754eb1a72d425446d2..5102a430651202ce5f6b08e98b9daf1a2f011768 100644 (file)
@@ -125,6 +125,7 @@ function print_trial_balance()
 
        $accounts = get_gl_accounts();
 
+       $pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0;
        $begin = begin_fiscalyear();
        if (date1_greater_date2($begin, $from))
                $begin = $from;
@@ -162,7 +163,17 @@ function print_trial_balance()
                        $rep->TextCol(5, 6,     number_format2($curr['credit'], $dec));
                        $rep->TextCol(6, 7,     number_format2($tot['debit'], $dec));
                        $rep->TextCol(7, 8,     number_format2($tot['credit'], $dec));
+                       $pdeb += $prev['debit'];
+                       $pcre += $prev['credit'];
+                       $cdeb += $curr['debit'];
+                       $ccre += $curr['credit'];
+                       $tdeb += $tot['debit'];
+                       $tcre += $tot['credit'];
+                       
                }       
+               $pbal += $prev['balance'];
+               $cbal += $curr['balance'];
+               $tbal += $tot['balance'];
                $rep->NewLine();
 
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
@@ -175,35 +186,35 @@ function print_trial_balance()
        $rep->NewLine();
        $rep->Font('bold');
 
-       $prev = get_balance(null, $dimension, $dimension2, $begin, $from, false, false);
-       $curr = get_balance(null, $dimension, $dimension2, $from, $to, true, true);
-       $tot = get_balance(null, $dimension, $dimension2, $begin, $to, false, true);
+       //$prev = get_balance(null, $dimension, $dimension2, $begin, $from, false, false);
+       //$curr = get_balance(null, $dimension, $dimension2, $from, $to, true, true);
+       //$tot = get_balance(null, $dimension, $dimension2, $begin, $to, false, true);
 
        if ($balances == 0)
        {
                $rep->TextCol(0, 2, _("Total"));
-               $rep->TextCol(2, 3,     number_format2($prev['debit'], $dec));
-               $rep->TextCol(3, 4,     number_format2($prev['credit'], $dec));
-               $rep->TextCol(4, 5,     number_format2($curr['debit'], $dec));
-               $rep->TextCol(5, 6,     number_format2($curr['credit'], $dec));
-               $rep->TextCol(6, 7,     number_format2($tot['debit'], $dec));
-               $rep->TextCol(7, 8,     number_format2($tot['credit'], $dec));
+               $rep->TextCol(2, 3,     number_format2($pdeb, $dec));
+               $rep->TextCol(3, 4,     number_format2($pcre, $dec));
+               $rep->TextCol(4, 5,     number_format2($cdeb, $dec));
+               $rep->TextCol(5, 6,     number_format2($ccre, $dec));
+               $rep->TextCol(6, 7,     number_format2($tdeb, $dec));
+               $rep->TextCol(7, 8,     number_format2($tcre, $dec));
                $rep->NewLine();
        }       
        $rep->TextCol(0, 2, _("Ending Balance"));
 
        if ($prev['balance'] >= 0.0)
-               $rep->TextCol(2, 3,     number_format2($prev['balance'], $dec));
+               $rep->TextCol(2, 3,     number_format2($pbal, $dec));
        else
-               $rep->TextCol(3, 4,     number_format2(abs($prev['balance']), $dec));
+               $rep->TextCol(3, 4,     number_format2(abs($pbal), $dec));
        if ($curr['balance'] >= 0.0)
-               $rep->TextCol(4, 5,     number_format2($curr['balance'], $dec));
+               $rep->TextCol(4, 5,     number_format2($cbal, $dec));
        else
-               $rep->TextCol(5, 6,     number_format2(abs($curr['balance']), $dec));
+               $rep->TextCol(5, 6,     number_format2(abs($cbal), $dec));
        if ($tot['balance'] >= 0.0)
-               $rep->TextCol(6, 7,     number_format2($tot['balance'], $dec));
+               $rep->TextCol(6, 7,     number_format2($tbal, $dec));
        else
-               $rep->TextCol(7, 8,     number_format2(abs($tot['balance']), $dec));
+               $rep->TextCol(7, 8,     number_format2(abs($tbal), $dec));
        
        $rep->Line($rep->row - 6);