X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Finquiry%2Fbalance_sheet.php;h=e2cd107536108864a5b4e74d0b9724d2eb9545d5;hb=92516cf782e07af078fab627e35c75c822702ab2;hp=8bf527577a2dc663f61d753e252370bc92e4f2cf;hpb=39c785175e25929af8c503f6e97fadd38525cf90;p=fa-stable.git diff --git a/gl/inquiry/balance_sheet.php b/gl/inquiry/balance_sheet.php index 8bf52757..e2cd1075 100644 --- a/gl/inquiry/balance_sheet.php +++ b/gl/inquiry/balance_sheet.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js = get_js_date_picker(); page(_($help_context = "Balance Sheet Drilldown"), false, false, "", $js); @@ -47,9 +47,9 @@ if (isset($_GET["AccGrp"])) //---------------------------------------------------------------------------------------------------- -function display_type ($type, $typename, $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root) +function display_type ($type, $typename, $from, $to, $convert, $dimension, $dimension2, $drilldown) { - global $levelptr, $k; + global $path_to_root, $levelptr, $k; $acctstotal = 0; $typestotal = 0; @@ -57,28 +57,27 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime //Get Accounts directly under this group/type $result = get_gl_accounts(null, null, $type); - while ($account=db_fetch($result)) - { - $prev_balance = get_gl_balance_from_to("", $from, $account["account_code"], $dimension, $dimension2); - $curr_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2); - if (!$prev_balance && !$curr_balance) - continue; - - if ($drilldown && $levelptr == 0) - { - $url = "" . $account['account_code'] - ." ". $account['account_name'] .""; - - start_row("class='stockmankobg'"); - label_cell($url); - amount_cell(($curr_balance + $prev_balance) * $convert); - end_row(); - } - - $acctstotal += $curr_balance + $prev_balance; - } + while ($account=db_fetch($result)) + { + $net_balance = get_gl_trans_from_to("", $to, $account["account_code"], $dimension, $dimension2); + if (!$net_balance) + continue; + + if ($drilldown && $levelptr == 0) + { + $url = "" . $account['account_code'] + ." ". $account['account_name'] .""; + + start_row("class='stockmankobg'"); + label_cell($url); + amount_cell(($net_balance) * $convert); + end_row(); + } + + $acctstotal += $net_balance; + } $levelptr = 1; @@ -87,7 +86,7 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime while ($accounttype=db_fetch($result)) { $typestotal += display_type($accounttype["id"], $accounttype["name"], $from, $to, - $convert, $dimension, $dimension2, $drilldown, $path_to_root); + $convert, $dimension, $dimension2, $drilldown); } //Display Type Summary if total is != 0 @@ -105,7 +104,6 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime $parent1 = $acctype1["parent"]; if ($drilldown && $parent1 == $_POST["AccGrp"]) //END Patch#2 - //elseif ($drilldown && $type != $_POST["AccGrp"]) { $url = " -