diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e03c38..60adc6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +v 1.9.0 [18-jun-2018] +--------------------- + - Se agrega la vista del detalle de facturas + - Fix: Al timbrar nómina + + v 1.8.1 [14-jun-2018] --------------------- - Fix: Se agrega una barra de desplazamiento al buscar productos o clientes diff --git a/VERSION b/VERSION index a8fdfda..f8e233b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.1 +1.9.0 diff --git a/source/app/controllers/cfdi_xml.py b/source/app/controllers/cfdi_xml.py index a192565..f01e117 100644 --- a/source/app/controllers/cfdi_xml.py +++ b/source/app/controllers/cfdi_xml.py @@ -124,7 +124,7 @@ class CFDI(object): if datos['donativo']: self._donativo = True - self._edu = datos['edu'] + self._edu = datos.get('edu', False) if datos['complementos']: if 'ine' in datos['complementos']: diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 2573584..0385eae 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -48,7 +48,7 @@ try: from com.sun.star.awt import Size from com.sun.star.view.PaperFormat import LETTER APP_LIBO = True -except: +except ImportError: APP_LIBO = False import pyqrcode @@ -1469,12 +1469,13 @@ def import_employees(rfc): if not is_file(path): return () + msg = 'LibreOffice no se pudo iniciar' if APP_LIBO: app = LIBO() if app.is_running: return app.employees(path) - return () + return (), msg def import_nomina(rfc): diff --git a/source/app/models/main.py b/source/app/models/main.py index 20d509f..b6ab4ca 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -3585,6 +3585,9 @@ class Facturas(BaseModel): if values['opt'] == 'reinvoice': return self._get_reinvoice(self, int(values['id'])) + if values['opt'] == 'detalle': + return FacturasDetalle.get_detalle(int(values['id'])) + cfdis = util.loads(values['cfdis']) if values['year'] == '-1': @@ -4955,6 +4958,24 @@ class FacturasDetalle(BaseModel): data.append({'row': row, 'taxes': impuestos}) return data + @classmethod + def get_detalle(cls, id): + data = [] + products = FacturasDetalle.select().where(FacturasDetalle.factura==id) + for p in reversed(products): + row = {'id_product': p.producto.id} + row['clave'] = p.clave + row['clave_sat'] = p.clave_sat + row['descripcion'] = p.descripcion + row['unidad'] = p.producto.unidad.name + row['cantidad'] = p.cantidad + row['valor_unitario'] = p.valor_unitario + row['descuento'] = p.descuento + pf = p.valor_unitario - p.descuento + row['importe'] = round(pf * p.cantidad, DECIMALES) + data.append(row) + return data + class PreFacturasDetalle(BaseModel): factura = ForeignKeyField(PreFacturas) diff --git a/source/app/settings.py b/source/app/settings.py index a26597b..b680e1b 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -31,7 +31,7 @@ except ImportError: DEBUG = DEBUG -VERSION = '1.8.1' +VERSION = '1.9.0' EMAIL_SUPPORT = ('soporte@empresalibre.net',) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) diff --git a/source/static/css/app.css b/source/static/css/app.css index 0bd1d39..fe3d0a0 100644 --- a/source/static/css/app.css +++ b/source/static/css/app.css @@ -88,3 +88,17 @@ font-size: 1.5vw; color: white; } + +.table_sg .webix_hcell{ + background: #A64C4C; + color: white; + font-weight: bold; + +} +.table_sg .webix_column{ + font-style: italic; + background: #FFF8DC; +} +.table_sg .webix_column > div{ + border-color: #ddd; +} diff --git a/source/static/js/controller/invoices.js b/source/static/js/controller/invoices.js index ed650d0..0b9c0a2 100644 --- a/source/static/js/controller/invoices.js +++ b/source/static/js/controller/invoices.js @@ -34,6 +34,8 @@ var invoices_controllers = { $$('grid_invoices').attachEvent('onItemClick', grid_invoices_click) $$('grid_invoices').attachEvent('onSelectChange', grid_invoices_on_select_change) $$('grid_invoices').attachEvent('onHeaderClick', grid_invoices_on_header_click) + $$('grid_invoices').attachEvent('onSubViewCreate', grid_invoices_on_subview_create) + $$('filter_year').attachEvent('onChange', filter_year_change) $$('filter_month').attachEvent('onChange', filter_month_change) $$('filter_dates').attachEvent('onChange', filter_dates_change) @@ -2212,8 +2214,18 @@ function cmd_invoice_verify_sat_click(){ } +function grid_invoices_on_subview_create(view, item){ + var values = {'opt': 'detalle', 'id': item.id} + webix.ajax().get('/invoices', values, { + error: function(text, data, xhr) { + msg_error('Error al consultar') + }, + success: function(text, data, xhr) { + view.parse(data.json(), 'json') + } + }); +} + + function cmd_preinvoice_generate_delete_click(){ - - - -} \ No newline at end of file +} diff --git a/source/static/js/ui/invoices.js b/source/static/js/ui/invoices.js index 00a7491..45cbc26 100644 --- a/source/static/js/ui/invoices.js +++ b/source/static/js/ui/invoices.js @@ -162,7 +162,7 @@ var body_cfdi_notes = {rows: [ label: 'Guardar y Cerrar', type: 'iconButton', hotkey: 'Ctrl+enter'}, {}]}, {minHeight: 5, maxHeight: 5}, -]} +],} var win_invoice_notes = { @@ -241,8 +241,8 @@ var grid_invoices_cols = [ {id: 'index', header: '#', adjust: 'data', css: 'right', footer: {content: 'countRows', colspan: 3, css: 'right'}}, {id: "id", header:"ID", hidden:true}, - {id: "serie", header: ["Serie", {content: "selectFilter"}], adjust: "data", - sort:"string"}, + {id: 'serie', header: ["Serie", {content: "selectFilter"}], adjust: "data", + sort: 'string', template: '{common.subrow()} #serie#'}, {id: 'folio', header: ['Folio', {content: 'numberFilter'}], adjust: 'data', sort: 'int', css: 'right', footer: {text: 'Facturas', colspan: 3}}, {id: "uuid", header: ["UUID", {content: "textFilter"}], adjust: "data", @@ -268,9 +268,41 @@ var grid_invoices_cols = [ ] +var sv_grid_invoices = { + borderless: true, + view: 'datatable', + headerRowHeight: 25, + columns: [ + {id: 'id_product', header: 'id_product', hidden: true}, + {id: "clave", header:{text: 'Clave', css: 'center'}, width: 100, + adjust: 'data'}, + {id: "clave_sat", hidden: true}, + {id: "descripcion", header:{text: 'Descripción', css: 'center'}, + fillspace: true}, + {id: "pedimento", header: 'Pedimento', hidden: true}, + {id: "id_student", header: 'ID_Alumno', hidden: true}, + {id: 'student', header: 'Alumno', hidden: true, width: 150}, + {id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100}, + {id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100, + format: webix.i18n.numberFormat, css: 'right'}, + {id: "valor_unitario", header:{text: 'Valor Unitario', css: 'center'}, + width: 100, format: webix.i18n.priceFormat, css: 'right'}, + {id: 'descuento', header:{text: 'Descuento', css: 'center'}, + width: 80, format: webix.i18n.priceFormat, css: 'right'}, + {id: 'precio_final', hidden: true, header: 'precio_final', width: 80, + format: webix.i18n.priceFormat, css: 'right'}, + {id: "importe", header:{text: 'Importe', css: 'center'}, width: 150, + format: webix.i18n.priceFormat, css: 'right'}, + ], + scrollX: false, + autoheight: true, + css: 'table_sg', +} + var grid_invoices = { view: 'datatable', id: 'grid_invoices', + subview: sv_grid_invoices, select: 'row', multiselect: true, adjust: true,