Skip to content

Commit

Permalink
fixed some shit
Browse files Browse the repository at this point in the history
  • Loading branch information
cbdavide committed Nov 10, 2017
1 parent 9c56437 commit 5b2b659
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sales/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
padding-bottom: 0 !important;
margin-bottom: 0;
}
#back {
#back, #print {
display: none;
}
.containter {
Expand Down
4 changes: 3 additions & 1 deletion sales/static/js/listado.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ $(document).ready(function() {
console.log(data)
var registros = data.data

elements['cash'].text(data.today_cash)
elements['credit'].text(data.card_cash)

var ingresos = {}
Expand Down Expand Up @@ -64,6 +63,9 @@ $(document).ready(function() {
})
}

elements['cash'].text(data.today_cash - gastos['kenosis'])


})
})

Expand Down
4 changes: 3 additions & 1 deletion sales/static/js/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ $(document).ready(function() {
if(!data.ok){
alert(data.msg)
elements['bar_code'].val('')
elements['name'].val('')
elements['price'].val('')
elements['bar_code'].focus()

} else {
Expand Down Expand Up @@ -90,6 +92,7 @@ $(document).ready(function() {
if(data.ok) {
alert('El ingreso se registro correctamente.')
initialize(elements)
window.print()

} else {
alert(data.msg)
Expand Down Expand Up @@ -124,5 +127,4 @@ function initialize(elements) {
elements['cedula_cliente'].val('')

elements['pay_with_card'].prop('checked', false)

}
8 changes: 7 additions & 1 deletion sales/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ def post(self, *args, **kwargs):
class ProductDataJSONView(View):
def get(self, request, *args, **kwargs):
product_id = request.GET.get('code')
if not str(product_id).isdigit():
return JsonResponse({
'ok': False,
'msg': 'Producto no encontrado',
})

product = Product.objects.filter(code=product_id).first()
if not product:
return JsonResponse({
Expand All @@ -194,7 +200,7 @@ def get(self, request, *args, **kwargs):
yeison = {'data': []}


today = timezone.now()
today = timezone.localtime(timezone.now())

today_registers = Register.objects.filter(
date__date=today.date()
Expand Down

0 comments on commit 5b2b659

Please sign in to comment.