$path_to_root = "../.."; include $path_to_root . "/includes/session.inc"; page(_($help_context = "Bank Accounts")); include $path_to_root . "/includes/ui.inc"; simple_page_mode(); //----------------------------------------------------------------------------------- if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') { //initialise no input errors assumed initially before we test $input_error = 0; //first off validate inputs sensible if (strlen($_POST['bank_account_name']) == 0) { $input_error = 1; display_error(_("The bank account name cannot be empty.")); set_focus('bank_account_name'); } if ($Mode == 'ADD_ITEM' && (gl_account_in_bank_accounts(get_post('account_code')) || key_in_foreign_table(get_post('account_code'), 'gl_trans', 'account'))) { $input_error = 1; display_error(_("The GL account selected is already in use. Select another GL account.")); set_focus('account_code'); } if ($input_error != 1) { if ($selected_id != -1) { update_bank_account($selected_id, $_POST['account_code'], $_POST['account_type'], $_POST['bank_account_name'], $_POST['bank_name'], $_POST['bank_account_number'], $_POST['bank_address'], $_POST['BankAccountCurrency'], $_POST['dflt_curr_act']); display_notification(_('Bank account has been updated')); } else { add_bank_account($_POST['account_code'], $_POST['account_type'], $_POST['bank_account_name'], $_POST['bank_name'], $_POST['bank_account_number'], $_POST['bank_address'], $_POST['BankAccountCurrency'], $_POST['dflt_curr_act']); display_notification(_('New bank account has been added')); } $Mode = 'RESET'; } } elseif ($Mode == 'Delete') {
} //$date = sql2date($date); if (is_date_in_fiscalyear($date) == false) { display_error(_("Error: Date not within company fiscal year. Make sure date is in dd/mm/yyyy format and your csv years are 4 digits long. Check that current fiscal year is active under Setup..Company Setup")); $error = true; } // validation for if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) { $bankdesc = get_gl_account_name($bank_account_gl_code); } if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT || $type == ST_JOURNAL) { $i = journal_display($i, $type, $taxtype, $amt, $entry, $code_id, $dim1, $dim2, $memo, $description, $bank_account_gl_code, $bank_desc); } if (!$error) { if ($type == ST_JOURNAL) { if (gl_account_in_bank_accounts($code_id) == true) { display_notification_centered(_("Error: Bank account detected in journal. No processing of bank accounts allowed. (line {$line} in import file '{$_FILES['imp']['name']}')")); $error = true; } if (check_tax_appropriate($code_id, $taxtype, $line) == true) { journal_inclusive_tax($type, $date, $line, $curEntryId, $code_id, $dim1, $dim2, $memo, $amt, $taxtype, $person_type_id, $person_id); add_audit_trail($type, $curEntryId, $date); } } elseif (($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) && $amt > 0) { if (check_tax_appropriate($code_id, $taxtype, $line) == true) { bank_inclusive_tax($type, $reference, $date, $bank_account, $bank_account_gl_code, $line, $curEntryId, $code_id, $dim1, $dim2, $memo, $amt, $taxtype, $person_type_id, $person_id, $BranchNo); } else { display_notification_centered(_("Warning: Taxtype used with Asset or Liability - {$curEntryId}, {$date}, {$code_id}.(line {$line} in import file '{$_FILES['imp']['name']}')")); } } elseif (($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) && $amt < 0) { display_notification_centered(_("Error: Credit amounts represented by negative amounts being entered. Check csv file is correct.(line {$line} in import file '{$_FILES['imp']['name']}')"));