contabilizar produtos vendidos no balcão

This commit is contained in:
2024-12-26 10:37:05 -03:00
parent 63c9859557
commit a9896730eb
7 changed files with 29 additions and 37 deletions

View File

@@ -35,22 +35,14 @@ def paymentBalcao(request, comanda_id):
typePayment = TypePay.objects.get(id=1)
consumo = ProductComanda.objects.filter(comanda=comanda_id)
vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO')
print('ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg')
print(f'ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg{vendasBalcao.id}')
comanda = Comanda.objects.get(name='VENDA BALCÃO')
total = 0
for produto in consumo:
total += produto.product.price
produto.comanda = 14
produto.comanda = vendasBalcao
produto.save()
# newObject = ProductComanda.objects.get(comanda=produto.id)
# newObject.comanda= 14
# newObject.save()
pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALCÃO')
pagamento.save()
# comanda.save()
return redirect('comandas')
return redirect('viewBalcao')

View File

@@ -186,7 +186,7 @@
<ul>
</ul>
<footer>
<button class="secondary" hx-get="{% url 'paymentComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="backPage()">
<button class="secondary" hx-get="{% url 'paymentBalcao' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="backPage()">
Comfimar
</button>

View File

@@ -16,10 +16,10 @@ htmx_urlpatterns = [
# path('listProduct/', htmx_views.listProduct, name='listProduct'),
path('listProduct/<int:comanda_id>/', htmx_views.listProductBalcao, name='listProductBalcao'),
path('addProduct<int:product_id>/<int:comanda_id>/', htmx_views.addProductBalcao, name='addProductBalcao'),
path('removeProductComanda<int:productComanda_id>/', htmx_views.removeProductBalcao, name='removeProductBalcao'),
path('removeProductBalcao<int:productComanda_id>/', htmx_views.removeProductBalcao, name='removeProductBalcao'),
# path('closeComanda<int:comanda_id>/', htmx_views.closeComanda, name='closeComanda'),
# path('reopenComanda<int:comanda_id>/', htmx_views.reopenComanda, name='reopenComanda'),
path('paymentComanda<int:comanda_id>/', htmx_views.paymentBalcao, name='paymentBalcao'),
path('paymentBalcao<int:comanda_id>/', htmx_views.paymentBalcao, name='paymentBalcao'),
]
urlpatterns += htmx_urlpatterns

Binary file not shown.

View File

@@ -108,30 +108,30 @@ function teclado(event){
if (event.keyCode == 50){
document.getElementById('qtd-product').innerHTML = '2'
}
else if (event.keyCode == 73){
imprimirFichas()
}
else if (event.keyCode == 51){
document.getElementById('qtd-product').innerHTML = '3'
}
else if (event.keyCode == 52){
document.getElementById('qtd-product').innerHTML = '4'
}
else if (event.keyCode == 53){
document.getElementById('qtd-product').innerHTML = '5'
}
else if (event.keyCode == 54){
document.getElementById('qtd-product').innerHTML = '6'
}
else if (event.keyCode == 55){
document.getElementById('qtd-product').innerHTML = '7'
}
else if (event.keyCode == 56){
document.getElementById('qtd-product').innerHTML = '8'
}
else if (event.keyCode == 57){
document.getElementById('qtd-product').innerHTML = '9'
}
// else if (event.keyCode == 73){
// imprimirFichas()
// }
// else if (event.keyCode == 51){
// document.getElementById('qtd-product').innerHTML = '3'
// }
// else if (event.keyCode == 52){
// document.getElementById('qtd-product').innerHTML = '4'
// }
// else if (event.keyCode == 53){
// document.getElementById('qtd-product').innerHTML = '5'
// }
// else if (event.keyCode == 54){
// document.getElementById('qtd-product').innerHTML = '6'
// }
// else if (event.keyCode == 55){
// document.getElementById('qtd-product').innerHTML = '7'
// }
// else if (event.keyCode == 56){
// document.getElementById('qtd-product').innerHTML = '8'
// }
// else if (event.keyCode == 57){
// document.getElementById('qtd-product').innerHTML = '9'
// }
}