forked from elmau/empresa-libre
Tickets, ir al final en nota
This commit is contained in:
parent
bee911504b
commit
59de554b2b
|
@ -320,52 +320,11 @@ function calcular_precio_con_impuestos(precio, taxes){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function txt_ticket_new_cant_key_press(code, e){
|
function edit_cant(id){
|
||||||
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']){
|
if(!cfg_ticket['edit_cant']){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
$$('grid_tdetails').edit({row: id, column: 'cantidad'})
|
||||||
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()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,8 +341,8 @@ function agregar_producto(values){
|
||||||
producto['valor_unitario'] = calcular_precio_con_impuestos(
|
producto['valor_unitario'] = calcular_precio_con_impuestos(
|
||||||
parseFloat(producto['valor_unitario']), taxes)
|
parseFloat(producto['valor_unitario']), taxes)
|
||||||
producto['importe'] = producto['valor_unitario']
|
producto['importe'] = producto['valor_unitario']
|
||||||
grid.add(producto, 0)
|
var id = grid.add(producto, 0)
|
||||||
edit_cant()
|
edit_cant(id)
|
||||||
}else{
|
}else{
|
||||||
producto['cantidad'] = parseFloat(row.cantidad) + 1
|
producto['cantidad'] = parseFloat(row.cantidad) + 1
|
||||||
producto['descuento'] = parseFloat(row.descuento)
|
producto['descuento'] = parseFloat(row.descuento)
|
||||||
|
@ -725,13 +684,10 @@ function cmd_ticket_notes_click(){
|
||||||
var values = $$('form_new_ticket').getValues()
|
var values = $$('form_new_ticket').getValues()
|
||||||
$$('ticket_notes').setValue(values.notas)
|
$$('ticket_notes').setValue(values.notas)
|
||||||
$$('win_ticket_notes').show()
|
$$('win_ticket_notes').show()
|
||||||
|
to_end('ticket_notes')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~ function ticket_notes_key_up(){
|
|
||||||
//~ var value = this.getValue()
|
|
||||||
//~ $$('form_new_ticket').setValues({notas: value}, true)
|
|
||||||
//~ }
|
|
||||||
function cmd_ticket_save_note_click(){
|
function cmd_ticket_save_note_click(){
|
||||||
var value = $$('ticket_notes').getValue()
|
var value = $$('ticket_notes').getValue()
|
||||||
$$('form_new_ticket').setValues({notas: value}, true)
|
$$('form_new_ticket').setValues({notas: value}, true)
|
||||||
|
|
|
@ -50,6 +50,17 @@ function focus(name){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function to_end(name){
|
||||||
|
focus(name)
|
||||||
|
var txt = $$(name)
|
||||||
|
var pos = txt.getValue().length
|
||||||
|
var height = txt.getInputNode().scrollHeight
|
||||||
|
|
||||||
|
webix.html.setSelectionRange(txt.getInputNode(), pos)
|
||||||
|
txt.getInputNode().scrollTop = height
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function showvar(values){
|
function showvar(values){
|
||||||
webix.message(JSON.stringify(values, null, 2))
|
webix.message(JSON.stringify(values, null, 2))
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ var toolbar_new_ticket = {
|
||||||
view: 'toolbar', elements: [
|
view: 'toolbar', elements: [
|
||||||
{view: 'button', id: 'cmd_generar_ticket', label: 'Generar',
|
{view: 'button', id: 'cmd_generar_ticket', label: 'Generar',
|
||||||
icon: 'ticket', type: 'iconButton', autowidth: true,
|
icon: 'ticket', type: 'iconButton', autowidth: true,
|
||||||
align: 'center'}, {},
|
align: 'center', hotkey: 'Ctrl+g'}, {},
|
||||||
{view: 'button', id: 'cmd_ticket_notes', label: 'Notas',
|
{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',
|
{view: 'button', id: 'cmd_cerrar_ticket', label: 'Cerrar',
|
||||||
|
@ -457,7 +457,8 @@ var body_ticket_notes = {rows: [
|
||||||
placeholder: 'Captura las notas'},
|
placeholder: 'Captura las notas'},
|
||||||
{minHeight: 5, maxHeight: 5},
|
{minHeight: 5, maxHeight: 5},
|
||||||
{cols: [{}, {view: 'button', id: 'cmd_ticket_save_note', autowidth: true,
|
{cols: [{}, {view: 'button', id: 'cmd_ticket_save_note', autowidth: true,
|
||||||
label: 'Guardar y Cerrar', type: 'iconButton'}, {}]},
|
label: 'Guardar y Cerrar', type: 'iconButton', hotkey: 'Ctrl+enter'},
|
||||||
|
{}]},
|
||||||
{minHeight: 5, maxHeight: 5},
|
{minHeight: 5, maxHeight: 5},
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@ -474,6 +475,5 @@ var win_ticket_notes = {
|
||||||
head: 'Notas',
|
head: 'Notas',
|
||||||
body: body_ticket_notes,
|
body: body_ticket_notes,
|
||||||
})
|
})
|
||||||
//~ $$('ticket_notes').attachEvent('onTimedKeyPress', ticket_notes_key_up);
|
|
||||||
$$('cmd_ticket_save_note').attachEvent('onItemClick', cmd_ticket_save_note_click)
|
$$('cmd_ticket_save_note').attachEvent('onItemClick', cmd_ticket_save_note_click)
|
||||||
}}
|
}}
|
Loading…
Reference in New Issue