+// To support Edit feature
+if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 )
+{
+ $_POST['trans_no'] = $_GET['trans_no'];
+
+ $new = 0;
+ $myrow = get_customer_trans($_POST['trans_no'], ST_CUSTPAYMENT);
+ $_POST['customer_id'] = $myrow["debtor_no"];
+ $_POST['customer_name'] = $myrow["DebtorName"];
+ $_POST['BranchID'] = $myrow["branch_code"];
+ $_POST['bank_account'] = $myrow["bank_act"];
+ $_POST['ref'] = $myrow["reference"];
+ $charge = get_cust_bank_charge(ST_CUSTPAYMENT, $_POST['trans_no']);
+ $_POST['charge'] = price_format($charge);
+ $_POST['DateBanked'] = sql2date($myrow['tran_date']);
+ $_POST["amount"] = price_format($myrow['Total'] - $myrow['ov_discount']);
+ $_POST["bank_amount"] = price_format($myrow['bank_amount']+$charge);
+ $_POST["discount"] = price_format($myrow['ov_discount']);
+ $_POST["memo_"] = get_comments_string(ST_CUSTPAYMENT,$_POST['trans_no']);
+
+ //Prepare allocation cart
+ if (isset($_POST['trans_no']) && $_POST['trans_no'] > 0 )
+ $_SESSION['alloc'] = new allocation(ST_CUSTPAYMENT,$_POST['trans_no']);
+ else
+ {
+ $_SESSION['alloc'] = new allocation(ST_CUSTPAYMENT, $_POST['trans_no']);
+ $Ajax->activate('alloc_tbl');
+ }
+}