-if (isset($_POST['AddPaymentItem']))
-{
- $payment_no = add_customer_payment($_POST['customer_id'], $_POST['BranchID'],
- $_POST['bank_account'], $_POST['DateBanked'], $_POST['ReceiptType'], $_POST['ref'],
- $_POST['amount'], $_POST['discount'], $_POST['memo_']);
+if (isset($_POST['AddPaymentItem'])) {
+
+ $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']);
+
+ $payment_no = write_customer_payment(0, $_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();