Solicitar cantidad en ticket
This commit is contained in:
parent
af26b9d62f
commit
233482c16c
|
@ -1894,6 +1894,8 @@ class ImportFacturaLibreGambas(object):
|
|||
|
||||
if not new['categoria']:
|
||||
new['categoria'] = None
|
||||
new['codigo_barras'] = new['codigo_barras'] or ''
|
||||
new['cuenta_predial'] = new['cuenta_predial'] or ''
|
||||
new['descripcion'] = ' '.join(new['descripcion'].split())
|
||||
new['clave_sat'] = DEFAULT_SAT_PRODUCTO
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ def config_ticket():
|
|||
conf = {
|
||||
'open_pdf': Configuracion.get_bool('chk_ticket_pdf_show'),
|
||||
'direct_print': Configuracion.get_bool('chk_ticket_direct_print'),
|
||||
'edit_cant': Configuracion.get_bool('chk_ticket_edit_cant'),
|
||||
}
|
||||
return conf
|
||||
|
||||
|
@ -245,6 +246,7 @@ class Configuracion(BaseModel):
|
|||
'chk_usar_punto_de_venta',
|
||||
'chk_ticket_pdf_show',
|
||||
'chk_ticket_direct_print',
|
||||
'chk_ticket_edit_cant',
|
||||
)
|
||||
data = (Configuracion
|
||||
.select()
|
||||
|
@ -4010,6 +4012,13 @@ class Tickets(BaseModel):
|
|||
|
||||
return inicio
|
||||
|
||||
def _without_tax(self, importe, obj):
|
||||
# ~ Por ahora se asume que solo tiene IVA trasladado 0.16
|
||||
for tax in obj.impuestos:
|
||||
tasa = 1.0 + float(tax.tasa)
|
||||
base = round(importe / tasa, DECIMALES)
|
||||
return base
|
||||
|
||||
def _calcular_totales(self, ticket, productos):
|
||||
subtotal = 0
|
||||
descuento_cfdi = 0
|
||||
|
@ -4024,7 +4033,7 @@ class Tickets(BaseModel):
|
|||
producto['producto'] = id_producto
|
||||
|
||||
cantidad = float(producto['cantidad'])
|
||||
valor_unitario = float(p.valor_unitario)
|
||||
valor_unitario = self._without_tax(self, producto['valor_unitario'], p)
|
||||
descuento = float(producto['descuento'])
|
||||
precio_final = valor_unitario - descuento
|
||||
importe = round(cantidad * precio_final, DECIMALES)
|
||||
|
@ -4198,7 +4207,6 @@ class Tickets(BaseModel):
|
|||
if tax.tipo == 'E':
|
||||
continue
|
||||
|
||||
|
||||
invoice_tax = {
|
||||
'factura': invoice.id,
|
||||
'impuesto': tax.id,
|
||||
|
@ -4943,10 +4951,13 @@ def _borrar_rfc():
|
|||
return
|
||||
|
||||
|
||||
def _listar_rfc():
|
||||
def _listar_rfc(detalle):
|
||||
data = util.get_rfcs()
|
||||
for row in data:
|
||||
msg = 'RFC: {}\n\t{}'.format(row[0], row[1])
|
||||
if detalle:
|
||||
msg = 'RFC: {}\n\t{}'.format(row[0], row[1])
|
||||
else:
|
||||
msg = 'RFC: {}'.format(row[0])
|
||||
log.info(msg)
|
||||
return
|
||||
|
||||
|
@ -5520,10 +5531,11 @@ help_lr = 'Listar RFCs'
|
|||
@click.option('-n', '--no-bd', is_flag=True, default=False)
|
||||
@click.option('-a', '--alta', is_flag=True, default=False)
|
||||
@click.option('-r', '--rfc')
|
||||
@click.option('-d', '--detalle', is_flag=True, default=False)
|
||||
def main(iniciar_bd, migrar_bd, nuevo_superusuario, cambiar_contraseña,
|
||||
agregar_rfc, borrar_rfc, listar_rfc, importar_valores, archivo, conexion,
|
||||
factura_libre, factura_libre_gambas, test, generar_archivo_productos,
|
||||
importar_productos, backup_dbs, no_bd, alta, rfc):
|
||||
importar_productos, backup_dbs, no_bd, alta, rfc, detalle):
|
||||
|
||||
opt = locals()
|
||||
|
||||
|
@ -5563,7 +5575,7 @@ def main(iniciar_bd, migrar_bd, nuevo_superusuario, cambiar_contraseña,
|
|||
sys.exit(0)
|
||||
|
||||
if opt['listar_rfc']:
|
||||
_listar_rfc()
|
||||
_listar_rfc(opt['detalle'])
|
||||
sys.exit(0)
|
||||
|
||||
if opt['importar_valores']:
|
||||
|
|
|
@ -64,6 +64,7 @@ var controllers = {
|
|||
$$('chk_usar_punto_de_venta').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_ticket_pdf_show').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_ticket_direct_print').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_ticket_edit_cant').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('txt_ticket_printer').attachEvent('onKeyPress', txt_ticket_printer_key_press)
|
||||
|
||||
$$('cmd_subir_bdfl').attachEvent('onItemClick', cmd_subir_bdfl_click)
|
||||
|
|
|
@ -258,10 +258,6 @@ function precio_con_impuestos_change(new_value, old_value){
|
|||
}
|
||||
|
||||
|
||||
//~ function clave_sat_icon_click(){
|
||||
//~ show('Buscar SAT')
|
||||
//~ }
|
||||
|
||||
function calcular_sin_impuestos(value, taxes){
|
||||
var vu = $$('valor_unitario')
|
||||
var precio = value
|
||||
|
|
|
@ -119,6 +119,7 @@ function configuracion_inicial_ticket(){
|
|||
//~ showvar(values)
|
||||
cfg_ticket['open_pdf'] = values.open_pdf
|
||||
cfg_ticket['direct_print'] = values.direct_print
|
||||
cfg_ticket['edit_cant'] = values.edit_cant
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -310,6 +311,55 @@ function calcular_precio_con_impuestos(precio, taxes){
|
|||
}
|
||||
|
||||
|
||||
function txt_ticket_new_cant_key_press(code, e){
|
||||
var value = this.getValue()
|
||||
if(code == 13){
|
||||
var grid = $$('grid_tdetails')
|
||||
var row = grid.getItem(grid.getFirstId())
|
||||
var cant = value.to_float()
|
||||
if(!cant){
|
||||
cant = 1.0
|
||||
}
|
||||
if(cant != 1){
|
||||
var precio_final = row.valor_unitario - row.descuento
|
||||
importe = (cant * precio_final).round(DECIMALES)
|
||||
grid.updateItem(row.id, {cantidad: cant, importe: importe})
|
||||
grid.refresh()
|
||||
}
|
||||
$$('win_edit_cant').hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function edit_cant(){
|
||||
if(!cfg_ticket['edit_cant']){
|
||||
return
|
||||
}
|
||||
|
||||
var row = $$('grid_tdetails').getItem($$('grid_tdetails').getFirstId())
|
||||
var win = webix.ui({
|
||||
view: 'window',
|
||||
id: 'win_edit_cant',
|
||||
autoheight: true,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Captura la cantidad',
|
||||
body: {rows: [{view: 'text', id: 'txt_ticket_new_cant', width: 150,
|
||||
value: 1}]
|
||||
},
|
||||
})
|
||||
$$('txt_ticket_new_cant').attachEvent('onKeyPress', txt_ticket_new_cant_key_press)
|
||||
|
||||
win.show(
|
||||
$$('tsearch_product_name').getInputNode(),
|
||||
{pos: "bottom", x: 50, y: 10}
|
||||
)
|
||||
focus('txt_ticket_new_cant')
|
||||
$$('txt_ticket_new_cant').getInputNode().select()
|
||||
|
||||
}
|
||||
|
||||
|
||||
function agregar_producto(values){
|
||||
var taxes = values.taxes
|
||||
var producto = values.row
|
||||
|
@ -323,7 +373,8 @@ function agregar_producto(values){
|
|||
producto['valor_unitario'] = calcular_precio_con_impuestos(
|
||||
parseFloat(producto['valor_unitario']), taxes)
|
||||
producto['importe'] = producto['valor_unitario']
|
||||
grid.add(producto)
|
||||
grid.add(producto, 0)
|
||||
edit_cant()
|
||||
}else{
|
||||
producto['cantidad'] = parseFloat(row.cantidad) + 1
|
||||
producto['descuento'] = parseFloat(row.descuento)
|
||||
|
|
|
@ -545,6 +545,10 @@ var options_admin_otros = [
|
|||
label: 'Impresora: ', labelWidth: 75, labelAlign: 'right',
|
||||
placeholder: 'ENTER para guardar'},
|
||||
{maxWidth: 15}]},
|
||||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_ticket_edit_cant', labelWidth: 0,
|
||||
labelRight: 'Solicitar cantidad al agregar'},
|
||||
{maxWidth: 15}]},
|
||||
|
||||
{}]
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ var grid_tickets = {
|
|||
view: 'datatable',
|
||||
id: 'grid_tickets',
|
||||
select: 'row',
|
||||
scrollY: true,
|
||||
adjust: true,
|
||||
footer: true,
|
||||
resizeColumn: true,
|
||||
|
@ -174,10 +175,15 @@ var body_ticket_informacion = {rows: [
|
|||
|
||||
|
||||
var toolbar_new_ticket = {
|
||||
view: 'toolbar', elements: [{},
|
||||
view: 'toolbar', elements: [
|
||||
{view: 'button', id: 'cmd_generar_ticket', label: 'Generar',
|
||||
icon: 'ticket', type: 'iconButton', autowidth: true,
|
||||
align: 'center'}, {},
|
||||
{view: 'button', id: 'cmd_ticket_notes', label: 'Notas',
|
||||
autowidth: true, type: 'iconButton', icon: 'commenting-o'},
|
||||
{}]}
|
||||
autowidth: true, type: 'iconButton', icon: 'commenting-o'}, {},
|
||||
{view: 'button', id: 'cmd_cerrar_ticket', label: 'Cerrar',
|
||||
type: 'danger', autowidth: true, align: 'center'}
|
||||
]}
|
||||
|
||||
|
||||
var cells_new_ticket = [
|
||||
|
@ -194,20 +200,6 @@ var cells_new_ticket = [
|
|||
]},
|
||||
{view: 'label', label: 'Detalle', height: 30, align: 'left'},
|
||||
grid_tdetails,
|
||||
{minHeight: 20, maxHeight: 20},
|
||||
{margin: 20, cols: [{},
|
||||
{view: 'button', id: 'cmd_generar_ticket', label: 'Generar',
|
||||
icon: 'ticket', type: 'iconButton', autowidth: true, align: 'center'},
|
||||
{}]
|
||||
},
|
||||
{rows: [
|
||||
{template: '', type: 'section'},
|
||||
{margin: 10, cols: [{},
|
||||
{view: 'button', id: 'cmd_cerrar_ticket', label: 'Cerrar',
|
||||
type: 'danger', autowidth: true, align: 'center'}
|
||||
]
|
||||
},
|
||||
]}
|
||||
]
|
||||
|
||||
|
||||
|
@ -219,12 +211,6 @@ var toolbar_ticket_invoice = {view: 'toolbar', elements: [{},
|
|||
]}
|
||||
|
||||
|
||||
//~ var toolbar_new_ticket = {view: 'toolbar', elements: [{},
|
||||
//~ {view: 'button', id: 'cmd_ticket_notes', label: 'Notas',
|
||||
//~ type: 'iconButton', autowidth: true, icon: 'commenting-o'},
|
||||
//~ {}]}
|
||||
|
||||
|
||||
var ticket_suggest_partners = {
|
||||
view: 'gridsuggest',
|
||||
id: 'grid_ticket_clients_found',
|
||||
|
@ -365,14 +351,6 @@ var controls_ticket_to_invoice = [
|
|||
icon: 'ticket', type: 'iconButton', autowidth: true, align: 'center'},
|
||||
{}]
|
||||
},
|
||||
//~ {rows: [
|
||||
//~ {template: '', type: 'section'},
|
||||
//~ {margin: 10, cols: [{},
|
||||
//~ {view: 'button', id: 'cmd_close_ticket_invoice', label: 'Cerrar',
|
||||
//~ type: 'danger', autowidth: true, align: 'center'}
|
||||
//~ ]
|
||||
//~ },
|
||||
//~ ]}
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue