Fix - Ticket #223
This commit is contained in:
parent
0caea7b0ce
commit
8c874dd8dd
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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(){
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue