Fixing year closure for earlier fiscal years. en_US-demo.sql
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 3 Dec 2010 11:59:19 +0000 (11:59 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 3 Dec 2010 11:59:19 +0000 (11:59 +0000)
Rerun of trial balance.

CHANGELOG.txt
gl/inquiry/gl_trial_balance.php
reporting/rep708.php
sql/en_US-demo.sql

index c55772294eaa755ba693fb964d87660ea8e4cb2d..9815867f892799b248c2a456bb0138c0699f5ee1 100644 (file)
@@ -24,6 +24,8 @@ $ -> Affected files
   and a probably cause of that.
 $ /gl/inquiry/gl_trial_balance.php
   /reporting/rep708.php
+! Fixing year closure for earlier fiscal years. en_US-demo.sql
+$ /sql/en_US-demo.sql
   
 02-Dec-2010 Joe Hunt
 # When deleting a fiscal year, the open balances should share the same trans no.
index e5eb20cc706bd3cf71d615851a71158dc4c7db2f..c0a3e56ab1c15108466eb271e9c8250a5bf252eb 100644 (file)
@@ -14,9 +14,9 @@ $path_to_root="../..";
 
 include_once($path_to_root . "/includes/session.inc");
 
+include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
-include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 
 include_once($path_to_root . "/gl/includes/gl_db.inc");
@@ -169,7 +169,7 @@ function display_trial_balance()
        end_row();
 
        end_table(1);
-       if ($pbal != 0)
+       if (($pbal = round2($pbal, user_price_dec()))  != 0)
                display_warning(_("The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear."));
        div_end();
 }
index 277d18158fef6b89d7979ea449a27144d963e85a..2095602919aaf7e4ed3b9df4bdf75ba591dde530 100644 (file)
@@ -19,6 +19,7 @@ $page_security = 'SA_GLANALYTIC';
 $path_to_root="..";
 
 include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 include_once($path_to_root . "/gl/includes/gl_db.inc");
@@ -204,10 +205,10 @@ function print_trial_balance()
        $rep->NewLine();
                
        $rep->Line($rep->row);
-       if ($pbal != 0.0)
+       if (($pbal = round2($pbal, $dec)) != 0.0)
        {
-       $rep->NewLine(2);
-       $rep->Font();
+               $rep->NewLine(2);
+               $rep->Font();
                $rep->TextCol(0, 8, _("The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear."));
        }       
        $rep->End();
index afe2b67e049315ffffcd7766517f866456cf915a..4905730154bd8221cbb5a44072a7b507ca38bc15 100644 (file)
@@ -823,8 +823,8 @@ CREATE TABLE IF NOT EXISTS `0_fiscal_year` (
 -- Dumping data for table `0_fiscal_year`
 --
 
-INSERT INTO `0_fiscal_year` VALUES(1, '2008-01-01', '2008-12-31', 0);
-INSERT INTO `0_fiscal_year` VALUES(2, '2009-01-01', '2009-12-31', 0);
+INSERT INTO `0_fiscal_year` VALUES(1, '2008-01-01', '2008-12-31', 1);
+INSERT INTO `0_fiscal_year` VALUES(2, '2009-01-01', '2009-12-31', 1);
 INSERT INTO `0_fiscal_year` VALUES(3, '2010-01-01', '2010-12-31', 0);
 
 --
@@ -939,6 +939,8 @@ INSERT INTO `0_gl_trans` VALUES(80, 11, 3, '2009-06-21', '1510', '', 10, 0, 0, 2
 INSERT INTO `0_gl_trans` VALUES(81, 11, 3, '2009-06-21', '4010', '', 50, 2, 0, 2, '3');
 INSERT INTO `0_gl_trans` VALUES(82, 11, 3, '2009-06-21', '1200', '', -52.5, 0, 0, 2, '3');
 INSERT INTO `0_gl_trans` VALUES(83, 11, 3, '2009-06-21', '2150', '', 2.5, 0, 0, 2, '3');
+INSERT INTO `0_gl_trans` VALUES ('84', '0', '20', '2009-12-31', '3590', 'Closing Year', '-91.19', '0', '0', NULL, NULL);
+INSERT INTO `0_gl_trans` VALUES ('85', '0', '20', '2009-12-31', '9990', 'Closing Year', '91.19', '0', '0', NULL, NULL);
 
 -- --------------------------------------------------------