fix: timesheet report not showing total amount correctly

This commit is contained in:
Anurag Mishra
2019-04-11 16:07:38 +05:30
parent 0f62b13dd8
commit 50db128ff1

View File

@@ -74,24 +74,17 @@ def get_data(filters):
if time_start <= from_date and time_end >= from_date: if time_start <= from_date and time_end >= from_date:
total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity, total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity,
time_end, from_date, total_hours, total_billable_hours, total_amount) time_end, from_date, total_hours, total_billable_hours, total_amount)
elif time_start <= to_date and time_end >= to_date:
billable_hours_worked += total_billable_hours
hours_worked += total_hours
working_cost += total_amount
elif time_start >= from_date and time_end >= to_date:
total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity, total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity,
to_date, time_start, total_hours, total_billable_hours, total_amount) to_date, time_start, total_hours, total_billable_hours, total_amount)
billable_hours_worked += total_billable_hours
hours_worked += total_hours
working_cost += total_amount
elif time_start >= from_date and time_end <= to_date: elif time_start >= from_date and time_end <= to_date:
total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity, total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity,
time_end, time_start, total_hours, total_billable_hours, total_amount) time_end, time_start, total_hours, total_billable_hours, total_amount)
billable_hours_worked += total_billable_hours
hours_worked += total_hours hours_worked += total_hours
working_cost += total_amount billable_hours_worked += total_billable_hours
working_cost += total_amount
row = { row = {
"employee": entries.employee, "employee": entries.employee,
@@ -101,7 +94,6 @@ def get_data(filters):
"total_hours": total_hours, "total_hours": total_hours,
"amount": total_amount "amount": total_amount
} }
if entries_exists: if entries_exists:
data.append(row) data.append(row)
entries_exists = False entries_exists = False