Allowing multiple jounal entries on one trans_no.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 2 Nov 2021 12:25:36 +0000 (13:25 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 2 Nov 2021 12:25:36 +0000 (13:25 +0100)
Ex. trans_no, Joulnal Entry, customer_id.

purchasing/supplier_payment.php
sales/customer_payments.php
sales/includes/db/cust_trans_db.inc

index d516070a351f8d528c4831bcaecee677056cf932..ab98b662a5f9c5951378033d102eac1cce9ee4b0 100644 (file)
@@ -63,8 +63,9 @@ if (!isset($_POST['bank_account'])) { // first page call
        $_SESSION['alloc'] = new allocation(ST_SUPPAYMENT, 0, get_post('supplier_id'));
 
        if (isset($_GET['PInvoice'])) {
+               $supp = isset($_POST['supplier_id']) ? $_POST['supplier_id'] : null;
                //  get date and supplier
-               $inv = get_supp_trans($_GET['PInvoice'], $_GET['trans_type']);
+               $inv = get_supp_trans($_GET['PInvoice'], $_GET['trans_type'], $supp);
                if ($inv) {
                        $_SESSION['alloc']->person_id = $_POST['supplier_id'] = $inv['supplier_id'];
                        $_SESSION['alloc']->read();
index 7612a2b4b68cf66bb30bc3432644cdc6b431ec9b..78561a9104b91531ea7b07e52261f452b0ef66fc 100644 (file)
@@ -49,7 +49,8 @@ if (!isset($_POST['bank_account'])) { // first page call
        if (isset($_GET['SInvoice'])) {
                //  get date and supplier
                $type = !isset($_GET['Type']) ? ST_SALESINVOICE : $_GET['Type'];
-               $inv = get_customer_trans($_GET['SInvoice'], $type);
+               $cust = !isset($_GET['customer_id']) ? null : $_GET['customer_id'];
+               $inv = get_customer_trans($_GET['SInvoice'], $type,  $cust);
                $dflt_act = get_default_bank_account($inv['curr_code']);
                $_POST['bank_account'] = $dflt_act['id'];
                if ($inv) {
index 710be16f4f395968577688fcb9611ac6943b70b0..602c412744c830c41b4819e7502ffb68b943dea6 100644 (file)
@@ -396,7 +396,7 @@ function get_sql_for_customer_inquiry($from, $to, $cust_id = ALL_TEXT, $filter =
        }
        }
 
-       $sql .= " GROUP BY trans.trans_no, trans.type";
+       $sql .= " GROUP BY trans.trans_no, trans.type, trans.debtor_no";
 
        return $sql;
 }