From e1ad4f3f77cb20f692185b0b5e493820c5fb7f77 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Mon, 14 Jun 2010 13:52:12 +0000 Subject: [PATCH] Bug [0000231] Wrong On Order for Advanced Manufacturing.before final production. Allow optional non zero values in reports 101,102,201,202,203 and 303. --- CHANGELOG.txt | 12 +++++ includes/db/manufacturing_db.inc | 4 +- reporting/rep101.php | 71 ++++++++++++++++------------- reporting/rep102.php | 70 +++++++++++++++-------------- reporting/rep201.php | 59 +++++++++++++----------- reporting/rep202.php | 77 +++++++++++++++++--------------- reporting/rep203.php | 46 +++++++++++-------- reporting/rep303.php | 44 ++++++++++-------- reporting/reports_main.php | 8 +++- 9 files changed, 226 insertions(+), 165 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 98ac5b6d..ad399043 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,18 @@ Legend: ! -> Note $ -> Affected files +14-Jun-2010 Tom Moulton/Joe Hunt +# Bug [0000231] Wrong On Order for Advanced Manufacturing.before final production. +$ /includes/db/manufacturing_db.inc +! Allow optional non zero values in reports 101,102,201,202,203 and 303. +$ /reporting/rep101.php + /reporting/rep102.php + /reporting/rep201.php + /reporting/rep202.php + /reporting/rep203.php + /reporting/rep303.php + /reporting/reports_main.php + ------------------------------- Release 2.2.10 ---------------------------------- 11-Jun-2010 Joe Hunt ! Release 2.2.10 diff --git a/includes/db/manufacturing_db.inc b/includes/db/manufacturing_db.inc index 396fe3b1..c2da112f 100644 --- a/includes/db/manufacturing_db.inc +++ b/includes/db/manufacturing_db.inc @@ -61,8 +61,8 @@ function stock_demand_manufacture($stock_id, $qty, $demand_id, $location, $level $qoh_stock = array(); load_stock_levels($location); } - $stock_qty = $qoh_stock[$stock_id]; - if ($stock_qty == NULL) $stock_qty = 0; + if (empty($qoh_stock[$stock_id])) $stock_qty = 0; + else $stock_qty = $qoh_stock[$stock_id]; if ($qty <= $stock_qty) return $demand; $bom = @$bom_list[$stock_id]; if ($bom == NULL) { diff --git a/reporting/rep101.php b/reporting/rep101.php index 772d33f0..be617e44 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -91,14 +91,15 @@ function get_transactions($debtorno, $from, $to) function print_customer_balances() { - global $path_to_root, $systypes_array; - - $from = $_POST['PARAM_0']; - $to = $_POST['PARAM_1']; - $fromcust = $_POST['PARAM_2']; - $currency = $_POST['PARAM_3']; - $comments = $_POST['PARAM_4']; - $destination = $_POST['PARAM_5']; + global $path_to_root, $systypes_array; + + $from = $_POST['PARAM_0']; + $to = $_POST['PARAM_1']; + $fromcust = $_POST['PARAM_2']; + $currency = $_POST['PARAM_3']; + $no_zeros = $_POST['PARAM_4']; + $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); else @@ -108,7 +109,7 @@ function print_customer_balances() $cust = _('All'); else $cust = get_customer_name($fromcust); - $dec = user_price_dec(); + $dec = user_price_dec(); if ($currency == ALL_TEXT) { @@ -118,6 +119,9 @@ function print_customer_balances() else $convert = false; + if ($no_zeros) $nozeros = _('Yes'); + else $nozeros = _('No'); + $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515); $headers = array(_('Trans Type'), _('#'), _('Date'), _('Due Date'), _('Charges'), _('Credits'), @@ -125,16 +129,17 @@ function print_customer_balances() $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right'); - $params = array( 0 => $comments, - 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), - 2 => array('text' => _('Customer'), 'from' => $cust, 'to' => ''), - 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => '')); + $params = array( 0 => $comments, + 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), + 2 => array('text' => _('Customer'), 'from' => $cust, 'to' => ''), + 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''), + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); - $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize()); + $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize()); - $rep->Font(); - $rep->Info($params, $cols, $headers, $aligns); - $rep->Header(); + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); + $rep->Header(); $grandtotal = array(0,0,0,0); @@ -143,26 +148,32 @@ function print_customer_balances() $sql .= "WHERE debtor_no=".db_escape($fromcust); $sql .= " ORDER BY name"; $result = db_query($sql, "The customers could not be retrieved"); + $num_lines = 0; while ($myrow = db_fetch($result)) { - if (!$convert && $currency != $myrow['curr_code']) - continue; + if (!$convert && $currency != $myrow['curr_code']) continue; + + $bal = get_open_balance($myrow['debtor_no'], $from, $convert); + $init[0] = $init[1] = 0.0; + $init[0] = round2(abs($bal['charges']), $dec); + $init[1] = round2(Abs($bal['credits']), $dec); + $init[2] = round2($bal['Allocated'], $dec); + $init[3] = round2($bal['OutStanding'], $dec);; + + $res = get_transactions($myrow['debtor_no'], $from, $to); + if ($no_zeros && db_num_rows($res) == 0) continue; + + $num_lines++; $rep->fontSize += 2; $rep->TextCol(0, 2, $myrow['name']); if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); $rep->fontSize -= 2; - $bal = get_open_balance($myrow['debtor_no'], $from, $convert); - $init[0] = $init[1] = 0.0; $rep->TextCol(3, 4, _("Open Balance")); - $init[0] = round2(abs($bal['charges']), $dec); $rep->AmountCol(4, 5, $init[0], $dec); - $init[1] = round2(Abs($bal['credits']), $dec); $rep->AmountCol(5, 6, $init[1], $dec); - $init[2] = round2($bal['Allocated'], $dec); $rep->AmountCol(6, 7, $init[2], $dec); - $init[3] = round2($bal['OutStanding'], $dec);; $rep->AmountCol(7, 8, $init[3], $dec); $total = array(0,0,0,0); for ($i = 0; $i < 4; $i++) @@ -171,12 +182,12 @@ function print_customer_balances() $grandtotal[$i] += $init[$i]; } $rep->NewLine(1, 2); - $res = get_transactions($myrow['debtor_no'], $from, $to); if (db_num_rows($res)==0) continue; $rep->Line($rep->row + 4); while ($trans = db_fetch($res)) { + if ($no_zeros && $trans['TotalAmount'] == 0 && $trans['Allocated'] == 0) continue; $rep->NewLine(1, 2); $rep->TextCol(0, 1, $systypes_array[$trans['type']]); $rep->TextCol(1, 2, $trans['reference']); @@ -224,8 +235,8 @@ function print_customer_balances() $rep->TextCol(0, 3, _('Total')); for ($i = 0; $i < 4; $i++) $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec); - $rep->Line($rep->row - 4); - $rep->NewLine(2); + $rep->Line($rep->row - 4); + $rep->NewLine(2); } $rep->fontSize += 2; $rep->TextCol(0, 3, _('Grand Total')); @@ -234,7 +245,7 @@ function print_customer_balances() $rep->AmountCol($i + 4, $i + 5, $grandtotal[$i], $dec); $rep->Line($rep->row - 4); $rep->NewLine(); - $rep->End(); + $rep->End(); } -?> \ No newline at end of file +?> diff --git a/reporting/rep102.php b/reporting/rep102.php index fc2457c4..bba5c018 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -64,15 +64,16 @@ function get_invoices($customer_id, $to) function print_aged_customer_analysis() { - global $comp_path, $path_to_root, $systypes_array; + global $comp_path, $path_to_root, $systypes_array; - $to = $_POST['PARAM_0']; - $fromcust = $_POST['PARAM_1']; - $currency = $_POST['PARAM_2']; + $to = $_POST['PARAM_0']; + $fromcust = $_POST['PARAM_1']; + $currency = $_POST['PARAM_2']; $summaryOnly = $_POST['PARAM_3']; - $graphics = $_POST['PARAM_4']; - $comments = $_POST['PARAM_5']; - $destination = $_POST['PARAM_6']; + $no_zeros = $_POST['PARAM_4']; + $graphics = $_POST['PARAM_5']; + $comments = $_POST['PARAM_6']; + $destination = $_POST['PARAM_7']; if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); else @@ -87,7 +88,7 @@ function print_aged_customer_analysis() $from = _('All'); else $from = get_customer_name($fromcust); - $dec = user_price_dec(); + $dec = user_price_dec(); if ($summaryOnly == 1) $summary = _('Summary Only'); @@ -101,6 +102,9 @@ function print_aged_customer_analysis() else $convert = false; + if ($no_zeros) $nozeros = _('Yes'); + else $nozeros = _('No'); + $PastDueDays1 = get_company_pref('past_due_days'); $PastDueDays2 = 2 * $PastDueDays1; $nowdue = "1-" . $PastDueDays1 . " " . _('Days'); @@ -113,19 +117,20 @@ function print_aged_customer_analysis() $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right'); - $params = array( 0 => $comments, - 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), - 2 => array('text' => _('Customer'), 'from' => $from, 'to' => ''), - 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''), - 4 => array('text' => _('Type'), 'from' => $summary,'to' => '')); + $params = array( 0 => $comments, + 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), + 2 => array('text' => _('Customer'), 'from' => $from, 'to' => ''), + 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''), + 4 => array('text' => _('Type'), 'from' => $summary,'to' => ''), + 5 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); if ($convert) $headers[2] = _('Currency'); - $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis", user_pagesize()); + $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis", user_pagesize()); - $rep->Font(); - $rep->Info($params, $cols, $headers, $aligns); - $rep->Header(); + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); + $rep->Header(); $total = array(0,0,0,0, 0); @@ -139,29 +144,28 @@ function print_aged_customer_analysis() { if (!$convert && $currency != $myrow['curr_code']) continue; - $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); - if ($convert) - { - $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); - $rep->TextCol(2, 3, $myrow['curr_code']); - } - else - $rate = 1.0; - $rep->fontSize -= 2; + + if ($convert) $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); + else $rate = 1.0; $custrec = get_customer_details($myrow['debtor_no'], $to); foreach ($custrec as $i => $value) $custrec[$i] *= $rate; - $total[0] += ($custrec["Balance"] - $custrec["Due"]); - $total[1] += ($custrec["Due"]-$custrec["Overdue1"]); - $total[2] += ($custrec["Overdue1"]-$custrec["Overdue2"]); - $total[3] += $custrec["Overdue2"]; - $total[4] += $custrec["Balance"]; $str = array($custrec["Balance"] - $custrec["Due"], $custrec["Due"]-$custrec["Overdue1"], $custrec["Overdue1"]-$custrec["Overdue2"], $custrec["Overdue2"], $custrec["Balance"]); + if ($no_zeros && array_sum($str) == 0) continue; + + $rep->fontSize += 2; + $rep->TextCol(0, 2, $myrow['name']); + if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); + $rep->fontSize -= 2; + $total[0] += ($custrec["Balance"] - $custrec["Due"]); + $total[1] += ($custrec["Due"]-$custrec["Overdue1"]); + $total[2] += ($custrec["Overdue1"]-$custrec["Overdue2"]); + $total[3] += $custrec["Overdue2"]; + $total[4] += $custrec["Balance"]; for ($i = 0; $i < count($str); $i++) $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec); $rep->NewLine(1, 2); @@ -242,4 +246,4 @@ function print_aged_customer_analysis() $rep->End(); } -?> \ No newline at end of file +?> diff --git a/reporting/rep201.php b/reporting/rep201.php index 532da5fc..567d12f1 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -82,14 +82,15 @@ function getTransactions($supplier_id, $from, $to) function print_supplier_balances() { - global $path_to_root, $systypes_array; - - $from = $_POST['PARAM_0']; - $to = $_POST['PARAM_1']; - $fromsupp = $_POST['PARAM_2']; - $currency = $_POST['PARAM_3']; - $comments = $_POST['PARAM_4']; - $destination = $_POST['PARAM_5']; + global $path_to_root, $systypes_array; + + $from = $_POST['PARAM_0']; + $to = $_POST['PARAM_1']; + $fromsupp = $_POST['PARAM_2']; + $currency = $_POST['PARAM_3']; + $no_zeros = $_POST['PARAM_4']; + $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); else @@ -99,7 +100,7 @@ function print_supplier_balances() $supp = _('All'); else $supp = get_supplier_name($fromsupp); - $dec = user_price_dec(); + $dec = user_price_dec(); if ($currency == ALL_TEXT) { @@ -109,6 +110,9 @@ function print_supplier_balances() else $convert = false; + if ($no_zeros) $nozeros = _('Yes'); + else $nozeros = _('No'); + $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515); $headers = array(_('Trans Type'), _('#'), _('Date'), _('Due Date'), _('Charges'), @@ -117,9 +121,10 @@ function print_supplier_balances() $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right'); $params = array( 0 => $comments, - 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), - 2 => array('text' => _('Supplier'), 'from' => $supp, 'to' => ''), - 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => '')); + 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), + 2 => array('text' => _('Supplier'), 'from' => $supp, 'to' => ''), + 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''), + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Supplier Balances'), "SupplierBalances", user_pagesize()); @@ -140,35 +145,37 @@ function print_supplier_balances() { if (!$convert && $currency != $myrow['curr_code']) continue; - $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); - if ($convert) - $rep->TextCol(2, 3, $myrow['curr_code']); - $rep->fontSize -= 2; $bal = get_open_balance($myrow['supplier_id'], $from, $convert); $init[0] = $init[1] = 0.0; - $rep->TextCol(3, 4, _("Open Balance")); $init[0] = round2(abs($bal['charges']), $dec); - $rep->AmountCol(4, 5, $init[0], $dec); $init[1] = round2(Abs($bal['credits']), $dec); - $rep->AmountCol(5, 6, $init[1], $dec); $init[2] = round2($bal['Allocated'], $dec); - $rep->AmountCol(6, 7, $init[2], $dec); $init[3] = round2($bal['OutStanding'], $dec);; - $rep->AmountCol(7, 8, $init[3], $dec); $total = array(0,0,0,0); for ($i = 0; $i < 4; $i++) { $total[$i] += $init[$i]; $grandtotal[$i] += $init[$i]; } - $rep->NewLine(1, 2); $res = getTransactions($myrow['supplier_id'], $from, $to); - if (db_num_rows($res)==0) - continue; + if ($no_zeros && db_num_rows($res) == 0) continue; + + $rep->fontSize += 2; + $rep->TextCol(0, 2, $myrow['name']); + if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); + $rep->fontSize -= 2; + $rep->TextCol(3, 4, _("Open Balance")); + $rep->AmountCol(4, 5, $init[0], $dec); + $rep->AmountCol(5, 6, $init[1], $dec); + $rep->AmountCol(6, 7, $init[2], $dec); + $rep->AmountCol(7, 8, $init[3], $dec); + $rep->NewLine(1, 2); + if (db_num_rows($res)==0) continue; + $rep->Line($rep->row + 4); while ($trans=db_fetch($res)) { + if ($no_zeros && $trans['TotalAmount'] == 0 && $trans['Allocated'] == 0) continue; $rep->NewLine(1, 2); $rep->TextCol(0, 1, $systypes_array[$trans['type']]); $rep->TextCol(1, 2, $trans['reference']); @@ -230,4 +237,4 @@ function print_supplier_balances() $rep->End(); } -?> \ No newline at end of file +?> diff --git a/reporting/rep202.php b/reporting/rep202.php index 3f68bb5a..fc3c6f48 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -65,15 +65,16 @@ function get_invoices($supplier_id, $to) function print_aged_supplier_analysis() { - global $comp_path, $path_to_root, $systypes_array; + global $comp_path, $path_to_root, $systypes_array; - $to = $_POST['PARAM_0']; - $fromsupp = $_POST['PARAM_1']; - $currency = $_POST['PARAM_2']; + $to = $_POST['PARAM_0']; + $fromsupp = $_POST['PARAM_1']; + $currency = $_POST['PARAM_2']; $summaryOnly = $_POST['PARAM_3']; - $graphics = $_POST['PARAM_4']; - $comments = $_POST['PARAM_5']; - $destination = $_POST['PARAM_6']; + $no_zeros = $_POST['PARAM_4']; + $graphics = $_POST['PARAM_5']; + $comments = $_POST['PARAM_6']; + $destination = $_POST['PARAM_7']; if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); else @@ -88,7 +89,7 @@ function print_aged_supplier_analysis() $from = _('All'); else $from = get_supplier_name($fromsupp); - $dec = user_price_dec(); + $dec = user_price_dec(); if ($summaryOnly == 1) $summary = _('Summary Only'); @@ -101,6 +102,10 @@ function print_aged_supplier_analysis() } else $convert = false; + + if ($no_zeros) $nozeros = _('Yes'); + else $nozeros = _('No'); + $PastDueDays1 = get_company_pref('past_due_days'); $PastDueDays2 = 2 * $PastDueDays1; $nowdue = "1-" . $PastDueDays1 . " " . _('Days'); @@ -114,19 +119,20 @@ function print_aged_supplier_analysis() $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right'); - $params = array( 0 => $comments, - 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), - 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), - 3 => array('text' => _('Currency'),'from' => $currency,'to' => ''), - 4 => array('text' => _('Type'), 'from' => $summary,'to' => '')); + $params = array( 0 => $comments, + 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), + 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), + 3 => array('text' => _('Currency'),'from' => $currency,'to' => ''), + 4 => array('text' => _('Type'), 'from' => $summary,'to' => ''), + 5 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); if ($convert) $headers[2] = _('currency'); - $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize()); + $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize()); - $rep->Font(); - $rep->Info($params, $cols, $headers, $aligns); - $rep->Header(); + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); + $rep->Header(); $total = array(); $total[0] = $total[1] = $total[2] = $total[3] = $total[4] = 0.0; @@ -145,31 +151,32 @@ function print_aged_supplier_analysis() while ($myrow=db_fetch($result)) { - if (!$convert && $currency != $myrow['curr_code']) - continue; - $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); - if ($convert) - { - $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); - $rep->TextCol(2, 3, $myrow['curr_code']); - } - else - $rate = 1.0; - $rep->fontSize -= 2; + if (!$convert && $currency != $myrow['curr_code']) continue; + + if ($convert) $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); + else $rate = 1.0; + $supprec = get_supplier_details($myrow['supplier_id'], $to); foreach ($supprec as $i => $value) $supprec[$i] *= $rate; - $total[0] += ($supprec["Balance"] - $supprec["Due"]); - $total[1] += ($supprec["Due"]-$supprec["Overdue1"]); - $total[2] += ($supprec["Overdue1"]-$supprec["Overdue2"]); - $total[3] += $supprec["Overdue2"]; - $total[4] += $supprec["Balance"]; + $str = array($supprec["Balance"] - $supprec["Due"], $supprec["Due"]-$supprec["Overdue1"], $supprec["Overdue1"]-$supprec["Overdue2"], $supprec["Overdue2"], $supprec["Balance"]); + + if ($no_zeros && array_sum($str) == 0) continue; + + $rep->fontSize += 2; + $rep->TextCol(0, 2, $myrow['name']); + if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); + $rep->fontSize -= 2; + $total[0] += ($supprec["Balance"] - $supprec["Due"]); + $total[1] += ($supprec["Due"]-$supprec["Overdue1"]); + $total[2] += ($supprec["Overdue1"]-$supprec["Overdue2"]); + $total[3] += $supprec["Overdue2"]; + $total[4] += $supprec["Balance"]; for ($i = 0; $i < count($str); $i++) $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec); $rep->NewLine(1, 2); @@ -243,4 +250,4 @@ function print_aged_supplier_analysis() $rep->End(); } -?> \ No newline at end of file +?> diff --git a/reporting/rep203.php b/reporting/rep203.php index 7c907274..b1a42730 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -55,13 +55,14 @@ function getTransactions($supplier, $date) function print_payment_report() { - global $path_to_root, $systypes_array; - - $to = $_POST['PARAM_0']; - $fromsupp = $_POST['PARAM_1']; - $currency = $_POST['PARAM_2']; - $comments = $_POST['PARAM_3']; - $destination = $_POST['PARAM_4']; + global $path_to_root, $systypes_array; + + $to = $_POST['PARAM_0']; + $fromsupp = $_POST['PARAM_1']; + $currency = $_POST['PARAM_2']; + $no_zeros = $_POST['PARAM_3']; + $comments = $_POST['PARAM_4']; + $destination = $_POST['PARAM_5']; if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); else @@ -72,7 +73,7 @@ function print_payment_report() else $from = get_supplier_name($fromsupp); - $dec = user_price_dec(); + $dec = user_price_dec(); if ($currency == ALL_TEXT) { @@ -82,6 +83,9 @@ function print_payment_report() else $convert = false; + if ($no_zeros) $nozeros = _('Yes'); + else $nozeros = _('No'); + $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515); $headers = array(_('Trans Type'), _('#'), _('Due Date'), '', '', @@ -90,9 +94,10 @@ function print_payment_report() $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right'); $params = array( 0 => $comments, - 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), - 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), - 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => '')); + 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), + 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), + 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''), + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize()); @@ -113,25 +118,28 @@ function print_payment_report() while ($myrow=db_fetch($result)) { - if (!$convert && $currency != $myrow['curr_code']) - continue; + if (!$convert && $currency != $myrow['curr_code']) continue; + + $res = getTransactions($myrow['supplier_id'], $to); + if ($no_zeros && db_num_rows($res)==0) continue; + $rep->fontSize += 2; $rep->TextCol(0, 6, $myrow['name'] . " - " . $myrow['terms']); if ($convert) $rep->TextCol(6, 7, $myrow['curr_code']); $rep->fontSize -= 2; $rep->NewLine(1, 2); - $res = getTransactions($myrow['supplier_id'], $to); if (db_num_rows($res)==0) continue; $rep->Line($rep->row + 4); $total[0] = $total[1] = 0.0; while ($trans=db_fetch($res)) { - if ($convert) - $rate = $trans['rate']; - else - $rate = 1.0; + if ($no_zeros && $trans['TranTotal'] == 0 && $trans['Balance'] == 0) continue; + + if ($convert) $rate = $trans['rate']; + else $rate = 1.0; + $rep->NewLine(1, 2); $rep->TextCol(0, 1, $systypes_array[$trans['type']]); $rep->TextCol(1, 2, $trans['supp_reference']); @@ -175,4 +183,4 @@ function print_payment_report() $rep->End(); } -?> \ No newline at end of file +?> diff --git a/reporting/rep303.php b/reporting/rep303.php index 7317ecae..cc1eeec0 100644 --- a/reporting/rep303.php +++ b/reporting/rep303.php @@ -61,15 +61,16 @@ function getTransactions($category, $location) function print_stock_check() { - global $comp_path, $path_to_root, $pic_height; - - $category = $_POST['PARAM_0']; - $location = $_POST['PARAM_1']; - $pictures = $_POST['PARAM_2']; - $check = $_POST['PARAM_3']; - $shortage = $_POST['PARAM_4']; - $comments = $_POST['PARAM_5']; - $destination = $_POST['PARAM_6']; + global $comp_path, $path_to_root, $pic_height; + + $category = $_POST['PARAM_0']; + $location = $_POST['PARAM_1']; + $pictures = $_POST['PARAM_2']; + $check = $_POST['PARAM_3']; + $shortage = $_POST['PARAM_4']; + $no_zeros = $_POST['PARAM_5']; + $comments = $_POST['PARAM_6']; + $destination = $_POST['PARAM_7']; if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); else @@ -97,7 +98,9 @@ function print_stock_check() { $short = _('No'); $available = _('Available'); - } + } + if ($no_zeros) $nozeros = _('Yes'); + else $nozeros = _('No'); if ($check) { $cols = array(0, 100, 250, 295, 345, 390, 445, 515); @@ -112,21 +115,22 @@ function print_stock_check() } - $params = array( 0 => $comments, - 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), - 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), - 3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => '')); + $params = array( 0 => $comments, + 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), + 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), + 3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => ''), + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); if ($pictures) $user_comp = user_company(); else $user_comp = ""; - $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize()); + $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize()); - $rep->Font(); - $rep->Info($params, $cols, $headers, $aligns); - $rep->Header(); + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); + $rep->Header(); $res = getTransactions($category, $location); $catt = ''; @@ -141,7 +145,9 @@ function print_stock_check() $onorder = get_on_porder_qty($trans['stock_id'], $loc_code); $flag = get_mb_flag($trans['stock_id']); if ($flag == 'M') - $onorder += get_on_worder_qty($trans['stock_id'], $loc_code); + $onorder += get_on_worder_qty($trans['stock_id'], $loc_code); + if ($no_zeros && $trans['QtyOnHand'] == 0 && $demandqty == 0 && $onorder == 0) + continue; if ($shortage && $trans['QtyOnHand'] - $demandqty >= 0) continue; if ($catt != $trans['cat_description']) diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 31767cc0..a35ce845 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -32,6 +32,7 @@ $reports->addReport(_('Customer'),101,_('Customer &Balances'), _('End Date') => 'DATEENDM', _('Customer') => 'CUSTOMERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', + _('Suppress Zeros') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); $reports->addReport(_('Customer'),102,_('&Aged Customer Analysis'), @@ -39,6 +40,7 @@ $reports->addReport(_('Customer'),102,_('&Aged Customer Analysis'), _('Customer') => 'CUSTOMERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', _('Summary Only') => 'YES_NO', + _('Suppress Zeros') => 'YES_NO', _('Graphics') => 'GRAPHIC', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); @@ -121,6 +123,7 @@ $reports->addReport(_('Supplier'),201,_('Supplier &Balances'), _('End Date') => 'DATEENDM', _('Supplier') => 'SUPPLIERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', + _('Suppress Zeros') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); $reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'), @@ -128,6 +131,7 @@ $reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'), _('Supplier') => 'SUPPLIERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', _('Summary Only') => 'YES_NO', + _('Suppress Zeros') => 'YES_NO', _('Graphics') => 'GRAPHIC', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); @@ -135,6 +139,7 @@ $reports->addReport(_('Supplier'),203,_('&Payment Report'), array( _('End Date') => 'DATE', _('Supplier') => 'SUPPLIERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', + _('Suppress Zeros') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); $reports->addReport(_('Supplier'),204,_('Outstanding &GRNs Report'), @@ -172,6 +177,7 @@ $reports->addReport(_('Inventory'),303,_('Stock &Check Sheets'), _('Show Pictures') => 'YES_NO', _('Inventory Column') => 'YES_NO', _('Show Shortage') => 'YES_NO', + _('Suppress Zeros') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); $reports->addReport(_('Inventory'),304,_('Inventory &Sales Report'), @@ -383,4 +389,4 @@ echo "