Agregar nodo para domicilio en Carta Porte
This commit is contained in:
parent
0f041ed975
commit
074cdc475f
|
@ -5329,10 +5329,29 @@ class Facturas(BaseModel):
|
|||
return
|
||||
|
||||
values = utils.loads(valores)
|
||||
values['TotalDistRec'] = f"{float(values['TotalDistRec']):.2f}"
|
||||
|
||||
total_weight = 0.00
|
||||
mercancias = values['mercancias']
|
||||
for mercancia in mercancias['mercancias']:
|
||||
mercancia['ClaveUnidad'] = SATUnidades.get_key_by_id(mercancia['ClaveUnidad'])
|
||||
total_weight += float(mercancia['PesoEnKg'])
|
||||
mercancias['PesoBrutoTotal'] = f"{total_weight:.2f}"
|
||||
|
||||
ubicaciones = values['ubicaciones']
|
||||
for ubicacion in ubicaciones:
|
||||
municipio = ubicacion.pop('Municipio')
|
||||
estado = ubicacion.pop('Estado')
|
||||
pais = ubicacion.pop('Pais')
|
||||
cp = ubicacion.pop('CodigoPostal')
|
||||
if municipio and estado and pais and cp:
|
||||
ubicacion['domicilio'] = {
|
||||
'Municipio': municipio,
|
||||
'Estado': estado,
|
||||
'Pais': pais,
|
||||
'CodigoPostal': cp,
|
||||
}
|
||||
# ~ print(2, values)
|
||||
data = {
|
||||
'factura': invoice,
|
||||
'nombre': 'cartaporte',
|
||||
|
|
|
@ -700,7 +700,7 @@ function guardar_y_timbrar(values){
|
|||
var usar_cartaporte = $$('chk_cfdi_usar_cartaporte').getValue()
|
||||
if(usar_cartaporte){
|
||||
var total_distance = 0.00
|
||||
var total_weight = 0.00
|
||||
//~ var total_weight = 0.00
|
||||
var cartaporte = {
|
||||
TranspInternac: $$('lst_carta_TranspInternac').getValue(),
|
||||
TotalDistRec: total_distance,
|
||||
|
@ -713,7 +713,7 @@ function guardar_y_timbrar(values){
|
|||
total_distance += parseFloat(row['DistanciaRecorrida'])
|
||||
}
|
||||
})
|
||||
cartaporte['TotalDistRec'] = String(total_distance)
|
||||
cartaporte['TotalDistRec'] = total_distance
|
||||
cartaporte['ubicaciones'] = ubicaciones
|
||||
|
||||
var row = $$('grid_carta_autotransporte').data.getRange()[0]
|
||||
|
@ -736,12 +736,12 @@ function guardar_y_timbrar(values){
|
|||
delete row['id']
|
||||
row['Cantidad'] = String(row['Cantidad'])
|
||||
//~ row['ValorMercancia'] = String(row['ValorMercancia'])
|
||||
if(row['PesoEnKg']){
|
||||
total_weight += parseFloat(row['PesoEnKg'])
|
||||
}
|
||||
//~ if(row['PesoEnKg']){
|
||||
//~ total_weight += parseFloat(row['PesoEnKg'])
|
||||
//~ }
|
||||
})
|
||||
var mercancias = {
|
||||
'PesoBrutoTotal': String(total_weight),
|
||||
'PesoBrutoTotal': 0.00,
|
||||
'UnidadPeso': $$('lst_carta_UnidadPeso').getValue(),
|
||||
'NumTotalMercancias': String(mercancias.length),
|
||||
mercancias: mercancias,
|
||||
|
|
|
@ -860,7 +860,7 @@ var date_suggest = {
|
|||
|
||||
|
||||
var opt_countries = [
|
||||
{id: 'MXN', value: 'México'},
|
||||
{id: 'MEX', value: 'México'},
|
||||
]
|
||||
|
||||
|
||||
|
@ -871,7 +871,7 @@ var grid_cols_carta_ubicaciones = [
|
|||
{id: 'RFCRemitenteDestinatario', header: 'RFC Rem/Des', editor: 'text', fillspace: 1},
|
||||
{id: 'NombreRemitenteDestinatario', header: 'Nombre Rem/Des', 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: 'DistanciaRecorrida', header: 'Distancia (KM)', editor: 'text', 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', headerd: 'Municipio', editor: 'text', fillspace: 1},
|
||||
{id: 'Estado', headerd: 'Estado', editor: 'text', fillspace: 1},
|
||||
{id: 'Pais', headerd: 'Pais', editor: 'select', options: opt_countries, fillspace: 1},
|
||||
|
|
Loading…
Reference in New Issue