forked from elmau/empresa-libre
Ticket, mostrar total arriba
This commit is contained in:
parent
b48d6bd1f5
commit
f8932d369d
|
@ -29,7 +29,6 @@ class AppEmpresas(object):
|
|||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
||||
|
||||
class AppLogin(object):
|
||||
template = 'login.html'
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ api.add_route('/movbanco', AppMovimientosBanco(db))
|
|||
session_options = {
|
||||
'session.type': 'file',
|
||||
'session.cookie_expires': True,
|
||||
'session.httponly': True,
|
||||
'session.data_dir': '/tmp/cache/data',
|
||||
'session.lock_dir': '/tmp/cache/lock',
|
||||
}
|
||||
|
|
|
@ -213,6 +213,8 @@ class StorageEngine(object):
|
|||
return main.PreFacturas.remove(id)
|
||||
if table == 'satimpuesto':
|
||||
return main.SATImpuestos.remove(id)
|
||||
if table == 'satunit':
|
||||
return main.SATUnidades.remove(id)
|
||||
if table == 'cuentasbanco':
|
||||
return main.CuentasBanco.remove(id)
|
||||
if table == 'movbanco':
|
||||
|
|
|
@ -167,6 +167,7 @@ def config_ticket():
|
|||
'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'),
|
||||
'total_up': Configuracion.get_bool('chk_ticket_total_up'),
|
||||
}
|
||||
return conf
|
||||
|
||||
|
@ -251,6 +252,7 @@ class Configuracion(BaseModel):
|
|||
'chk_ticket_pdf_show',
|
||||
'chk_ticket_direct_print',
|
||||
'chk_ticket_edit_cant',
|
||||
'chk_ticket_total_up',
|
||||
)
|
||||
data = (Configuracion
|
||||
.select()
|
||||
|
@ -990,6 +992,15 @@ class SATUnidades(BaseModel):
|
|||
)
|
||||
return tuple(rows)
|
||||
|
||||
@classmethod
|
||||
def remove(cls, id):
|
||||
with database_proxy.transaction():
|
||||
try:
|
||||
q = SATUnidades.delete().where(SATUnidades.id==id)
|
||||
return bool(q.execute())
|
||||
except IntegrityError:
|
||||
return False
|
||||
|
||||
|
||||
class SATFormaPago(BaseModel):
|
||||
key = TextField(unique=True, index=True)
|
||||
|
|
|
@ -34,6 +34,7 @@ var controllers = {
|
|||
$$('grid_admin_unidades').attachEvent('onCheck', grid_admin_unidades_on_check)
|
||||
$$('grid_admin_formasdepago').attachEvent('onCheck', grid_admin_formasdepago_on_check)
|
||||
$$('grid_unidad_found').attachEvent('onValueSuggest', grid_unidad_found_click)
|
||||
$$('grid_admin_unidades').attachEvent('onItemClick', grid_admin_unidades_click)
|
||||
$$('grid_moneda_found').attachEvent('onValueSuggest', grid_moneda_found_click)
|
||||
$$('cmd_agregar_impuesto').attachEvent('onItemClick', cmd_agregar_impuesto_click)
|
||||
//~ Usuarios
|
||||
|
@ -67,6 +68,7 @@ var controllers = {
|
|||
$$('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)
|
||||
$$('chk_ticket_total_up').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)
|
||||
|
@ -1364,9 +1366,9 @@ function grid_admin_taxes_click(id, e, node){
|
|||
return
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de borrar el impuesto seleccionado?'
|
||||
msg = '¿Estás seguro de borrar el Impuesto seleccionado?'
|
||||
webix.confirm({
|
||||
title: 'Borrar impuesto',
|
||||
title: 'Borrar Impuesto',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
|
@ -1381,6 +1383,44 @@ function grid_admin_taxes_click(id, e, node){
|
|||
}
|
||||
|
||||
|
||||
function delete_unit(id){
|
||||
var grid = $$('grid_admin_unidades')
|
||||
|
||||
webix.ajax().del('/values/satunit', {id: id}, function(text, xml, xhr){
|
||||
msg = 'Unidad eliminada correctamente'
|
||||
if(xhr.status == 200){
|
||||
grid.remove(id)
|
||||
msg_ok(msg)
|
||||
}else{
|
||||
msg = 'Unidad en uso, no se pudo eliminar.'
|
||||
msg_error(msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function grid_admin_unidades_click(id, e, node){
|
||||
if(id.column != 'delete'){
|
||||
return
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de borrar la Unidad seleccionada?'
|
||||
webix.confirm({
|
||||
title: 'Borrar Unidad',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
delete_unit(id.row)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function eliminar_cuenta_banco(id){
|
||||
var grid = $$('grid_emisor_cuentas_banco')
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ var tickets_controllers = {
|
|||
$$('grid_tickets_invoice').attachEvent('onItemDblClick', grid_tickets_invoice_double_click)
|
||||
$$('tsearch_client_key').attachEvent('onKeyPress', tsearch_client_key_press)
|
||||
$$('grid_ticket_clients_found').attachEvent('onValueSuggest', grid_ticket_clients_found_click)
|
||||
$$('grid_tdetails').attachEvent('onAfterRender', grid_tdetails_render)
|
||||
|
||||
|
||||
webix.extend($$('grid_tickets'), webix.ProgressBar)
|
||||
|
@ -120,6 +121,7 @@ function configuracion_inicial_ticket(){
|
|||
cfg_ticket['open_pdf'] = values.open_pdf
|
||||
cfg_ticket['direct_print'] = values.direct_print
|
||||
cfg_ticket['edit_cant'] = values.edit_cant
|
||||
cfg_ticket['total_up'] = values.total_up
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -171,6 +173,7 @@ function configuracion_inicial_nuevo_ticket(){
|
|||
grid.clearAll()
|
||||
table_pt.clear()
|
||||
table_totals.clear()
|
||||
show('grid_ticket_total_up', cfg_ticket['total_up'])
|
||||
$$('form_new_ticket').setValues({notas: '', forma_pago: last_forma_pago})
|
||||
}
|
||||
|
||||
|
@ -793,4 +796,15 @@ function cmd_ticket_report_xls_click(){
|
|||
ignore: {'pdf': true, 'print': true},
|
||||
rawValues: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function grid_tdetails_render(data){
|
||||
var total = 0.0
|
||||
this.eachRow(function(id){
|
||||
var item = this.getItem(id)
|
||||
total += item.importe
|
||||
})
|
||||
var id = $$('grid_ticket_total_up').getFirstId()
|
||||
$$('grid_ticket_total_up').updateItem(id, {total: total})
|
||||
}
|
|
@ -552,7 +552,9 @@ var options_admin_otros = [
|
|||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_ticket_edit_cant', labelWidth: 0,
|
||||
labelRight: 'Solicitar cantidad al agregar'},
|
||||
{maxWidth: 15}]},
|
||||
{view: 'checkbox', id: 'chk_ticket_total_up', labelWidth: 0,
|
||||
labelRight: 'Mostrar total arriba'},
|
||||
{}]},
|
||||
|
||||
{}]
|
||||
|
||||
|
@ -635,6 +637,7 @@ var grid_admin_bancos_cols = [
|
|||
|
||||
var grid_admin_unidades_cols = [
|
||||
{id: 'id', header: 'ID', hidden: true},
|
||||
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||
{id: 'key', header: 'Clave'},
|
||||
{id: 'name', header: 'Nombre', adjust: 'data'},
|
||||
{id: 'activo', header: 'Activa', template: '{common.checkbox()}',
|
||||
|
@ -661,7 +664,6 @@ var grid_admin_monedas = {
|
|||
view: 'datatable',
|
||||
id: 'grid_admin_monedas',
|
||||
select: 'cell',
|
||||
//~ multiselect: true,
|
||||
adjust: true,
|
||||
autoheight: true,
|
||||
autowidth: true,
|
||||
|
@ -674,7 +676,6 @@ var grid_admin_bancos = {
|
|||
view: 'datatable',
|
||||
id: 'grid_admin_bancos',
|
||||
select: 'cell',
|
||||
//~ multiselect: true,
|
||||
adjust: true,
|
||||
autowidth: true,
|
||||
headermenu: true,
|
||||
|
@ -687,13 +688,18 @@ var grid_admin_unidades = {
|
|||
view: 'datatable',
|
||||
id: 'grid_admin_unidades',
|
||||
select: 'cell',
|
||||
//~ multiselect: true,
|
||||
adjust: true,
|
||||
autowidth: true,
|
||||
autoheight: true,
|
||||
headermenu: true,
|
||||
footer: true,
|
||||
columns: grid_admin_unidades_cols,
|
||||
on:{
|
||||
'data->onStoreUpdated':function(){
|
||||
this.data.each(function(obj, i){
|
||||
obj.delete = '-'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -186,6 +186,27 @@ var toolbar_new_ticket = {
|
|||
]}
|
||||
|
||||
|
||||
var grid_ticket_total_up = {
|
||||
view: 'datatable',
|
||||
id: 'grid_ticket_total_up',
|
||||
adjust: true,
|
||||
autoheight: true,
|
||||
width: 250,
|
||||
header: false,
|
||||
footer: true,
|
||||
hidden: true,
|
||||
rowHeight: 0,
|
||||
columns: [
|
||||
{id: 'id', hidden: true},
|
||||
{id: 'title', width: 100,
|
||||
footer: {text: 'Total ', css: 'right_footer2'}},
|
||||
{id: 'total', fillspace: true, format: webix.i18n.priceFormat,
|
||||
footer: {content: 'summColumn', css: 'right_footer2'}},
|
||||
],
|
||||
data: [{id:0, title: '', total: 0.00}]
|
||||
}
|
||||
|
||||
|
||||
var cells_new_ticket = [
|
||||
{minHeight: 10, maxHeight: 10},
|
||||
toolbar_new_ticket,
|
||||
|
@ -198,7 +219,11 @@ var cells_new_ticket = [
|
|||
{view: 'fieldset', label: 'Información', body: body_ticket_informacion},
|
||||
]},
|
||||
]},
|
||||
{view: 'label', label: 'Detalle', height: 30, align: 'left'},
|
||||
{cols: [
|
||||
{view: 'label', label: 'Detalle', height: 30, align: 'left'},
|
||||
{},
|
||||
grid_ticket_total_up,
|
||||
]},
|
||||
grid_tdetails,
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue