From 332bb2b00f809bf108fd504ce10273c9c7529143 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 9 Oct 2009 16:21:37 +0000 Subject: [PATCH] Added option to print delivery notes as packing slip in reports and links. --- CHANGELOG.txt | 13 +++++ includes/ui/ui_controls.inc | 4 +- reporting/includes/doctext.inc | 2 +- reporting/includes/doctext2.inc | 2 +- reporting/includes/header2.inc | 2 +- reporting/includes/pdf_report.inc | 2 +- reporting/includes/reporting.inc | 5 +- reporting/rep110.php | 92 ++++++++++++++++++------------- reporting/reports_main.php | 1 + sales/customer_delivery.php | 13 +++-- sales/sales_order_entry.php | 2 + 11 files changed, 89 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 000a364a..cf10e18e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,19 @@ Legend: ! -> Note $ -> Affected files +09-Oct-2009 Joe Hunt ++ Added option to print delivery notes as packing slip in reports and links. +$ /includes/ui/ui_controls.inc + /reporting/rep110.php + /reporting/reports_main.php + /reporting/includes/doctext.inc + /reporting/includes/doctext2.inc + /reporting/includes/header2.inc + /reporting/includes/pdf_report.inc + /reporting/includes/reporting.inc + /sales/customer_delivery.php + /sales/sales_order_entry.php + 08-Oct-2009 Joe Hunt + Prepared the Report Engine for Tags handling. ! Changed report::getDisplay() to use combo_input from ui_lists.inc insted of local function diff --git a/includes/ui/ui_controls.inc b/includes/ui/ui_controls.inc index b237889d..9848761e 100644 --- a/includes/ui/ui_controls.inc +++ b/includes/ui/ui_controls.inc @@ -196,9 +196,9 @@ function submenu_view($title, $type, $number, $id=null) display_note(get_trans_view_str($type, $number, $title, false, 'menu_option', $id), 0, 1); } -function submenu_print($title, $type, $number, $id=null, $email=0) +function submenu_print($title, $type, $number, $id=null, $email=0, $extra=0) { - display_note(print_document_link($number, $title, true, $type, false, 'menu_option', $id, $email), 0, 1); + display_note(print_document_link($number, $title, true, $type, false, 'menu_option', $id, $email, $extra), 0, 1); } //----------------------------------------------------------------------------------- diff --git a/reporting/includes/doctext.inc b/reporting/includes/doctext.inc index 23a8c65d..0edc595f 100644 --- a/reporting/includes/doctext.inc +++ b/reporting/includes/doctext.inc @@ -71,7 +71,7 @@ if (isset($header2type)) elseif ($doctype == 8) $this->title = _("PURCHASE ORDER"); elseif ($doctype == 13) - $this->title = _("DELIVERY NOTE"); + $this->title = ($packing_slip==1 ? _("PACKING SLIP") : _("DELIVERY NOTE")); elseif ($doctype == 9) $this->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER")); elseif ($doctype == 10) diff --git a/reporting/includes/doctext2.inc b/reporting/includes/doctext2.inc index 9f94b1b4..40853642 100644 --- a/reporting/includes/doctext2.inc +++ b/reporting/includes/doctext2.inc @@ -74,7 +74,7 @@ if (isset($header2type)) elseif ($doctype == 10) $this->title = "INVOICE"; elseif ($doctype == 13) - $this->title = "DELIVERY NOTE"; + $this->title = ($packing_slip==1 ? "PACKING SLIP" : "DELIVERY NOTE"); elseif ($doctype == 26) $this->title = "WORK ORDER"; else diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index 5755b627..7fae9f64 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -251,7 +251,7 @@ $col += $width; if ($doctype == 26) $this->TextWrap($col, $this->row, $width, sql2date($myrow["required_by"]), 'C'); - else + elseif (!isset($packing_slip) || $packing_slip == 0) { $id = $myrow['payment_terms']; $sql = "SELECT terms FROM ".TB_PREF."payment_terms WHERE terms_indicator='$id'"; diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index af7ba6cc..db9e6649 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -266,7 +266,7 @@ class FrontReport extends Cpdf function Header2($myrow, $branch, $sales_order, $bankaccount, $doctype) { - global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no; + global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no, $packing_slip; $this->pageNumber++; if ($this->pageNumber > 1) diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 12cffc11..6a071299 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -15,7 +15,7 @@ // You only need full parameter list for invoices/credit notes function print_document_link($doc_no, $link_text, $link=true, $type_no, - $icon=false, $class='printlink', $id='', $email=0) + $icon=false, $class='printlink', $id='', $email=0, $extra=0) { global $path_to_root; include_once($path_to_root . "/includes/types.inc"); @@ -51,7 +51,8 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, $ar = array( 'PARAM_0' => $doc_no, 'PARAM_1' => $doc_no, - 'PARAM_2' => $email); + 'PARAM_2' => $email, + 'PARAM_3' => $extra); break; case ST_SALESINVOICE : // Sales Invoice case ST_CUSTCREDIT : // Customer Credit Note diff --git a/reporting/rep110.php b/reporting/rep110.php index 5af4a83c..d1665aa2 100644 --- a/reporting/rep110.php +++ b/reporting/rep110.php @@ -25,6 +25,7 @@ include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/sales/includes/sales_db.inc"); +$packing_slip = 0; //---------------------------------------------------------------------------------------------------- print_deliveries(); @@ -33,14 +34,15 @@ print_deliveries(); function print_deliveries() { - global $path_to_root; + global $path_to_root, $packing_slip; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $email = $_POST['PARAM_2']; - $comments = $_POST['PARAM_3']; + $packing_slip = $_POST['PARAM_3']; + $comments = $_POST['PARAM_4']; if ($from == null) $from = 0; @@ -62,7 +64,10 @@ function print_deliveries() if ($email == 0) { - $rep = new FrontReport(_('DELIVERY'), "DeliveryNoteBulk", user_pagesize()); + if ($packing_slip == 0) + $rep = new FrontReport(_('DELIVERY'), "DeliveryNoteBulk", user_pagesize()); + else + $rep = new FrontReport(_('PACKING SLIP'), "PackingSlipBulk", user_pagesize()); $rep->currency = $cur; $rep->Font(); $rep->Info($params, $cols, null, $aligns); @@ -80,15 +85,23 @@ function print_deliveries() $rep = new FrontReport("", "", user_pagesize()); $rep->currency = $cur; $rep->Font(); + if ($packing_slip == 0) + { $rep->title = _('DELIVERY NOTE'); $rep->filename = "Delivery" . $myrow['reference'] . ".pdf"; + } + else + { + $rep->title = _('PACKING SLIP'); + $rep->filename = "Packing_slip" . $myrow['reference'] . ".pdf"; + } $rep->Info($params, $cols, null, $aligns); } else $rep->title = _('DELIVERY NOTE'); $rep->Header2($myrow, $branch, $sales_order, '', 13); - $result = get_customer_trans_details(13, $i); + $result = get_customer_trans_details(13, $i); $SubTotal = 0; while ($myrow2=db_fetch($result)) { @@ -109,9 +122,12 @@ function print_deliveries() $rep->row = $oldrow; $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); - $rep->TextCol(4, 5, $DisplayPrice, -2); - $rep->TextCol(5, 6, $DisplayDiscount, -2); - $rep->TextCol(6, 7, $DisplayNet, -2); + if ($packing_slip == 0) + { + $rep->TextCol(4, 5, $DisplayPrice, -2); + $rep->TextCol(5, 6, $DisplayDiscount, -2); + $rep->TextCol(6, 7, $DisplayNet, -2); + } $rep->row = $newrow; //$rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) @@ -140,37 +156,39 @@ function print_deliveries() { include($path_to_root . "/reporting/includes/doctext.inc"); } - - $rep->TextCol(3, 6, $doc_Sub_total, -2); - $rep->TextCol(6, 7, $DisplaySubTot, -2); - $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Shipping, -2); - $rep->TextCol(6, 7, $DisplayFreight, -2); - $rep->NewLine(); - $tax_items = get_trans_tax_details(13, $i); - while ($tax_item = db_fetch($tax_items)) - { - $DisplayTax = number_format2($tax_item['amount'], $dec); - if ($tax_item['included_in_price']) - { - $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] . - " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2); - } - else - { - $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" . - $tax_item['rate'] . "%)", -2); - $rep->TextCol(6, 7, $DisplayTax, -2); - } + if ($packing_slip == 0) + { + $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); - } - $rep->NewLine(); - $DisplayTotal = number_format2($myrow["ov_freight"] +$myrow["ov_freight_tax"] + $myrow["ov_gst"] + - $myrow["ov_amount"],$dec); - $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2); - $rep->TextCol(6, 7, $DisplayTotal, -2); - $rep->Font(); + $rep->TextCol(3, 6, $doc_Shipping, -2); + $rep->TextCol(6, 7, $DisplayFreight, -2); + $rep->NewLine(); + $tax_items = get_trans_tax_details(13, $i); + while ($tax_item = db_fetch($tax_items)) + { + $DisplayTax = number_format2($tax_item['amount'], $dec); + if ($tax_item['included_in_price']) + { + $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] . + " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2); + } + else + { + $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" . + $tax_item['rate'] . "%)", -2); + $rep->TextCol(6, 7, $DisplayTax, -2); + } + $rep->NewLine(); + } + $rep->NewLine(); + $DisplayTotal = number_format2($myrow["ov_freight"] +$myrow["ov_freight_tax"] + $myrow["ov_gst"] + + $myrow["ov_amount"],$dec); + $rep->Font('bold'); + $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2); + $rep->TextCol(6, 7, $DisplayTotal, -2); + $rep->Font(); + } if ($email == 1) { $myrow['dimension_id'] = $paylink; // helper for pmt link diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 0c683b85..75beda95 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -83,6 +83,7 @@ $reports->addReport(_('Customer'),110,_('Print &Deliveries'), array( new ReportParam(_('From'),'DELIVERY'), new ReportParam(_('To'),'DELIVERY'), new ReportParam(_('email Customers'),'YES_NO'), + new ReportParam(_('Print as Packing Slip'),'YES_NO'), new ReportParam(_('Comments'),'TEXTBOX'))); $reports->addReport(_('Customer'),108,_('Print &Statements'), array( new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index f4ffe915..26bd6eec 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -52,7 +52,9 @@ if (isset($_GET['AddedID'])) { display_note(get_customer_trans_view_str(ST_CUSTDELIVERY, $dispatch_no, _("&View This Delivery")), 0, 1); display_note(print_document_link($dispatch_no, _("&Print Delivery Note"), true, ST_CUSTDELIVERY)); - display_note(print_document_link($dispatch_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "", "", 1), 1); + display_note(print_document_link($dispatch_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "", "", 1), 1, 1); + display_note(print_document_link($dispatch_no, _("P&rint as Packing Slip"), true, ST_CUSTDELIVERY, false, "", "", 0, 1)); + display_note(print_document_link($dispatch_no, _("E&mail as Packing Slip"), true, ST_CUSTDELIVERY, false, "", "", 1, 1), 1); display_note(get_gl_view_str(13, $dispatch_no, _("View the GL Journal Entries for this Dispatch")),1); @@ -68,9 +70,12 @@ if (isset($_GET['AddedID'])) { display_notification_centered(sprintf(_('Delivery Note # %d has been updated.'),$delivery_no)); - display_note(get_trans_view_str(ST_CUSTDELIVERY, $delivery_no, _("View this delivery"))); - echo '
'; - display_note(print_document_link($delivery_no, _("Print this delivery"), true, ST_CUSTDELIVERY)); + display_note(get_trans_view_str(ST_CUSTDELIVERY, $delivery_no, _("View this delivery")), 0, 1); + + display_note(print_document_link($delivery_no, _("&Print Delivery Note"), true, ST_CUSTDELIVERY)); + display_note(print_document_link($delivery_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "", "", 1), 1, 1); + display_note(print_document_link($delivery_no, _("P&rint as Packing Slip"), true, ST_CUSTDELIVERY, false, "", "", 0, 1)); + display_note(print_document_link($delivery_no, _("E&mail as Packing Slip"), true, ST_CUSTDELIVERY, false, "", "", 1, 1), 1); hyperlink_params($path_to_root . "/sales/customer_invoice.php", _("Confirm Delivery and Invoice"), "DeliveryNumber=$delivery_no"); diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index ff794578..c1453441 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -162,6 +162,8 @@ if (isset($_GET['AddedID'])) { submenu_print(_("&Print Delivery Note"), ST_CUSTDELIVERY, $delivery, 'prtopt'); submenu_print(_("&Email Delivery Note"), ST_CUSTDELIVERY, $delivery, null, 1); + submenu_print(_("P&rint as Packing Slip"), ST_CUSTDELIVERY, $delivery, 'prtopt', null, 1); + submenu_print(_("E&mail as Packing Slip"), ST_CUSTDELIVERY, $delivery, null, 1, 1); set_focus('prtopt'); display_note(get_gl_view_str(ST_CUSTDELIVERY, $delivery, _("View the GL Journal Entries for this Dispatch")),0, 1); -- 2.30.2