From be99f1e63f8e27c2c5db75f93cd9956eb2239a03 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 29 Jan 2014 08:49:48 +0100 Subject: [PATCH] Link customer payment entry after saving Invoice (if not cash) --- purchasing/supplier_invoice.php | 3 ++- sales/customer_invoice.php | 9 +++++++++ sales/sales_order_entry.php | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 07b8d665..c9029c3b 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -45,7 +45,8 @@ if (isset($_GET['AddedID'])) display_note(get_gl_view_str($trans_type, $invoice_no, _("View the GL Journal Entries for this Invoice")), 1); - hyperlink_no_params("$path_to_root/purchasing/supplier_payment.php", _("Entry supplier &payment for this invoice")); + hyperlink_params("$path_to_root/purchasing/supplier_payment.php", _("Entry supplier &payment for this invoice"), + "PInvoice=".$invoice_no); hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Invoice"), "New=1"); diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index b2499485..ea489879 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -63,6 +63,15 @@ if (isset($_GET['AddedID'])) { hyperlink_params("$path_to_root/sales/inquiry/sales_deliveries_view.php", _("Select Another &Delivery For Invoicing"), "OutstandingOnly=1"); + $sql = "SELECT trans_type_from, trans_no_from FROM ".TB_PREF."cust_allocations + WHERE trans_type_to=".ST_SALESINVOICE." AND trans_no_to=".db_escape($invoice_no); + $result = db_query($sql, "could not retrieve customer allocation"); + $row = db_fetch($result); + + if ($row === false) + hyperlink_params("$path_to_root/sales/customer_payments.php", _("Entry &customer payment for this invoice"), + "SInvoice=".$invoice_no); + hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=$trans_type&trans_no=$invoice_no"); display_footer_exit(); diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index a9fb1bf1..9b7e46b4 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -231,6 +231,9 @@ if (isset($_GET['AddedID'])) { submenu_option(_("Enter a &New Direct Invoice"), "/sales/sales_order_entry.php?NewInvoice=0"); + if ($row === false) + submenu_option(_("Entry &customer payment for this invoice"), "/sales/customer_payments.php?SInvoice=".$invoice); + submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=".ST_SALESINVOICE."&trans_no=$invoice"); display_footer_exit(); -- 2.30.2