From: Joe Hunt Date: Mon, 27 Nov 2017 08:37:22 +0000 (+0100) Subject: Account Class/Group drill down added according to Apmuthu. X-Git-Tag: v2.4.4~50 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=004760666ed0828f177b6055f91cf6f6ce905be2 Account Class/Group drill down added according to Apmuthu. --- diff --git a/gl/manage/gl_account_classes.php b/gl/manage/gl_account_classes.php index 51288781..a08a17e4 100644 --- a/gl/manage/gl_account_classes.php +++ b/gl/manage/gl_account_classes.php @@ -119,7 +119,7 @@ while ($myrow = db_fetch($result)) alt_table_row_color($k); label_cell($myrow["cid"]); - label_cell($myrow['class_name']); + label_cell(''.$myrow['class_name'].''); if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1) { $myrow['ctype'] = ($myrow["ctype"] >= CL_ASSETS && $myrow["ctype"] < CL_INCOME ? 1 : 0); diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index 0a1791bc..1358cae8 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -19,6 +19,9 @@ include($path_to_root . "/gl/includes/gl_db.inc"); include($path_to_root . "/includes/ui.inc"); +if (isset($_GET["cid"])) + $_POST["cid"] = $_GET["cid"]; + simple_page_mode(false); //----------------------------------------------------------------------------------- @@ -119,8 +122,11 @@ if ($Mode == 'RESET') unset($_POST['class_id']); } //----------------------------------------------------------------------------------- - -$result = get_account_types(check_value('show_inactive')); +$filter_cid = (isset($_POST["cid"])); +if ($filter_cid) + $result = get_account_types(check_value('show_inactive'), $_POST["cid"]); +else + $result = get_account_types(check_value('show_inactive')); start_form(); start_table(TABLESTYLE); @@ -146,7 +152,7 @@ while ($myrow = db_fetch($result)) } label_cell($myrow["id"]); - label_cell($myrow["name"]); + label_cell(''.$myrow["name"].''); label_cell($parent_text); label_cell($bs_text); inactive_control_cell($myrow["id"], $myrow["inactive"], 'chart_types', 'id'); @@ -188,7 +194,10 @@ text_row_ex(_("Name:"), 'name', 50); gl_account_types_list_row(_("Subgroup Of:"), 'parent', null, _("None"), true); -class_list_row(_("Class:"), 'class_id', null); +if ($filter_cid) + class_list_row(_("Class:"), 'class_id', $_POST['cid']); +else + class_list_row(_("Class:"), 'class_id', null); end_table(1); diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 5bda0dcd..9d7e0918 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -26,6 +26,9 @@ include_once($path_to_root . "/includes/data_checks.inc"); check_db_has_gl_account_groups(_("There are no account groups defined. Please define at least one account group before entering accounts.")); +if (isset($_GET["id"])) + $_POST["id"] = $_GET["id"]; + //------------------------------------------------------------------------------------- if (isset($_POST['_AccountList_update'])) @@ -190,6 +193,7 @@ if (isset($_POST['delete'])) } //------------------------------------------------------------------------------------- +$filter_id = (isset($_POST["id"])); start_form(); @@ -197,8 +201,10 @@ if (db_has_gl_accounts()) { start_table(TABLESTYLE_NOBORDER); start_row(); - gl_all_accounts_list_cells(null, 'AccountList', null, false, false, - _('New account'), true, check_value('show_inactive')); + if ($filter_id) + gl_all_accounts_list_cells(null, 'AccountList', null, false, false, _('New account'), true, check_value('show_inactive'), $_POST['id']); + else + gl_all_accounts_list_cells(null, 'AccountList', null, false, false, _('New account'), true, check_value('show_inactive')); check_cells(_("Show inactive:"), 'show_inactive', null, true); end_row(); end_table(); @@ -240,6 +246,7 @@ else $_POST['account_code'] = $_POST['account_code2'] = ''; $_POST['account_name'] = $_POST['account_type'] = ''; $_POST['inactive'] = 0; + if ($filter_id) $_POST['account_type'] = $_POST['id']; } text_row_ex(_("Account Code:"), 'account_code', 15); } diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 351fc5da..eab6f4fa 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -1805,7 +1805,7 @@ function gl_account_types_list_row($label, $name, $selected_id=null, $all_option //----------------------------------------------------------------------------------------------- function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=false, - $cells=false, $all_option=false, $submit_on_change=false, $all=false) + $cells=false, $all_option=false, $submit_on_change=false, $all=false, $type_id=false) { if ($skip_bank_accounts) $sql = "SELECT chart.account_code, chart.account_name, type.name, chart.inactive, type.id @@ -1818,6 +1818,7 @@ function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=fals $sql = "SELECT chart.account_code, chart.account_name, type.name, chart.inactive, type.id FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type WHERE chart.account_type=type.id"; + if ($type_id ) $sql .= " AND chart.account_type=".db_escape($type_id); return combo_input($name, $selected_id, $sql, 'chart.account_code', 'chart.account_name', array( @@ -1845,22 +1846,22 @@ function _format_account($row) function gl_all_accounts_list_cells($label, $name, $selected_id=null, $skip_bank_accounts=false, $cells=false, $all_option=false, - $submit_on_change=false, $all=false) + $submit_on_change=false, $all=false, $type_id=false) { if ($label != null) echo "$label\n"; echo ""; echo gl_all_accounts_list($name, $selected_id, - $skip_bank_accounts, $cells, $all_option, $submit_on_change, $all); + $skip_bank_accounts, $cells, $all_option, $submit_on_change, $all, $type_id); echo "\n"; } function gl_all_accounts_list_row($label, $name, $selected_id=null, - $skip_bank_accounts=false, $cells=false, $all_option=false) + $skip_bank_accounts=false, $cells=false, $all_option=false, $type_id=false) { echo "$label"; gl_all_accounts_list_cells(null, $name, $selected_id, - $skip_bank_accounts, $cells, $all_option); + $skip_bank_accounts, $cells, $all_option, $type_id); echo "\n"; }