forked from elmau/empresa-libre
111 lines
2.6 KiB
JavaScript
111 lines
2.6 KiB
JavaScript
var query = []
|
|
var grid = null
|
|
|
|
|
|
function get_series(){
|
|
webix.ajax().get('/values/series', function(text, data){
|
|
var values = data.json()
|
|
table_series.clear()
|
|
table_series.insert(values)
|
|
pre = values[0]
|
|
$$('lst_serie').getList().parse(values)
|
|
$$('lst_serie').setValue(pre.id)
|
|
if(pre.usar_con){
|
|
$$('lst_tipo_comprobante').setValue(pre.usar_con)
|
|
$$('lst_tipo_comprobante').config.readonly = true
|
|
$$('lst_tipo_comprobante').refresh()
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
function get_forma_pago(){
|
|
webix.ajax().get('/values/formapago', function(text, data){
|
|
var values = data.json()
|
|
pre = values[0]
|
|
$$('lst_forma_pago').getList().parse(values)
|
|
$$('lst_forma_pago').setValue(pre.id)
|
|
})
|
|
}
|
|
|
|
|
|
function get_monedas(){
|
|
webix.ajax().get('/values/monedas', function(text, data){
|
|
var values = data.json()
|
|
pre = values[0]
|
|
$$('lst_moneda').getList().parse(values)
|
|
$$('lst_moneda').setValue(pre.id)
|
|
})
|
|
}
|
|
|
|
|
|
function get_uso_cfdi(){
|
|
webix.ajax().get('/values/usocfdi', function(text, data){
|
|
var values = data.json()
|
|
pre = values[0]
|
|
table_usocfdi.clear()
|
|
table_usocfdi.insert(values)
|
|
$$('lst_uso_cfdi').getList().parse(values)
|
|
$$('lst_uso_cfdi').setValue(pre.id)
|
|
})
|
|
}
|
|
|
|
|
|
function default_config(){
|
|
get_series()
|
|
get_forma_pago()
|
|
get_monedas()
|
|
get_uso_cfdi()
|
|
table_pt.clear()
|
|
table_totals.clear()
|
|
}
|
|
|
|
|
|
function cmd_new_invoice_click(id, e, node){
|
|
var form = $$('form_invoice')
|
|
var grid_totals = $$('grid_totals')
|
|
grid = $$('grid_details')
|
|
|
|
default_config()
|
|
form.adjust()
|
|
form.setValues({id: 0, id_partner: 0, lbl_partner: 'Ninguno'})
|
|
grid.clearAll()
|
|
grid_totals.clearAll()
|
|
grid_totals.add({id: 1, concepto: 'SubTotal', importe: 0})
|
|
$$('multi_invoices').setValue('invoices_new')
|
|
form.focus('search_partner_id')
|
|
}
|
|
|
|
|
|
function cmd_edit_invoice_click(id, e, node){
|
|
|
|
$$("multi_invoices").setValue("invoices_new")
|
|
|
|
};
|
|
|
|
|
|
function cmd_delete_invoice_click(id, e, node){
|
|
|
|
webix.message({type:"success", text: "OK Delete"});
|
|
|
|
};
|
|
|
|
|
|
function cmd_timbrar_click(id, e, node){
|
|
var form = this.getFormView()
|
|
|
|
if (!form.validate()) {
|
|
webix.message({type: 'error', text: 'Valores inválidos'})
|
|
return
|
|
}
|
|
|
|
$$('form_invoice').clear();
|
|
$$('multi_invoices').setValue('invoices_home')
|
|
webix.message({type:"success", text: "Factura guardada correctamente"})
|
|
}
|
|
|
|
|
|
function cmd_close_invoice_click(id, e, node){
|
|
$$('multi_invoices').setValue('invoices_home')
|
|
}
|