From 884c36eec7dbaae89e1f5532cc2c2f8033b010fd Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sat, 16 Oct 2010 08:11:12 +0000 Subject: [PATCH] [0000266] Added dimension selections in Profit Loss and Balance drilldown and Trial Balance --- CHANGELOG.txt | 6 ++++++ gl/inquiry/balance_sheet.php | 35 ++++++++++++++++++++++----------- gl/inquiry/gl_trial_balance.php | 17 ++++++++++++---- gl/inquiry/profit_loss.php | 23 +++++++++++++++++----- 4 files changed, 61 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index fa846a1c..aef91a34 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,12 @@ Legend: ! -> Note $ -> Affected files +16-Oct-2010 Joe Hunt +! [0000266] Added dimension selections in Profit Loss and Balance drilldown and Trial Balance +$ /gl/inquiry/balance_sheet.php + /gl/inquiry/gl_trial_balance.php + /gl/inquiry/profit_loss.php + 15-Oct-2010 Joe Hunt # [0000263] Customer Credit Note didn't update units when shifting items. $ /sales/includes/ui/sales_credit_ui.inc diff --git a/gl/inquiry/balance_sheet.php b/gl/inquiry/balance_sheet.php index 3ee0ee50..eafb4855 100644 --- a/gl/inquiry/balance_sheet.php +++ b/gl/inquiry/balance_sheet.php @@ -38,16 +38,19 @@ if (isset($_GET["TransFromDate"])) $_POST["TransFromDate"] = $_GET["TransFromDate"]; if (isset($_GET["TransToDate"])) $_POST["TransToDate"] = $_GET["TransToDate"]; +if (isset($_GET["Dimension"])) + $_POST["Dimension"] = $_GET["Dimension"]; +if (isset($_GET["Dimension2"])) + $_POST["Dimension2"] = $_GET["Dimension2"]; if (isset($_GET["AccGrp"])) $_POST["AccGrp"] = $_GET["AccGrp"]; //---------------------------------------------------------------------------------------------------- -function display_type ($type, $typename, $from, $to, $convert, $drilldown, $path_to_root) +function display_type ($type, $typename, $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root) { global $levelptr, $k; - $dimension = $dimension2 = 0; $acctstotal = 0; $typestotal = 0; @@ -64,7 +67,7 @@ function display_type ($type, $typename, $from, $to, $convert, $drilldown, $path if ($drilldown && $levelptr == 0) { $url = "" . $account['account_code'] ." ". $account['account_name'] .""; @@ -84,7 +87,7 @@ function display_type ($type, $typename, $from, $to, $convert, $drilldown, $path while ($accounttype=db_fetch($result)) { $typestotal += display_type($accounttype["id"], $accounttype["name"], $from, $to, - $convert, $drilldown, $path_to_root); + $convert, $dimension, $dimension2, $drilldown, $path_to_root); } //Display Type Summary if total is != 0 @@ -105,7 +108,7 @@ function display_type ($type, $typename, $from, $to, $convert, $drilldown, $path //elseif ($drilldown && $type != $_POST["AccGrp"]) { $url = "" . $typename .""; alt_table_row_color($k); @@ -119,8 +122,13 @@ function display_type ($type, $typename, $from, $to, $convert, $drilldown, $path function inquiry_controls() { + $dim = get_company_pref('use_dimension'); start_table(TABLESTYLE_NOBORDER); date_cells(_("As at:"), 'TransToDate'); + if ($dim >= 1) + dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1); + if ($dim > 1) + dimensions_list_cells(_("Dimension")." 2:", 'Dimension2', null, true, " ", false, 2); submit_cells('Show',_("Show"),'','', 'default'); end_table(); @@ -135,8 +143,12 @@ function display_balance_sheet() $from = begin_fiscalyear(); $to = $_POST['TransToDate']; - $dim = get_company_pref('use_dimension'); - $dimension = $dimension2 = 0; + if (!isset($_POST['Dimension'])) + $_POST['Dimension'] = 0; + if (!isset($_POST['Dimension2'])) + $_POST['Dimension2'] = 0; + $dimension = $_POST['Dimension']; + $dimension2 = $_POST['Dimension2']; $lconvert = $econvert = 1; if (isset($_POST["AccGrp"]) && (strlen($_POST['AccGrp']) > 0)) $drilldown = 1; // Deeper Level @@ -174,12 +186,13 @@ function display_balance_sheet() while ($accounttype=db_fetch($typeresult)) { $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, - $convert, $drilldown, $path_to_root); + $convert, $dimension, $dimension2, $drilldown, $path_to_root); //Print Summary if ($TypeTotal != 0 ) { $url = "" . $accounttype['name'] .""; + . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 + . "&AccGrp=" . $accounttype['id'] ."'>" . $accounttype['name'] .""; alt_table_row_color($k); label_cell($url); amount_cell($TypeTotal * $convert); @@ -212,7 +225,7 @@ function display_balance_sheet() $calculateclose *= -1; //Final Report Summary $url = ""._('Calculated Return').""; start_row("class='inquirybg' style='font-weight:bold'"); @@ -240,7 +253,7 @@ function display_balance_sheet() table_section_title(get_account_type_name($_POST["AccGrp"])); $classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to, - $convert, $drilldown, $path_to_root); + $convert, $dimension, $dimension2, $drilldown, $path_to_root); } end_table(1); // outer table diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index fbd23e94..818fd1b5 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -37,12 +37,17 @@ if (get_post('Show')) function gl_inquiry_controls() { + $dim = get_company_pref('use_dimension'); start_form(); start_table(TABLESTYLE_NOBORDER); date_cells(_("From:"), 'TransFromDate', '', null, -30); date_cells(_("To:"), 'TransToDate'); + if ($dim >= 1) + dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1); + if ($dim > 1) + dimensions_list_cells(_("Dimension")." 2:", 'Dimension2', null, true, " ", false, 2); check_cells(_("No zero values"), 'NoZero', null); check_cells(_("Only balances"), 'Balance', null); @@ -58,6 +63,10 @@ function display_trial_balance() global $path_to_root; div_start('balance_tbl'); + if (!isset($_POST['Dimension'])) + $_POST['Dimension'] = 0; + if (!isset($_POST['Dimension2'])) + $_POST['Dimension2'] = 0; start_table(TABLESTYLE); $tableheader = " " . _("Account") . " @@ -87,14 +96,14 @@ function display_trial_balance() while ($account = db_fetch($accounts)) { - $prev = get_balance($account["account_code"], 0, 0, $begin, $_POST['TransFromDate'], false, false); - $curr = get_balance($account["account_code"], 0, 0, $_POST['TransFromDate'], $_POST['TransToDate'], true, true); - $tot = get_balance($account["account_code"], 0, 0, $begin, $_POST['TransToDate'], false, true); + $prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false); + $curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true); + $tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true); if (check_value("NoZero") && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) continue; alt_table_row_color($k); - $url = "" . $account["account_code"] . ""; + $url = "" . $account["account_code"] . ""; label_cell($url); label_cell($account["account_name"]); diff --git a/gl/inquiry/profit_loss.php b/gl/inquiry/profit_loss.php index 70f08d54..46b8f44b 100644 --- a/gl/inquiry/profit_loss.php +++ b/gl/inquiry/profit_loss.php @@ -40,6 +40,10 @@ if (isset($_GET["TransToDate"])) $_POST["TransToDate"] = $_GET["TransToDate"]; if (isset($_GET["Compare"])) $_POST["Compare"] = $_GET["Compare"]; +if (isset($_GET["Dimension"])) + $_POST["Dimension"] = $_GET["Dimension"]; +if (isset($_GET["Dimension2"])) + $_POST["Dimension2"] = $_GET["Dimension2"]; if (isset($_GET["AccGrp"])) $_POST["AccGrp"] = $_GET["AccGrp"]; @@ -74,7 +78,7 @@ function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co if ($drilldown && $levelptr == 0) { $url = "" . $account['account_code'] ." ". $account['account_name'] .""; @@ -122,7 +126,7 @@ function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co //elseif ($drilldown && $type != $_POST["AccGrp"]) { $url = "" . $typename .""; alt_table_row_color($k); @@ -153,6 +157,7 @@ function Achieve($d1, $d2) function inquiry_controls() { + $dim = get_company_pref('use_dimension'); start_table(TABLESTYLE_NOBORDER); date_cells(_("From:"), 'TransFromDate', '', null, -30); @@ -165,6 +170,10 @@ function inquiry_controls() echo ""; echo array_selector('Compare', null, $sel); echo "\n"; + if ($dim >= 1) + dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1); + if ($dim > 1) + dimensions_list_cells(_("Dimension")." 2:", 'Dimension2', null, true, " ", false, 2); submit_cells('Show',_("Show"),'','', 'default'); end_table(); @@ -178,8 +187,12 @@ function display_profit_and_loss() { global $path_to_root, $sel; - $dim = get_company_pref('use_dimension'); - $dimension = $dimension2 = 0; + if (!isset($_POST['Dimension'])) + $_POST['Dimension'] = 0; + if (!isset($_POST['Dimension2'])) + $_POST['Dimension2'] = 0; + $dimension = $_POST['Dimension']; + $dimension2 = $_POST['Dimension2']; $from = $_POST['TransFromDate']; $to = $_POST['TransToDate']; @@ -252,7 +265,7 @@ function display_profit_and_loss() if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0 ) { $url = "" . $accounttype['name'] .""; alt_table_row_color($k); -- 2.30.2