Fix calc of daily sale
This commit is contained in:
parent
eca2d2d2a9
commit
44ff50d0f6
@ -1,8 +1,10 @@
|
|||||||
from django import template
|
|
||||||
from billard.models import Accounting
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
from django import template
|
||||||
from django.db.models import Sum
|
from django.db.models import Sum
|
||||||
|
|
||||||
|
from billard.models import Accounting
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
@ -10,9 +12,8 @@ register = template.Library()
|
|||||||
def display_daily_sale(location):
|
def display_daily_sale(location):
|
||||||
start_date = datetime.now().replace(hour=5, minute=0, second=0, microsecond=0)
|
start_date = datetime.now().replace(hour=5, minute=0, second=0, microsecond=0)
|
||||||
end_date = start_date + timedelta(days=1)
|
end_date = start_date + timedelta(days=1)
|
||||||
prize__sum = Accounting.objects.filter(billed=True,
|
prize__sum = Accounting.objects.filter(desk__client__location=location,
|
||||||
desk__client__location=location,
|
time_to__range=(start_date, end_date)).aggregate(Sum('prize'))
|
||||||
account_tst__range=(start_date, end_date)).aggregate(Sum('prize'))
|
|
||||||
if prize__sum['prize__sum'] is None:
|
if prize__sum['prize__sum'] is None:
|
||||||
prize__sum['prize__sum'] = 0
|
prize__sum['prize__sum'] = 0
|
||||||
return "Tagesumsatz: {0:.2f} EUR".format(prize__sum['prize__sum'])
|
return "Tagesumsatz: {0:.2f} EUR".format(prize__sum['prize__sum'])
|
||||||
|
Loading…
Reference in New Issue
Block a user