mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: ticket medio na home
This commit is contained in:
Binary file not shown.
@@ -24,6 +24,8 @@ RRB&C - DashBoard
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<h4> Quantidade de Pagamentos </h4>
|
<h4> Quantidade de Pagamentos </h4>
|
||||||
<h4> {{ qdt_pagamentos }} </h4>
|
<h4> {{ qdt_pagamentos }} </h4>
|
||||||
|
<h4> Tíket médio </h4>
|
||||||
|
<h4>R$ {{ ticekMedio |floatformat:2}} </h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ def home(request):
|
|||||||
total_pagamentos = Payments.objects.aggregate(total=Sum('value'))['total']
|
total_pagamentos = Payments.objects.aggregate(total=Sum('value'))['total']
|
||||||
qdt_pagamentos = Payments.objects.aggregate(total=Count('value'))['total']
|
qdt_pagamentos = Payments.objects.aggregate(total=Count('value'))['total']
|
||||||
pagamentos = Payments.objects.all()
|
pagamentos = Payments.objects.all()
|
||||||
|
ticekMedio = total_pagamentos / qdt_pagamentos
|
||||||
|
|
||||||
produtos_mais_vendidos = ProductComanda.objects.values('product').annotate(
|
produtos_mais_vendidos = ProductComanda.objects.values('product').annotate(
|
||||||
quantidade=Count('product'),
|
quantidade=Count('product'),
|
||||||
nome=F('product__name') ).order_by('-quantidade')[:5]
|
nome=F('product__name') ).order_by('-quantidade')[:5]
|
||||||
|
|
||||||
return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos})
|
return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos, 'ticekMedio': ticekMedio})
|
||||||
|
|||||||
Reference in New Issue
Block a user