Add a grand total of unbilled hours and amount to the overview view

This commit is contained in:
Paul van Tilburg 2015-06-19 22:02:13 +02:00
parent 5ec8b170bc
commit a744a4f0d1
2 changed files with 22 additions and 0 deletions

View File

@ -898,6 +898,7 @@ module StopTime::Controllers
@task_count = 0
@active_tasks = {}
@active_tasks_summary = {}
@totals = [0.0, 0,0]
Customer.all.each do |customer|
tasks = customer.unbilled_tasks
@tasks[customer] = tasks
@ -908,7 +909,9 @@ module StopTime::Controllers
active_tasks.inject([0.0, 0.0]) do |summ, task|
task_summ = task.summary
summ[0] += task_summ[0]
@totals[0] += task_summ[0]
summ[1] += task_summ[2]
@totals[1] += task_summ[2]
summ
end
end
@ -1861,6 +1864,20 @@ module StopTime::Views
end
end
end
div.row do
div.span12 do
table.table.table_condensed.grand_total do
col
col.total_hours
col.total_amount
tr do
td { big { b "Grand total" } }
td.text_right { big { b("%.2fh" % @totals[0]) } }
td.text_right { big { b("€ %.2f" % @totals[1]) } }
end
end
end
end
end
end

View File

@ -48,6 +48,8 @@ table
col.amount, col.hours, col.hourly_rate
width: 85px
col.total_hours, col.total_amount
width: 130px
col.reg_hours
width: 90px
col.flag
@ -93,6 +95,9 @@ table
td.indent
padding-left: 20px
table.grand-total
margin-top: 30px
/* Form layout */
.form-condensed
padding-top: 0px