forked from elmau/empresa-libre
Fix - Issue #94
This commit is contained in:
parent
d7d6b6efda
commit
8f7c1c3a31
|
@ -30,6 +30,8 @@ var invoices_controllers = {
|
||||||
$$('cmd_invoice_sat').attachEvent('onItemClick', cmd_invoice_sat_click)
|
$$('cmd_invoice_sat').attachEvent('onItemClick', cmd_invoice_sat_click)
|
||||||
$$('cmd_invoice_cancelar').attachEvent('onItemClick', cmd_invoice_cancelar_click)
|
$$('cmd_invoice_cancelar').attachEvent('onItemClick', cmd_invoice_cancelar_click)
|
||||||
$$('grid_invoices').attachEvent('onItemClick', grid_invoices_click)
|
$$('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)
|
||||||
$$('filter_year').attachEvent('onChange', filter_year_change)
|
$$('filter_year').attachEvent('onChange', filter_year_change)
|
||||||
$$('filter_month').attachEvent('onChange', filter_month_change)
|
$$('filter_month').attachEvent('onChange', filter_month_change)
|
||||||
$$('filter_dates').attachEvent('onChange', filter_dates_change)
|
$$('filter_dates').attachEvent('onChange', filter_dates_change)
|
||||||
|
@ -208,10 +210,15 @@ function cmd_delete_invoice_click(id, e, node){
|
||||||
}
|
}
|
||||||
|
|
||||||
var row = gi.getSelectedItem()
|
var row = gi.getSelectedItem()
|
||||||
|
|
||||||
if (row == undefined){
|
if (row == undefined){
|
||||||
msg_error('Selecciona una factura')
|
msg_error('Selecciona una factura')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (row instanceof Array){
|
||||||
|
msg_error('Selecciona solo una factura')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(row.uuid){
|
if(row.uuid){
|
||||||
msg_error('Solo se pueden eliminar facturas sin timbrar')
|
msg_error('Solo se pueden eliminar facturas sin timbrar')
|
||||||
|
@ -1049,6 +1056,10 @@ function cmd_invoice_timbrar_click(){
|
||||||
msg_error('Selecciona una factura')
|
msg_error('Selecciona una factura')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (row instanceof Array){
|
||||||
|
msg_error('Selecciona solo una factura')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(row.uuid){
|
if(row.uuid){
|
||||||
msg_error('La factura ya esta timbrada')
|
msg_error('La factura ya esta timbrada')
|
||||||
|
@ -1155,6 +1166,11 @@ function cmd_invoice_cancelar_click(){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (row instanceof Array){
|
||||||
|
msg_error('Selecciona solo una factura')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(!row.uuid){
|
if(!row.uuid){
|
||||||
msg_error('La factura no esta timbrada, solo es posible cancelar \
|
msg_error('La factura no esta timbrada, solo es posible cancelar \
|
||||||
facturas timbradas')
|
facturas timbradas')
|
||||||
|
@ -1238,6 +1254,10 @@ function cmd_invoice_sat_click(){
|
||||||
msg_error('Selecciona una factura')
|
msg_error('Selecciona una factura')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (row instanceof Array){
|
||||||
|
msg_error('Selecciona solo una factura')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(!row.uuid){
|
if(!row.uuid){
|
||||||
msg_error('La factura no esta timbrada, solo es posible consultar \
|
msg_error('La factura no esta timbrada, solo es posible consultar \
|
||||||
|
@ -1749,3 +1769,31 @@ function cmd_invoice_report_xls_click(){
|
||||||
rawValues: true,
|
rawValues: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function grid_invoices_on_select_change(){
|
||||||
|
var g = $$('grid_invoices')
|
||||||
|
var rows = g.getSelectedItem(true)
|
||||||
|
var total = 0
|
||||||
|
|
||||||
|
for (i = 0; i < rows.length; i++) {
|
||||||
|
total += rows[i].total_mn.to_float()
|
||||||
|
}
|
||||||
|
g.getColumnConfig('cliente').footer[0].text = webix.i18n.priceFormat(total)
|
||||||
|
g.refreshColumns()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function grid_invoices_on_header_click(id){
|
||||||
|
if(id.column != 'index'){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var g = $$('grid_invoices')
|
||||||
|
var rows = g.getSelectedItem(true)
|
||||||
|
if(rows.length){
|
||||||
|
g.unselectAll()
|
||||||
|
}else{
|
||||||
|
g.selectAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,8 @@ var toolbar_invoices = [
|
||||||
{view: "button", id: "cmd_refacturar", label: "Refacturar", type: "iconButton",
|
{view: "button", id: "cmd_refacturar", label: "Refacturar", type: "iconButton",
|
||||||
autowidth: true, icon: "pencil"},
|
autowidth: true, icon: "pencil"},
|
||||||
{},
|
{},
|
||||||
|
{view: 'button', id: 'cmd_admin_invoice_notes', label: 'Notas',
|
||||||
|
type: 'iconButton', autowidth: true, icon: 'commenting-o'},
|
||||||
{view: 'button', id: 'cmd_invoice_report_pdf', label: 'Reporte',
|
{view: 'button', id: 'cmd_invoice_report_pdf', label: 'Reporte',
|
||||||
type: 'iconButton', autowidth: true, icon: 'file-pdf-o'},
|
type: 'iconButton', autowidth: true, icon: 'file-pdf-o'},
|
||||||
{view: 'button', id: 'cmd_invoice_report_xls', label: 'Reporte',
|
{view: 'button', id: 'cmd_invoice_report_xls', label: 'Reporte',
|
||||||
|
@ -235,8 +237,8 @@ var grid_invoices_cols = [
|
||||||
{id: 'total_mn', header: ['Total M.N.', {content: 'numberFilter'}],
|
{id: 'total_mn', header: ['Total M.N.', {content: 'numberFilter'}],
|
||||||
width: 150, sort: 'int', format: webix.i18n.priceFormat, css: 'right',
|
width: 150, sort: 'int', format: webix.i18n.priceFormat, css: 'right',
|
||||||
footer: {content: 'summTimbrada', css: 'right'}},
|
footer: {content: 'summTimbrada', css: 'right'}},
|
||||||
{id: "cliente", header: ["Razón Social", {content: "selectFilter"}],
|
{id: 'cliente', header: ['Razón Social', {content: 'selectFilter'}],
|
||||||
fillspace:true, sort:"string"},
|
fillspace: true, sort: 'string', footer: '$ 0.00'},
|
||||||
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
|
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
|
||||||
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
||||||
{id: 'zip', header: 'ZIP', adjust: 'data', template: get_icon('zip')},
|
{id: 'zip', header: 'ZIP', adjust: 'data', template: get_icon('zip')},
|
||||||
|
@ -248,6 +250,7 @@ var grid_invoices = {
|
||||||
view: 'datatable',
|
view: 'datatable',
|
||||||
id: 'grid_invoices',
|
id: 'grid_invoices',
|
||||||
select: 'row',
|
select: 'row',
|
||||||
|
multiselect: true,
|
||||||
adjust: true,
|
adjust: true,
|
||||||
footer: true,
|
footer: true,
|
||||||
resizeColumn: true,
|
resizeColumn: true,
|
||||||
|
|
Loading…
Reference in New Issue