Show a total of unbilled time and earned money (excl. VAT) per customer
This commit is contained in:
parent
d1ac6ff979
commit
35462ed0dd
12
stoptime.rb
12
stoptime.rb
|
@ -759,10 +759,17 @@ module StopTime::Controllers
|
|||
# Views#overview.
|
||||
def get
|
||||
@tasks = {}
|
||||
@tasks_summary = {}
|
||||
@task_count = 0
|
||||
Customer.all.each do |customer|
|
||||
tasks = customer.active_tasks
|
||||
@tasks[customer] = tasks
|
||||
@tasks_summary[customer] = tasks.inject([0.0, 0.0]) do |summ, task|
|
||||
task_summ = task.summary
|
||||
summ[0] += task_summ[0]
|
||||
summ[1] += task_summ[2]
|
||||
summ
|
||||
end
|
||||
@task_count += tasks.count
|
||||
end
|
||||
render :overview
|
||||
|
@ -1614,6 +1621,11 @@ module StopTime::Views
|
|||
td.text_right { "€ %.2f" % summary[2] }
|
||||
end
|
||||
end
|
||||
tr do
|
||||
td { b "Total" }
|
||||
td.text_right { "%.2fh" % @tasks_summary[customer][0] }
|
||||
td.text_right { "€ %.2f" % @tasks_summary[customer][1] }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue