feat: taxa de serviço conticionado a configuração (que ainda não existe rs)

This commit is contained in:
2025-02-21 10:33:03 -03:00
parent 46f0900763
commit fdb9d9e453
11 changed files with 63 additions and 18 deletions

View File

@@ -1,5 +1,7 @@
{% extends "base.html" %}
{% load static %}
{% load custom_filter_tag %}
@@ -34,7 +36,7 @@ Clientes
<tr>
<td ><a id="name-{{client.id}}" href="{% url 'viewClient' client.id %}">{{client.name}}</a></td>
<td id="debt-{{client.id}}" >R$ {{client.debt}}</td>
<td id="debt-{{client.id}}" >R$ {{client.id | totalFiado}}</td>
<td class="hide-on-mobile" id="contact-{{client.id}}" >{{client.contact}}</td>
<td hidden id="active-{{client.id}}" >{{client.active}}</td>
<td>

View File

@@ -16,7 +16,7 @@ Comandas
<body>
<div style="justify-self: center;">
<h4>{{client.name}}</h4>
<h4>R$ {{total}}</h4>
<h4>R$ {{client.id | totalFiado}}</h4>
</div>
<div class=" ">

View File

@@ -15,21 +15,24 @@ def clients(request):
return render(request, 'clients.html', {'clients': clients})
def viewClient(request,clientId):
# config = {
# 'taxa': False
# }
client = Client.objects.get(id=int(clientId))
comandas = Comanda.objects.filter(client = client).filter(status = 'FIADO')
total = Decimal(0)
for comanda in comandas:
totalConsumo = 0
totalParcial = 0
consumo = ProductComanda.objects.filter(comanda=comanda)
parcial = Payments.objects.filter(comanda=comanda)
for p in parcial:
totalParcial += p.value
for produto in consumo:
totalConsumo += produto.product.price
total+= (totalConsumo - totalParcial)
total+= round(total * Decimal(0.1), 2)
return render(request, 'viewclient.html', {'total': total, 'client': client, 'comandas': comandas})
# for comanda in comandas:
# totalConsumo = 0
# totalParcial = 0
# consumo = ProductComanda.objects.filter(comanda=comanda)
# parcial = Payments.objects.filter(comanda=comanda)
# for p in parcial:
# totalParcial += p.value
# for produto in consumo:
# totalConsumo += produto.product.price
# total+= (totalConsumo - totalParcial)
# total = total + round(total * Decimal(0.1), 2) if config['taxa'] else total
return render(request, 'viewclient.html', {'client': client, 'comandas': comandas})
@group_required(groupName='Gerente')