X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fcustomer_payments.php;h=f00a88dab6364a8a6e51674adb1531c8e4047e3f;hb=389721f442ea4dc96ba1cafd65919e717e0d8746;hp=5c7b55ba31b672c261adccae067a489ae16940b0;hpb=d32bf2c6c188b2cbefc6f1c3e423027828a1bf76;p=fa-stable.git diff --git a/sales/customer_payments.php b/sales/customer_payments.php index 5c7b55ba..f00a88da 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -38,16 +38,12 @@ check_db_has_customers(_("There are no customers defined in the system.")); check_db_has_bank_accounts(_("There are no bank accounts defined in the system.")); //---------------------------------------------------------------------------------------- -if ($ret = context_restore()) { - if(isset($ret['customer_id'])) - $_POST['customer_id'] = $ret['customer_id']; - if(isset($ret['branch_id'])) - $_POST['BranchID'] = $ret['branch_id']; -} -if (isset($_POST['_customer_id_editor'])) { - context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'], - array( 'customer_id', 'BranchID', 'bank_account', 'DateBanked', - 'ref', 'amount', 'discount', 'memo_') ); + +if (list_updated('BranchID')) { + // when branch is selected via external editor also customer can change + $br = get_branch(get_post('BranchID')); + $_POST['customer_id'] = $br['debtor_no']; + $Ajax->activate('customer_id'); } if (!isset($_POST['customer_id'])) @@ -157,7 +153,7 @@ if (isset($_POST['_DateBanked_changed'])) { $Ajax->activate('_ex_rate'); } if (list_updated('customer_id') || list_updated('bank_account')) { - get_allocations_for_transaction(12, 0); + $_SESSION['alloc']->read(); $Ajax->activate('alloc_tbl'); } //---------------------------------------------------------------------------------------------- @@ -179,7 +175,7 @@ if (isset($_POST['AddPaymentItem'])) { input_num('amount'), input_num('discount'), $_POST['memo_'], $rate, input_num('charge')); $_SESSION['alloc']->trans_no = $payment_no; - handle_allocate(); + $_SESSION['alloc']->write(); meta_forward($_SERVER['PHP_SELF'], "AddedID=$payment_no"); } @@ -207,12 +203,13 @@ function read_customer_data() start_form(); - start_outer_table($table_style2, 5); + start_outer_table("$table_style2 width=60%", 5); table_section(1); customer_list_row(_("From Customer:"), 'customer_id', null, false, true); if (!isset($_POST['bank_account'])) // first page call - get_allocations_for_transaction(12, 0); + $_SESSION['alloc'] = new allocation(12,0); + if (db_customer_has_branches($_POST['customer_id'])) { customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true); } else {