function can_process() { global $selected_id; if (strlen($_POST['name']) == 0) { display_error(_("The tax type name cannot be empty.")); set_focus('name'); return false; } elseif (!check_num('rate', 0)) { display_error(_("The default tax rate must be numeric and not less than zero.")); set_focus('rate'); return false; } if (!is_tax_gl_unique(get_post('sales_gl_code'), get_post('purchasing_gl_code'), $selected_id)) { display_error(_("Selected GL Accounts cannot be used by another tax type.")); set_focus('sales_gl_code'); return false; } return true; }
function check_item_data() { if (isset($_POST['dimension_id']) && $_POST['dimension_id'] != 0 && dimension_is_closed($_POST['dimension_id'])) { display_error(_("Dimension is closed.")); set_focus('dimension_id'); return false; } if (isset($_POST['dimension2_id']) && $_POST['dimension2_id'] != 0 && dimension_is_closed($_POST['dimension2_id'])) { display_error(_("Dimension is closed.")); set_focus('dimension2_id'); return false; } if (!(input_num('AmountDebit') != 0 ^ input_num('AmountCredit') != 0)) { display_error(_("You must enter either a debit amount or a credit amount.")); set_focus('AmountDebit'); return false; } if (strlen($_POST['AmountDebit']) && !check_num('AmountDebit', 0)) { display_error(_("The debit amount entered is not a valid number or is less than zero.")); set_focus('AmountDebit'); return false; } elseif (strlen($_POST['AmountCredit']) && !check_num('AmountCredit', 0)) { display_error(_("The credit amount entered is not a valid number or is less than zero.")); set_focus('AmountCredit'); return false; } if (!is_tax_gl_unique(get_post('code_id'))) { display_error(_("Cannot post to GL account used by more than one tax type.")); set_focus('code_id'); return false; } if (!$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL') && is_bank_account($_POST['code_id'])) { display_error(_("You cannot make a journal entry for a bank account. Please use one of the banking functions for bank transactions.")); set_focus('code_id'); return false; } return true; }
$input_error = false; $result = get_gl_account_info($_POST['gl_code']); if (db_num_rows($result) == 0) { display_error(_("The account code entered is not a valid code, this line cannot be added to the transaction.")); set_focus('gl_code'); $input_error = true; } else { $myrow = db_fetch_row($result); $gl_act_name = $myrow[1]; if (!check_num('amount')) { display_error(_("The amount entered is not numeric. This line cannot be added to the transaction.")); set_focus('amount'); $input_error = true; } } if (!is_tax_gl_unique(get_post('gl_code'))) { display_error(_("Cannot post to GL account used by more than one tax type.")); set_focus('gl_code'); $input_error = true; } if ($input_error == false) { $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name, $_POST['dimension_id'], $_POST['dimension2_id'], input_num('amount'), $_POST['memo_']); reset_tax_input(); set_focus('gl_code'); } } //------------------------------------------------------------------------------------------------ function check_data() { global $Refs; if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) {