forked from elmau/empresa-libre
Refactorizar notas
This commit is contained in:
commit
1cd9b541a3
|
@ -1007,6 +1007,7 @@ class PrintTicket(object):
|
||||||
self._set('center', 'B', 'B', 2)
|
self._set('center', 'B', 'B', 2)
|
||||||
self._t(data['rfc'])
|
self._t(data['rfc'])
|
||||||
self._set('center', 'A')
|
self._set('center', 'A')
|
||||||
|
self._t(data['regimen'])
|
||||||
self._t(data['address'])
|
self._t(data['address'])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -3765,7 +3765,7 @@ class PreFacturasDetalle(BaseModel):
|
||||||
def facturar(cls, id):
|
def facturar(cls, id):
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
q = PreFacturas.select(PreFacturas.cliente).where(PreFacturas.id==id)[0]
|
q = PreFacturas.select().where(PreFacturas.id==id)[0]
|
||||||
if q.cliente.forma_pago is None:
|
if q.cliente.forma_pago is None:
|
||||||
forma_pago = ''
|
forma_pago = ''
|
||||||
else:
|
else:
|
||||||
|
@ -3782,6 +3782,7 @@ class PreFacturasDetalle(BaseModel):
|
||||||
'rfc': q.cliente.rfc,
|
'rfc': q.cliente.rfc,
|
||||||
'forma_pago': forma_pago,
|
'forma_pago': forma_pago,
|
||||||
'uso_cfdi': uso_cfdi,
|
'uso_cfdi': uso_cfdi,
|
||||||
|
'notas': q.notas,
|
||||||
}
|
}
|
||||||
|
|
||||||
productos = PreFacturasDetalle.select().where(
|
productos = PreFacturasDetalle.select().where(
|
||||||
|
@ -4416,6 +4417,7 @@ class Tickets(BaseModel):
|
||||||
formapago = SATFormaPago.get(SATFormaPago.key==obj['forma_pago'])
|
formapago = SATFormaPago.get(SATFormaPago.key==obj['forma_pago'])
|
||||||
|
|
||||||
emisor = util.get_dict(Emisor.select().dicts()[0])
|
emisor = util.get_dict(Emisor.select().dicts()[0])
|
||||||
|
|
||||||
emisor['nointerior'] = emisor['no_interior']
|
emisor['nointerior'] = emisor['no_interior']
|
||||||
emisor['noexterior'] = emisor['no_exterior']
|
emisor['noexterior'] = emisor['no_exterior']
|
||||||
emisor['codigopostal'] = emisor['codigo_postal']
|
emisor['codigopostal'] = emisor['codigo_postal']
|
||||||
|
@ -4467,11 +4469,13 @@ class Tickets(BaseModel):
|
||||||
|
|
||||||
def _format_ticket(self, id):
|
def _format_ticket(self, id):
|
||||||
emisor = util.get_dict(Emisor.select().dicts()[0])
|
emisor = util.get_dict(Emisor.select().dicts()[0])
|
||||||
|
regimen = Emisor.select()[0].regimenes[0].name
|
||||||
ticket = Tickets.select().where(Tickets.id==id).dicts()[0]
|
ticket = Tickets.select().where(Tickets.id==id).dicts()[0]
|
||||||
products = TicketsDetalle.get_by_print(id)
|
products = TicketsDetalle.get_by_print(id)
|
||||||
|
print (regimen)
|
||||||
emisor['name'] = '{}\n'.format(emisor['nombre'])
|
emisor['name'] = '{}\n'.format(emisor['nombre'])
|
||||||
emisor['rfc'] = 'RFC: {}\n'.format(emisor['rfc'])
|
emisor['rfc'] = 'RFC: {}\n'.format(emisor['rfc'])
|
||||||
|
emisor['regimen'] = 'Regimen: {}\n'.format(regimen)
|
||||||
interior = ''
|
interior = ''
|
||||||
if emisor['no_interior']:
|
if emisor['no_interior']:
|
||||||
interior = ', {}'.format(emisor['no_interior'])
|
interior = ', {}'.format(emisor['no_interior'])
|
||||||
|
|
|
@ -651,11 +651,13 @@ function search_client_by_id(id){
|
||||||
|
|
||||||
|
|
||||||
function set_client(row){
|
function set_client(row){
|
||||||
|
showvar(row)
|
||||||
var form = $$('form_invoice')
|
var form = $$('form_invoice')
|
||||||
var html = '<span class="webix_icon fa-user"></span><span class="lbl_partner">'
|
var html = '<span class="webix_icon fa-user"></span><span class="lbl_partner">'
|
||||||
form.setValues({
|
form.setValues({
|
||||||
id_partner:row.id, search_client_id:'', search_client_name:'',
|
id_partner:row.id, search_client_id:'', search_client_name:'',
|
||||||
forma_pago: row.forma_pago, uso_cfdi: row.uso_cfdi}, true)
|
forma_pago: row.forma_pago, uso_cfdi: row.uso_cfdi,
|
||||||
|
notas: row.notas}, true)
|
||||||
html += row.nombre + ' (' + row.rfc + ')</span>'
|
html += row.nombre + ' (' + row.rfc + ')</span>'
|
||||||
$$('lbl_client').setValue(html)
|
$$('lbl_client').setValue(html)
|
||||||
$$('cmd_cfdi_relacionados').enable()
|
$$('cmd_cfdi_relacionados').enable()
|
||||||
|
@ -1306,6 +1308,7 @@ function cmd_prefactura_click(){
|
||||||
data['metodo_pago'] = $$('lst_metodo_pago').getValue()
|
data['metodo_pago'] = $$('lst_metodo_pago').getValue()
|
||||||
data['uso_cfdi'] = $$('lst_uso_cfdi').getValue()
|
data['uso_cfdi'] = $$('lst_uso_cfdi').getValue()
|
||||||
data['regimen_fiscal'] = $$('lst_regimen_fiscal').getValue()
|
data['regimen_fiscal'] = $$('lst_regimen_fiscal').getValue()
|
||||||
|
data['notas'] = values.notas
|
||||||
|
|
||||||
if(!save_preinvoice(data)){
|
if(!save_preinvoice(data)){
|
||||||
return
|
return
|
||||||
|
@ -1457,7 +1460,6 @@ function refacturar_preinvoice(id){
|
||||||
for(var p of values.rows){
|
for(var p of values.rows){
|
||||||
agregar_preproducto(p)
|
agregar_preproducto(p)
|
||||||
}
|
}
|
||||||
//~ calculate_taxes()
|
|
||||||
calcular_impuestos()
|
calcular_impuestos()
|
||||||
$$('tv_invoice').getTabbar().setValue('Generar')
|
$$('tv_invoice').getTabbar().setValue('Generar')
|
||||||
}
|
}
|
||||||
|
@ -1704,13 +1706,18 @@ function lst_serie_change(nv, ov){
|
||||||
|
|
||||||
function cmd_cfdi_notes_click(){
|
function cmd_cfdi_notes_click(){
|
||||||
win_invoice_notes.init()
|
win_invoice_notes.init()
|
||||||
$$('win_cfdi_notes').show()
|
var values = $$('form_invoice').getValues()
|
||||||
|
$$('invoice_notes').setValue(values.notas)
|
||||||
|
$$('win_invoice_notes').show()
|
||||||
|
to_end('invoice_notes')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function cfdi_notes_key_up(){
|
function cmd_invoice_save_note_click(){
|
||||||
var value = this.getValue()
|
var value = $$('invoice_notes').getValue()
|
||||||
$$('form_invoice').setValues({notas: value}, true)
|
$$('form_invoice').setValues({notas: value}, true)
|
||||||
|
$$('win_invoice_notes').close()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ var tickets_controllers = {
|
||||||
$$('grid_ticket_clients_found').attachEvent('onValueSuggest', grid_ticket_clients_found_click)
|
$$('grid_ticket_clients_found').attachEvent('onValueSuggest', grid_ticket_clients_found_click)
|
||||||
$$('grid_tdetails').attachEvent('onAfterRender', grid_tdetails_render)
|
$$('grid_tdetails').attachEvent('onAfterRender', grid_tdetails_render)
|
||||||
|
|
||||||
|
|
||||||
webix.extend($$('grid_tickets'), webix.ProgressBar)
|
webix.extend($$('grid_tickets'), webix.ProgressBar)
|
||||||
webix.extend($$('grid_tickets_active'), webix.ProgressBar)
|
webix.extend($$('grid_tickets_active'), webix.ProgressBar)
|
||||||
}
|
}
|
||||||
|
@ -321,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()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,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)
|
||||||
|
@ -726,12 +684,15 @@ 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(){
|
function cmd_ticket_save_note_click(){
|
||||||
var value = this.getValue()
|
var value = $$('ticket_notes').getValue()
|
||||||
$$('form_new_ticket').setValues({notas: value}, true)
|
$$('form_new_ticket').setValues({notas: value}, true)
|
||||||
|
$$('win_ticket_notes').close()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,11 +138,14 @@ var ui_invoice = {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var body_cfdi_notes = {rows: [
|
var body_cfdi_notes = {rows: [
|
||||||
{minHeight: 5, maxHeight: 5},
|
{minHeight: 5, maxHeight: 5},
|
||||||
{view: 'textarea', id: 'cfdi_notes', name: 'cfdi_notes', height: 300,
|
{view: 'textarea', id: 'invoice_notes', name: 'invoice_notes', height: 300,
|
||||||
placeholder: 'Captura las notas, se autoguarda al escribir.'},
|
placeholder: 'Captura las notas.'},
|
||||||
|
{minHeight: 5, maxHeight: 5},
|
||||||
|
{cols: [{}, {view: 'button', id: 'cmd_invoice_save_note', autowidth: true,
|
||||||
|
label: 'Guardar y Cerrar', type: 'iconButton', hotkey: 'Ctrl+enter'},
|
||||||
|
{}]},
|
||||||
{minHeight: 5, maxHeight: 5},
|
{minHeight: 5, maxHeight: 5},
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@ -151,22 +154,17 @@ var win_invoice_notes = {
|
||||||
init: function(){
|
init: function(){
|
||||||
webix.ui({
|
webix.ui({
|
||||||
view: 'window',
|
view: 'window',
|
||||||
id: 'win_cfdi_notes',
|
id: 'win_invoice_notes',
|
||||||
height: 350,
|
height: 400,
|
||||||
width: 500,
|
width: 500,
|
||||||
modal: true,
|
modal: true,
|
||||||
position: 'center',
|
position: 'center',
|
||||||
head: {view: 'toolbar',
|
head: 'Notas',
|
||||||
elements: [
|
|
||||||
{view: 'label', label: 'Notas'},
|
|
||||||
{view: 'icon', icon: 'times-circle',
|
|
||||||
click: '$$("win_cfdi_notes").close()'},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
body: body_cfdi_notes,
|
body: body_cfdi_notes,
|
||||||
})
|
})
|
||||||
$$('cfdi_notes').attachEvent('onTimedKeyPress', cfdi_notes_key_up);
|
$$('cmd_invoice_save_note').attachEvent('onItemClick', cmd_invoice_save_note_click)
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var toolbar_invoices = [
|
var toolbar_invoices = [
|
||||||
|
|
|
@ -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',
|
||||||
|
@ -454,7 +454,11 @@ var app_tickets = {
|
||||||
var body_ticket_notes = {rows: [
|
var body_ticket_notes = {rows: [
|
||||||
{minHeight: 5, maxHeight: 5},
|
{minHeight: 5, maxHeight: 5},
|
||||||
{view: 'textarea', id: 'ticket_notes', name: 'ticket_notes', height: 300,
|
{view: 'textarea', id: 'ticket_notes', name: 'ticket_notes', height: 300,
|
||||||
placeholder: 'Captura las notas, se autoguarda al escribir.'},
|
placeholder: 'Captura las notas'},
|
||||||
|
{minHeight: 5, maxHeight: 5},
|
||||||
|
{cols: [{}, {view: 'button', id: 'cmd_ticket_save_note', autowidth: true,
|
||||||
|
label: 'Guardar y Cerrar', type: 'iconButton', hotkey: 'Ctrl+enter'},
|
||||||
|
{}]},
|
||||||
{minHeight: 5, maxHeight: 5},
|
{minHeight: 5, maxHeight: 5},
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@ -464,18 +468,13 @@ var win_ticket_notes = {
|
||||||
webix.ui({
|
webix.ui({
|
||||||
view: 'window',
|
view: 'window',
|
||||||
id: 'win_ticket_notes',
|
id: 'win_ticket_notes',
|
||||||
height: 350,
|
height: 400,
|
||||||
width: 500,
|
width: 500,
|
||||||
modal: true,
|
modal: true,
|
||||||
position: 'center',
|
position: 'center',
|
||||||
head: {view: 'toolbar',
|
head: 'Notas',
|
||||||
elements: [
|
|
||||||
{view: 'label', label: 'Notas'},
|
|
||||||
{view: 'icon', icon: 'times-circle', hotkey: 'esc',
|
|
||||||
click: '$$("win_ticket_notes").close()'},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
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)
|
||||||
}}
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue