X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fbank_transfer.php;h=439d6b6e0e63982bd79bb6d0d7def31a619174b0;hb=e6d9f3706a42003ac003820c0532db20d5d50ff8;hp=1f7cbe3efec1c028b345f3254ebced02e8fda0b7;hpb=2d23368483326fc5229a37e715de0769dcee883a;p=fa-stable.git diff --git a/gl/bank_transfer.php b/gl/bank_transfer.php index 1f7cbe3e..439d6b6e 100644 --- a/gl/bank_transfer.php +++ b/gl/bank_transfer.php @@ -69,7 +69,16 @@ function gl_payment_controls() bank_accounts_list_row(_("To Account:"), 'ToBankAccount', null, true); - date_row(_("Transfer Date:"), 'DatePaid', '', null, 0, 0, 0, null, true); + if (!isset($_POST['DatePaid'])) { // init page + $_POST['DatePaid'] = new_doc_date(); + if (!is_date_in_fiscalyear($_POST['DatePaid'])) + $_POST['DatePaid'] = end_fiscalyear(); + } + date_row(_("Transfer Date:"), 'DatePaid', '', true, 0, 0, 0, null, true); + + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER)); + + table_section(2); $from_currency = get_bank_account_currency($_POST['FromBankAccount']); $to_currency = get_bank_account_currency($_POST['ToBankAccount']); @@ -86,10 +95,6 @@ function gl_payment_controls() amount_row(_("Bank Charge:"), 'charge'); } - table_section(2); - - ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER)); - textarea_row(_("Memo:"), 'memo_', null, 40,4); end_outer_table(1); // outer table @@ -134,7 +139,7 @@ function check_valid_entries() $amnt_tr = input_num('charge') + input_num('amount'); - if ($limit != null && ($limit < $amnt_tr))) + if ($limit != null && ($limit < $amnt_tr)) { display_error(sprintf(_("The total bank amount exceeds allowed limit (%s) for source account."), price_format($limit))); set_focus('amount'); @@ -179,6 +184,12 @@ function check_valid_entries() set_focus('ToBankAccount'); return false; } + + if (!db_has_currency_rates(get_bank_account_currency($_POST['FromBankAccount']), $_POST['DatePaid'])) + return false; + + if (!db_has_currency_rates(get_bank_account_currency($_POST['ToBankAccount']), $_POST['DatePaid'])) + return false; return true; } @@ -187,6 +198,7 @@ function check_valid_entries() function handle_add_deposit() { + new_doc_date($_POST['DatePaid']); $trans_no = add_bank_transfer($_POST['FromBankAccount'], $_POST['ToBankAccount'], $_POST['DatePaid'], input_num('amount'), $_POST['ref'], $_POST['memo_'], input_num('charge'));