From a05c00d0cf91fd89343f4ead1c349baaf47961c6 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 3 Dec 2010 11:59:19 +0000 Subject: [PATCH] Fixing year closure for earlier fiscal years. en_US-demo.sql Rerun of trial balance. --- CHANGELOG.txt | 2 ++ gl/inquiry/gl_trial_balance.php | 4 ++-- reporting/rep708.php | 7 ++++--- sql/en_US-demo.sql | 6 ++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c5577229..9815867f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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. diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index e5eb20cc..c0a3e56a 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -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(); } diff --git a/reporting/rep708.php b/reporting/rep708.php index 277d1815..20956029 100644 --- a/reporting/rep708.php +++ b/reporting/rep708.php @@ -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(); diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index afe2b67e..49057301 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -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); -- -------------------------------------------------------- -- 2.30.2