Stamp Carta Porte v3
This commit is contained in:
parent
13a3c106c6
commit
7f129b84b2
|
@ -111,10 +111,10 @@ SAT = {
|
||||||
'schema': ' http://www.sat.gob.mx/leyendasFiscales http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xsd',
|
'schema': ' http://www.sat.gob.mx/leyendasFiscales http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xsd',
|
||||||
},
|
},
|
||||||
'cartaporte': {
|
'cartaporte': {
|
||||||
'version': '2.0',
|
'version': '3.0',
|
||||||
'prefix': 'cartaporte20',
|
'prefix': 'cartaporte30',
|
||||||
'xmlns': 'http://www.sat.gob.mx/CartaPorte20',
|
'xmlns': 'http://www.sat.gob.mx/CartaPorte30',
|
||||||
'schema': ' http://www.sat.gob.mx/CartaPorte20 http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte20.xsd',
|
'schema': ' http://www.sat.gob.mx/CartaPorte30 http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte30.xsd',
|
||||||
},
|
},
|
||||||
'comercioe': {
|
'comercioe': {
|
||||||
'version': '2.0',
|
'version': '2.0',
|
||||||
|
@ -575,6 +575,11 @@ class CFDI(object):
|
||||||
mercancias = datos.pop('mercancias', ())
|
mercancias = datos.pop('mercancias', ())
|
||||||
tiposfigura = datos.pop('tiposfigura', ())
|
tiposfigura = datos.pop('tiposfigura', ())
|
||||||
|
|
||||||
|
autotransporte = datos.pop('autotransporte', {})
|
||||||
|
identificacion = autotransporte.pop('identificacion')
|
||||||
|
seguros = autotransporte.pop('seguros')
|
||||||
|
remolques = autotransporte.pop('remolques')
|
||||||
|
|
||||||
atributos = {'Version': SAT['cartaporte']['version']}
|
atributos = {'Version': SAT['cartaporte']['version']}
|
||||||
atributos.update(datos)
|
atributos.update(datos)
|
||||||
|
|
||||||
|
@ -592,10 +597,6 @@ class CFDI(object):
|
||||||
|
|
||||||
attr = mercancias
|
attr = mercancias
|
||||||
mercancias = attr.pop('mercancias')
|
mercancias = attr.pop('mercancias')
|
||||||
autotransporte = attr.pop('autotransporte')
|
|
||||||
identificacion = autotransporte.pop('identificacion')
|
|
||||||
seguros = autotransporte.pop('seguros')
|
|
||||||
remolque = autotransporte.pop('remolque')
|
|
||||||
|
|
||||||
node = ET.SubElement(node_carta, f'{prefix}:Mercancias', attr)
|
node = ET.SubElement(node_carta, f'{prefix}:Mercancias', attr)
|
||||||
for mercancia in mercancias:
|
for mercancia in mercancias:
|
||||||
|
@ -604,10 +605,10 @@ class CFDI(object):
|
||||||
sub_node = ET.SubElement(node, f'{prefix}:Autotransporte', autotransporte)
|
sub_node = ET.SubElement(node, f'{prefix}:Autotransporte', autotransporte)
|
||||||
ET.SubElement(sub_node, f'{prefix}:IdentificacionVehicular', identificacion)
|
ET.SubElement(sub_node, f'{prefix}:IdentificacionVehicular', identificacion)
|
||||||
ET.SubElement(sub_node, f'{prefix}:Seguros', seguros)
|
ET.SubElement(sub_node, f'{prefix}:Seguros', seguros)
|
||||||
if 'SubTipoRem' in remolque and 'Placa' in remolque \
|
if remolques:
|
||||||
and remolque['SubTipoRem'] and remolque['Placa']:
|
node_remolques = ET.SubElement(sub_node, f'{prefix}:Remolques')
|
||||||
tmp = ET.SubElement(sub_node, f'{prefix}:Remolques')
|
for remolque in remolques:
|
||||||
ET.SubElement(tmp, f'{prefix}:Remolque', remolque)
|
ET.SubElement(node_remolques, f'{prefix}:Remolque', remolque)
|
||||||
|
|
||||||
if tiposfigura:
|
if tiposfigura:
|
||||||
sub_node = ET.SubElement(node_carta, f'{prefix}:FiguraTransporte')
|
sub_node = ET.SubElement(node_carta, f'{prefix}:FiguraTransporte')
|
||||||
|
|
|
@ -2422,6 +2422,7 @@ def upload_file(rfc, opt, file_obj):
|
||||||
'_4.0_cn_1.2.ods',
|
'_4.0_cn_1.2.ods',
|
||||||
'_4.0_cp_2.0.ods',
|
'_4.0_cp_2.0.ods',
|
||||||
'_4.0_ccp_2.0.ods',
|
'_4.0_ccp_2.0.ods',
|
||||||
|
'_4.0_ccp_3.0.ods',
|
||||||
'_4.0_cd_1.1.ods',
|
'_4.0_cd_1.1.ods',
|
||||||
'_4.0_cce_2.0.ods',
|
'_4.0_cce_2.0.ods',
|
||||||
'_4.0.json',
|
'_4.0.json',
|
||||||
|
@ -3144,4 +3145,8 @@ def parse_xml2(xml_str):
|
||||||
return etree.fromstring(xml_str.encode('utf-8'))
|
return etree.fromstring(xml_str.encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
def get_idccp():
|
||||||
|
uuid_v4 = uuid.uuid4()
|
||||||
|
custom_uuid_str = f"CCC{uuid_v4.hex[3:8].upper()}-{uuid_v4.hex[8:12].upper()}-{uuid_v4.hex[12:16].upper()}-{uuid_v4.hex[16:20].upper()}-{uuid_v4.hex[20:32].upper()}"
|
||||||
|
return custom_uuid_str
|
||||||
|
|
||||||
|
|
|
@ -5575,16 +5575,37 @@ class Facturas(BaseModel):
|
||||||
if not valores:
|
if not valores:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
info = {}
|
||||||
values = utils.loads(valores)
|
values = utils.loads(valores)
|
||||||
|
info['IdCCP'] = util.get_idccp()
|
||||||
|
info['TranspInternac'] = values['TranspInternac']
|
||||||
|
autotransporte = {
|
||||||
|
'PermSCT': values['autotransporte'].pop('PermSCT'),
|
||||||
|
'NumPermisoSCT': values['autotransporte'].pop('NumPermisoSCT'),
|
||||||
|
}
|
||||||
|
identificacion = values['autotransporte']
|
||||||
|
if 'PesoBrutoVehicular' in identificacion \
|
||||||
|
and isinstance(identificacion['PesoBrutoVehicular'], float):
|
||||||
|
identificacion['PesoBrutoVehicular'] = f"{identificacion['PesoBrutoVehicular']:.2f}"
|
||||||
|
info['autotransporte'] = autotransporte
|
||||||
|
info['autotransporte']['identificacion'] = identificacion
|
||||||
|
info['autotransporte']['seguros'] = values['seguros']
|
||||||
|
info['autotransporte']['remolques'] = values['remolques']
|
||||||
|
|
||||||
total_distance = 0.00
|
total_distance = 0.00
|
||||||
total_weight = 0.00
|
total_weight = 0.00
|
||||||
mercancias = values['mercancias']
|
mercancias = values['mercancias']
|
||||||
for mercancia in mercancias['mercancias']:
|
for mercancia in mercancias:
|
||||||
total_weight += float(mercancia['PesoEnKg'])
|
total_weight += float(mercancia['PesoEnKg'])
|
||||||
if isinstance(mercancia['PesoEnKg'], (int, float)):
|
if isinstance(mercancia['PesoEnKg'], (int, float)):
|
||||||
mercancia['PesoEnKg'] = f"{mercancia['PesoEnKg']:.2f}"
|
mercancia['PesoEnKg'] = f"{mercancia['PesoEnKg']:.2f}"
|
||||||
mercancias['PesoBrutoTotal'] = f"{total_weight:.2f}"
|
mercancia['Cantidad'] = f"{mercancia['Cantidad']:.2f}"
|
||||||
|
|
||||||
|
info['mercancias'] = {}
|
||||||
|
info['mercancias']['UnidadPeso'] = values['unidad_peso']
|
||||||
|
info['mercancias']['PesoBrutoTotal'] = f"{total_weight:.2f}"
|
||||||
|
info['mercancias']['NumTotalMercancias'] = f"{len(mercancias):,}"
|
||||||
|
info['mercancias']['mercancias'] = mercancias
|
||||||
|
|
||||||
ubicaciones = values['ubicaciones']
|
ubicaciones = values['ubicaciones']
|
||||||
for ubicacion in ubicaciones:
|
for ubicacion in ubicaciones:
|
||||||
|
@ -5608,12 +5629,15 @@ class Facturas(BaseModel):
|
||||||
'CodigoPostal': cp,
|
'CodigoPostal': cp,
|
||||||
}
|
}
|
||||||
|
|
||||||
values['TotalDistRec'] = f"{total_distance:.2f}"
|
info['TotalDistRec'] = f"{total_distance:.2f}"
|
||||||
# ~ print(2, values)
|
info['ubicaciones'] = ubicaciones
|
||||||
|
info['tiposfigura'] = values['tiposfigura']
|
||||||
|
|
||||||
|
# ~ print(2, info)
|
||||||
data = {
|
data = {
|
||||||
'factura': invoice,
|
'factura': invoice,
|
||||||
'nombre': 'cartaporte',
|
'nombre': 'cartaporte',
|
||||||
'valores': utils.dumps(values),
|
'valores': utils.dumps(info),
|
||||||
}
|
}
|
||||||
FacturasComplementos.create(**data)
|
FacturasComplementos.create(**data)
|
||||||
return
|
return
|
||||||
|
|
|
@ -100,9 +100,11 @@ var invoices_controllers = {
|
||||||
//~ CartaPorte
|
//~ CartaPorte
|
||||||
$$('grid_ccp_ubicaciones').attachEvent('onBeforeEditStop', grid_ccp_ubicaciones_before_edit_stop)
|
$$('grid_ccp_ubicaciones').attachEvent('onBeforeEditStop', grid_ccp_ubicaciones_before_edit_stop)
|
||||||
$$('grid_ccp_ubicaciones').attachEvent('onItemClick', grid_ccp_ubicaciones_click)
|
$$('grid_ccp_ubicaciones').attachEvent('onItemClick', grid_ccp_ubicaciones_click)
|
||||||
$$('cmd_ccp_agregar_ubicacion').attachEvent('onItemClick', cmd_ccp_agregar_ubicacion_click)
|
|
||||||
$$('grid_ccp_mercancias').attachEvent('onItemClick', grid_ccp_mercancias_click)
|
$$('grid_ccp_mercancias').attachEvent('onItemClick', grid_ccp_mercancias_click)
|
||||||
|
$$('grid_ccp_remolques').attachEvent('onItemClick', grid_ccp_remolques_click)
|
||||||
|
$$('cmd_ccp_agregar_ubicacion').attachEvent('onItemClick', cmd_ccp_agregar_ubicacion_click)
|
||||||
$$('cmd_ccp_add_product').attachEvent('onItemClick', cmd_ccp_add_product_click)
|
$$('cmd_ccp_add_product').attachEvent('onItemClick', cmd_ccp_add_product_click)
|
||||||
|
$$('cmd_ccp_agregar_remolque').attachEvent('onItemClick', cmd_ccp_agregar_remolque_click)
|
||||||
//~ $$('cmd_carta_copy_from_invoice').attachEvent('onItemClick', cmd_carta_copy_from_invoice_click)
|
//~ $$('cmd_carta_copy_from_invoice').attachEvent('onItemClick', cmd_carta_copy_from_invoice_click)
|
||||||
$$('cmd_carta_import_json').attachEvent('onItemClick', cmd_carta_import_json_click)
|
$$('cmd_carta_import_json').attachEvent('onItemClick', cmd_carta_import_json_click)
|
||||||
|
|
||||||
|
@ -401,16 +403,6 @@ function validate_invoice(values){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var usar_cartaporte = $$('chk_cfdi_usar_cartaporte').getValue()
|
|
||||||
if(usar_cartaporte){
|
|
||||||
value = $$('lst_carta_UnidadPeso').getValue()
|
|
||||||
if(!value){
|
|
||||||
msg = 'Es necesario seleccionar una Unidad de Peso'
|
|
||||||
msg_error(msg)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var tipo_comprobante = $$('lst_tipo_comprobante').getValue()
|
var tipo_comprobante = $$('lst_tipo_comprobante').getValue()
|
||||||
if(tipo_comprobante != 'T'){
|
if(tipo_comprobante != 'T'){
|
||||||
if(values.id_partner == 0){
|
if(values.id_partner == 0){
|
||||||
|
@ -593,10 +585,99 @@ function validate_invoice(values){
|
||||||
var values = _get_values_comercio_exterior()
|
var values = _get_values_comercio_exterior()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~ validate carta porte
|
||||||
|
var usar_cartaporte = $$('chk_cfdi_usar_cartaporte').getValue()
|
||||||
|
if(usar_cartaporte){
|
||||||
|
var result = _get_values_carta_porte()
|
||||||
|
if(!result.ok){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _get_values_carta_porte(){
|
||||||
|
var ok = false
|
||||||
|
var values = new Object()
|
||||||
|
|
||||||
|
unidad_peso = $$('lst_carta_UnidadPeso').getValue()
|
||||||
|
if(!unidad_peso){
|
||||||
|
msg = 'Es necesario seleccionar una Unidad de Peso'
|
||||||
|
msg_error(msg)
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ubicaciones = $$('grid_ccp_ubicaciones').data.getRange()
|
||||||
|
if (ubicaciones.length < 2){
|
||||||
|
msg = 'Se requieren al menos dos ubicaciones'
|
||||||
|
msg_error(msg)
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
ubicaciones.forEach(function(row, index){
|
||||||
|
delete row['id']
|
||||||
|
delete row['delete']
|
||||||
|
//~ delete row['IDUbicacion']
|
||||||
|
})
|
||||||
|
|
||||||
|
var mercancias = $$('grid_ccp_mercancias').data.getRange()
|
||||||
|
if (mercancias.length < 1){
|
||||||
|
msg = 'Se requieren al menos una mercancía'
|
||||||
|
msg_error(msg)
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
mercancias.forEach(function(row, index){
|
||||||
|
delete row['id']
|
||||||
|
delete row['delete']
|
||||||
|
})
|
||||||
|
|
||||||
|
var autotransporte = $$('grid_ccp_autotransporte').data.getRange()[0]
|
||||||
|
delete autotransporte['id']
|
||||||
|
if(autotransporte['PermSCT'] === undefined){
|
||||||
|
msg = 'El campo PermSCT es requerido'
|
||||||
|
msg_error(msg)
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
|
||||||
|
var remolques = $$('grid_ccp_remolques').data.getRange()
|
||||||
|
remolques.forEach(function(row, index){
|
||||||
|
delete row['id']
|
||||||
|
})
|
||||||
|
|
||||||
|
var seguros = $$('grid_ccp_seguros').data.getRange()[0]
|
||||||
|
delete seguros['id']
|
||||||
|
if(seguros['AseguraRespCivil'] === undefined){
|
||||||
|
msg = 'El campo AseguraRespCivil es requerido'
|
||||||
|
msg_error(msg)
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
if(seguros['PolizaRespCivil'] === undefined){
|
||||||
|
msg = 'El campo PolizaRespCivil es requerido'
|
||||||
|
msg_error(msg)
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tipos_figuras = $$('grid_ccp_tipos_figuras').data.getRange()
|
||||||
|
tipos_figuras.forEach(function(row, index){
|
||||||
|
delete row['id']
|
||||||
|
})
|
||||||
|
|
||||||
|
values['TranspInternac'] = $$('lst_cp_TranspInternac').getValue()
|
||||||
|
values['unidad_peso'] = unidad_peso
|
||||||
|
values['ubicaciones'] = ubicaciones
|
||||||
|
values['mercancias'] = mercancias
|
||||||
|
values['autotransporte'] = autotransporte
|
||||||
|
values['remolques'] = remolques
|
||||||
|
values['seguros'] = seguros
|
||||||
|
values['tiposfigura'] = tipos_figuras
|
||||||
|
|
||||||
|
ok = true
|
||||||
|
|
||||||
|
return {ok: ok, values: values}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_grid_invoices(values){
|
function update_grid_invoices(values){
|
||||||
if(values.new){
|
if(values.new){
|
||||||
gi.add(values.row)
|
gi.add(values.row)
|
||||||
|
@ -803,66 +884,66 @@ function guardar_y_timbrar(values){
|
||||||
if(usar_cartaporte){
|
if(usar_cartaporte){
|
||||||
//~ var total_distance = 0.00
|
//~ var total_distance = 0.00
|
||||||
//~ var total_weight = 0.00
|
//~ var total_weight = 0.00
|
||||||
var cartaporte = {
|
//~ var cartaporte = {
|
||||||
TranspInternac: $$('lst_carta_TranspInternac').getValue(),
|
//~ TranspInternac: $$('lst_carta_TranspInternac').getValue(),
|
||||||
//~ TotalDistRec: total_distance,
|
//~ TotalDistRec: total_distance,
|
||||||
}
|
//~ }
|
||||||
var ubicaciones = $$('grid_carta_ubicaciones').data.getRange()
|
//~ var ubicaciones = $$('grid_carta_ubicaciones').data.getRange()
|
||||||
ubicaciones.forEach(function(row, index){
|
//~ ubicaciones.forEach(function(row, index){
|
||||||
delete row['id']
|
//~ delete row['id']
|
||||||
delete row['delete']
|
//~ delete row['delete']
|
||||||
//~ if(row['DistanciaRecorrida']){
|
//~ if(row['DistanciaRecorrida']){
|
||||||
//~ total_distance += parseFloat(row['DistanciaRecorrida'])
|
//~ total_distance += parseFloat(row['DistanciaRecorrida'])
|
||||||
//~ }
|
//~ }
|
||||||
})
|
//~ })
|
||||||
//~ cartaporte['TotalDistRec'] = total_distance
|
//~ cartaporte['TotalDistRec'] = total_distance
|
||||||
cartaporte['ubicaciones'] = ubicaciones
|
//~ cartaporte['ubicaciones'] = ubicaciones
|
||||||
|
|
||||||
var row = $$('grid_carta_autotransporte').data.getRange()[0]
|
//~ var row = $$('grid_carta_autotransporte').data.getRange()[0]
|
||||||
var autotransporte = {
|
//~ var autotransporte = {
|
||||||
PermSCT: row['PermSCT'],
|
//~ PermSCT: row['PermSCT'],
|
||||||
NumPermisoSCT: row['NumPermisoSCT'],
|
//~ NumPermisoSCT: row['NumPermisoSCT'],
|
||||||
identificacion: {
|
//~ identificacion: {
|
||||||
ConfigVehicular: row['ConfigVehicular'],
|
//~ ConfigVehicular: row['ConfigVehicular'],
|
||||||
PlacaVM: row['PlacaVM'],
|
//~ PlacaVM: row['PlacaVM'],
|
||||||
AnioModeloVM: row['AnioModeloVM'],
|
//~ AnioModeloVM: row['AnioModeloVM'],
|
||||||
},
|
//~ },
|
||||||
seguros: {
|
//~ seguros: {
|
||||||
AseguraRespCivil: row['AseguraRespCivil'],
|
//~ AseguraRespCivil: row['AseguraRespCivil'],
|
||||||
PolizaRespCivil: row['PolizaRespCivil'],
|
//~ PolizaRespCivil: row['PolizaRespCivil'],
|
||||||
},
|
//~ },
|
||||||
remolque: {
|
//~ remolque: {
|
||||||
SubTipoRem: row['SubTipoRem'],
|
//~ SubTipoRem: row['SubTipoRem'],
|
||||||
Placa: row['Placa'],
|
//~ Placa: row['Placa'],
|
||||||
}
|
//~ }
|
||||||
}
|
//~ }
|
||||||
|
|
||||||
var mercancias = $$('grid_carta_mercancias').data.getRange()
|
//~ var mercancias = $$('grid_carta_mercancias').data.getRange()
|
||||||
mercancias.forEach(function(row, index){
|
//~ mercancias.forEach(function(row, index){
|
||||||
delete row['id']
|
//~ delete row['id']
|
||||||
delete row['delete']
|
//~ delete row['delete']
|
||||||
row['Cantidad'] = String(row['Cantidad'])
|
//~ row['Cantidad'] = String(row['Cantidad'])
|
||||||
//~ row['ValorMercancia'] = String(row['ValorMercancia'])
|
//~ row['ValorMercancia'] = String(row['ValorMercancia'])
|
||||||
//~ if(row['PesoEnKg']){
|
//~ if(row['PesoEnKg']){
|
||||||
//~ total_weight += parseFloat(row['PesoEnKg'])
|
//~ total_weight += parseFloat(row['PesoEnKg'])
|
||||||
//~ }
|
//~ }
|
||||||
})
|
//~ })
|
||||||
var mercancias = {
|
//~ var mercancias = {
|
||||||
'PesoBrutoTotal': 0.00,
|
//~ 'PesoBrutoTotal': 0.00,
|
||||||
'UnidadPeso': $$('lst_carta_UnidadPeso').getValue(),
|
//~ 'UnidadPeso': $$('lst_carta_UnidadPeso').getValue(),
|
||||||
'NumTotalMercancias': String(mercancias.length),
|
//~ 'NumTotalMercancias': String(mercancias.length),
|
||||||
mercancias: mercancias,
|
//~ mercancias: mercancias,
|
||||||
autotransporte: autotransporte,
|
//~ autotransporte: autotransporte,
|
||||||
}
|
//~ }
|
||||||
cartaporte['mercancias'] = mercancias
|
//~ cartaporte['mercancias'] = mercancias
|
||||||
|
|
||||||
var tiposfigura = $$('grid_carta_tipos_figuras').data.getRange()
|
//~ var tiposfigura = $$('grid_carta_tipos_figuras').data.getRange()
|
||||||
tiposfigura.forEach(function(row, index){
|
//~ tiposfigura.forEach(function(row, index){
|
||||||
delete row['id']
|
//~ delete row['id']
|
||||||
})
|
//~ })
|
||||||
cartaporte['tiposfigura'] = tiposfigura
|
//~ cartaporte['tiposfigura'] = tiposfigura
|
||||||
|
var result = _get_values_carta_porte()
|
||||||
data['cartaporte'] = cartaporte
|
data['cartaporte'] = result.values
|
||||||
}
|
}
|
||||||
|
|
||||||
var usar_comercioe = $$('chk_cfdi_usar_comercioe').getValue()
|
var usar_comercioe = $$('chk_cfdi_usar_comercioe').getValue()
|
||||||
|
@ -933,6 +1014,11 @@ function cmd_timbrar_click(id, e, node){
|
||||||
msg += 'Estas usando el complemento:<BR>Comercio Exterior<BR><BR>'
|
msg += 'Estas usando el complemento:<BR>Comercio Exterior<BR><BR>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usar_carta_porte = $$('chk_cfdi_usar_cartaporte').getValue()
|
||||||
|
if(usar_carta_porte){
|
||||||
|
msg += 'Estas usando el complemento:<BR>Carta Porte<BR><BR>'
|
||||||
|
}
|
||||||
|
|
||||||
if(tipo_comprobante == 'T'){
|
if(tipo_comprobante == 'T'){
|
||||||
msg += 'El Tipo de Comprobante es Traslado, el total será puesto a 0 (Cero), asegurate de que sea el tipo de comprobante correcto<BR><BR>'
|
msg += 'El Tipo de Comprobante es Traslado, el total será puesto a 0 (Cero), asegurate de que sea el tipo de comprobante correcto<BR><BR>'
|
||||||
}
|
}
|
||||||
|
@ -2822,6 +2908,14 @@ function cmd_ccp_add_product_click(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function cmd_ccp_agregar_remolque_click(){
|
||||||
|
var g = $$('grid_ccp_remolques')
|
||||||
|
if(g.count() < 2){
|
||||||
|
g.add({delete: '-'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function _copy_from_invoice(){
|
function _copy_from_invoice(){
|
||||||
var g1 = $$('grid_details')
|
var g1 = $$('grid_details')
|
||||||
var g2 = $$('grid_carta_mercancias')
|
var g2 = $$('grid_carta_mercancias')
|
||||||
|
@ -2881,6 +2975,14 @@ function grid_ccp_mercancias_click(id, e, node){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function grid_ccp_remolques_click(id, e, node){
|
||||||
|
if(id.column != 'delete'){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.remove(id.row)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function _set_carta_porte_from_json(data){
|
function _set_carta_porte_from_json(data){
|
||||||
try{
|
try{
|
||||||
var values = JSON.parse(data)
|
var values = JSON.parse(data)
|
||||||
|
@ -2894,26 +2996,17 @@ function _set_carta_porte_from_json(data){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var mercancias = values['mercancias']
|
$$('lst_cp_TranspInternac').setValue(values['TranspInternac'])
|
||||||
|
$$('lst_carta_UnidadPeso').setValue(values['UnidadPeso'])
|
||||||
|
|
||||||
var ubicaciones = values['ubicaciones']
|
var ubicaciones = values['ubicaciones']
|
||||||
|
var mercancias = values['mercancias']
|
||||||
var autotransporte = values['autotransporte']
|
var autotransporte = values['autotransporte']
|
||||||
var operador = values['operador']
|
var remolques = values['remolques']
|
||||||
|
var seguros = values['seguros']
|
||||||
|
var figura = values['figura']
|
||||||
|
|
||||||
$$('lst_carta_UnidadPeso').setValue(values['unidad_de_peso'])
|
var grid = $$('grid_ccp_ubicaciones')
|
||||||
var grid = $$('grid_carta_mercancias')
|
|
||||||
grid.clearAll()
|
|
||||||
mercancias.forEach(function(row, index){
|
|
||||||
var data = new Object()
|
|
||||||
data['delete'] = '-'
|
|
||||||
data['BienesTransp'] = row.clave_sat
|
|
||||||
data['Descripcion'] = row.descripcion
|
|
||||||
data['Cantidad'] = row.cantidad
|
|
||||||
data['ClaveUnidad'] = row.clave_unidad
|
|
||||||
data['PesoEnKg'] = row.peso_en_kg
|
|
||||||
grid.add(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
var grid = $$('grid_carta_ubicaciones')
|
|
||||||
grid.clearAll()
|
grid.clearAll()
|
||||||
ubicaciones.forEach(function(row, index){
|
ubicaciones.forEach(function(row, index){
|
||||||
var data = new Object()
|
var data = new Object()
|
||||||
|
@ -2932,32 +3025,55 @@ function _set_carta_porte_from_json(data){
|
||||||
grid.add(data)
|
grid.add(data)
|
||||||
})
|
})
|
||||||
|
|
||||||
var grid = $$('grid_carta_autotransporte')
|
var grid = $$('grid_ccp_mercancias')
|
||||||
|
grid.clearAll()
|
||||||
|
mercancias.forEach(function(row, index){
|
||||||
|
var data = new Object()
|
||||||
|
data['delete'] = '-'
|
||||||
|
data['BienesTransp'] = row.clave_sat
|
||||||
|
data['Descripcion'] = row.descripcion
|
||||||
|
data['Cantidad'] = row.cantidad
|
||||||
|
data['ClaveUnidad'] = row.clave_unidad
|
||||||
|
data['PesoEnKg'] = row.peso_en_kg
|
||||||
|
grid.add(data)
|
||||||
|
})
|
||||||
|
|
||||||
|
var grid = $$('grid_ccp_autotransporte')
|
||||||
grid.clearAll()
|
grid.clearAll()
|
||||||
var data = new Object()
|
var data = new Object()
|
||||||
data['PermSCT'] = autotransporte.tipo_permiso
|
data['PermSCT'] = autotransporte.PermSCT
|
||||||
data['NumPermisoSCT'] = autotransporte.numero
|
data['NumPermisoSCT'] = autotransporte.NumPermisoSCT
|
||||||
data['ConfigVehicular'] = autotransporte.clave
|
data['ConfigVehicular'] = autotransporte.ConfigVehicular
|
||||||
data['PlacaVM'] = autotransporte.placa
|
data['PesoBrutoVehicular'] = autotransporte.PesoBrutoVehicular
|
||||||
data['AnioModeloVM'] = autotransporte.modelo
|
data['PlacaVM'] = autotransporte.PlacaVM
|
||||||
if('remolque' in autotransporte){
|
data['AnioModeloVM'] = autotransporte.AnioModeloVM
|
||||||
data['SubTipoRem'] = autotransporte.remolque
|
|
||||||
data['Placa'] = autotransporte.placa_remolque
|
|
||||||
}
|
|
||||||
data['AseguraRespCivil'] = autotransporte.aseguradora
|
|
||||||
data['PolizaRespCivil'] = autotransporte.poliza
|
|
||||||
grid.add(data)
|
grid.add(data)
|
||||||
|
|
||||||
var grid = $$('grid_carta_tipos_figuras')
|
var grid = $$('grid_ccp_remolques')
|
||||||
|
//~ if(remolques.length > 0){
|
||||||
|
grid.clearAll()
|
||||||
|
remolques.forEach(function(row, index){
|
||||||
|
var data = new Object()
|
||||||
|
data['SubTipoRem'] = row.SubTipoRem
|
||||||
|
data['Placa'] = row.Placa
|
||||||
|
grid.add(data)
|
||||||
|
})
|
||||||
|
//~ }
|
||||||
|
|
||||||
|
var grid = $$('grid_ccp_seguros')
|
||||||
grid.clearAll()
|
grid.clearAll()
|
||||||
var data = new Object()
|
var data = new Object()
|
||||||
data['TipoFigura'] = '01'
|
data['AseguraRespCivil'] = seguros.AseguraRespCivil
|
||||||
if('tipo' in operador){
|
data['PolizaRespCivil'] = seguros.PolizaRespCivil
|
||||||
data['TipoFigura'] = operador.tipo
|
grid.add(data)
|
||||||
}
|
|
||||||
data['RFCFigura'] = operador.rfc
|
var grid = $$('grid_ccp_tipos_figuras')
|
||||||
data['NombreFigura'] = operador.nombre
|
grid.clearAll()
|
||||||
data['NumLicencia'] = operador.licencia
|
var data = new Object()
|
||||||
|
data['TipoFigura'] = figura.TipoFigura
|
||||||
|
data['RFCFigura'] = figura.RFCFigura
|
||||||
|
data['NumLicencia'] = figura.NumLicencia
|
||||||
|
data['NombreFigura'] = figura.NombreFigura
|
||||||
grid.add(data)
|
grid.add(data)
|
||||||
|
|
||||||
$$('chk_cfdi_usar_cartaporte').setValue(1)
|
$$('chk_cfdi_usar_cartaporte').setValue(1)
|
||||||
|
|
|
@ -604,6 +604,7 @@ var opt_templates_cfdi = [
|
||||||
{id: '_4.0_cn_1.2.ods', value: 'CFDI v4.0 - Nómina v1.2'},
|
{id: '_4.0_cn_1.2.ods', value: 'CFDI v4.0 - Nómina v1.2'},
|
||||||
{id: '_4.0_cp_2.0.ods', value: 'CFDI v4.0 - Pagos v2.0'},
|
{id: '_4.0_cp_2.0.ods', value: 'CFDI v4.0 - Pagos v2.0'},
|
||||||
{id: '_4.0_ccp_2.0.ods', value: 'CFDI v4.0 - Carta Porte v2.0'},
|
{id: '_4.0_ccp_2.0.ods', value: 'CFDI v4.0 - Carta Porte v2.0'},
|
||||||
|
{id: '_4.0_ccp_3.0.ods', value: 'CFDI v4.0 - Carta Porte v3.0'},
|
||||||
{id: '_4.0_cd_1.1.ods', value: 'CFDI v4.0 - Donativos v1.1'},
|
{id: '_4.0_cd_1.1.ods', value: 'CFDI v4.0 - Donativos v1.1'},
|
||||||
{id: '_4.0_cce_2.0.ods', value: 'CFDI v4.0 - Comercio Exterior v2.0'},
|
{id: '_4.0_cce_2.0.ods', value: 'CFDI v4.0 - Comercio Exterior v2.0'},
|
||||||
{id: '_4.0.json', value: 'CFDI v4.0 - JSON'},
|
{id: '_4.0.json', value: 'CFDI v4.0 - JSON'},
|
||||||
|
|
|
@ -965,16 +965,16 @@ var grid_cols_ccp_ubicaciones = [
|
||||||
{id: 'id', header: 'ID', hidden: true},
|
{id: 'id', header: 'ID', hidden: true},
|
||||||
{id: 'delete', header: '', width: 30, css: 'delete'},
|
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||||
{id: 'TipoUbicacion', header: 'TipoUbicacion', editor: 'select', options: opt_ccp_origen_destino, fillspace: 1},
|
{id: 'TipoUbicacion', header: 'TipoUbicacion', editor: 'select', options: opt_ccp_origen_destino, fillspace: 1},
|
||||||
{id: 'IDUbicacion', header: 'IDUbicacion', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'IDUbicacion', header: 'IDUbicacion', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'RFCRemitenteDestinatario', header: 'RFC Rem/Des', editor: 'text', fillspace: 1},
|
{id: 'RFCRemitenteDestinatario', header: 'RFC Rem/Des', editor: 'text', fillspace: 1},
|
||||||
{id: 'NombreRemitenteDestinatario', header: 'Nombre Rem/Des', editor: 'text', fillspace: 1},
|
{id: 'NombreRemitenteDestinatario', header: 'Nombre Rem/Des', editor: 'text', fillspace: 1},
|
||||||
{id: 'NumRegIdTrib', header: 'NumRegIdTrib', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'NumRegIdTrib', header: 'NumRegIdTrib', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'ResidenciaFiscal', header: 'ResidenciaFiscal', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'ResidenciaFiscal', header: 'ResidenciaFiscal', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'NumEstacion', header: 'NumEstacion', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'NumEstacion', header: 'NumEstacion', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'NombreEstacion', header: 'NombreEstacion', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'NombreEstacion', header: 'NombreEstacion', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'NavegacionTrafico', header: 'NavegacionTrafico', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'NavegacionTrafico', header: 'NavegacionTrafico', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'FechaHoraSalidaLlegada', header: 'Fecha/Hora', editor: 'date', suggest: date_suggest, format: webix.Date.dateToStr("%D, %d-%M-%Y %h:%i"), footer: 'Total distancia:', fillspace: 1},
|
{id: 'FechaHoraSalidaLlegada', header: 'Fecha/Hora', editor: 'date', suggest: date_suggest, format: webix.Date.dateToStr("%D, %d-%M-%Y %h:%i"), footer: 'Total distancia:', fillspace: 1},
|
||||||
{id: 'TipoEstacion', header: 'TipoEstacion', hidden: true, editor: 'text', fillspace: 1},
|
//~ {id: 'TipoEstacion', header: 'TipoEstacion', hidden: true, editor: 'text', fillspace: 1},
|
||||||
{id: 'DistanciaRecorrida', header: 'Distancia (KM)', editor: 'text', format: webix.i18n.numberFormat, css: 'right', footer: {content: 'summColumn', css: 'right'}, fillspace: 1},
|
{id: 'DistanciaRecorrida', header: 'Distancia (KM)', editor: 'text', format: webix.i18n.numberFormat, css: 'right', footer: {content: 'summColumn', css: 'right'}, fillspace: 1},
|
||||||
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
|
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
|
||||||
{id: 'Estado', header: 'Estado', editor: 'select', options: opt_ccp_carta_estados, fillspace: 1},
|
{id: 'Estado', header: 'Estado', editor: 'select', options: opt_ccp_carta_estados, fillspace: 1},
|
||||||
|
@ -1135,6 +1135,7 @@ var grid_cols_ccp_autotransporte = [
|
||||||
]
|
]
|
||||||
var grid_cols_ccp_remolques = [
|
var grid_cols_ccp_remolques = [
|
||||||
{id: 'id', header: 'ID', hidden: true},
|
{id: 'id', header: 'ID', hidden: true},
|
||||||
|
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||||
{id: 'SubTipoRem', header: 'SubTipo Remolque', editor: 'select', options: opt_ccp_tipo_remolque, fillspace: 1},
|
{id: 'SubTipoRem', header: 'SubTipo Remolque', editor: 'select', options: opt_ccp_tipo_remolque, fillspace: 1},
|
||||||
{id: 'Placa', header: 'Placa', editor: 'text', fillspace: 1},
|
{id: 'Placa', header: 'Placa', editor: 'text', fillspace: 1},
|
||||||
]
|
]
|
||||||
|
@ -1167,10 +1168,10 @@ var grid_cols_ccp_tipos_figuras = [
|
||||||
{id: 'NombreFigura', header: 'NombreFigura', editor: 'text', fillspace: 1},
|
{id: 'NombreFigura', header: 'NombreFigura', editor: 'text', fillspace: 1},
|
||||||
//~ {id: 'NumRegIdTribFigura', header: 'NumRegIdTribFigura', editor: 'text', fillspace: 1},
|
//~ {id: 'NumRegIdTribFigura', header: 'NumRegIdTribFigura', editor: 'text', fillspace: 1},
|
||||||
//~ {id: 'ResidenciaFiscalFigura', header: 'ResidenciaFiscalFigura', editor: 'text', fillspace: 1},
|
//~ {id: 'ResidenciaFiscalFigura', header: 'ResidenciaFiscalFigura', editor: 'text', fillspace: 1},
|
||||||
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
|
//~ {id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
|
||||||
{id: 'Estado', header: 'Estado', editor: 'select', options: opt_ccp_carta_estados, fillspace: 1},
|
//~ {id: 'Estado', header: 'Estado', editor: 'select', options: opt_ccp_carta_estados, fillspace: 1},
|
||||||
{id: 'Pais', header: 'País', editor: 'select', options: opt_ccp_countries, fillspace: 1},
|
//~ {id: 'Pais', header: 'País', editor: 'select', options: opt_ccp_countries, fillspace: 1},
|
||||||
{id: 'CodigoPostal', header: 'C.P.', editor: 'text', fillspace: 1},
|
//~ {id: 'CodigoPostal', header: 'C.P.', editor: 'text', fillspace: 1},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1220,7 +1221,6 @@ var grid_ccp_remolques = {
|
||||||
headermenu: true,
|
headermenu: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
columns: grid_cols_ccp_remolques,
|
columns: grid_cols_ccp_remolques,
|
||||||
data: [{id: 0}, {id: 1}],
|
|
||||||
}
|
}
|
||||||
var grid_ccp_seguros = {
|
var grid_ccp_seguros = {
|
||||||
view: 'datatable',
|
view: 'datatable',
|
||||||
|
@ -1275,9 +1275,14 @@ var body_ccp_mercancias = {rows:[
|
||||||
|
|
||||||
var body_ccp_autotransporte = {rows:[
|
var body_ccp_autotransporte = {rows:[
|
||||||
grid_ccp_autotransporte,
|
grid_ccp_autotransporte,
|
||||||
{maxHeight: 10},
|
{minHeight: 10},
|
||||||
|
{cols: [
|
||||||
|
{view: 'button', id: 'cmd_ccp_agregar_remolque', label: 'Agregar Remolque', icon: 'plus',
|
||||||
|
type: 'iconButton', autowidth: true, align: 'center'},
|
||||||
|
{}]},
|
||||||
|
{minHeight: 10},
|
||||||
grid_ccp_remolques,
|
grid_ccp_remolques,
|
||||||
{maxHeight: 10},
|
{minHeight: 10},
|
||||||
grid_ccp_seguros,
|
grid_ccp_seguros,
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue