Commit 4d831fa9 authored by Frank Bergmann's avatar Frank Bergmann

Added filter for profit centers

parent f31776ec
......@@ -26,6 +26,12 @@
<input type=textfield 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>Minimum Turnover</td>
<td class=form-widget>
......
......@@ -14,6 +14,7 @@ ad_page_contract {
} {
{ start_date "" }
{ end_date "" }
{ report_cost_center_id "" }
{ output_format "html" }
{ project_id:integer 0}
{ prov_id:integer 0}
......@@ -114,16 +115,15 @@ set current_url [im_url_with_query]
# ------------------------------------------------------------
set criteria [list]
if {"" != $project_id && 0 != $project_id} {
lappend criteria "p.project_id = :project_id"
}
if {"" != $prov_id && 0 != $prov_id} {
lappend criteria "p.company_id = :prov_id"
if {"" != $project_id && 0 != $project_id} { lappend criteria "c.project_id = :project_id" }
if {"" != $prov_id && 0 != $prov_id} { lappend criteria "c.provider_id = :prov_id" }
if {"" ne $report_cost_center_id && 0 ne $report_cost_center_id} {
lappend criteria "c.cost_center_id in ([join [im_sub_cost_center_ids $report_cost_center_id] ", "])"
}
set where_clause [join $criteria "\n\tand "]
if {"" != $where_clause} { set where_clause "and $where_clause" }
set sql "
select c.cost_id,
c.cost_name,
......@@ -148,6 +148,7 @@ set sql "
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
and c.effective_date::date < to_date(:end_date, 'YYYY-MM-DD')
$where_clause
"
# ------------------------------------------------------------
......
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