diff --git a/source/app/controllers/helper.py b/source/app/controllers/helper.py
index 1703fe7..43aa8ed 100644
--- a/source/app/controllers/helper.py
+++ b/source/app/controllers/helper.py
@@ -1007,6 +1007,7 @@ class PrintTicket(object):
self._set('center', 'B', 'B', 2)
self._t(data['rfc'])
self._set('center', 'A')
+ self._t(data['regimen'])
self._t(data['address'])
return
diff --git a/source/app/models/main.py b/source/app/models/main.py
index e7fbf2c..d8648af 100644
--- a/source/app/models/main.py
+++ b/source/app/models/main.py
@@ -3765,7 +3765,7 @@ class PreFacturasDetalle(BaseModel):
def facturar(cls, id):
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:
forma_pago = ''
else:
@@ -3782,6 +3782,7 @@ class PreFacturasDetalle(BaseModel):
'rfc': q.cliente.rfc,
'forma_pago': forma_pago,
'uso_cfdi': uso_cfdi,
+ 'notas': q.notas,
}
productos = PreFacturasDetalle.select().where(
@@ -4416,6 +4417,7 @@ class Tickets(BaseModel):
formapago = SATFormaPago.get(SATFormaPago.key==obj['forma_pago'])
emisor = util.get_dict(Emisor.select().dicts()[0])
+
emisor['nointerior'] = emisor['no_interior']
emisor['noexterior'] = emisor['no_exterior']
emisor['codigopostal'] = emisor['codigo_postal']
@@ -4467,11 +4469,13 @@ class Tickets(BaseModel):
def _format_ticket(self, id):
emisor = util.get_dict(Emisor.select().dicts()[0])
+ regimen = Emisor.select()[0].regimenes[0].name
ticket = Tickets.select().where(Tickets.id==id).dicts()[0]
products = TicketsDetalle.get_by_print(id)
-
+ print (regimen)
emisor['name'] = '{}\n'.format(emisor['nombre'])
emisor['rfc'] = 'RFC: {}\n'.format(emisor['rfc'])
+ emisor['regimen'] = 'Regimen: {}\n'.format(regimen)
interior = ''
if emisor['no_interior']:
interior = ', {}'.format(emisor['no_interior'])
diff --git a/source/static/js/controller/invoices.js b/source/static/js/controller/invoices.js
index 9925bbf..53378cf 100644
--- a/source/static/js/controller/invoices.js
+++ b/source/static/js/controller/invoices.js
@@ -651,11 +651,13 @@ function search_client_by_id(id){
function set_client(row){
+ showvar(row)
var form = $$('form_invoice')
var html = ''
form.setValues({
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 + ')'
$$('lbl_client').setValue(html)
$$('cmd_cfdi_relacionados').enable()
@@ -1306,6 +1308,7 @@ function cmd_prefactura_click(){
data['metodo_pago'] = $$('lst_metodo_pago').getValue()
data['uso_cfdi'] = $$('lst_uso_cfdi').getValue()
data['regimen_fiscal'] = $$('lst_regimen_fiscal').getValue()
+ data['notas'] = values.notas
if(!save_preinvoice(data)){
return
@@ -1457,7 +1460,6 @@ function refacturar_preinvoice(id){
for(var p of values.rows){
agregar_preproducto(p)
}
- //~ calculate_taxes()
calcular_impuestos()
$$('tv_invoice').getTabbar().setValue('Generar')
}
@@ -1704,13 +1706,18 @@ function lst_serie_change(nv, ov){
function cmd_cfdi_notes_click(){
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(){
- var value = this.getValue()
+function cmd_invoice_save_note_click(){
+ var value = $$('invoice_notes').getValue()
$$('form_invoice').setValues({notas: value}, true)
+ $$('win_invoice_notes').close()
+
}
diff --git a/source/static/js/controller/tickets.js b/source/static/js/controller/tickets.js
index b133f9c..9c1fc0d 100644
--- a/source/static/js/controller/tickets.js
+++ b/source/static/js/controller/tickets.js
@@ -34,7 +34,6 @@ var tickets_controllers = {
$$('grid_ticket_clients_found').attachEvent('onValueSuggest', grid_ticket_clients_found_click)
$$('grid_tdetails').attachEvent('onAfterRender', grid_tdetails_render)
-
webix.extend($$('grid_tickets'), 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){
- 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(){
+function edit_cant(id){
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()
-
+ $$('grid_tdetails').edit({row: id, column: 'cantidad'})
}
@@ -383,8 +341,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, 0)
- edit_cant()
+ var id = grid.add(producto, 0)
+ edit_cant(id)
}else{
producto['cantidad'] = parseFloat(row.cantidad) + 1
producto['descuento'] = parseFloat(row.descuento)
@@ -726,12 +684,15 @@ function cmd_ticket_notes_click(){
var values = $$('form_new_ticket').getValues()
$$('ticket_notes').setValue(values.notas)
$$('win_ticket_notes').show()
+ to_end('ticket_notes')
}
-function ticket_notes_key_up(){
- var value = this.getValue()
+function cmd_ticket_save_note_click(){
+ var value = $$('ticket_notes').getValue()
$$('form_new_ticket').setValues({notas: value}, true)
+ $$('win_ticket_notes').close()
+
}
diff --git a/source/static/js/controller/util.js b/source/static/js/controller/util.js
index fec50c5..92810a7 100644
--- a/source/static/js/controller/util.js
+++ b/source/static/js/controller/util.js
@@ -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){
webix.message(JSON.stringify(values, null, 2))
}
diff --git a/source/static/js/ui/invoices.js b/source/static/js/ui/invoices.js
index 5cc5bda..c610391 100644
--- a/source/static/js/ui/invoices.js
+++ b/source/static/js/ui/invoices.js
@@ -138,11 +138,14 @@ var ui_invoice = {
}}
-
var body_cfdi_notes = {rows: [
{minHeight: 5, maxHeight: 5},
- {view: 'textarea', id: 'cfdi_notes', name: 'cfdi_notes', height: 300,
- placeholder: 'Captura las notas, se autoguarda al escribir.'},
+ {view: 'textarea', id: 'invoice_notes', name: 'invoice_notes', height: 300,
+ 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},
]}
@@ -151,22 +154,17 @@ var win_invoice_notes = {
init: function(){
webix.ui({
view: 'window',
- id: 'win_cfdi_notes',
- height: 350,
+ id: 'win_invoice_notes',
+ height: 400,
width: 500,
modal: true,
position: 'center',
- head: {view: 'toolbar',
- elements: [
- {view: 'label', label: 'Notas'},
- {view: 'icon', icon: 'times-circle',
- click: '$$("win_cfdi_notes").close()'},
- ]
- },
+ head: 'Notas',
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 = [
diff --git a/source/static/js/ui/tickets.js b/source/static/js/ui/tickets.js
index fbf38f1..235aa3d 100644
--- a/source/static/js/ui/tickets.js
+++ b/source/static/js/ui/tickets.js
@@ -178,7 +178,7 @@ var toolbar_new_ticket = {
view: 'toolbar', elements: [
{view: 'button', id: 'cmd_generar_ticket', label: 'Generar',
icon: 'ticket', type: 'iconButton', autowidth: true,
- align: 'center'}, {},
+ align: 'center', hotkey: 'Ctrl+g'}, {},
{view: 'button', id: 'cmd_ticket_notes', label: 'Notas',
autowidth: true, type: 'iconButton', icon: 'commenting-o'}, {},
{view: 'button', id: 'cmd_cerrar_ticket', label: 'Cerrar',
@@ -454,7 +454,11 @@ var app_tickets = {
var body_ticket_notes = {rows: [
{minHeight: 5, maxHeight: 5},
{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},
]}
@@ -464,18 +468,13 @@ var win_ticket_notes = {
webix.ui({
view: 'window',
id: 'win_ticket_notes',
- height: 350,
+ height: 400,
width: 500,
modal: true,
position: 'center',
- head: {view: 'toolbar',
- elements: [
- {view: 'label', label: 'Notas'},
- {view: 'icon', icon: 'times-circle', hotkey: 'esc',
- click: '$$("win_ticket_notes").close()'},
- ]
- },
+ head: 'Notas',
body: body_ticket_notes,
})
- $$('ticket_notes').attachEvent('onTimedKeyPress', ticket_notes_key_up);
-}}
\ No newline at end of file
+ $$('cmd_ticket_save_note').attachEvent('onItemClick', cmd_ticket_save_note_click)
+ }
+}
\ No newline at end of file