Added calculation detail

This commit is contained in:
Juan Pablo Vial
2025-10-25 12:05:32 -03:00
parent 14d75b1ce9
commit ebaf708f79
3 changed files with 41 additions and 2 deletions

View File

@ -44,6 +44,7 @@
facturas: () => {
document.getElementById(this.ids.facturas).innerHTML = this.venta.draw().facturas(this.formatters)
this.venta.watch().facturas()
$('[data-html]').popup()
}
}
},

View File

@ -220,9 +220,47 @@
},
resumen: ({no, classes, formatters}) => {
const emptyTerreno = '<div class="ui tiny red horizontal circular label">0</div>'
const calculoTerreno = [
[
`Base Terreno (${formatters.date.format(this.props.terreno.fecha)})`,
`\$${formatters.pesos.format(this.props.terreno.valor)}`
],
[
`IPC (${formatters.date.format(this.props.fecha)})`,
`${formatters.percent.format({{ $ipc }})}%`
],
[
'Prorrateo',
`${formatters.percent.format(this.props.detalle.descuento * 100)}%`
],
[
'Proporcion',
`${(this.props.proporcion * 100).toFixed(2).replace('.', ',')}%`
],
[
'Terreno Aplicado',
`\$${formatters.pesos.format(this.props.detalle.terreno)}`
]
]
const tableClasses = [
'',
" align='right'"
]
const calculoTerrenoTable = [
'<table>'
]
calculoTerreno.forEach(items => {
const row = []
items.forEach((cell, idx) => {
row.push(`<td${tableClasses[idx]}>${cell}</td>`)
})
calculoTerrenoTable.push(`<tr>${row.join('')}</tr>`)
})
calculoTerrenoTable.push('</table>')
const data = [
no,
'Valor con Terreno: $' + formatters.pesos.format(this.props.detalle.base) + ' - Menos valor terreno: $' + ((this.props.detalle.terreno > 0) ? formatters.pesos.format(-this.props.detalle.terreno) : emptyTerreno) + '<br />' +
'Valor con Terreno: $' + formatters.pesos.format(this.props.detalle.base) + ' - Menos valor terreno: <span data-variation="wide multiline" data-html="' + calculoTerrenoTable.join('') + '">$' + ((this.props.detalle.terreno > 0) ? formatters.pesos.format(-this.props.detalle.terreno) : emptyTerreno) + '</span><br />' +
'Base imponible (Neto): $' + formatters.pesos.format(this.props.detalle.neto) + '<br />' +
'IVA: $' + formatters.pesos.format(this.props.detalle.iva) + '<br />' +
'SUBTOTAL (Bruto): $' + formatters.pesos.format(this.props.detalle.bruto) + '<br />' +