X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fmanage%2Fbank_accounts.php;h=ae1dc41e6f8cc7e924b4a1bc0ef88397afa17286;hb=df444f84379276fbc46eddca894ed3529120b2bb;hp=54bbe444c6786d8d2755ea26ec06b7812c24b272;hpb=916c3a6fd1dfd8dcf19ff5eb70e49b3bf3c5a338;p=fa-stable.git diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index 54bbe444..ae1dc41e 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -9,11 +9,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$page_security = 10; -$path_to_root="../.."; +$page_security = 'SA_BANKACCOUNT'; +$path_to_root = "../.."; include($path_to_root . "/includes/session.inc"); -page(_("Bank Accounts")); +page(_($help_context = "Bank Accounts")); include($path_to_root . "/includes/ui.inc"); @@ -42,7 +42,8 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') 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['bank_address'], $_POST['BankAccountCurrency'], + $_POST['dflt_curr_act']); display_notification(_('Bank account has been updated')); } else @@ -50,8 +51,8 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') 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['bank_account_number'], $_POST['bank_address'], + $_POST['BankAccountCurrency'], $_POST['dflt_curr_act']); display_notification(_('New bank account has been added')); } $Mode = 'RESET'; @@ -62,10 +63,10 @@ elseif( $Mode == 'Delete') //the link to delete a selected record was clicked instead of the submit button $cancel_delete = 0; - + $acc = db_escape($selected_id); // PREVENT DELETES IF DEPENDENT RECORDS IN 'bank_trans' - $sql= "SELECT COUNT(*) FROM ".TB_PREF."bank_trans WHERE bank_act='$selected_id'"; + $sql= "SELECT COUNT(*) FROM ".TB_PREF."bank_trans WHERE bank_act=$acc"; $result = db_query($sql,"check failed"); $myrow = db_fetch_row($result); if ($myrow[0] > 0) @@ -73,7 +74,7 @@ elseif( $Mode == 'Delete') $cancel_delete = 1; display_error(_("Cannot delete this bank account because transactions have been created using this account.")); } - $sql= "SELECT COUNT(*) FROM ".TB_PREF."sales_pos WHERE pos_account='$selected_id'"; + $sql= "SELECT COUNT(*) FROM ".TB_PREF."sales_pos WHERE pos_account=$acc"; $result = db_query($sql,"check failed"); $myrow = db_fetch_row($result); if ($myrow[0] > 0) @@ -100,8 +101,9 @@ if ($Mode == 'RESET') $sql = "SELECT account.*, gl_account.account_name FROM ".TB_PREF."bank_accounts account, ".TB_PREF."chart_master gl_account - WHERE account.account_code = gl_account.account_code" - ." ORDER BY account_code, bank_curr_code"; + WHERE account.account_code = gl_account.account_code"; +if (!check_value('show_inactive')) $sql .= " AND !account.inactive"; +$sql .= " ORDER BY account_code, bank_curr_code"; $result = db_query($sql,"could not get bank accounts"); @@ -111,7 +113,8 @@ start_form(); start_table("$table_style width='80%'"); $th = array(_("Account Name"), _("Type"), _("Currency"), _("GL Account"), - _("Bank"), _("Number"), _("Bank Address"),'',''); + _("Bank"), _("Number"), _("Bank Address"), _("Dflt"), '',''); +inactive_control_column($th); table_header($th); $k = 0; @@ -121,21 +124,25 @@ while ($myrow = db_fetch($result)) alt_table_row_color($k); label_cell($myrow["bank_account_name"], "nowrap"); - label_cell(bank_account_types::name($myrow["account_type"]), "nowrap"); + label_cell($bank_account_types[$myrow["account_type"]], "nowrap"); label_cell($myrow["bank_curr_code"], "nowrap"); label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap"); label_cell($myrow["bank_name"], "nowrap"); label_cell($myrow["bank_account_number"], "nowrap"); label_cell($myrow["bank_address"]); + if ($myrow["dflt_curr_act"]) + label_cell(_("Yes")); + else + label_cell(_("No")); + + inactive_control_cell($myrow["id"], $myrow["inactive"], 'bank_accounts', 'id'); edit_button_cell("Edit".$myrow["id"], _("Edit")); delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row(); } -end_table(); -end_form(); -echo '
'; -start_form(); +inactive_control_row($th); +end_table(1); $is_editing = $selected_id != -1; @@ -153,6 +160,7 @@ if ($is_editing) $_POST['bank_account_number'] = $myrow["bank_account_number"]; $_POST['bank_address'] = $myrow["bank_address"]; $_POST['BankAccountCurrency'] = $myrow["bank_curr_code"]; + $_POST['dflt_curr_act'] = $myrow["dflt_curr_act"]; } hidden('selected_id', $selected_id); hidden('account_code'); @@ -165,7 +173,7 @@ text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100); if ($is_editing) { - label_row(_("Account Type:"), bank_account_types::name($_POST['account_type'])); + label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]); } else { @@ -180,6 +188,8 @@ else currencies_list_row(_("Bank Account Currency:"), 'BankAccountCurrency', null); } +yesno_list_row(_("Default currency account:"), 'dflt_curr_act'); + if($is_editing) label_row(_("Bank Account GL Code:"), $_POST['account_code']); else @@ -191,7 +201,7 @@ textarea_row(_("Bank Address:"), 'bank_address', null, 40, 5); end_table(1); -submit_add_or_update_center($selected_id == -1, '', true); +submit_add_or_update_center($selected_id == -1, '', 'both'); end_form();