X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=sales%2Fcustomer_payments.php;h=10742c88dac54381fc360a932bd108ab593dfc98;hb=f44132511cc91b83f20f91af0625d4b112b4c26e;hp=7b3b117f90fc4a76e4edf20234faad62ca4ffd90;hpb=5b8f4c4b4aa8cf996bc071f116bfce1273200fa2;p=fa-stable.git diff --git a/sales/customer_payments.php b/sales/customer_payments.php index 7b3b117f..10742c88 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc"); include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; -if ($use_popup_windows) { +if ($SysPrefs->use_popup_windows) { $js .= get_js_open_window(900, 500); } if (user_use_date_picker()) { @@ -54,6 +54,7 @@ if (!isset($_POST['bank_account'])) { // first page call if($inv) { $_SESSION['alloc']->person_id = $_POST['customer_id'] = $inv['debtor_no']; $_SESSION['alloc']->read(); + $_POST['BranchID'] = $inv['branch_code']; $_POST['DateBanked'] = sql2date($inv['tran_date']); foreach($_SESSION['alloc']->allocs as $line => $trans) { if ($trans->type == ST_SALESINVOICE && $trans->type_no == $_GET['SInvoice']) { @@ -158,22 +159,7 @@ function can_process() return false; } - if (!$Refs->is_valid($_POST['ref'])) { - display_error(_("You must enter a reference.")); - set_focus('ref'); - return false; - } - - //Chaitanya : 13-OCT-2011 - To support Edit feature - if (isset($_POST['trans_no']) && $_POST['trans_no'] == 0 && (!is_new_reference($_POST['ref'], ST_CUSTPAYMENT))) { - display_error(_("The entered reference is already in use.")); - set_focus('ref'); - return false; - } - //Avoid duplicate reference while modifying - elseif ($_POST['ref'] != $_POST['old_ref'] && !is_new_reference($_POST['ref'], ST_CUSTPAYMENT)) - { - display_error( _("The entered reference is already in use.")); + if (!check_reference($_POST['ref'], ST_CUSTPAYMENT, @$_POST['trans_no'])) { set_focus('ref'); return false; } @@ -280,12 +266,12 @@ function read_customer_data() //Chaitanya : 13-OCT-2011 - To support Edit feature //If page is called first time and New entry fetch the nex reference number if (!$_SESSION['alloc']->trans_no && !isset($_POST['charge'])) - $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT); + $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT, null, array( + 'customer' => get_post('customer_id'), 'date' => get_post('DateBanked'))); } //---------------------------------------------------------------------------------------------- $new = 1; -$old_ref = 0; //Chaitanya : 13-OCT-2011 - To support Edit feature if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 ) @@ -299,7 +285,6 @@ if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 ) $_POST['BranchID'] = $myrow["branch_code"]; $_POST['bank_account'] = $myrow["bank_act"]; $_POST['ref'] = $myrow["reference"]; - $old_ref = $myrow["reference"]; $charge = get_cust_bank_charge(ST_CUSTPAYMENT, $_POST['trans_no']); $_POST['charge'] = price_format($charge); $_POST['DateBanked'] = sql2date($myrow['tran_date']); @@ -323,9 +308,8 @@ $new = !$_SESSION['alloc']->trans_no; start_form(); hidden('trans_no'); - hidden('old_ref', $old_ref); - start_outer_table(TABLESTYLE2, "width=60%", 5); + start_outer_table(TABLESTYLE2, "width='60%'", 5); table_section(1); @@ -391,7 +375,7 @@ start_form(); show_allocatable(false); div_end(); - start_table(TABLESTYLE, "width=60%"); + start_table(TABLESTYLE, "width='60%'"); label_row(_("Customer prompt payment discount :"), $display_discount_percent);