+ //Chaitanya : 13-OCT-2011 - To support Edit feature
+ //If page is called first time and New entry fetch the nex reference number
+ if ($new && !isset($_POST['charge']))
+ $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT);
+}
+
+//----------------------------------------------------------------------------------------------
+$new = 1;
+$old_ref = 0;
+
+//Chaitanya : 13-OCT-2011 - To support Edit feature
+if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 )
+ $_POST['trans_no'] = $_GET['trans_no'];
+//Read data
+if (isset($_POST['trans_no']) && $_POST['trans_no'] > 0 )
+{
+ $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"];
+ $old_ref = $myrow["reference"];
+ //$_POST['charge'] = $myrow[""];
+ $_POST['DateBanked'] = sql2date($myrow['tran_date']);
+ $_POST["amount"] = price_format($myrow['Total'] - $myrow['ov_discount']);
+ $_POST["discount"] = price_format($myrow['ov_discount']);
+ $_POST["memo_"] = get_comments_string(ST_CUSTPAYMENT,$_POST['trans_no']);