Compare commits

...

2 Commits

Author SHA1 Message Date
59115bd631 Merge branch 'feature/cierres' into develop 2025-10-25 12:51:27 -03:00
2edcdacbe0 FIX: promotions id 2025-10-25 12:49:58 -03:00
2 changed files with 24 additions and 2 deletions

View File

@ -533,13 +533,35 @@
'<th>Precio</th>',
'</thead>'
]
const rowAlters = [
'',
" align='right'",
" align='right'",
" align='right'"
]
reservation.units.forEach(unit => {
let type = unit.unit.proyecto_tipo_unidad.tipo_unidad.descripcion
type = type.charAt(0).toUpperCase() + type.slice(1)
const base = unit.base ?? (unit.value ?? 0);
const price = unit.unit.current_precio?.valor ?? 0
const diff = (base - price) / price * 100
table.push(`<tr><td>${type} ${unit.unit.descripcion}:</td><td align='right'> ${formatter.format(base)} UF</td><td align='right'>${formatter.format(price)} UF</td><td align='right'>(${formatter.format(diff)} %)</td></tr>`)
const rowsData = [
[
`${type} ${unit.unit.descripcion}`,
`${formatter.format(base)} UF`,
`${formatter.format(price)} UF`,
`(${formatter.format(diff)} %)`
]
]
const rowContent = []
rowsData.forEach(row => {
const content = []
row.forEach((cell, idx) => {
content.push(`<td${rowAlters[idx]}>${cell}</td>`)
})
rowContent.push(`<tr>${content.join('')}</tr>`)
})
table.push(rowContent.join(''))
})
if (reservation.broker !== null) {
table.push('<tr><td>-----</td></tr>')

View File

@ -222,7 +222,7 @@
draw = {
promotion: idx => {
const promotions = this.data.promotions.map(promotion => {
return `<div class="item" data-value="${promotion.id}">${promotion.name}</div>`
return `<div class="item" data-value="${promotion.value}">${promotion.name}</div>`
})
return [
`<div class="fields promotion" data-id="${idx}">`,