projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added text_input() helper.
[fa-stable.git]
/
gl
/
inquiry
/
profit_loss.php
diff --git
a/gl/inquiry/profit_loss.php
b/gl/inquiry/profit_loss.php
index 3af0e4a7ca65f142fda8b25ec79ab08bcb479b23..f4a73e129b3147cc4076a14550264a9a71d5a620 100644
(file)
--- 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 = "";
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);
$js = get_js_date_picker();
page(_($help_context = "Profit & Loss Drilldown"), false, false, "", $js);
@@
-40,6
+40,10
@@
if (isset($_GET["TransToDate"]))
$_POST["TransToDate"] = $_GET["TransToDate"];
if (isset($_GET["Compare"]))
$_POST["Compare"] = $_GET["Compare"];
$_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"];
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 = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate="
if ($drilldown && $levelptr == 0)
{
$url = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate="
- . $from . "&TransToDate=" . $to
+ . $from . "&TransToDate=" . $to
. "&Dimension=" . $dimension . "&Dimension2=" . $dimension2
. "&account=" . $account['account_code'] . "'>" . $account['account_code']
." ". $account['account_name'] ."</a>";
. "&account=" . $account['account_code'] . "'>" . $account['account_code']
." ". $account['account_name'] ."</a>";
@@
-114,11
+118,16
@@
function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co
amount_cell(Achieve(($code_per_balance + $per_balance_total), ($code_acc_balance + $acc_balance_total)));
end_row();
}
amount_cell(Achieve(($code_per_balance + $per_balance_total), ($code_acc_balance + $acc_balance_total)));
end_row();
}
- elseif ($drilldown && $type != $_POST["AccGrp"])
- {
+ //START Patch#1 : Display only direct child types
+ $acctype1 = get_account_type($type);
+ $parent1 = $acctype1["parent"];
+ if ($drilldown && $parent1 == $_POST["AccGrp"])
+ //END Patch#2
+ //elseif ($drilldown && $type != $_POST["AccGrp"])
+ {
$url = "<a href='$path_to_root/gl/inquiry/profit_loss.php?TransFromDate="
$url = "<a href='$path_to_root/gl/inquiry/profit_loss.php?TransFromDate="
- . $from . "&TransToDate=" . $to . "&Compare=" . $compare
- . "&AccGrp=" . $type ."'>" . $typename ."</a>";
+ . $from . "&TransToDate=" . $to . "&Compare=" . $compare
. "&Dimension=" . $dimension . "&Dimension2=" . $dimension2
+ . "&AccGrp=" . $type ."'>" . $type
. " " . $type
name ."</a>";
alt_table_row_color($k);
label_cell($url);
alt_table_row_color($k);
label_cell($url);
@@
-148,37
+157,50
@@
function Achieve($d1, $d2)
function inquiry_controls()
{
function inquiry_controls()
{
+ $dim = get_company_pref('use_dimension');
start_table(TABLESTYLE_NOBORDER);
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');
date_cells(_("To:"), 'TransToDate');
- //Compare Combo
- global $sel;
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
- echo "<td>
Comapre To
:</td>\n";
+ echo "<td>
"._("Compare to")."
:</td>\n";
echo "<td>";
echo array_selector('Compare', null, $sel);
echo "</td>\n";
echo "<td>";
echo array_selector('Compare', null, $sel);
echo "</td>\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();
hidden('AccGrp');
submit_cells('Show',_("Show"),'','', 'default');
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;
- $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'];
$from = $_POST['TransFromDate'];
$to = $_POST['TransToDate'];
- $compare = $_POST['Compare'];
if (isset($_POST["AccGrp"]) && (strlen($_POST['AccGrp']) > 0))
$drilldown = 1; // Deeper Level
if (isset($_POST["AccGrp"]) && (strlen($_POST['AccGrp']) > 0))
$drilldown = 1; // Deeper Level
@@
-206,12
+228,12
@@
function display_profit_and_loss()
div_start('pl_tbl');
div_start('pl_tbl');
- start_table(TABLESTYLE, "width=
50%
");
+ start_table(TABLESTYLE, "width=
'50%'
");
$tableheader = "<tr>
<td class='tableheader'>" . _("Group/Account Name") . "</td>
<td class='tableheader'>" . _("Period") . "</td>
$tableheader = "<tr>
<td class='tableheader'>" . _("Group/Account Name") . "</td>
<td class='tableheader'>" . _("Period") . "</td>
- <td class='tableheader'>" . $
sel[$compare]
. "</td>
+ <td class='tableheader'>" . $
compare
. "</td>
<td class='tableheader'>" . _("Achieved %") . "</td>
</tr>";
<td class='tableheader'>" . _("Achieved %") . "</td>
</tr>";
@@
-247,8
+269,8
@@
function display_profit_and_loss()
if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0 )
{
$url = "<a href='$path_to_root/gl/inquiry/profit_loss.php?TransFromDate="
if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0 )
{
$url = "<a href='$path_to_root/gl/inquiry/profit_loss.php?TransFromDate="
- . $from . "&TransToDate=" . $to . "&Compare=" . $compare
- . "&AccGrp=" . $accounttype['id'] ."'>" . $accounttype['name'] ."</a>";
+ . $from . "&TransToDate=" . $to . "&Compare=" . $compare
. "&Dimension=" . $dimension . "&Dimension2=" . $dimension2
+ . "&AccGrp=" . $accounttype['id'] ."'>" . $accounttype['
id'] . " " . $accounttype['
name'] ."</a>";
alt_table_row_color($k);
label_cell($url);
alt_table_row_color($k);
label_cell($url);
@@
-292,7
+314,7
@@
function display_profit_and_loss()
$convert = get_class_type_convert($class["ctype"]);
//Print Class Name
$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,
echo $tableheader;
$classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert,
@@
-309,12
+331,11
@@
function display_profit_and_loss()
start_form();
start_form();
-inquiry_controls();
+
$sel =
inquiry_controls();
-display_profit_and_loss();
+display_profit_and_loss(
$sel
);
end_form();
end_page();
end_form();
end_page();
-?>
\ No newline at end of file