X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Finquiry%2Fprofit_loss.php;h=f4a73e129b3147cc4076a14550264a9a71d5a620;hb=7e8df3a179c05c51085349e139aac9ce88b9378d;hp=46b8f44bb98b31062f212e105597a0a04ff638b4;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/gl/inquiry/profit_loss.php b/gl/inquiry/profit_loss.php index 46b8f44b..f4a73e12 100644 --- a/gl/inquiry/profit_loss.php +++ b/gl/inquiry/profit_loss.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 = "Profit & Loss Drilldown"), false, false, "", $js); @@ -127,7 +127,7 @@ function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co { $url = "" . $typename .""; + . "&AccGrp=" . $type ."'>" . $type . " " . $typename .""; alt_table_row_color($k); label_cell($url); @@ -160,11 +160,14 @@ function inquiry_controls() $dim = get_company_pref('use_dimension'); start_table(TABLESTYLE_NOBORDER); - date_cells(_("From:"), 'TransFromDate', '', null, -30); + $date = today(); + if (!isset($_POST['TransToDate'])) + $_POST['TransToDate'] = end_month($date); + if (!isset($_POST['TransFromDate'])) + $_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 ""; @@ -179,13 +182,15 @@ function inquiry_controls() end_table(); hidden('AccGrp'); + + return $sel[get_post('Compare')]; } //---------------------------------------------------------------------------------------------------- -function display_profit_and_loss() +function display_profit_and_loss($compare) { - global $path_to_root, $sel; + global $path_to_root; if (!isset($_POST['Dimension'])) $_POST['Dimension'] = 0; @@ -196,7 +201,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 @@ -224,12 +228,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 . " " . _("Achieved %") . " "; @@ -266,7 +270,7 @@ function display_profit_and_loss() { $url = "" . $accounttype['name'] .""; + . "&AccGrp=" . $accounttype['id'] ."'>" . $accounttype['id'] . " " . $accounttype['name'] .""; alt_table_row_color($k); label_cell($url); @@ -310,7 +314,7 @@ function display_profit_and_loss() $convert = get_class_type_convert($class["ctype"]); //Print Class Name - table_section_title(get_account_type_name($_POST["AccGrp"]),4); + table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]),4); echo $tableheader; $classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, @@ -327,12 +331,11 @@ function display_profit_and_loss() start_form(); -inquiry_controls(); +$sel = inquiry_controls(); -display_profit_and_loss(); +display_profit_and_loss($sel); end_form(); end_page(); -?> \ No newline at end of file