Fix bugs in report generation
This commit is contained in:
parent
18510cc0b2
commit
3fac4591a1
|
@ -130,7 +130,7 @@ def shift_filter(get_self):
|
||||||
| Q(price__management__provider__user__username=user)) \
|
| Q(price__management__provider__user__username=user)) \
|
||||||
.order_by('provider_approved', 'set_start')
|
.order_by('provider_approved', 'set_start')
|
||||||
if completed is not 'unspecified':
|
if completed is not 'unspecified':
|
||||||
shifts = shifts.exclude(actual_end__isnull=completed)
|
shifts = shifts.exclude(actual_end__isnull=completed) # leave actual_end
|
||||||
if provider_approved is not 'unspecified':
|
if provider_approved is not 'unspecified':
|
||||||
shifts = shifts.filter(provider_approved=provider_approved)
|
shifts = shifts.filter(provider_approved=provider_approved)
|
||||||
if manage:
|
if manage:
|
||||||
|
@ -183,13 +183,13 @@ def gen_timesheets(user, payday, manage=None):
|
||||||
timesheets = []
|
timesheets = []
|
||||||
|
|
||||||
shifts = Shift.objects.filter(deleted=False) \
|
shifts = Shift.objects.filter(deleted=False) \
|
||||||
.exclude(actual_end__isnull=True) \
|
.exclude(approved_end__isnull=True) \
|
||||||
.filter(
|
.filter(
|
||||||
Q(price__management__client__user__username=user)
|
Q(price__management__client__user__username=user)
|
||||||
| Q(price__management__provider__user__username=user)) \
|
| Q(price__management__provider__user__username=user)) \
|
||||||
.filter(approved_date=paystart) \
|
.filter(approved_date__gte=paystart) \
|
||||||
.filter(approved_date=payend) \
|
.filter(approved_date__lte=payend) \
|
||||||
.order_by('price__management', 'actual_start')
|
.order_by('price__management', 'approved_start')
|
||||||
if manage:
|
if manage:
|
||||||
shifts = shifts.filter(price__management__uuid=manage)
|
shifts = shifts.filter(price__management__uuid=manage)
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ def gen_timesheets(user, payday, manage=None):
|
||||||
for s in shifts:
|
for s in shifts:
|
||||||
shift = {}
|
shift = {}
|
||||||
shift['date'] = s.approved_date
|
shift['date'] = s.approved_date
|
||||||
shift['start'] = s.actual_start
|
shift['start'] = s.approved_start
|
||||||
shift['end'] = s.actual_end
|
shift['end'] = s.approved_end
|
||||||
shift['hours'] = (shift['end'] - shift['start']).total_seconds() / 3600
|
shift['hours'] = (shift['end'] - shift['start']).total_seconds() / 3600
|
||||||
shift['rate'] = s.set_price
|
shift['rate'] = s.set_price
|
||||||
shift['amount'] = Decimal(shift['hours']) * shift['rate']
|
shift['amount'] = Decimal(shift['hours']) * shift['rate']
|
||||||
|
|
Loading…
Reference in New Issue
Block a user