X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gl%2Finquiry%2Fprofit_loss.php;h=801fb6aa0495efcd60cfc504e82d5ab3703d723a;hb=523b8c69689f9ceb978b422b3e65a7eb9c089b6f;hp=f4a73e129b3147cc4076a14550264a9a71d5a620;hpb=17b390efcf904072b02ec866b2a427490471a260;p=fa-stable.git
diff --git a/gl/inquiry/profit_loss.php b/gl/inquiry/profit_loss.php
index f4a73e12..801fb6aa 100644
--- a/gl/inquiry/profit_loss.php
+++ b/gl/inquiry/profit_loss.php
@@ -26,6 +26,11 @@ if (user_use_date_picker())
page(_($help_context = "Profit & Loss Drilldown"), false, false, "", $js);
+$compare_types = array(
+ _("Accumulated"),
+ _("Period Y-1"),
+ _("Budget")
+);
//----------------------------------------------------------------------------------------------------
// Ajax updates
@@ -50,7 +55,7 @@ if (isset($_GET["AccGrp"]))
//----------------------------------------------------------------------------------------------------
function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $convert,
- &$dec, &$pdec, &$rep, $dimension=0, $dimension2=0, $drilldown, $path_to_root)
+ $dimension=0, $dimension2=0, $drilldown, $path_to_root)
{
global $levelptr, $k;
@@ -63,7 +68,7 @@ function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co
//Get Accounts directly under this group/type
$result = get_gl_accounts(null, null, $type);
-
+
while ($account=db_fetch($result))
{
$per_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2);
@@ -101,7 +106,7 @@ function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co
while ($accounttype=db_fetch($result))
{
$totals_arr = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end,
- $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
+ $compare, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
$per_balance_total += $totals_arr[0];
$acc_balance_total += $totals_arr[1];
}
@@ -157,6 +162,8 @@ function Achieve($d1, $d2)
function inquiry_controls()
{
+ global $compare_types;
+
$dim = get_company_pref('use_dimension');
start_table(TABLESTYLE_NOBORDER);
@@ -168,11 +175,11 @@ function inquiry_controls()
date_cells(_("From:"), 'TransFromDate');
date_cells(_("To:"), 'TransToDate');
- $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
echo "
"._("Compare to").": | \n";
echo "";
- echo array_selector('Compare', null, $sel);
+ echo array_selector('Compare', null, $compare_types);
echo " | \n";
+
if ($dim >= 1)
dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1);
if ($dim > 1)
@@ -182,15 +189,13 @@ function inquiry_controls()
end_table();
hidden('AccGrp');
-
- return $sel[get_post('Compare')];
}
//----------------------------------------------------------------------------------------------------
function display_profit_and_loss($compare)
{
- global $path_to_root;
+ global $path_to_root, $compare_types;
if (!isset($_POST['Dimension']))
$_POST['Dimension'] = 0;
@@ -207,9 +212,6 @@ function display_profit_and_loss($compare)
else
$drilldown = 0; // Root level
- $dec = 0;
- $pdec = user_percent_dec();
-
if ($compare == 0 || $compare == 2)
{
$end = $to;
@@ -233,15 +235,12 @@ function display_profit_and_loss($compare)
$tableheader = "
-
+
";
if (!$drilldown) //Root Level
{
- $parent = -1;
- $classper = 0.0;
- $classacc = 0.0;
$salesper = 0.0;
$salesacc = 0.0;
@@ -259,10 +258,11 @@ function display_profit_and_loss($compare)
//Get Account groups/types under this group/type
$typeresult = get_account_types(false, $class['cid'], -1);
+ $k = 0; // row color
while ($accounttype=db_fetch($typeresult))
{
$TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert,
- $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
+ $dimension, $dimension2, $drilldown, $path_to_root);
$class_per_total += $TypeTotal[0];
$class_acc_total += $TypeTotal[1];
@@ -318,12 +318,13 @@ function display_profit_and_loss($compare)
echo $tableheader;
$classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert,
- $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
+ $dimension, $dimension2, $drilldown, $path_to_root);
}
- end_table(1); // outer table
+ end_table(); // outer table
+ hyperlink_params($_SERVER['PHP_SELF'], _("Back"), "TransFromDate=". $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2);
div_end();
}
@@ -331,11 +332,11 @@ function display_profit_and_loss($compare)
start_form();
-$sel = inquiry_controls();
+inquiry_controls();
-display_profit_and_loss($sel);
+display_profit_and_loss(get_post('Compare'));
end_form();
-end_page();
+end_page(false, true);