Factura con fecha de UF
This commit is contained in:
@ -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 '<div class="ui divider" data-index="'+index+'"></div>'
|
||||
},
|
||||
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),
|
||||
'<div class="factura" data-index="'+propietario.props.index+'">',
|
||||
'<div class="ui compact grid">',
|
||||
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}),
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join("\n")
|
||||
@ -729,7 +732,7 @@
|
||||
'</div>'
|
||||
].join("\n")
|
||||
},
|
||||
table: ({venta, unidades, propietario, terreno, formatters}) => {
|
||||
table: ({venta, unidades, propietario, terreno, uf, formatters}) => {
|
||||
return [
|
||||
'<div class="row">',
|
||||
'<table class="ui celled table">',
|
||||
@ -747,7 +750,7 @@
|
||||
'</tr>',
|
||||
'</thead>',
|
||||
'<tbody>',
|
||||
this.draw().unidades({venta, unidades, propietario, terreno, formatters}),
|
||||
this.draw().unidades({venta, unidades, propietario, terreno, uf, formatters}),
|
||||
'</tbody>',
|
||||
'<tfoot>',
|
||||
'<tr>',
|
||||
@ -763,7 +766,7 @@
|
||||
'</div>'
|
||||
].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('</tr>')
|
||||
return row.join('')
|
||||
},
|
||||
resumen: ({propietario, venta, no, classes, formatters}) => {
|
||||
resumen: ({propietario, venta, uf, no, classes, formatters}) => {
|
||||
const emptyTerreno = '<div class="ui tiny red horizontal circular label">0</div>'
|
||||
const data = [
|
||||
no,
|
||||
@ -829,7 +834,7 @@
|
||||
'Mas valor terreno: $' + ((venta.exento > 0) ? formatters.pesos.format(venta.exento * propietario.props.proporcion) : emptyTerreno) + '<br />' +
|
||||
'TOTAL (Escritura): $' + formatters.pesos.format(venta.total * propietario.props.proporcion) + '; ' + formatters.ufs.format(venta.totalUF * propietario.props.proporcion) + ' UF<br /><br />' +
|
||||
'Descuento Terreno: ' + ((venta.exento > 0) ? formatters.percent.format(venta.descuento * 100) : emptyTerreno) + '%<br /><br />' +
|
||||
'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 = [
|
||||
'<div class="ui divider" data-index="'+propietario.props.index+'"></div>'+
|
||||
'<div class="factura" data-index="'+propietario.props.index+'">'+
|
||||
'<div class="ui compact grid">'+
|
||||
@ -1053,7 +1058,7 @@
|
||||
'</div>'+
|
||||
'</div>'
|
||||
)
|
||||
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')}}')
|
||||
},
|
||||
|
Reference in New Issue
Block a user