[0000077] Added a total before ending balance in trial balance (also in report)
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 24 Oct 2008 09:13:33 +0000 (09:13 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 24 Oct 2008 09:13:33 +0000 (09:13 +0000)
CHANGELOG.txt
gl/inquiry/gl_trial_balance.php
reporting/rep708.php

index f3eee076725dfa6e399d28bb2f02ac3ea786de8c..cf50ba60cf2d1b92abeb3f6fe52e0bd1dbad6fd2 100644 (file)
@@ -19,8 +19,15 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+24-Oct-2008 Joe Hunt
+! [0000077] Added a total before ending balance in trial balance (also in report)
+$ /gl/inquiry/gl_trial_balance.php
+  /reporting/rep708.php
+! Increased memory limit if reports in unicode (48M)
+  /reporting/includes/class.pdf.inc
+  
 ------------------------------- Release 2.0.4 --------------------------------------------
-23.Oct-2008 Joe Hunt
+23-Oct-2008 Joe Hunt
 ! Release 2.0.4
 $ config.php
 ! Changed design of Supplier Invoice/Credit. Everything is now done in one document form.
index 969cfcca0dd6c8030c6877e3afe950de87456d16..bb52ae9ad5b2d631c6a1beb678d8a4efaf62f88a 100644 (file)
@@ -99,7 +99,7 @@ function display_trial_balance()
 
        $k = 0;
 
-       $totprev = $totcurr = 0.0;
+       $totprevd = $totprevc = $totcurrd = $totcurrc = 0.0;
        $accounts = get_gl_accounts();
 
        while ($account = db_fetch($accounts))
@@ -118,8 +118,14 @@ function display_trial_balance()
                $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']);
                if (check_value("NoZero") && !$prev_balance && !$curr_balance)
                        continue;
-               $totprev += $prev_balance;
-               $totcurr += $curr_balance;
+               if ($prev_balance >= 0.0)
+                       $totprevd += $prev_balance;
+               else
+                       $totprevc += $prev_balance;
+               if ($curr_balance >= 0.0)
+                       $totcurrd += $curr_balance;
+               else
+                       $totcurrc += $curr_balance;
                alt_table_row_color($k);
 
                $url = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>";
@@ -132,8 +138,19 @@ function display_trial_balance()
                display_debit_or_credit_cells($prev_balance + $curr_balance);
                end_row();
        }
-       start_row("class='inquirybg'");
-       label_cell("<b>" . _("Ending Balance") ." - ".$_POST['TransToDate']. "</b>", "colspan=2");
+       start_row("class='inquirybg' style='font-weight:bold'");
+       label_cell(_("Total") ." - ".$_POST['TransToDate'], "colspan=2");
+       amount_cell($totprevd);
+       amount_cell(abs($totprevc));
+       amount_cell($totcurrd);
+       amount_cell(abs($totcurrc));
+       amount_cell($totprevd + $totcurrd);
+       amount_cell(abs($totprevc + $totcurrc));
+       end_row();
+       $totprev = $totprevd + $totprevc;
+       $totcurr = $totcurrd + $totcurrc;
+       start_row("class='inquirybg' style='font-weight:bold'");
+       label_cell(_("Ending Balance") ." - ".$_POST['TransToDate'], "colspan=2");
        display_debit_or_credit_cells($totprev);
        display_debit_or_credit_cells($totcurr);
        display_debit_or_credit_cells($totprev + $totcurr);
index fc71d67318d84720f01c736f5fb8d48f9815d8a0..6d72454bcf6691b0108ed9cba6a7c4726e5d133b 100644 (file)
@@ -91,7 +91,7 @@ function print_trial_balance()
        $rep->Font();
        $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
        $rep->Header();
-       $totprev = $totcurr = 0.0;
+       $totprevd = $totprevc = $totcurrd = $totcurrc = 0.0;
 
        $accounts = get_gl_accounts();
 
@@ -114,19 +114,29 @@ function print_trial_balance()
 
                if ($zero == 0 && !$prev_balance && !$curr_balance)
                        continue;
-               $totprev += $prev_balance;
-               $totcurr += $curr_balance;
                $rep->TextCol(0, 1, $account['account_code']);
                $rep->TextCol(1, 2,     $account['account_name']);
 
                if ($prev_balance >= 0.0)
+               {
+                       $totprevd += $prev_balance;
                        $rep->TextCol(2, 3,     number_format2(abs($prev_balance), $dec));
+               }       
                else
+               {
+                       $totprevc += $prev_balance;
                        $rep->TextCol(3, 4,     number_format2(abs($prev_balance), $dec));
+               }       
                if ($curr_balance >= 0.0)
+               {
+                       $totcurrd += $curr_balance;
                        $rep->TextCol(4, 5,     number_format2(abs($curr_balance), $dec));
+               }       
                else
+               {
+                       $totcurrc += $curr_balance;
                        $rep->TextCol(5, 6,     number_format2(abs($curr_balance), $dec));
+               }       
                if ($curr_balance + $prev_balance >= 0.0)
                        $rep->TextCol(6, 7,     number_format2(abs($curr_balance + $prev_balance), $dec));
                else
@@ -143,7 +153,17 @@ function print_trial_balance()
        $rep->Line($rep->row);
        $rep->NewLine();
        $rep->Font('bold');
-
+       $rep->TextCol(0, 2, _("Total"));
+
+       $rep->TextCol(2, 3,     number_format2(abs($totprevd), $dec));
+       $rep->TextCol(3, 4,     number_format2(abs($totprevc), $dec));
+       $rep->TextCol(4, 5,     number_format2(abs($totcurrd), $dec));
+       $rep->TextCol(5, 6,     number_format2(abs($totcurrc), $dec));
+       $rep->TextCol(6, 7,     number_format2(abs($totcurrd + $totprevd), $dec));
+       $rep->TextCol(7, 8,     number_format2(abs($totcurrc + $totprevc), $dec));
+       $rep->NewLine();
+       $totprev = $totprevd + $totprevc;
+       $totcurr = $totcurrd + $totcurrc;
        $rep->TextCol(0, 2, _("Ending Balance"));
 
        if ($totprev >= 0.0)