No display of shipping if there are no shipping costs on sales documents or views.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 23 Nov 2015 08:26:48 +0000 (09:26 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 23 Nov 2015 08:26:48 +0000 (09:26 +0100)
reporting/rep107.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep113.php
sales/view/view_credit.php
sales/view/view_dispatch.php
sales/view/view_invoice.php
sales/view/view_sales_order.php

index d3f74dd7999b3e826cc0443fa59196c95edd2b8c..58b1509fd7eaa54065c88147318892b6770649ed 100644 (file)
@@ -145,7 +145,6 @@ function print_invoices()
                        }
 
                        $DisplaySubTot = number_format2($SubTotal,$dec);
-                       $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                        $doctype = ST_SALESINVOICE;
@@ -153,9 +152,13 @@ function print_invoices()
                        $rep->TextCol(3, 6, _("Sub-total"), -2);
                        $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                        $rep->NewLine();
-                       $rep->TextCol(3, 6, _("Shipping"), -2);
-                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
-                       $rep->NewLine();
+                       if ($myrow['ov_freight'] != 0.0)
+                       {
+                               $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+                               $rep->TextCol(3, 6, _("Shipping"), -2);
+                               $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                               $rep->NewLine();
+                       }       
                        $tax_items = get_trans_tax_details(ST_SALESINVOICE, $i);
                        $first = true;
                while ($tax_item = db_fetch($tax_items))
index 8b22697ad9a52a0a153d08fe22a1760c0ecba751..e4592a788ad25db46f0aa8bc26695a65b080c014 100644 (file)
@@ -144,7 +144,6 @@ function print_sales_orders()
                        $rep->TextColLines(1, 5, $myrow['comments'], -2);
                }
                $DisplaySubTot = number_format2($SubTotal,$dec);
-               $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $doctype = ST_SALESORDER;
@@ -152,10 +151,13 @@ function print_sales_orders()
                $rep->TextCol(3, 6, _("Sub-total"), -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                $rep->NewLine();
-               $rep->TextCol(3, 6, _("Shipping"), -2);
-               $rep->TextCol(6, 7,     $DisplayFreight, -2);
-               $rep->NewLine();
-
+               if ($myrow['freight_cost'] != 0.0)
+               {
+                       $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
+                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                       $rep->NewLine();
+               }
                $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec);
                if ($myrow['tax_included'] == 0) {
                        $rep->TextCol(3, 6, _("TOTAL ORDER EX VAT"), - 2);
index bfc1e4e6ccc4850b23b92172c42a62e046a93c2f..f32b1264605166b1bb8894233acfc5051a304452 100644 (file)
@@ -150,7 +150,6 @@ function print_deliveries()
                        }
 
                        $DisplaySubTot = number_format2($SubTotal,$dec);
-                       $DisplayFreight = number_format2($myrow["ov_freight"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                        $doctype=ST_CUSTDELIVERY;
@@ -159,9 +158,13 @@ function print_deliveries()
                                $rep->TextCol(3, 6, _("Sub-total"), -2);
                                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                                $rep->NewLine();
-                               $rep->TextCol(3, 6, _("Shipping"), -2);
-                               $rep->TextCol(6, 7,     $DisplayFreight, -2);
-                               $rep->NewLine();
+                               if ($myrow['ov_freight'] != 0.0)
+                               {
+                                       $DisplayFreight = number_format2($myrow["ov_freight"],$dec);
+                                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                                       $rep->NewLine();
+                               }       
                                $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $i);
                                $first = true;
                        while ($tax_item = db_fetch($tax_items))
index 6eeda915e4b3e4d73d5b0a32002308bc0d988e78..65352501f479402b38a8474f0aecbc3da47117bd 100644 (file)
@@ -147,7 +147,6 @@ function print_sales_quotations()
                        $rep->TextColLines(1, 5, $myrow['comments'], -2);
                }
                $DisplaySubTot = number_format2($SubTotal,$dec);
-               $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $doctype = ST_SALESQUOTE;
@@ -155,10 +154,13 @@ function print_sales_quotations()
                $rep->TextCol(3, 6, _("Sub-total"), -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                $rep->NewLine();
-               $rep->TextCol(3, 6, _("Shipping"), -2);
-               $rep->TextCol(6, 7,     $DisplayFreight, -2);
-               $rep->NewLine();
-
+               if ($myrow['freight_cost'] != 0.0)
+               {
+                       $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
+                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                       $rep->NewLine();
+               }
                $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec);
                if ($myrow['tax_included'] == 0) {
                        $rep->TextCol(3, 6, _("TOTAL ORDER EX VAT"), - 2);
index c73388abf565650c4c097d4fa0c84f9bfe0cabda..107b210bef4e1678d7e72f8dda232c0270fb8c76 100644 (file)
@@ -139,7 +139,6 @@ function print_credits()
                        }
 
                        $DisplaySubTot = number_format2($SubTotal,$dec);
-                       $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                        $doctype = ST_CUSTCREDIT;
@@ -147,9 +146,13 @@ function print_credits()
                        $rep->TextCol(3, 6, _("Sub-total"), -2);
                        $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                        $rep->NewLine();
-                       $rep->TextCol(3, 6, _("Shipping"), -2);
-                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
-                       $rep->NewLine();
+                       if ($myrow['ov_freight'] != 0.0)
+                       {
+                               $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+                               $rep->TextCol(3, 6, _("Shipping"), -2);
+                               $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                               $rep->NewLine();
+                       }       
                        $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i);
                        $first = true;
                while ($tax_item = db_fetch($tax_items))
index 7fba678bf433216f497c557c22b04edb9d31884d..5c360eed4ec0e3f1d223f993f451ccf37935f491 100644 (file)
@@ -126,7 +126,6 @@ else
        display_note(_("There are no line items on this credit note."), 1, 2);
 
 $display_sub_tot = price_format($sub_total);
-$display_freight = price_format($myrow["ov_freight"]);
 
 $credit_total = $myrow["ov_freight"]+$myrow["ov_gst"]+$myrow["ov_amount"]+$myrow["ov_freight_tax"];
 $display_total = price_format($credit_total);
@@ -135,8 +134,12 @@ $display_total = price_format($credit_total);
 if ($sub_total != 0)
        label_row(_("Sub Total"), $display_sub_tot, "colspan=6 align=right",
                "nowrap align=right width='15%'");
-label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
 
+if ($myrow["ov_freight"] != 0.0)
+{
+       $display_freight = price_format($myrow["ov_freight"]);
+       label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+}
 $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $trans_id);
 display_customer_trans_tax_details($tax_items, 6);
 
index d089282b3a95d282272bd2f9d850fee599be11fa..260212853ebb3e0d84aee3d4fd4ad9d9a12205e6 100644 (file)
@@ -150,10 +150,11 @@ if (db_num_rows($result) > 0)
 else
        display_note(_("There are no line items on this dispatch."), 1, 2);
 
-$display_freight = price_format($myrow["ov_freight"]);
-
-label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
-
+if ($myrow['ov_freight'] != 0.0)
+{
+       $display_freight = price_format($myrow["ov_freight"]);
+       label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+}
 $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $trans_id);
 display_customer_trans_tax_details($tax_items, 6);
 
index 2d128a518d7a3af7996b39cef6b73fb1d5f3891d..4bd251fa870c7457fa1a64bc2e2d5b77481d9054 100644 (file)
@@ -151,11 +151,13 @@ if (db_num_rows($result) > 0)
 else
        display_note(_("There are no line items on this invoice."), 1, 2);
 
-$display_freight = price_format($myrow["ov_freight"]);
 
 /*Print out the invoice text entered */
-label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
-
+if ($myrow['ov_freight'] != 0.0)
+{
+       $display_freight = price_format($myrow["ov_freight"]);
+       label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+}
 $tax_items = get_trans_tax_details(ST_SALESINVOICE, $trans_id);
 display_customer_trans_tax_details($tax_items, 6);
 
index 3276b9582b89fb0a45e391dc207b98dbdac431a5..5c925b26c676f5abf0ab852750d216ec11eba387 100644 (file)
@@ -224,8 +224,9 @@ foreach ($_SESSION['View']->line_items as $stock_item) {
        end_row();
 }
 
-label_row(_("Shipping"), price_format($_SESSION['View']->freight_cost),
-       "align=right colspan=6", "nowrap align=right", 1);
+if ($_SESSION['View']->freight_cost != 0.0)
+       label_row(_("Shipping"), price_format($_SESSION['View']->freight_cost),
+               "align=right colspan=6", "nowrap align=right", 1);
 
 $sub_tot = $_SESSION['View']->get_items_total() + $_SESSION['View']->freight_cost;