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) typePayment = TypePay.objects.get(id=1)
consumo = ProductComanda.objects.filter(comanda=comanda_id) consumo = ProductComanda.objects.filter(comanda=comanda_id)
vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO') vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO')
print('ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg')
print(f'ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg{vendasBalcao.id}')
comanda = Comanda.objects.get(name='VENDA BALCÃO') comanda = Comanda.objects.get(name='VENDA BALCÃO')
total = 0 total = 0
for produto in consumo: for produto in consumo:
total += produto.product.price total += produto.product.price
produto.comanda = 14 produto.comanda = vendasBalcao
produto.save() 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 = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALCÃO')
pagamento.save() pagamento.save()
# comanda.save() # comanda.save()
return redirect('comandas') return redirect('viewBalcao')

View File

@@ -186,7 +186,7 @@
<ul> <ul>
</ul> </ul>
<footer> <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 Comfimar
</button> </button>

View File

@@ -16,10 +16,10 @@ htmx_urlpatterns = [
# path('listProduct/', htmx_views.listProduct, name='listProduct'), # path('listProduct/', htmx_views.listProduct, name='listProduct'),
path('listProduct/<int:comanda_id>/', htmx_views.listProductBalcao, name='listProductBalcao'), path('listProduct/<int:comanda_id>/', htmx_views.listProductBalcao, name='listProductBalcao'),
path('addProduct<int:product_id>/<int:comanda_id>/', htmx_views.addProductBalcao, name='addProductBalcao'), 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('closeComanda<int:comanda_id>/', htmx_views.closeComanda, name='closeComanda'),
# path('reopenComanda<int:comanda_id>/', htmx_views.reopenComanda, name='reopenComanda'), # 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 urlpatterns += htmx_urlpatterns

Binary file not shown.

View File

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