mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: taxa de serviso part1
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,7 +18,12 @@ def somar(consumo:ProductComanda, comanda:Comanda):
|
|||||||
totalParcial += p.value
|
totalParcial += p.value
|
||||||
for produto in consumo:
|
for produto in consumo:
|
||||||
total += Decimal(produto.product.price)
|
total += Decimal(produto.product.price)
|
||||||
return total - totalParcial
|
valores = {
|
||||||
|
'total':total,
|
||||||
|
'parcial':totalParcial,
|
||||||
|
'taxaTotal': round(total * Decimal(0.1), 2)
|
||||||
|
}
|
||||||
|
return valores
|
||||||
|
|
||||||
def listProduct(request, comanda_id):
|
def listProduct(request, comanda_id):
|
||||||
product = request.GET.get("search-product")
|
product = request.GET.get("search-product")
|
||||||
@@ -41,7 +46,8 @@ def addProduct(request, product_id, comanda_id):
|
|||||||
order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='')
|
order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='')
|
||||||
order.save()
|
order.save()
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||||
total = somar(consumo,comanda)
|
valores = somar(consumo,comanda)
|
||||||
|
total = valores['total'] - valores['parcial']
|
||||||
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
|
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
@@ -59,7 +65,8 @@ def removeProductComanda(request, productComanda_id):
|
|||||||
parcial = Payments.objects.filter(comanda=comanda)
|
parcial = Payments.objects.filter(comanda=comanda)
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda)
|
consumo = ProductComanda.objects.filter(comanda=comanda)
|
||||||
product_comanda.delete()
|
product_comanda.delete()
|
||||||
total = somar(consumo, comanda)
|
valores = somar(consumo,comanda)
|
||||||
|
total = valores['total'] - valores['parcial']
|
||||||
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
|
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
@@ -83,7 +90,8 @@ def paymentComanda(request, comanda_id):
|
|||||||
typePayment = TypePay.objects.get(id=1)
|
typePayment = TypePay.objects.get(id=1)
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||||
comanda = Comanda.objects.get(id=comanda_id)
|
comanda = Comanda.objects.get(id=comanda_id)
|
||||||
total = somar(consumo, comanda)
|
valores = somar(consumo,comanda)
|
||||||
|
total = valores['total'] - valores['parcial']
|
||||||
pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='tipo de pagamento mokado')
|
pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='tipo de pagamento mokado')
|
||||||
pagamento.save()
|
pagamento.save()
|
||||||
comanda.status = 'CLOSED'
|
comanda.status = 'CLOSED'
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ Detalhes {{comanda.name}}
|
|||||||
|
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center;"><b>Total R$ {{total}}</b></td>
|
<td colspan="2" style="text-align: center;"><b>Total R$ {{total}} - Taxa de serviso {{taxa}}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -29,7 +29,12 @@ def somar(consumo:ProductComanda, comanda:Comanda):
|
|||||||
totalParcial += p.value
|
totalParcial += p.value
|
||||||
for produto in consumo:
|
for produto in consumo:
|
||||||
total += Decimal(produto.product.price)
|
total += Decimal(produto.product.price)
|
||||||
return total - totalParcial
|
valores = {
|
||||||
|
'total':total,
|
||||||
|
'parcial':totalParcial,
|
||||||
|
'taxaTotal': round(total * Decimal(0.1), 2)
|
||||||
|
}
|
||||||
|
return valores
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def viewComanda(request):
|
def viewComanda(request):
|
||||||
@@ -51,8 +56,9 @@ def viewComanda(request):
|
|||||||
for p in products:
|
for p in products:
|
||||||
if p.name == produto['nome'] and p.active == True:
|
if p.name == produto['nome'] and p.active == True:
|
||||||
products_ordenados.append(p)
|
products_ordenados.append(p)
|
||||||
total = somar(consumo,comanda)
|
valores = somar(consumo,comanda)
|
||||||
return render(request, 'viewcomanda.html', {'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'total': total, 'products': products_ordenados,'mesas':mesas})
|
total = valores['total'] - valores['parcial']
|
||||||
|
return render(request, 'viewcomanda.html', {'taxa': valores['taxaTotal'],'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'total': total, 'products': products_ordenados,'mesas':mesas})
|
||||||
|
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user