X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fgl_payment.php;h=60efb8ae655585504fc28833d988f2de6d1e1aae;hb=4805d26604f8fac454e33eebf13686b57908f557;hp=696506820f84fc88939acc867b4fa4773f3f886a;hpb=0ad7b92c6cf2e4e65ca0fa94ba31f30f7b292ba8;p=fa-stable.git diff --git a/gl/gl_payment.php b/gl/gl_payment.php index 69650682..60efb8ae 100644 --- a/gl/gl_payment.php +++ b/gl/gl_payment.php @@ -12,13 +12,13 @@ include_once($path_to_root . "/gl/includes/ui/gl_payment_ui.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); include_once($path_to_root . "/gl/includes/gl_ui.inc"); -$js = get_js_form_entry("CodeID2", "code_id", "amount"); +$js = ''; if ($use_popup_windows) $js .= get_js_open_window(800, 500); if ($use_date_picker) $js .= get_js_date_picker(); -$js .= get_js_set_focus('CodeID2'); -page(_("Bank Account Payment Entry"), false, false, "setFocus()", $js); + +page(_("Bank Account Payment Entry"), false, false, '', $js); //----------------------------------------------------------------------------------------------- @@ -102,21 +102,25 @@ if (isset($_POST['Process'])) if (!references::is_valid($_POST['ref'])) { display_error( _("You must enter a reference.")); + set_focus('ref'); $input_error = 1; } elseif (!is_new_reference($_POST['ref'], systypes::bank_payment())) { display_error( _("The entered reference is already in use.")); + set_focus('ref'); $input_error = 1; } elseif (!is_date($_POST['date_'])) { display_error(_("The entered date for the payment is invalid.")); + set_focus('date_'); $input_error = 1; } elseif (!is_date_in_fiscalyear($_POST['date_'])) { display_error(_("The entered date is not in fiscal year.")); + set_focus('date_'); $input_error = 1; } @@ -149,18 +153,21 @@ function check_item_data() if (!check_num('amount', 0)) { display_error( _("The amount entered is not a valid number or is less than zero.")); + set_focus('amount'); return false; } if ($_POST['code_id'] == $_POST['bank_account']) { display_error( _("The source and destination accouts cannot be the same.")); + set_focus('code_id'); return false; } if (is_bank_account($_POST['code_id'])) { display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this.")); + set_focus('code_id'); return false; } @@ -176,6 +183,7 @@ function handle_update_item() $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'], $_POST['dimension2_id'], input_num('amount'), $_POST['LineMemo']); } + set_focus('_code_id_edit'); } //----------------------------------------------------------------------------------------------- @@ -198,20 +206,30 @@ function handle_new_item() //----------------------------------------------------------------------------------------------- -if (isset($_GET['Delete']) || isset($_GET['Edit'])) +if (isset($_GET['Edit'])) { + copy_from_py(); + set_focus('dimension_id'); +} +if (isset($_GET['Delete'])) { copy_from_py(); - -if (isset($_GET['Delete'])) handle_delete_item(); - -if (isset($_POST['AddItem']) || isset($_POST['UpdateItem'])) + set_focus('_code_id_edit'); +} +if (isset($_POST['AddItem'])) { copy_to_py(); - -if (isset($_POST['AddItem'])) handle_new_item(); - -if (isset($_POST['UpdateItem'])) + set_focus('_code_id_edit'); +} +if (isset($_POST['UpdateItem'])) { + copy_to_py(); handle_update_item(); + set_focus('_code_id_edit'); +} +if (isset($_POST['CancelItemChanges'])) + set_focus('_code_id_edit'); + +if (isset($_POST['EditItem'])) + set_focus('dimension_id'); //----------------------------------------------------------------------------------------------- @@ -237,9 +255,13 @@ end_table(1); if (!isset($_POST['Process'])) { - submit_center_first('Update', _("Update")); if ($_SESSION['pay_items']->count_gl_items() >= 1) + { + submit_center_first('Update', _("Update")); submit_center_last('Process', _("Process Payment")); + } + else + submit_center('Update', _("Update")); } end_form();