+if (get_post('AddPaymentItem') && can_process()) {
+
+ $cust_currency = get_customer_currency($_POST['customer_id']);
+ $bank_currency = get_bank_account_currency($_POST['bank_account']);
+ $comp_currency = get_company_currency();
+ if ($comp_currency != $bank_currency && $bank_currency != $cust_currency)
+ $rate = 0;
+ else
+ $rate = input_num('_ex_rate');
+
+ new_doc_date($_POST['DateBanked']);
+
+ $new_pmt = !$_SESSION['alloc']->trans_no;
+ //Chaitanya : 13-OCT-2011 - To support Edit feature
+ $payment_no = write_customer_payment($_SESSION['alloc']->trans_no, $_POST['customer_id'], $_POST['BranchID'],
+ $_POST['bank_account'], $_POST['DateBanked'], $_POST['ref'],
+ input_num('amount'), input_num('discount'), $_POST['memo_'], $rate, input_num('charge'));
+
+ $_SESSION['alloc']->trans_no = $payment_no;
+ $_SESSION['alloc']->write();
+
+ unset($_SESSION['alloc']);
+ //Chaitanya : 13-OCT-2011 - To support Edit feature
+ //meta_forward($_SERVER['PHP_SELF'], "AddedID=$payment_no");
+ meta_forward($_SERVER['PHP_SELF'], $new_pmt ? "AddedID=$payment_no" : "UpdatedID=$payment_no");