Compare commits
2 Commits
ebaf708f79
...
59115bd631
| Author | SHA1 | Date | |
|---|---|---|---|
| 59115bd631 | |||
| 2edcdacbe0 |
@ -533,13 +533,35 @@
|
|||||||
'<th>Precio</th>',
|
'<th>Precio</th>',
|
||||||
'</thead>'
|
'</thead>'
|
||||||
]
|
]
|
||||||
|
const rowAlters = [
|
||||||
|
'',
|
||||||
|
" align='right'",
|
||||||
|
" align='right'",
|
||||||
|
" align='right'"
|
||||||
|
]
|
||||||
reservation.units.forEach(unit => {
|
reservation.units.forEach(unit => {
|
||||||
let type = unit.unit.proyecto_tipo_unidad.tipo_unidad.descripcion
|
let type = unit.unit.proyecto_tipo_unidad.tipo_unidad.descripcion
|
||||||
type = type.charAt(0).toUpperCase() + type.slice(1)
|
type = type.charAt(0).toUpperCase() + type.slice(1)
|
||||||
const base = unit.base ?? (unit.value ?? 0);
|
const base = unit.base ?? (unit.value ?? 0);
|
||||||
const price = unit.unit.current_precio?.valor ?? 0
|
const price = unit.unit.current_precio?.valor ?? 0
|
||||||
const diff = (base - price) / price * 100
|
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) {
|
if (reservation.broker !== null) {
|
||||||
table.push('<tr><td>-----</td></tr>')
|
table.push('<tr><td>-----</td></tr>')
|
||||||
|
|||||||
@ -222,7 +222,7 @@
|
|||||||
draw = {
|
draw = {
|
||||||
promotion: idx => {
|
promotion: idx => {
|
||||||
const promotions = this.data.promotions.map(promotion => {
|
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 [
|
return [
|
||||||
`<div class="fields promotion" data-id="${idx}">`,
|
`<div class="fields promotion" data-id="${idx}">`,
|
||||||
|
|||||||
Reference in New Issue
Block a user