Add a grand total of unbilled hours and amount to the overview view
This commit is contained in:
parent
5ec8b170bc
commit
a744a4f0d1
17
stoptime.rb
17
stoptime.rb
|
@ -898,6 +898,7 @@ module StopTime::Controllers
|
||||||
@task_count = 0
|
@task_count = 0
|
||||||
@active_tasks = {}
|
@active_tasks = {}
|
||||||
@active_tasks_summary = {}
|
@active_tasks_summary = {}
|
||||||
|
@totals = [0.0, 0,0]
|
||||||
Customer.all.each do |customer|
|
Customer.all.each do |customer|
|
||||||
tasks = customer.unbilled_tasks
|
tasks = customer.unbilled_tasks
|
||||||
@tasks[customer] = tasks
|
@tasks[customer] = tasks
|
||||||
|
@ -908,7 +909,9 @@ module StopTime::Controllers
|
||||||
active_tasks.inject([0.0, 0.0]) do |summ, task|
|
active_tasks.inject([0.0, 0.0]) do |summ, task|
|
||||||
task_summ = task.summary
|
task_summ = task.summary
|
||||||
summ[0] += task_summ[0]
|
summ[0] += task_summ[0]
|
||||||
|
@totals[0] += task_summ[0]
|
||||||
summ[1] += task_summ[2]
|
summ[1] += task_summ[2]
|
||||||
|
@totals[1] += task_summ[2]
|
||||||
summ
|
summ
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1861,6 +1864,20 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ table
|
||||||
|
|
||||||
col.amount, col.hours, col.hourly_rate
|
col.amount, col.hours, col.hourly_rate
|
||||||
width: 85px
|
width: 85px
|
||||||
|
col.total_hours, col.total_amount
|
||||||
|
width: 130px
|
||||||
col.reg_hours
|
col.reg_hours
|
||||||
width: 90px
|
width: 90px
|
||||||
col.flag
|
col.flag
|
||||||
|
@ -93,6 +95,9 @@ table
|
||||||
td.indent
|
td.indent
|
||||||
padding-left: 20px
|
padding-left: 20px
|
||||||
|
|
||||||
|
table.grand-total
|
||||||
|
margin-top: 30px
|
||||||
|
|
||||||
/* Form layout */
|
/* Form layout */
|
||||||
.form-condensed
|
.form-condensed
|
||||||
padding-top: 0px
|
padding-top: 0px
|
||||||
|
|
Loading…
Reference in New Issue