From bb991dc5b071e966b39954bb53d3b0efe8420938 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Mon, 28 Jun 2010 10:57:14 +0000 Subject: [PATCH] Marged fixes from ain trunk up to 2.2.11 --- CHANGELOG.txt | 37 +++++++++++++++ admin/payment_terms.php | 12 ----- config.default.php | 10 ++--- includes/db/manufacturing_db.inc | 4 +- reporting/rep101.php | 58 ++++++++++++++---------- reporting/rep102.php | 62 +++++++++++++------------ reporting/rep201.php | 59 +++++++++++++----------- reporting/rep202.php | 70 +++++++++++++++++------------ reporting/rep203.php | 46 +++++++++++-------- reporting/rep303.php | 45 ++++++++++++------- reporting/reports_main.php | 8 +++- sales/create_recurrent_invoices.php | 2 +- sales/customer_credit_invoice.php | 2 +- sales/includes/db/custalloc_db.inc | 2 +- 14 files changed, 253 insertions(+), 164 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6fc4785a..b18913e4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,42 @@ Legend: ! -> Note $ -> Affected files +28-Jun-2010 Merged changes from main trunk (2.2.11) as follows +------------------------------- Release 2.2.11 ---------------------------------- +! Release 2.2.11 +$ config.default.php + update.html + +22-Jun-2010 Joe Hunt +# Minor select bug in create recurrent invoices +$ /sales/create_recurrent_invoices.php + +18-Jun-2010 Joe Hunt +- Removed constraint on day values in Payment Terms +$ /admin/payment_terms.php + +18-Jun-2010 Janusz Dobrowolski +# Small bug on final credit note screen redirection +$ /sales/customer_credit_invoice.php + +17-Jun-2010 Janusz Dobrowolski +# [0000235],[0000236] db error in sales order view window. +$ /sales/view/view_sales_order.php + +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 + +---------- End of changes from main trunk 2.2.11 + 27-Jun-2010 Janusz Dobrowolski + Added debtor_trans.src_id update $ /sql/alter2.3.php @@ -189,6 +225,7 @@ $ /purchasing/includes/db/grn_db.inc /purchasing/supplier_invoice.php 13-Jun-2010 Merged changes from main trunk (2.2.10) as follows + ------------------------------- Release 2.2.10 ---------------------------------- 11-Jun-2010 Joe Hunt ! Release 2.2.10 diff --git a/admin/payment_terms.php b/admin/payment_terms.php index df7401ea..76ccd53e 100644 --- a/admin/payment_terms.php +++ b/admin/payment_terms.php @@ -56,18 +56,6 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') $input_error = 1; display_error( _("The Terms description must be entered.")); set_focus('terms'); - } // there should be no limits by 30 here if they want longer payment terms. Joe Hunt 2010-05-31 - //elseif ($_POST['DayNumber'] > 30 && !check_value('DaysOrFoll')) - //{ - // $input_error = 1; - // display_error( _("When the check box to indicate a day in the following month is the due date, the due date cannot be a day after the 30th. A number between 1 and 30 is expected.")); - // set_focus('DayNumber'); - //} - elseif ($_POST['DayNumber'] > 500 && get_post('type')==PTT_DAYS) - { - $input_error = 1; - display_error( _("When the Day of the Following Month is selected the number entered should be less than 500 days.")); - set_focus('DayNumber'); } if ($_POST['DayNumber'] == '') diff --git a/config.default.php b/config.default.php index 67b1d627..d4e43270 100644 --- a/config.default.php +++ b/config.default.php @@ -129,11 +129,11 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ $pagesizes = array("Letter", "A4"); // default PDF pagesize /* Default border and spacing for tables */ - /* Should be moved to CSS */ - - $table_style = "class='tablestyle'"; - $table_style2 = "class='tablestyle2'"; - + /* Should be moved to CSS */ + + $table_style = "class='tablestyle'"; + $table_style2 = "class='tablestyle2'"; + /* Accounts Payable */ /* System check to see if quantity charged on purchase invoices exceeds the quantity received. If this parameter is checked the proportion by which the purchase invoice is an overcharge diff --git a/includes/db/manufacturing_db.inc b/includes/db/manufacturing_db.inc index c47cc561..9378f645 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 4800ddc5..dc027b5a 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -94,14 +94,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 @@ -111,7 +112,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) { @@ -121,6 +122,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'), @@ -131,12 +135,14 @@ function print_customer_balances() $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' => '')); + 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''), + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); + $grandtotal = array(0,0,0,0); $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master "; @@ -144,26 +150,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++) @@ -172,12 +184,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']); @@ -225,8 +237,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')); @@ -235,7 +247,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 62128b50..7892e2eb 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -66,13 +66,14 @@ function print_aged_customer_analysis() { global $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,15 +117,16 @@ 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); @@ -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 b176f2bd..1c1ee438 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 2915fc8f..57ef0e8b 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -71,9 +71,11 @@ function print_aged_supplier_analysis() $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 +90,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 +103,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 +120,26 @@ 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()); +<<<<<<< rep202.php $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); +======= + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); + $rep->Header(); +>>>>>>> 1.7 $total = array(); $total[0] = $total[1] = $total[2] = $total[3] = $total[4] = 0.0; @@ -145,31 +158,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 +257,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 6fe008d4..e6f00ce8 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 b72e9db3..e96f32b8 100644 --- a/reporting/rep303.php +++ b/reporting/rep303.php @@ -61,15 +61,17 @@ function getTransactions($category, $location) function print_stock_check() { - global $path_to_root, $pic_height, $pic_width; - - $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 $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 +99,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 +116,28 @@ 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()); +<<<<<<< rep303.php $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); +======= + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); + $rep->Header(); +>>>>>>> 1.22 $res = getTransactions($category, $location); $catt = ''; @@ -141,7 +152,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 e4831e2b..d60dfe2a 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -32,6 +32,7 @@ $reports->addReport(RC_CUSTOMER, 101, _('Customer &Balances'), _('End Date') => 'DATEENDM', _('Customer') => 'CUSTOMERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', + _('Suppress Zeros') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); $reports->addReport(RC_CUSTOMER, 102, _('&Aged Customer Analysis'), @@ -39,6 +40,7 @@ $reports->addReport(RC_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(RC_SUPPLIER, 201, _('Supplier &Balances'), _('End Date') => 'DATEENDM', _('Supplier') => 'SUPPLIERS_NO_FILTER', _('Currency Filter') => 'CURRENCY', + _('Suppress Zeros') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Destination') => 'DESTINATION')); $reports->addReport(RC_SUPPLIER, 202, _('&Aged Supplier Analyses'), @@ -128,6 +131,7 @@ $reports->addReport(RC_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(RC_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(RC_SUPPLIER, 204, _('Outstanding &GRNs Report'), @@ -173,6 +178,7 @@ $reports->addReport(RC_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(RC_INVENTORY, 304, _('Inventory &Sales Report'), @@ -393,4 +399,4 @@ echo "