From: Joe Hunt Date: Mon, 25 May 2009 12:54:26 +0000 (+0000) Subject: Fixed Supplier Credit so Purchase Order Outstanding is decreased too. X-Git-Tag: 2.3-final~1245 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=b71c0a971ea4d5d7a0d69b3a8754aa70accca688;p=fa-stable.git Fixed Supplier Credit so Purchase Order Outstanding is decreased too. Fixed so nested subtypes in account types are nested correctly in Balance Sheet and P&L Statement --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 290c88da..fb24fbca 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,14 @@ Legend: ! -> Note $ -> Affected files +25-May-2009 Joe Hunt +# Fixed Supplier Credit so Purchase Order Outstanding is decreased too. +$ /purchasing/includes/db/grn_db.inc +# Fixed so nested subtypes in account types are nested correctly in Balance Sheet and P&L Statement +$ /gl/includes/db/gl_db_accounts.inc +$ /reporting/rep706.php +$ /reporting/rep707.php + 23-May-2009 Janusz Dobrowolski # Fixed transaction table search update. $ /admin/view_print_transaction.php diff --git a/gl/includes/db/gl_db_accounts.inc b/gl/includes/db/gl_db_accounts.inc index 9622ebc2..695743d8 100644 --- a/gl/includes/db/gl_db_accounts.inc +++ b/gl/includes/db/gl_db_accounts.inc @@ -51,7 +51,8 @@ function get_gl_accounts($from=null, $to=null) function get_gl_accounts_all($balance=-1) { - $sql = "SELECT ".TB_PREF."chart_master.*,".TB_PREF."chart_types.name AS AccountTypeName,".TB_PREF."chart_class.class_name AS AccountClassName + $sql = "SELECT ".TB_PREF."chart_master.*,".TB_PREF."chart_types.name AS AccountTypeName,".TB_PREF."chart_types.parent, + ".TB_PREF."chart_class.class_name AS AccountClassName FROM ".TB_PREF."chart_master,".TB_PREF."chart_types, ".TB_PREF."chart_class WHERE ".TB_PREF."chart_master.account_type=".TB_PREF."chart_types.id AND ".TB_PREF."chart_types.class_id=".TB_PREF."chart_class.cid"; diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index c0fdf54a..9b56b0f7 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -169,6 +169,8 @@ function set_grn_item_credited(&$entered_grn, $supplier, $transno, $date) $sql = "UPDATE ".TB_PREF."purch_order_details SET quantity_received = quantity_received + $entered_grn->this_quantity_inv, + quantity_ordered = quantity_ordered + $entered_grn->this_quantity_inv, + qty_invoiced = qty_invoiced + $entered_grn->this_quantity_inv, std_cost_unit=$mcost, act_price=$entered_grn->chg_price WHERE po_detail_item = ".$myrow["po_detail_item"]; diff --git a/reporting/rep706.php b/reporting/rep706.php index d045d558..f490e08d 100644 --- a/reporting/rep706.php +++ b/reporting/rep706.php @@ -106,16 +106,20 @@ function print_balance_sheet() $rep->Info($params, $cols, $headers, $aligns); $rep->Header(); $classname = ''; - $group = ''; - $totalopen = 0.0; - $totalperiod = 0.0; - $totalclose = 0.0; $classopen = 0.0; $classperiod = 0.0; $classclose = 0.0; $assetsopen = 0.0; $assetsperiod = 0.0; $assetsclose = 0.0; + + $typeopen = array(0,0,0,0,0,0,0,0,0,0); + $typeperiod = array(0,0,0,0,0,0,0,0,0,0); + $typeclose = array(0,0,0,0,0,0,0,0,0,0); + $typename = array('','','','','','','','','',''); + $parent = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1); + $level = 0; + $closeclass = false; $rep->NewLine(); @@ -138,23 +142,29 @@ function print_balance_sheet() } } - if ($account['AccountTypeName'] != $group) + if ($account['AccountTypeName'] != $typename[$level]) { - if ($group != '') + if ($typename[$level] != '' && $account['parent'] == -1) { - $rep->row += 6; - $rep->Line($rep->row); - $rep->NewLine(); - $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->AmountCol(2, 3, $totalopen, $dec); - $rep->AmountCol(3, 4, $totalperiod, $dec); - $rep->AmountCol(4, 5, $totalclose, $dec); + for ( ; $level >= 0; $level--) + { + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); + $rep->TextCol(0, 2, _('Total') . " " . $typename[$level]); + $rep->AmountCol(2, 3, $typeopen[$level], $dec); + $rep->AmountCol(3, 4, $typeperiod[$level], $dec); + $rep->AmountCol(4, 5, $typeclose[$level], $dec); + $typeopen[$level] = $typeperiod[$level] = $typeclose[$level] = 0.0; + if ($parent[$level] == -1) + break; + $rep->NewLine(); + } if ($graphics) { - $pg->x[] = $group; - $pg->y[] = abs($totalclose); + $pg->x[] = $$typename[$level]; + $pg->y[] = abs($typeclose[$level]); } - $totalopen = $totalperiod = $totalclose = 0.0; $rep->NewLine(); if ($closeclass) { @@ -182,7 +192,9 @@ function print_balance_sheet() $rep->Font(); $rep->NewLine(); } - $group = $account['AccountTypeName']; + if ($account['parent'] != -1 && $account['parent'] != $parent[$level]) + $level++; + $typename[$level] = $account['AccountTypeName']; $rep->row -= 4; $rep->TextCol(0, 5, $account['AccountTypeName']); $rep->row -= 4; @@ -190,10 +202,14 @@ function print_balance_sheet() $rep->NewLine(); } $classname = $account['AccountClassName']; + $parent[$level] = $account['parent']; - $totalopen += $prev_balance; - $totalperiod += $curr_balance; - $totalclose = $totalopen + $totalperiod; + for ($i = 0; $i <= $level; $i++) + { + $typeopen[$i] += $prev_balance; + $typeperiod[$i] += $curr_balance; + $typeclose[$i] = $typeopen[$i] + $typeperiod[$i]; + } $classopen += $prev_balance; $classperiod += $curr_balance; $classclose = $classopen + $classperiod; @@ -219,21 +235,28 @@ function print_balance_sheet() $closeclass = true; } } - if ($account['AccountTypeName'] != $group) + if ($account['AccountTypeName'] != $typename[$level]) { - if ($group != '') + if ($typename[$level] != '') { - $rep->row += 6; - $rep->Line($rep->row); - $rep->NewLine(); - $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->AmountCol(2, 3, $totalopen, $dec); - $rep->AmountCol(3, 4, $totalperiod, $dec); - $rep->AmountCol(4, 5, $totalclose, $dec); + for ( ; $level >= 0; $level--) + { + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); + $rep->TextCol(0, 2, _('Total') . " " . $typename[$level]); + $rep->AmountCol(2, 3, $typeopen[$level], $dec); + $rep->AmountCol(3, 4, $typeperiod[$level], $dec); + $rep->AmountCol(4, 5, $typeclose[$level], $dec); + $typeopen[$level] = $typeperiod[$level] = $typeclose[$level] = 0.0; + if ($parent[$level] == -1) + break; + $rep->NewLine(); + } if ($graphics) { - $pg->x[] = $group; - $pg->y[] = abs($totalclose); + $pg->x[] = $$typename[$level]; + $pg->y[] = abs($typeclose[$level]); } $rep->NewLine(); if ($closeclass) diff --git a/reporting/rep707.php b/reporting/rep707.php index 5dd3ff5c..d562218b 100644 --- a/reporting/rep707.php +++ b/reporting/rep707.php @@ -141,9 +141,13 @@ function print_profit_and_loss_statement() $rep->Header(); $classname = ''; - $group = ''; - $totalper = 0.0; - $totalacc = 0.0; + + $typeper = array(0,0,0,0,0,0,0,0,0,0); + $typeacc = array(0,0,0,0,0,0,0,0,0,0); + $typename = array('','','','','','','','','',''); + $parent = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1); + $level = 0; + $classper = 0.0; $classacc = 0.0; $salesper = 0.0; @@ -170,24 +174,30 @@ function print_profit_and_loss_statement() } } - if ($account['AccountTypeName'] != $group) + if ($account['AccountTypeName'] != $typename[$level]) { - if ($group != '') + if ($typename[$level] != '' && $account['parent'] == -1) { - $rep->row += 6; - $rep->Line($rep->row); - $rep->NewLine(); - $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->AmountCol(2, 3, $totalper, $dec); - $rep->AmountCol(3, 4, $totalacc, $dec); - $rep->AmountCol(4, 5, Achieve($totalper, $totalacc), $pdec); + for ( ; $level >= 0; $level--) + { + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); + $rep->TextCol(0, 2, _('Total') . " " . $typename[$level]); + $rep->AmountCol(2, 3, $typeper[$level], $dec); + $rep->AmountCol(3, 4, $typeacc[$level], $dec); + $rep->AmountCol(4, 5, Achieve($typeper[$level], $typeacc[$level]), $pdec); + $typeper[$level] = $typeacc[$level] = 0.0; + if ($parent[$level] == -1) + break; + $rep->NewLine(); + } if ($graphics) { - $pg->x[] = $group; - $pg->y[] = abs($totalper); - $pg->z[] = abs($totalacc); + $pg->x[] = $typename[$level]; + $pg->y[] = abs($typeper[$level]); + $pg->z[] = abs($typeacc[$level]); } - $totalper = $totalacc = 0.0; $rep->NewLine(); if ($closeclass) { @@ -214,7 +224,9 @@ function print_profit_and_loss_statement() $rep->Font(); $rep->NewLine(); } - $group = $account['AccountTypeName']; + if ($account['parent'] != -1 && $account['parent'] != $parent[$level]) + $level++; + $typename[$level] = $account['AccountTypeName']; $rep->row -= 4; $rep->TextCol(0, 5, $account['AccountTypeName']); $rep->row -= 4; @@ -222,11 +234,16 @@ function print_profit_and_loss_statement() $rep->NewLine(); } $classname = $account['AccountClassName']; + $parent[$level] = $account['parent']; $per_balance *= -1; $acc_balance *= -1; - $totalper += $per_balance; - $totalacc += $acc_balance; + + for ($i = 0; $i <= $level; $i++) + { + $typeper[$i] += $per_balance; + $typeacc[$i] += $acc_balance; + } $classper += $per_balance; $classacc += $acc_balance; $rep->TextCol(0, 1, $account['account_code']); @@ -251,22 +268,29 @@ function print_profit_and_loss_statement() $closeclass = true; } } - if ($account['AccountTypeName'] != $group) + if ($account['AccountTypeName'] != $typename[$level]) { - if ($group != '') + if ($typename[$level] != '') { - $rep->row += 6; - $rep->Line($rep->row); - $rep->NewLine(); - $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->AmountCol(2, 3, $totalper, $dec); - $rep->AmountCol(3, 4, $totalacc, $dec); - $rep->AmountCol(4, 5, Achieve($totalper, $totalacc), $pdec); + for ( ; $level >= 0; $level--) + { + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); + $rep->TextCol(0, 2, _('Total') . " " . $typename[$level]); + $rep->AmountCol(2, 3, $typeper[$level], $dec); + $rep->AmountCol(3, 4, $typeacc[$level], $dec); + $rep->AmountCol(4, 5, Achieve($typeper[$level], $typeacc[$level]), $pdec); + $typeper[$level] = $typeacc[$level] = 0.0; + if ($parent[$level] == -1) + break; + $rep->NewLine(); + } if ($graphics) { - $pg->x[] = $group; - $pg->y[] = abs($totalper); - $pg->z[] = abs($totalacc); + $pg->x[] = $typename[$level]; + $pg->y[] = abs($typeper[$level]); + $pg->z[] = abs($typeacc[$level]); } $rep->NewLine(); if ($closeclass)