From: Joe Hunt Date: Thu, 26 Nov 2009 21:17:42 +0000 (+0000) Subject: Round to nearest value of 0 produced a division by zero error X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=f73d760d4f6f821d91cc2c2c3796b84a4b5f7e47;p=textcart.git 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. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 70a993f..7f7804c 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 366fc85..3ee19ed 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 f98c3ff..386f6d6 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_']))