Import from json
This commit is contained in:
parent
6fd8f9e2ea
commit
1efa280920
|
@ -22,7 +22,7 @@ var tipo_relacion = ''
|
|||
var anticipo = false
|
||||
var donativo = false
|
||||
var cfg_invoice = new Object()
|
||||
var values_comercioe = null
|
||||
//~ var values_comercioe = null
|
||||
var values_global = ''
|
||||
|
||||
|
||||
|
@ -855,14 +855,14 @@ function guardar_y_timbrar(values){
|
|||
|
||||
var usar_comercioe = $$('chk_cfdi_usar_comercioe').getValue()
|
||||
if(usar_comercioe){
|
||||
data['comercioe'] = values_comercioe
|
||||
data['comercioe'] = _get_values_comercio_exterior()
|
||||
}
|
||||
|
||||
if(!save_invoice(data)){
|
||||
return
|
||||
}
|
||||
|
||||
values_comercioe = null
|
||||
//~ values_comercioe = null
|
||||
values_global = ''
|
||||
$$('chk_cfdi_usar_comercioe').setValue(false)
|
||||
|
||||
|
@ -919,11 +919,11 @@ function cmd_timbrar_click(id, e, node){
|
|||
|
||||
if($$('chk_cfdi_usar_comercioe').getValue()){
|
||||
msg += 'Estas usando el complemento:<BR>Comercio Exterior<BR><BR>'
|
||||
if(values_comercioe === null){
|
||||
msg = 'El complemento de Comercio Exterior esta vacío'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
//~ if(values_comercioe === null){
|
||||
//~ msg = 'El complemento de Comercio Exterior esta vacío'
|
||||
//~ msg_error(msg)
|
||||
//~ return
|
||||
//~ }
|
||||
}
|
||||
|
||||
if(tipo_comprobante == 'T'){
|
||||
|
@ -2961,7 +2961,7 @@ function up_invoice_json_on_after_file_add(obj){
|
|||
|
||||
function _set_from_json_comercioe(data){
|
||||
try{
|
||||
values_comercioe = JSON.parse(data)
|
||||
values = JSON.parse(data)
|
||||
}catch(e){
|
||||
msg_error('Revisa el archivo JSON')
|
||||
webix.alert({
|
||||
|
@ -2971,6 +2971,66 @@ function _set_from_json_comercioe(data){
|
|||
})
|
||||
return
|
||||
}
|
||||
|
||||
const controls = {
|
||||
Exportacion: 'lst_ce_exportacion',
|
||||
MotivoTraslado: 'lst_ce_motivo_traslado',
|
||||
ClaveDePedimento: 'lst_ce_clave_pedimento',
|
||||
CertificadoOrigen: 'lst_ce_certificado_origen',
|
||||
NumCertificadoOrigen: 'txt_ce_numero_certificado',
|
||||
NumeroExportadorConfiable: 'txt_ce_numero_exportador',
|
||||
Incoterm: 'lst_ce_incoterm',
|
||||
Observaciones: 'txt_ce_observaciones',
|
||||
TipoCambioUSD: 'txt_ce_tipo_cambio_usd',
|
||||
TotalUSD: 'txt_ce_total_usd',
|
||||
};
|
||||
|
||||
Object.keys(controls).forEach(key => {
|
||||
if(key in values){
|
||||
$$(controls[key]).setValue(values[key])
|
||||
}
|
||||
});
|
||||
|
||||
var grid = $$('grid_ce_emisor')
|
||||
grid.clearAll()
|
||||
if ('emisor' in values) {
|
||||
grid.add(values['emisor'])
|
||||
} else {
|
||||
grid.add({id: 0})
|
||||
}
|
||||
|
||||
var grid = $$('grid_ce_receptor')
|
||||
grid.clearAll()
|
||||
if ('receptor' in values) {
|
||||
grid.add(values['receptor'])
|
||||
} else {
|
||||
grid.add({id: 0})
|
||||
}
|
||||
|
||||
var grid = $$('grid_ce_destinatario')
|
||||
grid.clearAll()
|
||||
if ('destinatario' in values) {
|
||||
grid.add(values['destinatario'])
|
||||
} else {
|
||||
grid.add({id: 0})
|
||||
}
|
||||
|
||||
var grid = $$('grid_ce_propietarios')
|
||||
grid.clearAll()
|
||||
if ('propietarios' in values) {
|
||||
values['propietarios'].forEach(function(row, index){
|
||||
row['delete'] = '-'
|
||||
grid.add(row)
|
||||
})
|
||||
}
|
||||
|
||||
var grid = $$('grid_ce_mercancias')
|
||||
grid.clearAll()
|
||||
values['mercancias'].forEach(function(row, index){
|
||||
row['delete'] = '-'
|
||||
grid.add(row)
|
||||
})
|
||||
|
||||
msg = 'Valores cargados correctamente'
|
||||
msg_ok(msg)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue