Bug 5512: Customer Allocation Inquiry - No alloc-icon for DEBET-Accounts-receivable...
[fa-stable.git] / sales / customer_payments.php
index 25f3b3f8090ce1aa6ec73c5ad71ba8ca8b5b6311..7612a2b4b68cf66bb30bc3432644cdc6b431ec9b 100644 (file)
@@ -48,7 +48,8 @@ if (!isset($_POST['bank_account'])) { // first page call
 
        if (isset($_GET['SInvoice'])) {
                //  get date and supplier
-               $inv = get_customer_trans($_GET['SInvoice'], ST_SALESINVOICE);
+               $type = !isset($_GET['Type']) ? ST_SALESINVOICE : $_GET['Type'];
+               $inv = get_customer_trans($_GET['SInvoice'], $type);
                $dflt_act = get_default_bank_account($inv['curr_code']);
                $_POST['bank_account'] = $dflt_act['id'];
                if ($inv) {
@@ -58,7 +59,7 @@ if (!isset($_POST['bank_account'])) { // first page call
                        $_POST['BranchID'] = $inv['branch_code'];
                        $_POST['DateBanked'] = sql2date($inv['tran_date']);
                        foreach($_SESSION['alloc']->allocs as $line => $trans) {
-                               if ($trans->type == ST_SALESINVOICE && $trans->type_no == $_GET['SInvoice']) {
+                               if ($trans->type == $type && $trans->type_no == $_GET['SInvoice']) {
                                        $un_allocated = $trans->amount - $trans->amount_allocated;
                                        if ($un_allocated){
                                                $_SESSION['alloc']->allocs[$line]->current_allocated = $un_allocated;