From 805b766842402a275c6bd0526df5278af03138ed Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Mon, 23 Nov 2015 09:26:48 +0100 Subject: [PATCH] No display of shipping if there are no shipping costs on sales documents or views. --- reporting/rep107.php | 11 +++++++---- reporting/rep109.php | 12 +++++++----- reporting/rep110.php | 11 +++++++---- reporting/rep111.php | 12 +++++++----- reporting/rep113.php | 11 +++++++---- sales/view/view_credit.php | 7 +++++-- sales/view/view_dispatch.php | 9 +++++---- sales/view/view_invoice.php | 8 +++++--- sales/view/view_sales_order.php | 5 +++-- 9 files changed, 53 insertions(+), 33 deletions(-) diff --git a/reporting/rep107.php b/reporting/rep107.php index d3f74dd7..58b1509f 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -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)) diff --git a/reporting/rep109.php b/reporting/rep109.php index 8b22697a..e4592a78 100644 --- a/reporting/rep109.php +++ b/reporting/rep109.php @@ -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); diff --git a/reporting/rep110.php b/reporting/rep110.php index bfc1e4e6..f32b1264 100644 --- a/reporting/rep110.php +++ b/reporting/rep110.php @@ -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)) diff --git a/reporting/rep111.php b/reporting/rep111.php index 6eeda915..65352501 100644 --- a/reporting/rep111.php +++ b/reporting/rep111.php @@ -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); diff --git a/reporting/rep113.php b/reporting/rep113.php index c73388ab..107b210b 100644 --- a/reporting/rep113.php +++ b/reporting/rep113.php @@ -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)) diff --git a/sales/view/view_credit.php b/sales/view/view_credit.php index 7fba678b..5c360eed 100644 --- a/sales/view/view_credit.php +++ b/sales/view/view_credit.php @@ -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); diff --git a/sales/view/view_dispatch.php b/sales/view/view_dispatch.php index d089282b..26021285 100644 --- a/sales/view/view_dispatch.php +++ b/sales/view/view_dispatch.php @@ -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); diff --git a/sales/view/view_invoice.php b/sales/view/view_invoice.php index 2d128a51..4bd251fa 100644 --- a/sales/view/view_invoice.php +++ b/sales/view/view_invoice.php @@ -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); diff --git a/sales/view/view_sales_order.php b/sales/view/view_sales_order.php index 3276b958..5c925b26 100644 --- a/sales/view/view_sales_order.php +++ b/sales/view/view_sales_order.php @@ -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; -- 2.30.2