Fixes in sales reports to use debtor_trans.tax_included field instead of trans_tax_de...
[fa-stable.git] / sales / customer_payments.php
index e73cccd1a5b6b745375200c1b9354b48f284d144..8b4bccec10bb9f893fe505f8d470e6aecba87bc0 100644 (file)
@@ -142,7 +142,7 @@ function can_process()
                set_focus('DateBanked');
                return false;
        } elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('DateBanked');
                return false;
        }
@@ -179,7 +179,7 @@ function can_process()
                return false;
        }
        if (isset($_POST['charge']) && input_num('charge') > 0) {
-               $charge_acct = get_company_pref('bank_charge_act');
+               $charge_acct = get_bank_charge_account($_POST['bank_account']);
                if (get_gl_account($charge_acct) == false) {
                        display_error(_("The Bank Charge Account has not been set in System and General GL Setup."));
                        set_focus('charge');
@@ -246,7 +246,7 @@ if (isset($_POST['ref']) && $_SESSION['alloc']->trans_no == 0) // added by Joe t
                display_error( _("The entered reference is already in use."));
                display_footer_exit();
        }
-}              
+}
 $new = $_SESSION['alloc']->trans_no == 0;
 
 if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
@@ -365,64 +365,60 @@ 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);
+       text_row(_("Reference:"), 'ref', null, 20, 40);
 
-               table_section(3);
+       table_section(3);
 
-               date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
+       date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
 
-               $comp_currency = get_company_currency();
-               $cust_currency = get_customer_currency($_POST['customer_id']);
-               $bank_currency = get_bank_account_currency($_POST['bank_account']);
+       $comp_currency = get_company_currency();
+       $cust_currency = get_customer_currency($_POST['customer_id']);
+       $bank_currency = get_bank_account_currency($_POST['bank_account']);
 
-               if ($cust_currency != $bank_currency) {
-                       exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], ($bank_currency == $comp_currency));
-               }
+       if ($cust_currency != $bank_currency) {
+               exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], ($bank_currency == $comp_currency));
+       }
 
-               amount_row(_("Bank Charge:"), 'charge');
+       amount_row(_("Bank Charge:"), 'charge');
 
-               end_outer_table(1);
+       end_outer_table(1);
 
-               if ($cust_currency == $bank_currency) {
-                       div_start('alloc_tbl');
-                       show_allocatable(false);
-                       div_end();
-               }
+       if ($cust_currency == $bank_currency) {
+               div_start('alloc_tbl');
+               show_allocatable(false);
+               div_end();
+       }
 
-               start_table(TABLESTYLE, "width=60%");
+       start_table(TABLESTYLE, "width=60%");
 
-               label_row(_("Customer prompt payment discount :"), $display_discount_percent);
-               amount_row(_("Amount of Discount:"), 'discount');
+       label_row(_("Customer prompt payment discount :"), $display_discount_percent);
+       amount_row(_("Amount of Discount:"), 'discount');
 
-               amount_row(_("Amount:"), 'amount');
+       amount_row(_("Amount:"), 'amount');
 
-               textarea_row(_("Memo:"), 'memo_', null, 22, 4);
-               end_table(1);
+       textarea_row(_("Memo:"), 'memo_', null, 22, 4);
+       end_table(1);
 
-               if ($cust_currency != $bank_currency)
-                       display_note(_("Amount and discount are in customer's currency."));
+       if ($cust_currency != $bank_currency)
+               display_note(_("Amount and discount are in customer's currency."));
 
-               br();
+       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');
-       }
+       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();