Commit 8f58728b authored by Frank Bergmann's avatar Frank Bergmann

Added cost center filter from cosine

parent 3fb6bae2
......@@ -16,11 +16,11 @@ ad_page_contract {
} {
{ start_date "2011-01-01" }
{ end_date "2099-12-31" }
{ report_cost_center_id:integer "" }
{ level_of_detail:integer 3 }
{ customer_id:integer 0 }
{ output_format "html" }
{ number_locale "" }
}
......@@ -165,6 +165,22 @@ set levels {3 "Customers + Projects"}
# ------------------------------------------------------------
# Conditional SQL Where-Clause
#
set criteria [list]
if {"" ne $report_cost_center_id && 0 ne $report_cost_center_id} {
lappend criteria "p.project_cost_center_id in ([join [im_sub_cost_center_ids $report_cost_center_id] ", "])"
}
set where_clause [join $criteria " and\n "]
if {![empty_string_p $where_clause]} {
set where_clause " and $where_clause"
}
# ------------------------------------------------------------
# Report SQL - This SQL statement defines the raw data
# that are to be shown.
......@@ -225,6 +241,7 @@ set report_sql "
and (p.project_budget is not NULL OR p.project_budget_hours is not NULL)
and p.end_date >= :start_date::timestamptz
and p.start_date < :end_date::timestamptz
$where_clause
) p
order by
lower(customer_name),
......@@ -374,6 +391,10 @@ switch $output_format {
<td>End Date:</td>
<td><input type=text name=end_date value='$end_date'></td>
</tr>
<tr>
<td>[lang::message::lookup "" intranet-cost.Profit_Center "Profit Center"]:</td>
<td>[im_cost_center_select -include_empty 1 -include_empty_name "All" report_cost_center_id $report_cost_center_id]</td>
</tr>
<tr>
<td class=form-label>Format</td>
<td class=form-widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment