Added option to print delivery notes as packing slip in reports and links.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 9 Oct 2009 16:21:37 +0000 (16:21 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 9 Oct 2009 16:21:37 +0000 (16:21 +0000)
CHANGELOG.txt
includes/ui/ui_controls.inc
reporting/includes/doctext.inc
reporting/includes/doctext2.inc
reporting/includes/header2.inc
reporting/includes/pdf_report.inc
reporting/includes/reporting.inc
reporting/rep110.php
reporting/reports_main.php
sales/customer_delivery.php
sales/sales_order_entry.php

index 000a364afd0fc8580be385eea5915ab91e7e645b..cf10e18eaecad87dcba74feb53ef082c91f7c3b9 100644 (file)
@@ -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
index b237889d745c2ee2fe69727375b1bbd884487fb3..9848761e263ac7e95eed708823810caf85d75d34 100644 (file)
@@ -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);
 }
 //-----------------------------------------------------------------------------------
 
index 23a8c65d02aa8dc8f5c226eb66c89b516ff60046..0edc595fde9c28d9493396cb331ce6540443f054 100644 (file)
@@ -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)
index 9f94b1b4c26fa33ed895d052be912659b03e78d6..40853642eedfa1f935b779dae7531c969284b7cc 100644 (file)
@@ -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
index 5755b627e984e118903b552788c061cc9314c537..7fae9f64fa2a5dac79f9dff8629be2c7adf28a1e 100644 (file)
                $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'";
index af7ba6cc6f51dafae4c98be5d0a317e34a2a36e7..db9e66498429d81ffb65d869e0c601068ecdf8de 100644 (file)
@@ -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)
index 12cffc11e558cba7e6841b55e94f9d91dac973a8..6a0712998267b8fd02ce64aec1dc785ebe14b1ec 100644 (file)
@@ -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
index 5af4a83ce15544652b40d9c7b7f7dc015052e1a5..d1665aa2deb368d3472d7786c36c5d4cfd565c50 100644 (file)
@@ -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
index 0c683b8504794f8d0a23feb8cd107750bab5c45e..75beda95d396e2db9954cf4ff27a924e916e2979 100644 (file)
@@ -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'),
index f4ffe9158752fb13b318e8d68acde9fb8b7cc7a9..26bd6eeccde8dd9dcc4790094ddf4556824c55c8 100644 (file)
@@ -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 '<br>';
-       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");
 
index ff7945785279f3f00fc800787e513759b910197a..c145344191cbd8198778c725bafa6d590f4057c0 100644 (file)
@@ -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);