diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py
index 438d082..a8997a0 100644
--- a/source/app/controllers/util.py
+++ b/source/app/controllers/util.py
@@ -822,6 +822,22 @@ class LIBO(object):
image.Anchor = self._set_cell('{timbre.cbb}')
return
+ def _donataria(self, data):
+ if not data:
+ return
+
+ for k, v in data.items():
+ self._set_cell('{donataria.%s}' % k, v)
+ return
+
+ def _ine(self, data):
+ if not data:
+ return
+
+ for k, v in data.items():
+ self._set_cell('{ine.%s}' % k, v)
+ return
+
def _render(self, data):
self._set_search()
self._es_pre = data.pop('es_pre', False)
@@ -831,6 +847,8 @@ class LIBO(object):
self._conceptos(data['conceptos'])
self._totales(data['totales'])
self._timbre(data['timbre'])
+ self._donataria(data['donataria'])
+ self._ine(data['ine'])
self._cancelado(data['cancelada'])
self._clean()
return
@@ -856,14 +874,19 @@ class LIBO(object):
return self._read(path)
-def to_pdf(data):
+def to_pdf(data, emisor_rfc):
rfc = data['emisor']['rfc']
+ if DEBUG:
+ rfc = emisor_rfc
version = data['comprobante']['version']
if APP_LIBO:
app = LIBO()
if app.is_running:
- name = '{}_{}.ods'.format(rfc, version)
+ donativo = ''
+ if data['donativo']:
+ donativo = '_donativo'
+ name = '{}_{}{}.ods'.format(rfc.lower(), version, donativo)
path = get_template_ods(name)
if path:
return app.pdf(path, data)
@@ -1099,8 +1122,35 @@ def _timbre(doc, version, values):
return data
+def _donataria(doc, version, fechadof):
+ node = doc.find('{}Complemento/{}Donatarias'.format(
+ PRE[version], PRE['DONATARIA']))
+ if node is None:
+ return {}
+
+ data = CaseInsensitiveDict(node.attrib.copy())
+ data['fechadof'] = fechadof
+ return data
+
+
+def _ine(doc, version):
+ node = doc.find('{}Complemento/{}INE'.format(PRE[version], PRE['INE']))
+ if node is None:
+ return {}
+
+ values = (
+ ('TipoComite', 'Tipo de Comite: {}'),
+ ('TipoProceso', 'Tipo de Proceso: {}'),
+ ('IdContabilidad', 'ID de Contabilidad: {}'),
+ )
+ data = CaseInsensitiveDict(node.attrib.copy())
+ for k, v in values:
+ data[k] = v.format(data[k])
+ return data
+
+
def get_data_from_xml(invoice, values):
- data = {'cancelada': invoice.cancelada}
+ data = {'cancelada': invoice.cancelada, 'donativo': invoice.donativo}
doc = parse_xml(invoice.xml)
data['comprobante'] = _comprobante(doc, values)
version = data['comprobante']['version']
@@ -1108,6 +1158,8 @@ def get_data_from_xml(invoice, values):
data['receptor'] = _receptor(doc, version, values)
data['conceptos'] = _conceptos(doc, version)
data['totales'] = _totales(doc, data['comprobante'], version)
+ data['donataria'] = _donataria(doc, version, values['fechadof'])
+ data['ine'] = _ine(doc, version)
options = {
'rfc_emisor': data['emisor']['rfc'],
@@ -1183,6 +1235,15 @@ def upload_file(rfc, opt, file_obj):
tmp = file_obj.filename.split('.')
name = '{}.{}'.format(rfc.lower(), tmp[-1].lower())
path = _join(PATH_MEDIA, 'logos', name)
+ elif opt == 'txt_plantilla_factura_32':
+ tmp = file_obj.filename.split('.')
+ ext = tmp[-1].lower()
+ if ext != 'ods':
+ msg = 'Extensión de archivo incorrecta, selecciona un archivo ODS'
+ return {'status': 'server', 'name': msg, 'ok': False}
+
+ name = '{}_3.2.ods'.format(rfc.lower())
+ path = _join(PATH_MEDIA, 'templates', name)
elif opt == 'txt_plantilla_factura_33':
tmp = file_obj.filename.split('.')
ext = tmp[-1].lower()
@@ -1192,14 +1253,23 @@ def upload_file(rfc, opt, file_obj):
name = '{}_3.3.ods'.format(rfc.lower())
path = _join(PATH_MEDIA, 'templates', name)
- elif opt == 'txt_plantilla_factura_32':
+ elif opt == 'txt_plantilla_factura_33j':
+ tmp = file_obj.filename.split('.')
+ ext = tmp[-1].lower()
+ if ext != 'json':
+ msg = 'Extensión de archivo incorrecta, selecciona un archivo JSON'
+ return {'status': 'server', 'name': msg, 'ok': False}
+
+ name = '{}_3.3.json'.format(rfc.lower())
+ path = _join(PATH_MEDIA, 'templates', name)
+ elif opt == 'txt_plantilla_donataria':
tmp = file_obj.filename.split('.')
ext = tmp[-1].lower()
if ext != 'ods':
msg = 'Extensión de archivo incorrecta, selecciona un archivo ODS'
return {'status': 'server', 'name': msg, 'ok': False}
- name = '{}_3.2.ods'.format(rfc.lower())
+ name = '{}_3.3_donativo.ods'.format(rfc.lower())
path = _join(PATH_MEDIA, 'templates', name)
if save_file(path, file_obj.file.read()):
diff --git a/source/app/models/main.py b/source/app/models/main.py
index 91ac870..427db72 100644
--- a/source/app/models/main.py
+++ b/source/app/models/main.py
@@ -153,7 +153,8 @@ class Configuracion(BaseModel):
fields = (
'txt_plantilla_factura_32',
'txt_plantilla_factura_33',
- 'txt_plantilla_factura_33j'
+ 'txt_plantilla_factura_33j',
+ 'txt_plantilla_donataria',
)
data = (Configuracion
.select()
@@ -1895,7 +1896,7 @@ class Facturas(BaseModel):
return data
- def _get_not_in_xml(self, invoice):
+ def _get_not_in_xml(self, invoice, emisor):
values = {}
if invoice.version == '3.2':
@@ -1924,18 +1925,21 @@ class Facturas(BaseModel):
obj = SATTipoRelacion.get(SATTipoRelacion.key==invoice.tipo_relacion)
values['tiporelacion'] = str(obj)
+ values['fechadof'] = str(emisor.fecha_dof)
+
return values
@classmethod
def get_pdf(cls, id, rfc):
+ emisor = Emisor.select()[0]
obj = Facturas.get(Facturas.id==id)
name = '{}{}_{}.pdf'.format(obj.serie, obj.folio, obj.cliente.rfc)
if obj.uuid is None:
return b'', name
- values = cls._get_not_in_xml(cls, obj)
+ values = cls._get_not_in_xml(cls, obj, emisor)
data = util.get_data_from_xml(obj, values)
- doc = util.to_pdf(data)
+ doc = util.to_pdf(data, emisor.rfc)
return doc, name
@classmethod
diff --git a/source/app/settings.py b/source/app/settings.py
index 2a4e9df..58007ca 100644
--- a/source/app/settings.py
+++ b/source/app/settings.py
@@ -84,6 +84,8 @@ PRE = {
'3.2': '{http://www.sat.gob.mx/cfd/3}',
'3.3': '{http://www.sat.gob.mx/cfd/3}',
'TIMBRE': '{http://www.sat.gob.mx/TimbreFiscalDigital}',
+ 'DONATARIA': '{http://www.sat.gob.mx/donat}',
+ 'INE': '{http://www.sat.gob.mx/ine}',
'NOMINA': {
'1.1': '{http://www.sat.gob.mx/nomina}',
'1.2': '{http://www.sat.gob.mx/nomina12}',
diff --git a/source/static/css/app.css b/source/static/css/app.css
index 4e8eb53..1634313 100644
--- a/source/static/css/app.css
+++ b/source/static/css/app.css
@@ -56,6 +56,14 @@
.webix_success div {
background-color: #00a65a !important;
- font-size: 1vw;
+ font-weight: bold;
+ font-size: 1.5vw;
+ color: white;
+}
+
+.webix_error div {
+ background-color: #DF0101 !important;
+ font-weight: bold;
+ font-size: 1.5vw;
color: white;
}
diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js
index 3a75a1a..4330737 100644
--- a/source/static/js/controller/admin.js
+++ b/source/static/js/controller/admin.js
@@ -39,6 +39,8 @@ var controllers = {
tb_options.attachEvent('onChange', tab_options_change)
$$('txt_plantilla_factura_32').attachEvent('onItemClick', txt_plantilla_factura_32_click)
$$('txt_plantilla_factura_33').attachEvent('onItemClick', txt_plantilla_factura_33_click)
+ $$('txt_plantilla_factura_33j').attachEvent('onItemClick', txt_plantilla_factura_33j_click)
+ $$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click)
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click)
}
@@ -134,7 +136,7 @@ function cmd_save_emisor_click(){
success:function(text, data, XmlHttpRequest){
var values = data.json()
if(values.ok){
- msg_sucess('Emisor guardado correctamente')
+ msg_ok('Emisor guardado correctamente')
}else{
msg_error(values.msg)
}
@@ -292,6 +294,10 @@ function get_config_values(opt){
return
}
+ if(opt == 'templates'){
+ show('txt_plantilla_donataria', $$('chk_ong').getValue())
+ }
+
webix.ajax().get('/config', {'fields': opt}, {
error: function(text, data, xhr) {
msg = 'Error al consultar'
@@ -486,7 +492,7 @@ function up_cert_upload_complete(response){
}
msg = 'Archivos subidos correctamente. Esperando validación'
- msg_sucess(msg)
+ msg_ok(msg)
var values = $$('form_upload').getValues()
$$('form_upload').setValues({})
@@ -501,7 +507,7 @@ function up_cert_upload_complete(response){
var values = data.json()
if(values.ok){
$$('form_cert').setValues(values.data)
- msg_sucess(values.msg)
+ msg_ok(values.msg)
}else{
msg_error(values.msg)
}
@@ -558,7 +564,7 @@ function cmd_agregar_serie_click(){
{folio_serie: '', folio_inicio: 1, folio_usarcon: 'S'})
grid.add(values.row)
msg = 'Serie agregada correctamente'
- msg_sucess(msg)
+ msg_ok(msg)
}else{
msg_error(values.msg)
}
@@ -585,7 +591,7 @@ function grid_folios_click(id, e, node){
msg = 'Serie eliminada correctamente'
if(xhr.status == 200){
$$('grid_folios').remove(id.row)
- msg_sucess(msg)
+ msg_ok(msg)
}else{
msg = 'No se pudo eliminar'
msg_error(msg)
@@ -652,7 +658,7 @@ function cmd_probar_correo_click(){
if (values.ok){
msg = 'Correo de prueba enviado correctamente. Ya puedes \
guardar esta configuración'
- msg_sucess(msg)
+ msg_ok(msg)
}else{
msg_error(values.msg)
}
@@ -673,7 +679,7 @@ function save_config_mail(values){
var values = data.json();
if (values.ok){
msg = 'Configuración guardada correctamente'
- msg_sucess(msg)
+ msg_ok(msg)
}else{
msg_error(values.msg)
}
@@ -726,7 +732,7 @@ function emisor_logo_click(id, e){
$$('up_emisor_logo').attachEvent('onUploadComplete', function(response){
$$('emisor_logo').setValue(response.name)
- msg_sucess('Logotipo cargado correctamente')
+ msg_ok('Logotipo cargado correctamente')
})
}
@@ -762,7 +768,7 @@ function txt_plantilla_factura_33_click(e){
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_factura_33').setValue(response.name)
- msg_sucess('Plantilla cargada correctamente')
+ msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
@@ -800,7 +806,83 @@ function txt_plantilla_factura_32_click(e){
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_factura_32').setValue(response.name)
- msg_sucess('Plantilla cargada correctamente')
+ msg_ok('Plantilla cargada correctamente')
+ }else{
+ msg_error(response.name)
+ }
+ })
+}
+
+
+function txt_plantilla_factura_33j_click(e){
+
+ var body_elements = [
+ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
+ value: 'Seleccionar archivo', upload: '/files/txt_plantilla_factura_33j',
+ width: 200}, {width: 100}]},
+ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
+ borderless: true},
+ {},
+ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
+ click:("$$('win_template').close();")}, {}]}
+ ]
+
+ var w = webix.ui({
+ view: 'window',
+ id: 'win_template',
+ modal: true,
+ position: 'center',
+ head: 'Subir Plantilla 3.3 JSON',
+ body: {
+ view: 'form',
+ elements: body_elements,
+ }
+ })
+
+ w.show()
+
+ $$('up_template').attachEvent('onUploadComplete', function(response){
+ if(response.ok){
+ $$('txt_plantilla_factura_33j').setValue(response.name)
+ msg_ok('Plantilla cargada correctamente')
+ }else{
+ msg_error(response.name)
+ }
+ })
+}
+
+
+function txt_plantilla_donataria_click(e){
+
+ var body_elements = [
+ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
+ value: 'Seleccionar archivo', upload: '/files/txt_plantilla_donataria',
+ width: 200}, {width: 100}]},
+ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
+ borderless: true},
+ {},
+ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
+ click:("$$('win_template').close();")}, {}]}
+ ]
+
+ var w = webix.ui({
+ view: 'window',
+ id: 'win_template',
+ modal: true,
+ position: 'center',
+ head: 'Subir Plantilla Donataria',
+ body: {
+ view: 'form',
+ elements: body_elements,
+ }
+ })
+
+ w.show()
+
+ $$('up_template').attachEvent('onUploadComplete', function(response){
+ if(response.ok){
+ $$('txt_plantilla_donataria').setValue(response.name)
+ msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
@@ -1106,10 +1188,10 @@ function borrar_impuesto(row){
msg = 'Impuesto eliminado correctamente'
if(xhr.status == 200){
grid.remove(row)
- msg_sucess(msg)
+ msg_ok(msg)
}else{
msg = 'Impuesto en uso, no se pudo eliminar.'
- msg_sucess(msg)
+ msg_error(msg)
}
})
}
@@ -1144,7 +1226,7 @@ function eliminar_cuenta_banco(id){
msg = 'Cuenta eliminada correctamente'
if(xhr.status == 200){
grid.remove(id)
- msg_sucess(msg)
+ msg_ok(msg)
}else{
msg = 'No se pudo eliminar'
msg_error(msg)
diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js
index 836593b..7c88523 100644
--- a/source/static/js/controller/bancos.js
+++ b/source/static/js/controller/bancos.js
@@ -566,7 +566,7 @@ function cancelar_movimiento(id){
if(xhr.status == 200){
get_estado_cuenta()
get_saldo_cuenta()
- msg_sucess('Movimiento cancelado correctamente')
+ msg_ok('Movimiento cancelado correctamente')
}else{
msg_error('No se pudo eliminar')
}
@@ -590,12 +590,12 @@ function cmd_cancelar_movimiento_click(){
var msg = '¿Estás seguro de cancelar el movimiento seleccionado?'
msg += '
ESTA ACCIÓN NO SE PUEDE DESHACER
'
webix.confirm({
- title:'Cancelar Movimiento',
- ok:'Si',
- cancel:'No',
- type:'confirm-error',
- text:msg,
- callback:function(result){
+ title: 'Cancelar Movimiento',
+ ok: 'Si',
+ cancel: 'No',
+ type: 'confirm-error',
+ text: msg,
+ callback: function(result){
if (result){
cancelar_movimiento(row['id'])
}
diff --git a/source/static/js/controller/invoices.js b/source/static/js/controller/invoices.js
index 7520e67..cd96780 100644
--- a/source/static/js/controller/invoices.js
+++ b/source/static/js/controller/invoices.js
@@ -150,7 +150,7 @@ function delete_invoice(id){
webix.ajax().del('/invoices', {id: id}, function(text, xml, xhr){
if(xhr.status == 200){
gi.remove(id)
- msg_sucess('Factura eliminada correctamente')
+ msg_ok('Factura eliminada correctamente')
}else{
msg_error('No se pudo eliminar')
}
@@ -340,7 +340,7 @@ function send_anticipo_egreso(id){
webix.ajax().get('/values/anticipoegreso', {id: id}, function(text, data){
var values = data.json()
if(values.ok){
- msg_sucess(values.msg)
+ msg_ok(values.msg)
gi.add(values.row)
}else{
webix.alert({
@@ -377,7 +377,7 @@ function send_timbrar(id){
webix.ajax().get('/values/timbrar', {id: id}, function(text, data){
var values = data.json()
if(values.ok){
- msg_sucess(values.msg)
+ msg_ok(values.msg)
gi.updateItem(id, values.row)
if(values.anticipo){
//~ generar_anticipo_egreso(id)
@@ -407,7 +407,7 @@ function save_invoice(data){
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
- msg_sucess('Factura guardada correctamente. Enviando a timbrar')
+ msg_ok('Factura guardada correctamente
Enviando a timbrar...')
update_grid_invoices(values)
gi.select(values.row['id'], false)
send_timbrar(values.row['id'])
@@ -442,7 +442,7 @@ function save_preinvoice(data){
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
- msg_sucess('Pre Factura generada correctamente')
+ msg_ok('Pre Factura generada correctamente')
result = true
}else{
msg_error(values.msg)
@@ -518,7 +518,7 @@ function guardar_y_timbrar(values){
tipo_relacion = ''
anticipo = false
$$('chk_cfdi_anticipo').setValue(0)
- $$('chk_cfdi_usar_ine').getValue(0)
+ $$('chk_cfdi_usar_ine').setValue(0)
$$('form_invoice').setValues({id_partner: 0, lbl_partner: 'Ninguno'})
$$('multi_invoices').setValue('invoices_home')
@@ -530,7 +530,7 @@ function cmd_timbrar_click(id, e, node){
var form = this.getFormView();
if(!form.validate()) {
- webix.message({type:'error', text:'Valores inválidos'})
+ msg_error('Valores inválidos')
return
}
@@ -547,6 +547,10 @@ function cmd_timbrar_click(id, e, node){
if(anticipo){
msg += 'La factura es Anticipo
'
}
+ usar_ine = $$('chk_cfdi_usar_ine').getValue()
+ if(usar_ine){
+ msg += 'Estas usando el complemento INE
'
+ }
msg += '¿Estás seguro de timbrar esta factura?'
webix.confirm({
@@ -573,7 +577,7 @@ function search_client_by_id(id){
var msg = ''
webix.ajax().get('/values/client', {'id': id}, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error('Error al consultar')
},
success: function(text, data, xhr){
var values = data.json()
@@ -581,7 +585,7 @@ function search_client_by_id(id){
set_client(values.row)
}else{
msg = 'No se encontró un cliente con la clave: ' + id
- webix.message({type:'error', text: msg})
+ msg_error(msg)
}
}
})
@@ -612,7 +616,7 @@ function search_client_id_key_press(code, e){
if(code == 13 && value.length > 0){
var id = parseInt(value, 10)
if (isNaN(id)){
- webix.message({type:'error', text:'Captura una clave válida'});
+ msg_error('Captura una clave válida')
}else{
search_client_by_id(id)
}
@@ -730,7 +734,7 @@ function search_product_by_id(id){
webix.ajax().get('/values/product', {'id': id}, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error('Error al consultar')
},
success: function(text, data, xhr){
var values = data.json()
@@ -738,7 +742,7 @@ function search_product_by_id(id){
set_product(values)
} else {
msg = 'No se encontró un producto con la clave: ' + id
- webix.message({type: 'error', text: msg})
+ msg_error(msg)
}
}
})
@@ -751,7 +755,7 @@ function search_product_id_key_press(code, e){
if(code == 13 && value.length > 0){
var id = parseInt(value, 10)
if (isNaN(id)){
- webix.message({type: 'error', text: 'Captura una clave válida'});
+ msg_error('Captura una clave válida')
}else{
search_product_by_id(id)
}
@@ -773,7 +777,7 @@ function grid_details_before_edit_stop(state, editor){
if(editor.column == 'descripcion'){
if(!state.value.trim()){
msg = 'La descripción no puede estar vacía'
- webix.message({type:'error', text: msg})
+ msg_error(msg)
grid.blockEvent()
state.value = state.old
grid.editCancel()
@@ -788,7 +792,7 @@ function grid_details_before_edit_stop(state, editor){
var cantidad = parseFloat(state.value)
if(isNaN(cantidad)){
msg = 'La cantidad debe ser un número'
- webix.message({type:'error', text: msg})
+ msg_error(msg)
grid.blockEvent()
state.value = state.old
grid.editCancel()
@@ -803,7 +807,7 @@ function grid_details_before_edit_stop(state, editor){
var valor_unitario = parseFloat(state.value)
if(isNaN(valor_unitario)){
msg = 'El valor unitario debe ser un número'
- webix.message({type:'error', text: msg})
+ msg_error(msg)
grid.blockEvent()
state.value = state.old
grid.editCancel()
@@ -818,7 +822,7 @@ function grid_details_before_edit_stop(state, editor){
var descuento = parseFloat(state.value)
if(isNaN(descuento)){
msg = 'El descuento debe ser un número'
- webix.message({type:'error', text: msg})
+ msg_error(msg)
grid.blockEvent()
state.value = state.old
grid.editCancel()
@@ -928,7 +932,7 @@ function enviar_correo(row){
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
- msg_sucess(values.msg)
+ msg_ok(values.msg)
}else{
msg_error(values.msg)
}
@@ -960,7 +964,7 @@ function send_cancel(id){
webix.ajax().get('/values/cancelinvoice', {id: id}, function(text, data){
var values = data.json()
if(values.ok){
- msg_sucess(values.msg)
+ msg_ok(values.msg)
gi.updateItem(id, values.row)
}else{
webix.alert({
@@ -1026,7 +1030,7 @@ function get_invoices(rango){
webix.ajax().get('/invoices', rango, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error('Error al consultar')
},
success: function(text, data, xhr) {
var values = data.json();
@@ -1163,7 +1167,7 @@ function get_prefacturas(){
var grid = $$('grid_preinvoices')
webix.ajax().get('/preinvoices', rango, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error('Error al consultar')
},
success: function(text, data, xhr) {
var values = data.json();
@@ -1197,7 +1201,7 @@ function delete_preinvoice(id){
webix.ajax().del('/preinvoices', {id: id}, function(text, xml, xhr){
if(xhr.status == 200){
$$('grid_preinvoices').remove(id)
- msg_sucess('PreFactura eliminada correctamente')
+ msg_ok('PreFactura eliminada correctamente')
}else{
msg_error('No se pudo eliminar')
}
@@ -1330,7 +1334,7 @@ function enviar_prefactura(id){
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
- msg_sucess(values.msg)
+ msg_ok(values.msg)
}else{
msg_error(values.msg)
}
@@ -1382,7 +1386,7 @@ function get_facturas_por_cliente(){
webix.ajax().get('/invoices', filters, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error('Error al consultar')
},
success: function(text, data, xhr) {
var values = data.json();
@@ -1449,7 +1453,7 @@ function cmd_limpiar_relacionados_click(){
$$('grid_relacionados').clearAll()
table_relaciones.clear()
tipo_relacion = ''
- msg_sucess('Las relaciones han sido eliminadas')
+ msg_ok('Las relaciones han sido eliminadas')
}
}
})
@@ -1474,7 +1478,7 @@ function cmd_guardar_relacionados_click(){
table_relaciones.clear()
table_relaciones.insert(data)
tipo_relacion = value
- msg_sucess('Relaciones guardadas correctamente')
+ msg_ok('Relaciones guardadas correctamente')
}
diff --git a/source/static/js/controller/main.js b/source/static/js/controller/main.js
index 68e0815..d74004a 100644
--- a/source/static/js/controller/main.js
+++ b/source/static/js/controller/main.js
@@ -98,7 +98,7 @@ function get_uso_cfdi_to_table(){
function get_partners(){
webix.ajax().get('/partners', {}, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'});
+ msg_error('Error al consultar')
},
success: function(text, data, xhr) {
var values = data.json();
@@ -115,7 +115,7 @@ function get_products(){
var grid = $$('grid_products')
webix.ajax().get('/products', {}, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error('Error al consultar')
},
success: function(text, data, xhr) {
var values = data.json();
@@ -166,7 +166,6 @@ function current_dates(){
function multi_change(prevID, nextID){
- //~ webix.message(nextID)
if(nextID == 'app_partners'){
active = $$('multi_partners').getActiveId()
if(active == 'partners_home'){
diff --git a/source/static/js/controller/partners.js b/source/static/js/controller/partners.js
index 7b331ae..93b4346 100644
--- a/source/static/js/controller/partners.js
+++ b/source/static/js/controller/partners.js
@@ -40,14 +40,14 @@ function cmd_edit_partner_click(id, e, node){
if (row == undefined){
msg = 'Selecciona un Socio de Negocio'
- webix.message({type:'error', text: msg})
+ msg_error(msg)
return
}
get_condicion_pago()
webix.ajax().get("/partners", {id: row['id']}, {
error: function(text, data, xhr) {
- webix.message({type:"error", text: "Error al consultar"})
+ msg_error()
},
success: function(text, data, xhr){
var values = data.json()
@@ -83,7 +83,7 @@ function cmd_delete_partner_click(id, e, node){
if (row == undefined){
msg = 'Selecciona un Cliente o Proveedor'
- webix.message({type:'error', text: msg})
+ msg_error(msg)
return
}
@@ -112,10 +112,10 @@ function delete_partner(id){
var msg = 'Socio eliminado correctamente'
if (xhr.status == 200){
$$('grid_partners').remove(id);
- webix.message({type: 'success', text: msg})
+ msg_ok(msg)
} else {
msg = 'No se pudo eliminar. Asegurate de que no tenga documentos relacionados'
- webix.message({type: 'error', text: msg})
+ msg_error(msg)
}
})
}
@@ -126,7 +126,7 @@ function cmd_save_partner_click(id, e, node){
var form = this.getFormView();
if (!form.validate()) {
- webix.message({type: 'error', text: msg})
+ msg_error(msg)
return
}
@@ -148,14 +148,14 @@ function cmd_save_partner_click(id, e, node){
webix.ajax().post('/partners', values, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico';
- webix.message({type:'error', text:msg});
+ msg_error(msg)
},
success:function(text, data, XmlHttpRequest){
var values = data.json();
if (values.ok) {
update_grid_partner(values)
} else {
- webix.message({type:'error', text:values.msg});
+ msg_error(msg)
}
}
})
@@ -173,7 +173,7 @@ function update_grid_partner(values){
$$("grid_partners").updateItem(values.row['id'], values.row)
}
$$('multi_partners').setValue('partners_home')
- webix.message({type:'success', text: msg})
+ msg_ok(msg)
}
@@ -193,13 +193,13 @@ function postal_code_key_up(){
if( value.length == 5 ){
webix.ajax().get('/values/cp', {cp: value}, {
error: function(text, data, xhr) {
- webix.message({type:'error', text:'Error al consultar el C.P.'})
+ msg_error('Error al consultar el C.P.')
},
success: function(text, data, xhr) {
var values = data.json();
if (values.estado == undefined){
msg = 'No se encontró el C.P., asegurate de que sea correcto'
- webix.message({type:'error', text:msg})
+ msg_error(msg)
} else {
$$('form_partner').setValues({
estado: values.estado,
diff --git a/source/static/js/controller/products.js b/source/static/js/controller/products.js
index da87d4f..52074c9 100644
--- a/source/static/js/controller/products.js
+++ b/source/static/js/controller/products.js
@@ -25,7 +25,7 @@ function cmd_edit_product_click(id, e, node){
var grid = $$('grid_products')
var row = grid.getSelectedItem()
if(row == undefined){
- webix.message({type: 'error', text: 'Selecciona un Producto'})
+ msg_error('Selecciona un Producto')
return
}
@@ -35,7 +35,7 @@ function cmd_edit_product_click(id, e, node){
webix.ajax().get('/products', {id:row['id']}, {
error: function(text, data, xhr) {
- webix.message({type: 'error', text: 'Error al consultar'})
+ msg_error()
},
success: function(text, data, xhr){
var values = data.json()
@@ -56,10 +56,10 @@ function delete_product(id){
var msg = 'Producto eliminado correctamente'
if(xhr.status == 200){
$$('grid_products').remove(id)
- webix.message({type:'success', text:msg})
+ msg_ok(msg)
}else{
msg = 'No se pudo eliminar'
- webix.message({type:'error', text:msg})
+ msg_error(msg)
}
})
}
@@ -68,7 +68,7 @@ function delete_product(id){
function cmd_delete_product_click(id, e, node){
var row = $$('grid_products').getSelectedItem()
if (row == undefined){
- webix.message({type:'error', text: 'Selecciona un Producto'})
+ msg_error('Selecciona un Producto')
return
}
@@ -117,7 +117,7 @@ function update_grid_products(values){
$$("grid_products").updateItem(values.row['id'], values.row)
}
$$('multi_products').setValue('products_home')
- webix.message({type: 'success', text: msg})
+ msg_ok(msg)
}
@@ -126,20 +126,20 @@ function cmd_save_product_click(id, e, node){
var form = this.getFormView()
if(!form.validate()){
- webix.message({type: 'error', text: 'Valores inválidos'})
+ msg_error('Valores inválidos')
return
}
var rows = $$('grid_product_taxes').getSelectedId(true, true)
if (rows.length == 0){
- webix.message({type: 'error', text: 'Selecciona un impuesto'})
+ msg_error('Selecciona un impuesto')
return
}
var values = form.getValues();
if (!validate_sat_key_product(values.clave_sat, false)){
- webix.message({ type:'error', text:'La clave SAT no existe' })
+ msg_error('La clave SAT no existe')
return
}
@@ -147,14 +147,14 @@ function cmd_save_product_click(id, e, node){
webix.ajax().sync().post('products', values, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico'
- webix.message({type: 'error', text: msg})
+ msg_error(msg)
},
success:function(text, data, XmlHttpRequest){
var values = data.json();
if (values.ok) {
update_grid_products(values)
}else{
- webix.message({type:'error', text:values.msg})
+ msg_error(values.msg)
}
}
})
@@ -192,7 +192,7 @@ function chk_automatica_change(new_value, old_value){
function get_new_key(){
webix.ajax().get('/values/newkey', {
error: function(text, data, xhr) {
- webix.message({type:'error', text: text})
+ msg_error(text)
},
success: function(text, data, xhr) {
var values = data.json();
diff --git a/source/static/js/controller/util.js b/source/static/js/controller/util.js
index 7d53233..713a3bb 100644
--- a/source/static/js/controller/util.js
+++ b/source/static/js/controller/util.js
@@ -56,12 +56,15 @@ function show(nombre, value){
function msg_error(msg){
+ if(!msg){
+ msg = 'Error al consultar'
+ }
webix.message({type: 'error', text: msg})
}
-function msg_sucess(msg){
- webix.message({type: 'sucess', text: msg})
+function msg_ok(msg){
+ webix.message({type: 'success', text: msg})
}
@@ -119,7 +122,7 @@ webix.ui.datafilter.rowCount = webix.extend({
function validate_rfc(value){
rfc = value.trim().toUpperCase();
if ( rfc == ""){
- webix.message({ type:"error", text:"El RFC no puede estar vacío" });
+ msg_error('El RFC no puede estar vacío')
return false
}
@@ -131,41 +134,41 @@ function validate_rfc(value){
start = 2
}
if (rfc.length != length){
- webix.message({ type:"error", text:"Longitud incorrecta del RFC" });
+ msg_error('Longitud incorrecta del RFC')
return false
}
if (tipo_persona < 3 && (rfc == RFC_PUBLICO || rfc == RFC_EXTRANJERO)){
- webix.message({ type:"error", text:"RFC incorrecto" });
+ msg_error('RFC incorrecto')
return false
}
var part = rfc.slice(0, start);
var re = new RegExp('[a-z&Ñ]{' + start + '}', 'i');
if (!part.match(re)){
- webix.message({ type:"error", text: "El RFC tiene caractéres inválidos al inicio" });
+ msg_error('El RFC tiene caractéres inválidos al inicio')
return false
}
part = rfc.slice(-3);
re = new RegExp('[a-z0-9]{3}', 'i');
if (!part.match(re)){
- webix.message({ type:"error", text: "El RFC tiene caractéres inválidos al final" });
+ msg_error('El RFC tiene caractéres inválidos al final')
return false
}
part = rfc.slice(-9, -3);
re = new RegExp('[0-9]{6}', 'i');
if (!part.match(re)){
- webix.message({ type:"error", text: "Fecha inválida" });
+ msg_error('Fecha inválida')
return false
}
var month = parseInt(part.slice(-4, -2))
if (month == 0 || month > 12 ){
- webix.message({ type:"error", text: "Fecha inválida" });
+ msg_error('Fecha inválida')
return false
}
var day = parseInt(part.slice(-2))
if (day == 0 || day > 31 ){
- webix.message({ type:"error", text: "Fecha inválida" });
+ msg_error('Fecha inválida')
return false
}
diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js
index 3ec846f..1178aaf 100644
--- a/source/static/js/ui/admin.js
+++ b/source/static/js/ui/admin.js
@@ -226,7 +226,7 @@ var controls_emisor = [
{id: 'Datos Fiscales', rows: emisor_datos_fiscales},
{id: 'Otros Datos', rows: emisor_otros_datos},
{id: 'Certificado', rows: emisor_certificado},
- {id: 'Cuentas de Banco', rows: emisor_cuentas_banco}
+ {id: 'Cuentas de Banco', rows: emisor_cuentas_banco},
]
}
]
@@ -234,16 +234,18 @@ var controls_emisor = [
var form_emisor = {
type: 'space',
+ responsive: true,
cols: [{
view: 'form',
id: 'form_emisor',
complexData: true,
+ scroll: true,
elements: controls_emisor,
elementsConfig: {
labelWidth: 150,
labelAlign: 'right'
},
- autoheight: true,
+ //~ autoheight: true,
rules: {
emisor_nombre: function(value){return value.trim() != ''},
}
@@ -427,6 +429,11 @@ var options_templates = [
{view: 'search', id: 'txt_plantilla_factura_33j', name: 'plantilla_factura_33j',
label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top',
icon: 'file'}, {}]},
+ {maxHeight: 20},
+ {cols: [{maxWidth: 15},
+ {view: 'search', id: 'txt_plantilla_donataria', name: 'plantilla_donataria',
+ label: 'Plantilla Donataria (solo ONGs): ', labelPosition: 'top',
+ icon: 'file'}, {}]},
{}]
@@ -678,7 +685,7 @@ var app_emisor = {
type: 'form', autowidth: true, align: 'center'},
{}]
},
- {},
+ {maxHeight: 20},
],
}
diff --git a/source/static/js/ui/invoices.js b/source/static/js/ui/invoices.js
index 5d94855..d8b30a3 100644
--- a/source/static/js/ui/invoices.js
+++ b/source/static/js/ui/invoices.js
@@ -615,8 +615,3 @@ var app_invoices = {
multi_invoices
],
}
-
-
-
-
-