FIX: % descuento

This commit is contained in:
2023-11-29 21:21:51 -03:00
parent 244d304e04
commit 91bdef5cc5

View File

@ -167,6 +167,7 @@
const ufFormatter = new Intl.NumberFormat('es-CL', {maximumFractionDigits: 2, minimumFractionDigits: 2}) const ufFormatter = new Intl.NumberFormat('es-CL', {maximumFractionDigits: 2, minimumFractionDigits: 2})
const percentFormatter = new Intl.NumberFormat('es-CL', {maximumFractionDigits: 5, minimumFractionDigits: 5}) const percentFormatter = new Intl.NumberFormat('es-CL', {maximumFractionDigits: 5, minimumFractionDigits: 5})
let terreno = 0 let terreno = 0
let prorrateo = 0
let c = 1 let c = 1
const classes = [ const classes = [
'', '',
@ -179,6 +180,7 @@
this.unidades.forEach(unidad => { this.unidades.forEach(unidad => {
const descuento = this.terreno * unidad.prorrateo const descuento = this.terreno * unidad.prorrateo
terreno += descuento terreno += descuento
prorrateo += unidad.prorrateo
const bruto = unidad.base - descuento const bruto = unidad.base - descuento
const neto = bruto / 1.19 const neto = bruto / 1.19
const data = [ const data = [
@ -207,7 +209,6 @@
const subtotal = base + iva const subtotal = base + iva
const total = subtotal + terreno const total = subtotal + terreno
const totalUF = total / this.uf const totalUF = total / this.uf
const descuento = terreno / base
const data = [ const data = [
c, c,
@ -217,7 +218,7 @@
'SUBTOTAL ' + pesoFormatter.format(subtotal * this.proporcion) + '<br />' + 'SUBTOTAL ' + pesoFormatter.format(subtotal * this.proporcion) + '<br />' +
'Mas valor terreno ' + pesoFormatter.format(terreno * this.proporcion) + '<br />' + 'Mas valor terreno ' + pesoFormatter.format(terreno * this.proporcion) + '<br />' +
'TOTAL ' + pesoFormatter.format(total * this.proporcion) + ';' + ufFormatter.format(totalUF * this.proporcion) + ' UF<br /><br />' + 'TOTAL ' + pesoFormatter.format(total * this.proporcion) + ';' + ufFormatter.format(totalUF * this.proporcion) + ' UF<br /><br />' +
'Descuento Terreno: ' + percentFormatter.format(descuento * 100) + '%<br /><br />' + 'Descuento Terreno: ' + percentFormatter.format(prorrateo) + '%<br /><br />' +
'UF: ' + ufFormatter.format(this.uf), 'UF: ' + ufFormatter.format(this.uf),
'1 UNID', '1 UNID',
pesoFormatter.format(terreno * this.proporcion), pesoFormatter.format(terreno * this.proporcion),