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