Factura con fecha de UF
This commit is contained in:
@ -337,7 +337,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fecha: date => {
|
fecha: date => {
|
||||||
this.props.fecha = date
|
this.props.uf.fecha = date
|
||||||
const url = '{{$urls->api}}/money/uf'
|
const url = '{{$urls->api}}/money/uf'
|
||||||
const method = 'post'
|
const method = 'post'
|
||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
@ -350,7 +350,7 @@
|
|||||||
if (typeof json.uf === 'undefined') {
|
if (typeof json.uf === 'undefined') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.props.uf = json.uf
|
this.props.uf.valor = json.uf
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -435,7 +435,9 @@
|
|||||||
const cdo = structuredClone(calendar_date_options)
|
const cdo = structuredClone(calendar_date_options)
|
||||||
cdo['initialDate'] = this.props.estado.fecha
|
cdo['initialDate'] = this.props.estado.fecha
|
||||||
cdo['onChange'] = (date, text, mode) => {
|
cdo['onChange'] = (date, text, mode) => {
|
||||||
this.update().fecha(date)
|
this.update().fecha(date).then(() => {
|
||||||
|
facturas.draw().facturas()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
$('#fecha_uf').calendar(cdo)
|
$('#fecha_uf').calendar(cdo)
|
||||||
},
|
},
|
||||||
@ -589,7 +591,8 @@
|
|||||||
propietario: this.props.propietarios[index],
|
propietario: this.props.propietarios[index],
|
||||||
unidades: this.props.unidades,
|
unidades: this.props.unidades,
|
||||||
terreno: this.props.terreno,
|
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
|
formatters
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
@ -660,15 +663,15 @@
|
|||||||
divider: index => {
|
divider: index => {
|
||||||
return '<div class="ui divider" data-index="'+index+'"></div>'
|
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 [
|
return [
|
||||||
this.draw().divider(propietario.props.index),
|
this.draw().divider(propietario.props.index),
|
||||||
'<div class="factura" data-index="'+propietario.props.index+'">',
|
'<div class="factura" data-index="'+propietario.props.index+'">',
|
||||||
'<div class="ui compact grid">',
|
'<div class="ui compact grid">',
|
||||||
this.draw().cabecera(proyecto),
|
this.draw().cabecera(proyecto),
|
||||||
this.draw().propietario({propietario, formatters}),
|
this.draw().propietario({propietario, formatters}),
|
||||||
this.draw().table({venta, unidades, propietario, terreno, formatters}),
|
this.draw().table({venta, unidades, propietario, terreno, uf, formatters}),
|
||||||
this.draw().totales({propietario, venta, formatters}),
|
this.draw().totales({propietario, venta, uf, formatters}),
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>'
|
'</div>'
|
||||||
].join("\n")
|
].join("\n")
|
||||||
@ -729,7 +732,7 @@
|
|||||||
'</div>'
|
'</div>'
|
||||||
].join("\n")
|
].join("\n")
|
||||||
},
|
},
|
||||||
table: ({venta, unidades, propietario, terreno, formatters}) => {
|
table: ({venta, unidades, propietario, terreno, uf, formatters}) => {
|
||||||
return [
|
return [
|
||||||
'<div class="row">',
|
'<div class="row">',
|
||||||
'<table class="ui celled table">',
|
'<table class="ui celled table">',
|
||||||
@ -747,7 +750,7 @@
|
|||||||
'</tr>',
|
'</tr>',
|
||||||
'</thead>',
|
'</thead>',
|
||||||
'<tbody>',
|
'<tbody>',
|
||||||
this.draw().unidades({venta, unidades, propietario, terreno, formatters}),
|
this.draw().unidades({venta, unidades, propietario, terreno, uf, formatters}),
|
||||||
'</tbody>',
|
'</tbody>',
|
||||||
'<tfoot>',
|
'<tfoot>',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
@ -763,7 +766,7 @@
|
|||||||
'</div>'
|
'</div>'
|
||||||
].join("\n")
|
].join("\n")
|
||||||
},
|
},
|
||||||
unidades: ({venta, unidades, propietario, terreno, formatters}) => {
|
unidades: ({venta, unidades, propietario, terreno, uf, formatters}) => {
|
||||||
const unidadesData = []
|
const unidadesData = []
|
||||||
let no = 1
|
let no = 1
|
||||||
const classes = [
|
const classes = [
|
||||||
@ -779,6 +782,7 @@
|
|||||||
unidad,
|
unidad,
|
||||||
propietario,
|
propietario,
|
||||||
terreno,
|
terreno,
|
||||||
|
uf,
|
||||||
no: no++,
|
no: no++,
|
||||||
classes,
|
classes,
|
||||||
formatters
|
formatters
|
||||||
@ -787,15 +791,16 @@
|
|||||||
unidadesData.push(this.draw().resumen({
|
unidadesData.push(this.draw().resumen({
|
||||||
propietario,
|
propietario,
|
||||||
venta,
|
venta,
|
||||||
|
uf,
|
||||||
no,
|
no,
|
||||||
classes,
|
classes,
|
||||||
formatters
|
formatters
|
||||||
}))
|
}))
|
||||||
return unidadesData.join("\n")
|
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 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 neto = bruto / 1.19
|
||||||
const data = [
|
const data = [
|
||||||
no,
|
no,
|
||||||
@ -818,7 +823,7 @@
|
|||||||
row.push('</tr>')
|
row.push('</tr>')
|
||||||
return row.join('')
|
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 emptyTerreno = '<div class="ui tiny red horizontal circular label">0</div>'
|
||||||
const data = [
|
const data = [
|
||||||
no,
|
no,
|
||||||
@ -829,7 +834,7 @@
|
|||||||
'Mas valor terreno: $' + ((venta.exento > 0) ? formatters.pesos.format(venta.exento * propietario.props.proporcion) : emptyTerreno) + '<br />' +
|
'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 />' +
|
'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 />' +
|
'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',
|
'1 UNID',
|
||||||
formatters.pesos.format(venta.exento * propietario.props.proporcion),
|
formatters.pesos.format(venta.exento * propietario.props.proporcion),
|
||||||
'EX',
|
'EX',
|
||||||
@ -882,7 +887,7 @@
|
|||||||
].join("\n")
|
].join("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const output = [
|
/*const output = [
|
||||||
'<div class="ui divider" data-index="'+propietario.props.index+'"></div>'+
|
'<div class="ui divider" data-index="'+propietario.props.index+'"></div>'+
|
||||||
'<div class="factura" data-index="'+propietario.props.index+'">'+
|
'<div class="factura" data-index="'+propietario.props.index+'">'+
|
||||||
'<div class="ui compact grid">'+
|
'<div class="ui compact grid">'+
|
||||||
@ -1053,7 +1058,7 @@
|
|||||||
'</div>'+
|
'</div>'+
|
||||||
'</div>'
|
'</div>'
|
||||||
)
|
)
|
||||||
return output.join('')
|
return output.join('')*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1090,7 +1095,10 @@
|
|||||||
direccion: '{{$venta->proyecto()->direccion()->simple()}}'
|
direccion: '{{$venta->proyecto()->direccion()->simple()}}'
|
||||||
},
|
},
|
||||||
valor: {{$venta->valor}},
|
valor: {{$venta->valor}},
|
||||||
uf: {{$uf}},
|
uf: {
|
||||||
|
fecha: new Date('{{$venta->currentEstado()->fecha->add(new DateInterval('P1D'))->format('Y-m-d')}}'),
|
||||||
|
valor: {{$uf}}
|
||||||
|
},
|
||||||
estado: {
|
estado: {
|
||||||
fecha: new Date('{{$venta->currentEstado()->fecha->add(new DateInterval('P1D'))->format('Y-m-d')}}')
|
fecha: new Date('{{$venta->currentEstado()->fecha->add(new DateInterval('P1D'))->format('Y-m-d')}}')
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user