From 7e4fa01197224b1784257e389a999dd239ffaba1 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Thu, 26 Nov 2009 21:17:42 +0000 Subject: [PATCH] Round to nearest value of 0 produced a division by zero error When printing reference numbers instead of internal numbers on documents it should also refer to reference numbers in deliveries and orders. --- CHANGELOG.txt | 7 +++++++ admin/company_preferences.php | 2 ++ reporting/includes/header2.inc | 21 ++++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 70a993f4..7f7804c6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,13 @@ Legend: ! -> Note $ -> Affected files +26-Nov-2009 Joe Hunt +# Round to nearest value of 0 produced a division by zero error +$ /admin/company_preferences.php +# When printing reference numbers instead of internal numbers on documents + it should also refer to reference numbers in deliveries and orders. +$ /reporting/includes/header2.inc + 25-Nov-2009 Joe Hunt/Tom Hallman # Fixed so total amount cannot be 0 in Bank Payments/Deposits $ /gl/gl_bank.php diff --git a/admin/company_preferences.php b/admin/company_preferences.php index 366fc852..3ee19edb 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -102,6 +102,8 @@ if (isset($_POST['update']) && $_POST['update'] != "") } if ($_POST['add_pct'] == "") $_POST['add_pct'] = -1; + if ($_POST['round_to'] <= 0) + $_POST['round_to'] = 1; if ($input_error != 1) { update_company_setup($_POST['coy_name'], $_POST['coy_no'], diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index f98c3ffa..386f6d6a 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -236,10 +236,18 @@ $col += $width; if ($doctype == 10) { - $deliveries = get_parent_trans(10,$myrow['trans_no']); + $deliveries = get_parent_trans(ST_SALESINVOICE, $myrow['trans_no']); $line = ""; foreach ($deliveries as $delivery) { + if ($print_invoice_no == 0) + { + $ref = get_reference(ST_CUSTDELIVERY, $delivery); + if ($ref) + $delivery = $ref; + else + continue; + } if ($line == "") $line .= "$delivery"; else @@ -247,6 +255,17 @@ } $this->TextWrap($col, $this->row, $width, $line, 'C'); } + elseif ($doctype == 13) + { + $ref = $myrow['order_']; + if ($print_invoice_no == 0) + { + $ref = get_reference(ST_SALESORDER, $myrow['order_']); + if (!$ref) + $ref = ""; + } + $this->TextWrap($col, $this->row, $width, $ref, 'C'); + } elseif ($doctype == 26) $this->TextWrap($col, $this->row, $width, $myrow["location_name"], 'C'); elseif (isset($myrow['order_'])) -- 2.30.2