Still bugs in trial balances and account inquiry on screen when selecting non balance...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 13 Dec 2007 23:03:21 +0000 (23:03 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 13 Dec 2007 23:03:21 +0000 (23:03 +0000)
CHANGELOG.txt
gl/inquiry/gl_account_inquiry.php
gl/inquiry/gl_trial_balance.php

index 405fe842abba33dc5950dcea56689a9e47cd3bca..05243b005354adcce172c5399f74f722770f38b5 100644 (file)
@@ -19,6 +19,11 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+13-Dec-2007 Joe Hunt
+ # Still bugs in trial balances and account inquiry on screen when selecting non balance accounts. Fixed.
+ $ /gl/inquiry/gl_trial_balance.php
+   /gl/inquiry/gl_account_inquiry.php
+
 13-Dec-2007 Joe Hunt
  # Fixed a bug when voiding a transaction (Journal Entry). An eventually underlying bank transfer was not voided.
  $ /admin/db/voiding_db.inc
index db669563290e841677f734d97941f0bbcd721811..6fedc61ede6d1fc3f251413a219060f7e477ebe5 100644 (file)
@@ -81,11 +81,6 @@ function show_results()
        $result = get_gl_transactions($_POST['TransFromDate'], $_POST['TransToDate'], -1,
        $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
 
-       if (db_num_rows($result) == 0)
-       {
-               display_note(_("No general ledger transactions have been created for this account on the selected dates."), 0, 1);
-               return;
-       }
        $colspan = ($dim == 2 ? "6" : ($dim == 1 ? "5" : "4"));
        //echo "\nDimension =". $_POST['Dimension'];
        display_heading($_POST["account"]. "&nbsp;&nbsp;&nbsp;".$act_name);
@@ -101,14 +96,14 @@ function show_results()
                $th = array(_("Type"), _("#"), _("Date"),
                        _("Person/Item"), _("Debit"), _("Credit"), _("Balance"), _("Memo"));
        table_header($th);
-       if (is_account_balancesheet($account["account_code"]))
+       if (is_account_balancesheet($_POST["account"]))
                $begin = "";
        else
        {
-               if ($from < $begin)
-                       $begin = add_days($_POST['TransFromDate'], -1);
-               else
-                       $begin = add_days(begin_fiscalyear(), -1);
+               $begin = begin_fiscalyear();
+               if ($_POST['TransFromDate'] < $begin)
+                       $begin = $_POST['TransFromDate'];
+               $begin = add_days($begin, -1);
        }
 
     $bfw = get_gl_balance_from_to($begin, $_POST['TransFromDate'], $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
@@ -161,6 +156,8 @@ function show_results()
        end_row();
 
        end_table(2);
+       if (db_num_rows($result) == 0)
+               display_note(_("No general ledger transactions have been created for this account on the selected dates."), 0, 1);
 }
 
 //----------------------------------------------------------------------------------------------------
index 4ab7a46512a99684cee31b522d1f5ec4ca5cdb3a..8a6ba2f9c1c65ec251fb70a53a52d6549fb91f6f 100644 (file)
@@ -100,10 +100,10 @@ function display_trial_balance()
                        $begin = null;
                else
                {
-                       if ($from < $begin)
-                               $begin = add_days($_POST['TransFromDate'], -1);
-                       else
-                               $begin = add_days(begin_fiscalyear(), -1);
+                       $begin = begin_fiscalyear();
+                       if ($_POST['TransFromDate'] < $begin)
+                               $begin = $_POST['TransFromDate'];
+                       $begin = add_days($begin, -1);
                }
                $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false);