mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Add CB refills sum
This commit is contained in:
parent
ec8ee15d0e
commit
53a2a160be
@ -15,6 +15,9 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="submit" value="{% trans %}Go{% endtrans %}" />
|
<input type="submit" value="{% trans %}Go{% endtrans %}" />
|
||||||
</form>
|
</form>
|
||||||
|
<br>
|
||||||
|
<p>{% trans %}CB Payments{% endtrans %} : {{sum_cb}} €</p>
|
||||||
|
<br>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<td>{% trans %}Club{% endtrans %}</td>
|
<td>{% trans %}Club{% endtrans %}</td>
|
||||||
|
@ -1031,6 +1031,14 @@ class InvoiceCallView(CounterAdminTabsMixin, CounterAdminMixin, TemplateView):
|
|||||||
start_date = start_date.replace(tzinfo=pytz.UTC)
|
start_date = start_date.replace(tzinfo=pytz.UTC)
|
||||||
end_date = (start_date + timedelta(days=32)).replace(day=1, hour=0, minute=0, microsecond=0)
|
end_date = (start_date + timedelta(days=32)).replace(day=1, hour=0, minute=0, microsecond=0)
|
||||||
from django.db.models import Sum, Case, When, F, DecimalField
|
from django.db.models import Sum, Case, When, F, DecimalField
|
||||||
|
sum_cb = 0
|
||||||
|
for r in Refilling.objects.filter(payment_method='CARD', is_validated=True,
|
||||||
|
date__gte=start_date, date__lte=end_date):
|
||||||
|
sum_cb +=r.amount
|
||||||
|
for s in Selling.objects.filter(payment_method='CARD', is_validated=True,
|
||||||
|
date__gte=start_date, date__lte=end_date):
|
||||||
|
sum_cb +=s.quantity*s.unit_price
|
||||||
|
kwargs['sum_cb'] = sum_cb
|
||||||
kwargs['start_date'] = start_date
|
kwargs['start_date'] = start_date
|
||||||
kwargs['sums'] = Selling.objects.values('club__name').annotate(selling_sum=Sum(
|
kwargs['sums'] = Selling.objects.values('club__name').annotate(selling_sum=Sum(
|
||||||
Case(When(date__gte=start_date,
|
Case(When(date__gte=start_date,
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user