Topic: New filter for cust. inquiry screen: 'Sales Invoices & Delivery Notes'
Hi Guys
I made a quick mod to the 'Customer Transactions' screen to give you a new document filter.
I wanted to quickly see just Sales Invoices and Delivery Notes documents in the list, so made the following mod instructions if you want to do the same thing (or add your own custom document filter).
I'm not suggesting this go into the main version, I just posted the instructions here in case anyone wants to do the same thing, or add their own filters. Use at your own risk!
Pete
New 'Sales Invoice & Delivery Notes' selector for customer_inquiry.php by Pete p2409.
------------------------------------------------------------------------------------
Currently, FA lets you filter document types in the customer inquiry (transactions)
screen eg. Sales Invoices, Overdue Invoices etc.
This mod adds a new filter: Sales Invoices & Delivery Notes, letting you match them
more easily. Two files are modified (3 minor mods).
The logic can easily be adapted for any other document filters you want in this screen.
CHANGES TO CODE/TABLE
---------------------
1) ./includes/ui/ui_lists.inc
Add 'Sales Invoices & Delivery Notes' option to the cust_allocations_list_cells
function.
Around line 1935, find:
$allocs = array(
$all_items=>_("All Types"),
'1'=> _("Sales Invoices"),
'2'=> _("Overdue Invoices"),
'3' => _("Payments"),
'4' => _("Credit Notes"),
'5' => _("Delivery Notes")
);
CHANGE TO:
$allocs = array(
$all_items=>_("All Types"),
'1'=> _("Sales Invoices"),
'2'=> _("Overdue Invoices"),
'3' => _("Payments"),
'4' => _("Credit Notes"),
'5' => _("Delivery Notes"),
'6' => _("Sales Invoices") . " & " . _("Delivery Notes")
);
2) ./sales/includes/db/cust_trans_db.inc
We need to update SQL the in customer transaction query function (get_sql_for_customer_inquiry)
Around line 356, ADD:
// Add delivery and invoices option
elseif ($_POST['filterType'] == '6')
{
$sql .= " AND (trans.type = ".ST_SALESINVOICE ." OR
trans.type = ". ST_CUSTDELIVERY . ") ";
}
// eof delivery and invoice filter option
The transaction sort key has been changed to order number, just for this option.
Around line 370, after the group by clause, add a test for this new option, and
a single ORDER BY line below:
AFTER:
$sql .= " GROUP BY trans.trans_no, trans.type";
ADD:
// Order by trans.order_, but only for 'Sales Invoice & Delivery Note' filter.
if ($_POST['filterType'] == '6') {
$sql .= " ORDER BY trans.order_ DESC, trans.trans_no DESC ";
}
// eof p2409