X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fcustomer_payments.php;h=34a862b1fc93e39c468bdfd73d46b8bdc69f7f60;hb=aa2ff78063656a7843d763859e3b9b4c15a3f920;hp=e73cccd1a5b6b745375200c1b9354b48f284d144;hpb=f75695448532371e64f0d3033b88389a62d41da3;p=fa-stable.git diff --git a/sales/customer_payments.php b/sales/customer_payments.php index e73cccd1..34a862b1 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -211,6 +211,8 @@ function can_process() set_focus('discount'); return false; } + if (!db_has_currency_rates(get_customer_currency($_POST['customer_id']), $_POST['DateBanked'], true)) + return false; $_SESSION['alloc']->amount = input_num('amount'); @@ -365,64 +367,61 @@ start_form(); read_customer_data(); set_global_customer($_POST['customer_id']); - if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) { - end_outer_table(); - display_error(_("This customer account is on hold.")); - } else { - $display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%"; + if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) + display_warning(_("This customer account is on hold.")); + $display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%"; - table_section(2); - if (!list_updated('bank_account')) - $_POST['bank_account'] = get_default_customer_bank_account($_POST['customer_id']); - - //Chaitanya : 13-OCT-2011 - Is AJAX call really needed ??? - //bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true); - bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, false); + table_section(2); + if (!list_updated('bank_account')) + $_POST['bank_account'] = get_default_customer_bank_account($_POST['customer_id']); - text_row(_("Reference:"), 'ref', null, 20, 40); + //Chaitanya : 13-OCT-2011 - Is AJAX call really needed ??? + //bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true); + bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, false); - table_section(3); + text_row(_("Reference:"), 'ref', null, 20, 40); - date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true); + table_section(3); - $comp_currency = get_company_currency(); - $cust_currency = get_customer_currency($_POST['customer_id']); - $bank_currency = get_bank_account_currency($_POST['bank_account']); + date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true); - if ($cust_currency != $bank_currency) { - exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], ($bank_currency == $comp_currency)); - } + $comp_currency = get_company_currency(); + $cust_currency = get_customer_currency($_POST['customer_id']); + $bank_currency = get_bank_account_currency($_POST['bank_account']); - amount_row(_("Bank Charge:"), 'charge'); + if ($cust_currency != $bank_currency) { + exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], ($bank_currency == $comp_currency)); + } - end_outer_table(1); + amount_row(_("Bank Charge:"), 'charge'); - if ($cust_currency == $bank_currency) { - div_start('alloc_tbl'); - show_allocatable(false); - div_end(); - } + end_outer_table(1); - start_table(TABLESTYLE, "width=60%"); + if ($cust_currency == $bank_currency) { + div_start('alloc_tbl'); + show_allocatable(false); + div_end(); + } - label_row(_("Customer prompt payment discount :"), $display_discount_percent); - amount_row(_("Amount of Discount:"), 'discount'); + start_table(TABLESTYLE, "width=60%"); - amount_row(_("Amount:"), 'amount'); + label_row(_("Customer prompt payment discount :"), $display_discount_percent); + amount_row(_("Amount of Discount:"), 'discount'); - textarea_row(_("Memo:"), 'memo_', null, 22, 4); - end_table(1); + amount_row(_("Amount:"), 'amount'); - if ($cust_currency != $bank_currency) - display_note(_("Amount and discount are in customer's currency.")); + textarea_row(_("Memo:"), 'memo_', null, 22, 4); + end_table(1); - br(); + if ($cust_currency != $bank_currency) + display_note(_("Amount and discount are in customer's currency.")); - if (isset($_POST['trans_no']) && $_POST['trans_no'] > 0 ) - submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default'); - else - submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default'); - } + br(); + + if (isset($_POST['trans_no']) && $_POST['trans_no'] > 0 ) + submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default'); + else + submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default'); br();