Bin Location and Branch ID in Packing List

  • Bin Location is a very important part of Inventory Management and FrontAccounting v2.3.x lacks this in it's core.
  • The need for the Branch ID (0_cust_branch.branch_code) atleast in the packing list will enable lookup and interface with external applications which have pertinent branch level details not in the FA database.
  • The Packing List (called Pick Ticket in the US) is an internal document for use in the warehouse and to serve as an audit trail serving and tracking employee responsibility.
  • It is desirable to have the Branch ID in the header section of the report and the Bin Location in the body of the report against each line item.
  • It is also desirable not to extend the table structure with new fields so as to remain upgradeable to future FA versions without loss of data ensuring migratability in a standardised manner.
  • The Packing List is coded into the reporting/rep110.php file and the $packing_list flag is used to select it.

Backport code from FA v2.4

  • Insert the function parse_notes_params() into reporting/includes/reporting.inc from it's FA 2.4 counterpart or just download the backported file from the FAMods in apmuthu's unofficial GitHub Repo.
  • In reporting/rep110.php fix the variable scope issue for our new variables to be available in the report header by moving the $rep->SetHeaderType('Header2'); statement to just after the $rep->SetCommonData(...) statement.
  • Include the reporting.inc file into the reporting/includes/pdf_report.inc after the statement:
include_once(dirname(__FILE__)."/printer_class.inc");

insert the following statement:

include_once(dirname(__FILE__)."/reporting.inc");

Include the fields necessary in the functions / methods called

  • Extend the line 390 in reporting/includes/pdf_report.inc from:
        'branch' => array('br_address', 'br_name', 'salesman', 'disable_branch'),

to

        'branch' => array('br_address', 'br_name', 'salesman', 'disable_branch', 'branch_code', 'notes'),
  • Extend line 22 in the function get_customer_trans_details() in the file sales/includes/db/cust_trans_details_db.inc from:
        ".TB_PREF."stock_master.units, ".TB_PREF."stock_master.mb_flag

to

        ".TB_PREF."stock_master.units, ".TB_PREF."stock_master.mb_flag, ".TB_PREF."stock_master.long_description 

Insert the relevant data for printing Packing List

  • In the 0_cust_branch.notes field, place your space separated and say a CID# prefixed value (amongst others) of any substitute branch code only if that may need to supercede the branch_code in FrontAccounting to be used for lookup in any external application like:
Frt#2300 CID#35263 Introduced by So and So Owner#Brian
  • In the 0_stock_master.long_description field, place your space separated and say a BinLoc# prefixed Bin Location value (amongst others) like:
BinLoc#R12T3B4L6 Clr#Grey
  • The above may well indicate that the stock_id is physically located in a warehouse with a loc_code (Location ID) and in Bin Location at Row 12 - Tray 3 - Bay 4 - Left Side, Item 6 with Color Grey'.

Extract Non Field Data from DB into variables needed for the report (Company 0 assumed here - change as needed)

  • Make a copy of the reporting/includes/doctext.inc into company/0/reporting/includes/doctext.inc
  • Edit the copied doctext.inc to extract the Non Field Data from DB into variables. A little after the case ST_CUSTDELIVERY: statement, find the snippet:
            if (@$packing_slip)
                $Payment_Terms = '';

and replace it with:

            if (@$packing_slip) {
                $Payment_Terms = '';
                $this->headers = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), '', '', _("Bin Location"));
                $notes_params = parse_notes_params($this->formData['notes']);
                $CIDval = (array_key_exists('CID', $notes_params) ? "Old ".$notes_params['CID'] : $this->formData['branch_code']);
            }

Show the Branch ID in the report header

  • Make a copy of the reporting/includes/header2.inc into company/0/reporting/includes/header2.inc
  • Edit the copied header2.inc to show the Branch ID or it's equivalent. After this snippet of code in it:
        if (@$this->formData['domicile'])
        {
            $this->Text($ccol, _("Domicile"), $c2col);
            $this->Text($c2col, $this->company['domicile'], $mcol);
            $this->NewLine();
        }

insert this snippet:

        if (@$CIDval)
        {
            $this->Text($ccol, _("Branch ID"), $c2col);
            $this->Text($c2col, $CIDval, $mcol);
            $this->NewLine();
        }

Show the Bin Location in the report line items

  • Make a copy of the reporting/rep110.php into company/0/reporting/rep110.php
  • Edit the copied rep110.php to show the Bin Location. After this snippet of code:
                    if ($packing_slip == 0)
                    {
                        $rep->TextCol(4, 5,    $DisplayPrice, -2);
                        $rep->TextCol(5, 6,    $DisplayDiscount, -2);
                        $rep->TextCol(6, 7,    $DisplayNet, -2);
                    }

insert this snippet:

                    else {
                        $item_params = parse_notes_params($myrow2['long_description']);
                        $BinLoc = (array_key_exists('BinLoc', $item_params) ? $item_params['BinLoc'] : '');
                        $rep->TextCol(6, 7,    $BinLoc, -2);
                    }