Primera versión mínima de Carta Porte timbrada
This commit is contained in:
parent
86bc032413
commit
a3d291c893
|
@ -492,10 +492,22 @@ class CFDI(object):
|
|||
|
||||
attr = mercancias
|
||||
mercancias = attr.pop('mercancias')
|
||||
autotransporte = attr.pop('autotransporte')
|
||||
identificacion = autotransporte.pop('identificacion')
|
||||
seguros = autotransporte.pop('seguros')
|
||||
|
||||
node = ET.SubElement(node_carta, f'{prefix}:Mercancias', attr)
|
||||
for mercancia in mercancias:
|
||||
ET.SubElement(node, f'{prefix}:Mercancia', mercancia)
|
||||
|
||||
sub_node = ET.SubElement(node, f'{prefix}:Autotransporte', autotransporte)
|
||||
ET.SubElement(sub_node, f'{prefix}:IdentificacionVehicular', identificacion)
|
||||
ET.SubElement(sub_node, f'{prefix}:Seguros', seguros)
|
||||
|
||||
if tiposfigura:
|
||||
sub_node = ET.SubElement(node_carta, f'{prefix}:FiguraTransporte')
|
||||
for figura in tiposfigura:
|
||||
ET.SubElement(sub_node, f'{prefix}:TiposFigura', figura)
|
||||
|
||||
if self._divisas:
|
||||
atributos = {
|
||||
|
|
|
@ -1452,6 +1452,11 @@ class SATUnidades(BaseModel):
|
|||
except:
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_key_by_id(self, id):
|
||||
obj = SATUnidades.get(SATUnidades.id==id)
|
||||
return obj.key
|
||||
|
||||
@classmethod
|
||||
def get_(self):
|
||||
rows = SATUnidades.select().dicts()
|
||||
|
@ -5321,10 +5326,16 @@ class Facturas(BaseModel):
|
|||
def _save_cartaporte(self, invoice, valores):
|
||||
if not valores:
|
||||
return
|
||||
|
||||
values = utils.loads(valores)
|
||||
mercancias = values['mercancias']
|
||||
for mercancia in mercancias['mercancias']:
|
||||
mercancia['ClaveUnidad'] = SATUnidades.get_key_by_id(mercancia['ClaveUnidad'])
|
||||
|
||||
data = {
|
||||
'factura': invoice,
|
||||
'nombre': 'cartaporte',
|
||||
'valores': valores,
|
||||
'valores': utils.dumps(values),
|
||||
}
|
||||
FacturasComplementos.create(**data)
|
||||
return
|
||||
|
|
|
@ -716,10 +716,26 @@ function guardar_y_timbrar(values){
|
|||
cartaporte['TotalDistRec'] = String(total_distance)
|
||||
cartaporte['ubicaciones'] = ubicaciones
|
||||
|
||||
var row = $$('grid_carta_autotransporte').data.getRange()[0]
|
||||
var autotransporte = {
|
||||
PermSCT: row['PermSCT'],
|
||||
NumPermisoSCT: row['NumPermisoSCT'],
|
||||
identificacion: {
|
||||
ConfigVehicular: row['ConfigVehicular'],
|
||||
PlacaVM: row['PlacaVM'],
|
||||
AnioModeloVM: row['AnioModeloVM'],
|
||||
},
|
||||
seguros: {
|
||||
AseguraRespCivil: row['AseguraRespCivil'],
|
||||
PolizaRespCivil: row['PolizaRespCivil'],
|
||||
}
|
||||
}
|
||||
|
||||
var mercancias = $$('grid_carta_mercancias').data.getRange()
|
||||
mercancias.forEach(function(row, index){
|
||||
delete row['id']
|
||||
row['Cantidad'] = String(row['Cantidad'])
|
||||
//~ row['ValorMercancia'] = String(row['ValorMercancia'])
|
||||
if(row['PesoEnKg']){
|
||||
total_weight += parseFloat(row['PesoEnKg'])
|
||||
}
|
||||
|
@ -729,9 +745,16 @@ function guardar_y_timbrar(values){
|
|||
'UnidadPeso': $$('lst_carta_UnidadPeso').getValue(),
|
||||
'NumTotalMercancias': String(mercancias.length),
|
||||
mercancias: mercancias,
|
||||
autotransporte: autotransporte,
|
||||
}
|
||||
cartaporte['mercancias'] = mercancias
|
||||
|
||||
var tiposfigura = $$('grid_carta_tipos_figuras').data.getRange()
|
||||
tiposfigura.forEach(function(row, index){
|
||||
delete row['id']
|
||||
})
|
||||
cartaporte['tiposfigura'] = tiposfigura
|
||||
|
||||
data['cartaporte'] = cartaporte
|
||||
}
|
||||
|
||||
|
@ -2480,7 +2503,7 @@ function _tab_carta_porte(){
|
|||
data['Descripcion'] = r.descripcion
|
||||
data['Cantidad'] = r.cantidad
|
||||
data['ClaveUnidad'] = r.unidad
|
||||
data['ValorMercancia'] = r.importe
|
||||
//~ data['ValorMercancia'] = r.importe
|
||||
g2.add(data)
|
||||
})
|
||||
|
||||
|
|
|
@ -875,7 +875,7 @@ var grid_cols_carta_mercancias = [
|
|||
{id: 'Descripcion', header: 'Descripción', fillspace: 1},
|
||||
{id: 'Cantidad', header: 'Cantidad', format: webix.i18n.numberFormat, css: 'right', fillspace: 1},
|
||||
{id: 'ClaveUnidad', header: 'Unidad', options: 'values/unidades', fillspace: 1},
|
||||
{id: 'ValorMercancia', header: 'Valor Mercancia', format: webix.i18n.priceFormat, css: 'right', footer: 'Total peso:', fillspace: 1},
|
||||
//~ {id: 'ValorMercancia', header: 'Valor Mercancia', format: webix.i18n.priceFormat, css: 'right', footer: 'Total peso:', fillspace: 1},
|
||||
{id: 'PesoEnKg', header: 'Peso (Kg)', format: webix.i18n.numberFormat, css: 'right', editor: 'text', footer: {content: 'summColumn', css: 'right'}, fillspace: 1},
|
||||
]
|
||||
|
||||
|
@ -895,6 +895,8 @@ var grid_cols_carta_autotransporte = [
|
|||
{id: 'ConfigVehicular', header: 'Clave Autotransporte', editor: 'select', options: opt_config_auto, fillspace: 1},
|
||||
{id: 'PlacaVM', header: 'Placa', editor: 'text', fillspace: 1},
|
||||
{id: 'AnioModeloVM', header: 'Modelo (Año)', editor: 'text', fillspace: 1},
|
||||
{id: 'AseguraRespCivil', header: 'Aseguradora', editor: 'text', fillspace: 1},
|
||||
{id: 'PolizaRespCivil', header: 'Póliza', editor: 'text', fillspace: 1},
|
||||
]
|
||||
|
||||
|
||||
|
@ -911,11 +913,24 @@ var grid_cols_carta_tipos_figuras = [
|
|||
{id: 'id', header: 'ID', hidden: true},
|
||||
{id: 'TipoFigura', header: 'Tipo Figura', editor: 'select', options: opt_tipos_figura, fillspace: 1},
|
||||
{id: 'RFCFigura', header: 'RFC Figura', editor: 'text', fillspace: 1},
|
||||
{id: 'NombreFigura', header: 'Nombre Figura', editor: 'text', fillspace: 1},
|
||||
{id: 'NumLicencia', header: 'Número de Licencia', editor: 'text', fillspace: 1},
|
||||
|
||||
]
|
||||
|
||||
|
||||
var data_tmp1 = [
|
||||
{delete: '-', TipoUbicacion: 'Origen', RFCRemitenteDestinatario: 'XIQB891116QE4', FechaHoraSalidaLlegada: new Date(2022, 1, 10, 12, 00)},
|
||||
{delete: '-', TipoUbicacion: 'Destino', RFCRemitenteDestinatario: 'XIQB891116QE4', FechaHoraSalidaLlegada: new Date(2022, 1, 11, 12, 00)},
|
||||
]
|
||||
var data_tmp2 = [
|
||||
{id: 0, PermSCT: 'TPAF03', NumPermisoSCT: 'Transporte privado de carga', ConfigVehicular: 'C3', PlacaVM: 'YYY1234', AnioModeloVM: '2020', AseguraRespCivil: 'Compañia Aseguradora', PolizaRespCivil: '1234567890'},
|
||||
]
|
||||
var data_tmp3 = [
|
||||
{id: 0, TipoFigura: '01', RFCFigura: 'XIQB891116QE4', NombreFigura: 'Homero Simpson', NumLicencia: '1234567890'},
|
||||
]
|
||||
|
||||
|
||||
var grid_carta_ubicaciones = {
|
||||
view: 'datatable',
|
||||
id: 'grid_carta_ubicaciones',
|
||||
|
@ -926,10 +941,11 @@ var grid_carta_ubicaciones = {
|
|||
editable: true,
|
||||
footer: true,
|
||||
columns: grid_cols_carta_ubicaciones,
|
||||
data: [
|
||||
{delete: '-', TipoUbicacion: 'Origen'},
|
||||
{delete: '-', TipoUbicacion: 'Destino'},
|
||||
]
|
||||
data: data_tmp1,
|
||||
//~ data: [
|
||||
//~ {delete: '-', TipoUbicacion: 'Origen', },
|
||||
//~ {delete: '-', TipoUbicacion: 'Destino'},
|
||||
//~ ]
|
||||
}
|
||||
|
||||
|
||||
|
@ -955,7 +971,8 @@ var grid_carta_autotransporte = {
|
|||
headermenu: true,
|
||||
editable: true,
|
||||
columns: grid_cols_carta_autotransporte,
|
||||
data: [{id: 0}],
|
||||
//~ data: [{id: 0}],
|
||||
data: data_tmp2,
|
||||
}
|
||||
|
||||
|
||||
|
@ -968,7 +985,8 @@ var grid_carta_tipos_figuras = {
|
|||
headermenu: true,
|
||||
editable: true,
|
||||
columns: grid_cols_carta_tipos_figuras,
|
||||
data: [{id: 0}],
|
||||
//~ data: [{id: 0}],
|
||||
data: data_tmp3,
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue