X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Finquiry%2Fprofit_loss.php;h=8dcf81e2ff9a393f1fc84fc8f1788c3454444d7d;hb=63ed17b5a7a6436c148adc545f3df532b30b493f;hp=4022e968f7ccb89a2082b90cf2bb377f445b6225;hpb=0c1ab57c09d87eed2bd248892dbfe3f256767a82;p=fa-stable.git diff --git a/gl/inquiry/profit_loss.php b/gl/inquiry/profit_loss.php index 4022e968..8dcf81e2 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 @@ -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); @@ -157,6 +162,8 @@ function Achieve($d1, $d2) function inquiry_controls() { + global $compare_types; + $dim = get_company_pref('use_dimension'); start_table(TABLESTYLE_NOBORDER); @@ -164,17 +171,15 @@ function inquiry_controls() if (!isset($_POST['TransToDate'])) $_POST['TransToDate'] = end_month($date); if (!isset($_POST['TransFromDate'])) - $_POST['TransFromDate'] = add_days(end_month($date), -$_SESSION["wa_current_user"]->prefs->transaction_days()); + $_POST['TransFromDate'] = add_days(end_month($date), -user_transaction_days()); date_cells(_("From:"), 'TransFromDate'); date_cells(_("To:"), 'TransToDate'); - //Compare Combo - global $sel; - $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) @@ -188,9 +193,9 @@ function inquiry_controls() //---------------------------------------------------------------------------------------------------- -function display_profit_and_loss() +function display_profit_and_loss($compare) { - global $path_to_root, $sel; + global $path_to_root, $compare_types; if (!isset($_POST['Dimension'])) $_POST['Dimension'] = 0; @@ -201,7 +206,6 @@ function display_profit_and_loss() $from = $_POST['TransFromDate']; $to = $_POST['TransToDate']; - $compare = $_POST['Compare']; if (isset($_POST["AccGrp"]) && (strlen($_POST['AccGrp']) > 0)) $drilldown = 1; // Deeper Level @@ -229,12 +233,12 @@ function display_profit_and_loss() div_start('pl_tbl'); - start_table(TABLESTYLE, "width=50%"); + start_table(TABLESTYLE, "width='50%'"); $tableheader = " " . _("Group/Account Name") . " " . _("Period") . " - " . $sel[$compare] . " + " . $compare_types[$compare] . " " . _("Achieved %") . " "; @@ -334,10 +338,9 @@ start_form(); inquiry_controls(); -display_profit_and_loss(); +display_profit_and_loss(get_post('Compare')); end_form(); end_page(); -?> \ No newline at end of file