Link customer payment entry after saving Invoice (if not cash)
authorJoe <unknown>
Wed, 29 Jan 2014 07:49:48 +0000 (08:49 +0100)
committerJoe <unknown>
Wed, 29 Jan 2014 07:49:48 +0000 (08:49 +0100)
purchasing/supplier_invoice.php
sales/customer_invoice.php
sales/sales_order_entry.php

index 07b8d665d327b44364121c850d0d411798e53cca..c9029c3b0bd4fc09778e4c4a842e261730ce3854 100644 (file)
@@ -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");
 
index b249948559332441319a3085620f5c5e09e20e90..ea4898790220e87230b9257d5de5d362a34a1027 100644 (file)
@@ -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();
index a9fb1bf1d03024ea96c128a391d24692662f2a6c..9b7e46b4dc57adf2eaff3d70aa0f635390119800 100644 (file)
@@ -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();