Round to nearest value of 0 produced a division by zero error
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 26 Nov 2009 21:17:42 +0000 (21:17 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 26 Nov 2009 21:17:42 +0000 (21:17 +0000)
When printing reference numbers instead of internal numbers on documents it should also refer to reference numbers in deliveries and orders.

CHANGELOG.txt
admin/company_preferences.php
reporting/includes/header2.inc

index 70a993f492f41eef67fa5eef70dd106d439f5658..7f7804c6d8202124ea38ef0796aa263dff4983b3 100644 (file)
@@ -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
index 366fc852613328c472df27031ce3af399a249e8b..3ee19edbc7a493be95e19e3763c7ecd0d95cf7ef 100644 (file)
@@ -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'], 
index f98c3ffacd14235f3bb92727a76bb85554c826e1..386f6d6acc3fd9e2d699ffbbdd8a7fcbd37562bf 100644 (file)
                $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
                        }               
                        $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_']))