diff --git a/app/resources/views/ventas/facturacion/show.blade.php b/app/resources/views/ventas/facturacion/show.blade.php
index 98dcb92..1450208 100644
--- a/app/resources/views/ventas/facturacion/show.blade.php
+++ b/app/resources/views/ventas/facturacion/show.blade.php
@@ -337,7 +337,7 @@
}
},
fecha: date => {
- this.props.fecha = date
+ this.props.uf.fecha = date
const url = '{{$urls->api}}/money/uf'
const method = 'post'
const body = new FormData()
@@ -350,7 +350,7 @@
if (typeof json.uf === 'undefined') {
return
}
- this.props.uf = json.uf
+ this.props.uf.valor = json.uf
})
})
},
@@ -435,7 +435,9 @@
const cdo = structuredClone(calendar_date_options)
cdo['initialDate'] = this.props.estado.fecha
cdo['onChange'] = (date, text, mode) => {
- this.update().fecha(date)
+ this.update().fecha(date).then(() => {
+ facturas.draw().facturas()
+ })
}
$('#fecha_uf').calendar(cdo)
},
@@ -589,7 +591,8 @@
propietario: this.props.propietarios[index],
unidades: this.props.unidades,
terreno: this.props.terreno,
- venta: this.valores(this.props.propietarios[index].props.uf),
+ venta: this.valores(this.props.uf.valor),
+ uf: this.props.uf,
formatters
}))
})
@@ -660,15 +663,15 @@
divider: index => {
return '
'
},
- factura: ({proyecto, propietario, unidades, terreno, venta, formatters = {date, pesos, ufs, percent}}) => {
+ factura: ({proyecto, propietario, unidades, terreno, venta, uf, formatters = {date, pesos, ufs, percent}}) => {
return [
this.draw().divider(propietario.props.index),
'',
'
',
this.draw().cabecera(proyecto),
this.draw().propietario({propietario, formatters}),
- this.draw().table({venta, unidades, propietario, terreno, formatters}),
- this.draw().totales({propietario, venta, formatters}),
+ this.draw().table({venta, unidades, propietario, terreno, uf, formatters}),
+ this.draw().totales({propietario, venta, uf, formatters}),
'
',
'
'
].join("\n")
@@ -729,7 +732,7 @@
''
].join("\n")
},
- table: ({venta, unidades, propietario, terreno, formatters}) => {
+ table: ({venta, unidades, propietario, terreno, uf, formatters}) => {
return [
'',
'
',
@@ -747,7 +750,7 @@
'',
'',
'',
- this.draw().unidades({venta, unidades, propietario, terreno, formatters}),
+ this.draw().unidades({venta, unidades, propietario, terreno, uf, formatters}),
'',
'',
'',
@@ -763,7 +766,7 @@
''
].join("\n")
},
- unidades: ({venta, unidades, propietario, terreno, formatters}) => {
+ unidades: ({venta, unidades, propietario, terreno, uf, formatters}) => {
const unidadesData = []
let no = 1
const classes = [
@@ -779,6 +782,7 @@
unidad,
propietario,
terreno,
+ uf,
no: no++,
classes,
formatters
@@ -787,15 +791,16 @@
unidadesData.push(this.draw().resumen({
propietario,
venta,
+ uf,
no,
classes,
formatters
}))
return unidadesData.join("\n")
},
- unidad: ({unidad, propietario, terreno, no, classes, formatters}) => {
+ unidad: ({unidad, propietario, terreno, uf, no, classes, formatters}) => {
const descuento = terreno.reajustado * unidad.props.prorrateo
- const bruto = unidad.props.valor * propietario.props.uf - descuento
+ const bruto = unidad.props.valor * uf.valor - descuento
const neto = bruto / 1.19
const data = [
no,
@@ -818,7 +823,7 @@
row.push('
')
return row.join('')
},
- resumen: ({propietario, venta, no, classes, formatters}) => {
+ resumen: ({propietario, venta, uf, no, classes, formatters}) => {
const emptyTerreno = '0
'
const data = [
no,
@@ -829,7 +834,7 @@
'Mas valor terreno: $' + ((venta.exento > 0) ? formatters.pesos.format(venta.exento * propietario.props.proporcion) : emptyTerreno) + '
' +
'TOTAL (Escritura): $' + formatters.pesos.format(venta.total * propietario.props.proporcion) + '; ' + formatters.ufs.format(venta.totalUF * propietario.props.proporcion) + ' UF
' +
'Descuento Terreno: ' + ((venta.exento > 0) ? formatters.percent.format(venta.descuento * 100) : emptyTerreno) + '%
' +
- 'UF (' + formatters.date.format(propietario.props.fecha) + '): $' + formatters.ufs.format(propietario.props.uf),
+ 'UF (' + formatters.date.format(uf.fecha) + '): $' + formatters.ufs.format(uf.valor),
'1 UNID',
formatters.pesos.format(venta.exento * propietario.props.proporcion),
'EX',
@@ -882,7 +887,7 @@
].join("\n")
}
}
- const output = [
+ /*const output = [
''+
''+
'
'+
@@ -1053,7 +1058,7 @@
'
'+
'
'
)
- return output.join('')
+ return output.join('')*/
}
}
@@ -1090,7 +1095,10 @@
direccion: '{{$venta->proyecto()->direccion()->simple()}}'
},
valor: {{$venta->valor}},
- uf: {{$uf}},
+ uf: {
+ fecha: new Date('{{$venta->currentEstado()->fecha->add(new DateInterval('P1D'))->format('Y-m-d')}}'),
+ valor: {{$uf}}
+ },
estado: {
fecha: new Date('{{$venta->currentEstado()->fecha->add(new DateInterval('P1D'))->format('Y-m-d')}}')
},