Commit 26a4bdfe authored by Frank Bergmann's avatar Frank Bergmann

- EconoMedic changes

	- Implemented company-wide bank holidays
	- Extended invoices to check the CostCenter before
	  creating an invoice
	- Implemented custom number circuits for EconoMedic
	- Implemented controlling by day
	- Implemented invoicing by day
	- Implemented conversion function from hours to days,
	  limiting the number of days logged per consultant
	  to 1.
	- Implemented OpenOffice invoicing templates
	- Implemented Template maintenance page in /intranet/admin/
	- Improved filtering in AbsenceListPage
parent 7c465003
...@@ -182,7 +182,6 @@ ad_proc im_timesheet_invoicing_project_hierarchy { ...@@ -182,7 +182,6 @@ ad_proc im_timesheet_invoicing_project_hierarchy {
<td align=center><input type=radio name=invoice_hour_type value=interval $invoice_radio_disabled $interval_checked></td> <td align=center><input type=radio name=invoice_hour_type value=interval $invoice_radio_disabled $interval_checked></td>
<td align=center><input type=radio name=invoice_hour_type value=unbilled $invoice_radio_disabled $unbilled_checked></td> <td align=center><input type=radio name=invoice_hour_type value=unbilled $invoice_radio_disabled $unbilled_checked></td>
<td></td> <td></td>
<!-- <td></td> -->
<td></td> <td></td>
</tr> </tr>
" "
...@@ -206,15 +205,25 @@ ad_proc im_timesheet_invoicing_project_hierarchy { ...@@ -206,15 +205,25 @@ ad_proc im_timesheet_invoicing_project_hierarchy {
m.material_billable_p, m.material_billable_p,
im_category_from_id(t.uom_id) as uom_name, im_category_from_id(t.uom_id) as uom_name,
(select sum(h.hours) from im_hours h where h.project_id = children.project_id) as all_reported_hours, (select sum(h.hours) from im_hours h where h.project_id = children.project_id) as all_reported_hours,
(select sum(h.days) from im_hours h where h.project_id = children.project_id) as all_reported_days,
(select sum(h.hours) from im_hours h where (select sum(h.hours) from im_hours h where
h.project_id = children.project_id h.project_id = children.project_id
and h.day >= to_timestamp(:start_date, 'YYYY-MM-DD') and h.day >= to_timestamp(:start_date, 'YYYY-MM-DD')
and h.day < to_timestamp(:end_date, 'YYYY-MM-DD') and h.day < to_timestamp(:end_date, 'YYYY-MM-DD')
) as hours_in_interval, ) as hours_in_interval,
(select sum(h.days) from im_hours h where
h.project_id = children.project_id
and h.day >= to_timestamp(:start_date, 'YYYY-MM-DD')
and h.day < to_timestamp(:end_date, 'YYYY-MM-DD')
) as days_in_interval,
(select sum(h.hours) from im_hours h where (select sum(h.hours) from im_hours h where
h.project_id = children.project_id h.project_id = children.project_id
and h.invoice_id is null and h.invoice_id is null
) as unbilled_hours ) as unbilled_hours,
(select sum(h.days) from im_hours h where
h.project_id = children.project_id
and h.invoice_id is null
) as unbilled_days
from from
im_projects parent, im_projects parent,
im_projects children im_projects children
...@@ -272,6 +281,24 @@ ad_proc im_timesheet_invoicing_project_hierarchy { ...@@ -272,6 +281,24 @@ ad_proc im_timesheet_invoicing_project_hierarchy {
set task_disabled "disabled" set task_disabled "disabled"
} }
switch $uom_id {
321 {
set all_reported_units $all_reported_days
set units_in_interval $days_in_interval
set unbilled_units $unbilled_days
}
320 {
set all_reported_units $all_reported_hours
set units_in_interval $hours_in_interval
set unbilled_units $unbilled_hours
}
default {
set all_reported_units "-"
set units_in_interval "-"
set unbilled_units "-"
}
}
append task_table_rows " append task_table_rows "
<tr $bgcolor([expr $ctr % 2])> <tr $bgcolor([expr $ctr % 2])>
<td align=middle><input type=checkbox name=include_task value=$project_id $task_disabled $task_checked></td> <td align=middle><input type=checkbox name=include_task value=$project_id $task_disabled $task_checked></td>
...@@ -279,9 +306,9 @@ ad_proc im_timesheet_invoicing_project_hierarchy { ...@@ -279,9 +306,9 @@ ad_proc im_timesheet_invoicing_project_hierarchy {
<td align=left>$material_name</td> <td align=left>$material_name</td>
<td align=right>$planned_units</td> <td align=right>$planned_units</td>
<td align=right>$billable_units</td> <td align=right>$billable_units</td>
<td align=right>$all_reported_hours</td> <td align=right>$all_reported_units</td>
<td align=right>$hours_in_interval</td> <td align=right>$units_in_interval</td>
<td align=right>$unbilled_hours</td> <td align=right>$unbilled_units</td>
<td align=right>$uom_name</td> <td align=right>$uom_name</td>
<td>$project_status</td> <td>$project_status</td>
</tr> </tr>
......
...@@ -171,7 +171,7 @@ set page_title [lang::message::lookup "" intranet-timesheet2-invoices.New_$targe ...@@ -171,7 +171,7 @@ set page_title [lang::message::lookup "" intranet-timesheet2-invoices.New_$targe
set context_bar [im_context_bar [list /intranet/invoices/ "[_ intranet-timesheet2-invoices.Invoices]"] $page_title] set context_bar [im_context_bar [list /intranet/invoices/ "[_ intranet-timesheet2-invoices.Invoices]"] $page_title]
set invoice_id [im_new_object_id] set invoice_id [im_new_object_id]
set invoice_nr [im_next_invoice_nr -invoice_type_id $target_cost_type_id] set invoice_nr [im_next_invoice_nr -cost_type_id $target_cost_type_id]
set invoice_date $todays_date set invoice_date $todays_date
set provider_id [im_company_internal] set provider_id [im_company_internal]
set customer_id $company_id set customer_id $company_id
...@@ -251,7 +251,7 @@ if {$aggregate_tasks_p} { ...@@ -251,7 +251,7 @@ if {$aggregate_tasks_p} {
sum(t.planned_units) as planned_sum, sum(t.planned_units) as planned_sum,
sum(t.billable_units) as billable_sum, sum(t.billable_units) as billable_sum,
sum(t.reported_units) as reported_sum, sum(t.reported_units) as reported_sum,
sum(t.hours_in_interval) as interval_sum, sum(t.units_in_interval) as interval_sum,
sum(t.unbilled_units) as unbilled_sum, sum(t.unbilled_units) as unbilled_sum,
parent.project_id as project_id, parent.project_id as project_id,
im_material_name_from_id(t.task_material_id) as task_name, im_material_name_from_id(t.task_material_id) as task_name,
...@@ -263,18 +263,35 @@ if {$aggregate_tasks_p} { ...@@ -263,18 +263,35 @@ if {$aggregate_tasks_p} {
(select (select
t.planned_units, t.planned_units,
t.billable_units, t.billable_units,
(select sum(h.hours) from im_hours h where CASE WHEN t.uom_id = 321 THEN
h.project_id = p.project_id (select sum(h.days) from im_hours h where h.project_id = p.project_id)
) as reported_units, ELSE
(select sum(h.hours) from im_hours h where (select sum(h.hours) from im_hours h where h.project_id = p.project_id)
h.project_id = p.project_id END as reported_units,
and h.day >= to_timestamp(:invoicing_start_date, 'YYYY-MM-DD') CASE WHEN t.uom_id = 321 THEN
and h.day < to_timestamp(:invoicing_end_date, 'YYYY-MM-DD') (select sum(h.days) from im_hours h where
) as hours_in_interval, h.project_id = p.project_id
(select sum(h.hours) from im_hours h where and h.day >= to_timestamp(:invoicing_start_date, 'YYYY-MM-DD')
h.project_id = p.project_id and h.day < to_timestamp(:invoicing_end_date, 'YYYY-MM-DD')
and h.invoice_id is null )
) as unbilled_units, ELSE
(select sum(h.hours) from im_hours h where
h.project_id = p.project_id
and h.day >= to_timestamp(:invoicing_start_date, 'YYYY-MM-DD')
and h.day < to_timestamp(:invoicing_end_date, 'YYYY-MM-DD')
)
END as units_in_interval,
CASE WHEN t.uom_id = 321 THEN
(select sum(h.days) from im_hours h where
h.project_id = p.project_id
and h.invoice_id is null
)
ELSE
(select sum(h.hours) from im_hours h where
h.project_id = p.project_id
and h.invoice_id is null
)
END as unbilled_units,
parent.project_id as project_id, parent.project_id as project_id,
coalesce(t.material_id, :default_material_id) as task_material_id, coalesce(t.material_id, :default_material_id) as task_material_id,
coalesce(t.uom_id, :default_uom_id) as uom_id, coalesce(t.uom_id, :default_uom_id) as uom_id,
...@@ -308,16 +325,35 @@ if {$aggregate_tasks_p} { ...@@ -308,16 +325,35 @@ if {$aggregate_tasks_p} {
select select
t.planned_units as planned_sum, t.planned_units as planned_sum,
t.billable_units as billable_sum, t.billable_units as billable_sum,
(select sum(h.hours) from im_hours h where h.project_id = p.project_id) as reported_sum, CASE WHEN t.uom_id = 321 THEN
(select sum(h.hours) from im_hours h where (select sum(h.days) from im_hours h where h.project_id = p.project_id)
h.project_id = p.project_id ELSE
and h.day >= to_timestamp(:invoicing_start_date, 'YYYY-MM-DD') (select sum(h.hours) from im_hours h where h.project_id = p.project_id)
and h.day < to_timestamp(:invoicing_end_date, 'YYYY-MM-DD') END as reported_sum,
) as interval_sum, CASE WHEN t.uom_id = 321 THEN
(select sum(h.hours) from im_hours h where (select sum(h.days) from im_hours h where
h.project_id = p.project_id h.project_id = p.project_id
and h.invoice_id is null and h.day >= to_timestamp(:invoicing_start_date, 'YYYY-MM-DD')
) as unbilled_sum, and h.day < to_timestamp(:invoicing_end_date, 'YYYY-MM-DD')
)
ELSE
(select sum(h.hours) from im_hours h where
h.project_id = p.project_id
and h.day >= to_timestamp(:invoicing_start_date, 'YYYY-MM-DD')
and h.day < to_timestamp(:invoicing_end_date, 'YYYY-MM-DD')
)
END as interval_sum,
CASE WHEN t.uom_id = 321 THEN
(select sum(h.days) from im_hours h where
h.project_id = p.project_id
and h.invoice_id is null
)
ELSE
(select sum(h.hours) from im_hours h where
h.project_id = p.project_id
and h.invoice_id is null
)
END as unbilled_sum,
p.company_id, p.company_id,
parent.project_id, parent.project_id,
......
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