Cambios solicitados
This commit is contained in:
@ -25,13 +25,14 @@
|
|||||||
unit.promotions?.forEach(promotion => {
|
unit.promotions?.forEach(promotion => {
|
||||||
amount /= 1/(1 - promotion.amount)
|
amount /= 1/(1 - promotion.amount)
|
||||||
})
|
})
|
||||||
amount /= 1/(1 - this.commission)
|
|
||||||
amount = 1 - amount
|
amount = 1 - amount
|
||||||
prices.push({
|
prices.push({
|
||||||
id: unit.id,
|
id: unit.id,
|
||||||
base: price,
|
base: price,
|
||||||
|
commission: this.commission,
|
||||||
|
broker: price / (1 - this.commission),
|
||||||
amount,
|
amount,
|
||||||
final: price / (1 - amount)
|
final: price / (1 - this.commission) / (1 - amount)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return prices
|
return prices
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
<th class="center aligned">Línea</th>
|
<th class="center aligned">Línea</th>
|
||||||
<th class="center aligned">Orientación</th>
|
<th class="center aligned">Orientación</th>
|
||||||
<th class="center aligned">Cantidad</th>
|
<th class="center aligned">Cantidad</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Lista</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
||||||
|
<th class="right aligned" style="text-decoration: overline">Comisión</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Porcentaje</th>
|
<th class="right aligned" style="text-decoration: overline">Porcentaje</th>
|
||||||
|
<th class="right aligned" style="text-decoration: overline">Precio Operador</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Final</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Final</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -51,6 +53,16 @@
|
|||||||
`Max: UF ${formatters.ufs.format(Math.max(...prices.map(p => p.base)))}`,
|
`Max: UF ${formatters.ufs.format(Math.max(...prices.map(p => p.base)))}`,
|
||||||
`Desv: UF ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.base)))}`
|
`Desv: UF ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.base)))}`
|
||||||
].join("\n").replaceAll(' ', ' ')
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const commission_tooltip = [
|
||||||
|
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.commission)))}`,
|
||||||
|
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.commission)))}`,
|
||||||
|
`Desv: ${formatters.percent.format(Stat.standardDeviation(prices.map(p => p.commission)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const broker_tooltip = [
|
||||||
|
`Min: ${formatters.ufs.format(Math.min(...prices.map(p => p.broker)))}`,
|
||||||
|
`Max: ${formatters.ufs.format(Math.max(...prices.map(p => p.broker)))}`,
|
||||||
|
`Desv: ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.broker)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
const amount_tooltip = [
|
const amount_tooltip = [
|
||||||
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.amount)))}`,
|
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.amount)))}`,
|
||||||
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.amount)))}`,
|
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.amount)))}`,
|
||||||
@ -69,6 +81,8 @@
|
|||||||
`<td class="center aligned">${orientacion}</td>`,
|
`<td class="center aligned">${orientacion}</td>`,
|
||||||
`<td class="center aligned">${unidades.length}</td>`,
|
`<td class="center aligned">${unidades.length}</td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
||||||
|
`<td class="right aligned"><span data-tooltip="${commission_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.commission)))}</span></td>`,
|
||||||
|
`<td class="right aligned"><span data-tooltip="${broker_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.broker)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.amount)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.amount)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.final)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.final)))}</span></td>`,
|
||||||
`</tr>`
|
`</tr>`
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
<th>Tipo</th>
|
<th>Tipo</th>
|
||||||
<th class="center aligned">Cantidad</th>
|
<th class="center aligned">Cantidad</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
||||||
|
<th class="right aligned" style="text-decoration: overline">Comisión</th>
|
||||||
|
<th class="right aligned" style="text-decoration: overline">Precio Operador</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Porcentaje</th>
|
<th class="right aligned" style="text-decoration: overline">Porcentaje</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Final</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Final</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -34,6 +36,16 @@
|
|||||||
`Max: UF ${formatters.ufs.format(Math.max(...prices.map(p => p.base)))}`,
|
`Max: UF ${formatters.ufs.format(Math.max(...prices.map(p => p.base)))}`,
|
||||||
`Desv: UF ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.base)))}`
|
`Desv: UF ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.base)))}`
|
||||||
].join("\n").replaceAll(' ', ' ')
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const commission_tooltip = [
|
||||||
|
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.commission)))}`,
|
||||||
|
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.commission)))}`,
|
||||||
|
`Desv: ${formatters.percent.format(Stat.standardDeviation(prices.map(p => p.commission)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const broker_tooltip = [
|
||||||
|
`Min: ${formatters.ufs.format(Math.min(...prices.map(p => p.broker)))}`,
|
||||||
|
`Max: ${formatters.ufs.format(Math.max(...prices.map(p => p.broker)))}`,
|
||||||
|
`Desv: ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.broker)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
const amount_tooltip = [
|
const amount_tooltip = [
|
||||||
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.amount)))}`,
|
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.amount)))}`,
|
||||||
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.amount)))}`,
|
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.amount)))}`,
|
||||||
@ -50,6 +62,8 @@
|
|||||||
`<td>${tipo.charAt(0).toUpperCase() + tipo.slice(1)}</td>`,
|
`<td>${tipo.charAt(0).toUpperCase() + tipo.slice(1)}</td>`,
|
||||||
`<td class="center aligned">${unidades.length}</td>`,
|
`<td class="center aligned">${unidades.length}</td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
||||||
|
`<td class="right aligned"><span data-tooltip="${commission_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.commission)))}</span></td>`,
|
||||||
|
`<td class="right aligned"><span data-tooltip="${broker_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.broker)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.amount)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.amount)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.final)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.final)))}</span></td>`,
|
||||||
`</tr>`
|
`</tr>`
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
<th>Tipo Order</th>
|
<th>Tipo Order</th>
|
||||||
<th class="right aligned">Unidad</th>
|
<th class="right aligned">Unidad</th>
|
||||||
<th>Unidad Orden</th>
|
<th>Unidad Orden</th>
|
||||||
|
<th>m²</th>
|
||||||
<th>Estado</th>
|
<th>Estado</th>
|
||||||
<th class="right aligned">Precio Lista</th>
|
<th class="right aligned">Precio Base</th>
|
||||||
|
<th class="right aligned">Comisión</th>
|
||||||
|
<th class="right aligned">Precio Operador</th>
|
||||||
<th class="right aligned">Porcentaje</th>
|
<th class="right aligned">Porcentaje</th>
|
||||||
<th class="right aligned">Precio Final</th>
|
<th class="right aligned">Precio Final</th>
|
||||||
<th>Fecha Inicio</th>
|
|
||||||
<th>Fecha Término</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
@ -22,6 +23,19 @@
|
|||||||
ids = {
|
ids = {
|
||||||
units: 'unidades',
|
units: 'unidades',
|
||||||
}
|
}
|
||||||
|
columns = [
|
||||||
|
'tipo',
|
||||||
|
'tipo_order',
|
||||||
|
'unidad',
|
||||||
|
'unidad_order',
|
||||||
|
'metros',
|
||||||
|
'estado',
|
||||||
|
'precio_base',
|
||||||
|
'commission',
|
||||||
|
'precio_operador',
|
||||||
|
'porcentaje',
|
||||||
|
'precio_final',
|
||||||
|
]
|
||||||
constructor(commission) {
|
constructor(commission) {
|
||||||
super(commission)
|
super(commission)
|
||||||
|
|
||||||
@ -41,7 +55,8 @@
|
|||||||
orderData: 3
|
orderData: 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: [2, 5, 6, 7],
|
target: ['metros', 'precio_base', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
|
||||||
|
.map(column => this.columns.indexOf(column)),
|
||||||
className: 'dt-right right aligned'
|
className: 'dt-right right aligned'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -50,7 +65,8 @@
|
|||||||
dto.layout = {
|
dto.layout = {
|
||||||
top1Start: {
|
top1Start: {
|
||||||
searchBuilder: {
|
searchBuilder: {
|
||||||
columns: [0, 2, 4, 5, 6, 7, 8, 9],
|
columns: this.columns.filter(column => !['tipo_order', 'unidad_order'].includes(column))
|
||||||
|
.map(column => this.columns.indexOf(column)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
top1End: {
|
top1End: {
|
||||||
@ -62,31 +78,23 @@
|
|||||||
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
|
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
|
||||||
download: 'open',
|
download: 'open',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: [0, 2, 5, 6, 7],
|
columns: ['tipo', 'unidad', 'metros', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
|
||||||
|
.map(column => this.columns.indexOf(column)),
|
||||||
rows: (idx, data, node) => {
|
rows: (idx, data, node) => {
|
||||||
return data[4] === 'Disponible'
|
return data[this.columns.indexOf('estado')] === 'Disponible'
|
||||||
},
|
},
|
||||||
format: {
|
format: {
|
||||||
body: (data, row, columnIdx, node) => {
|
body: (data, row, columnIdx, node) => {
|
||||||
if (typeof data === 'string' && data.includes('<span')) {
|
if (typeof data === 'string' && data.includes('<span')) {
|
||||||
return data.replace(/<span.*>(.*)<\/span>/, '$1')
|
return data.replace(/<span.*>(.*)<\/span>/, '$1')
|
||||||
}
|
}
|
||||||
|
if (columnIdx === this.columns.indexOf('metros')) {
|
||||||
|
return data.replaceAll('.', '').replaceAll(',', '.')
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
customize: xlsx => {
|
|
||||||
const sheet = xlsx.xl.worksheets['sheet1.xml']
|
|
||||||
const columns = Object.values($('row[r="2"] t', sheet).map((idx, column) => column.textContent))
|
|
||||||
const columnStylesMap = {
|
|
||||||
Valor: '63',
|
|
||||||
Fecha: '15'
|
|
||||||
}
|
|
||||||
Object.entries(columnStylesMap).forEach((column, style) => {
|
|
||||||
const columnIndex = String.fromCharCode('A'.charCodeAt(0) + columns.indexOf(column))
|
|
||||||
$(`c[r^="${columnIndex}"]`, sheet).attr('s', style)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -106,8 +114,11 @@
|
|||||||
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
|
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
|
||||||
unidad.descripcion,
|
unidad.descripcion,
|
||||||
unidad.descripcion.padStart(4, '0'),
|
unidad.descripcion.padStart(4, '0'),
|
||||||
|
formatters.ufs.format(unidad.proyecto_tipo_unidad.vendible) ?? 0,
|
||||||
unidad.sold ? '<span class="ui yellow text">Vendida</span>' : 'Disponible',
|
unidad.sold ? '<span class="ui yellow text">Vendida</span>' : 'Disponible',
|
||||||
'UF ' + formatters.ufs.format(price.base ?? 0),
|
'UF ' + formatters.ufs.format(price.base ?? 0),
|
||||||
|
formatters.percent.format(price.commission ?? 0),
|
||||||
|
'UF ' + formatters.ufs.format(price.broker ?? 0),
|
||||||
formatters.percent.format(price.amount ?? 0),
|
formatters.percent.format(price.amount ?? 0),
|
||||||
'UF ' + formatters.ufs.format(price.final ?? 0),
|
'UF ' + formatters.ufs.format(price.final ?? 0),
|
||||||
unidad.promotion?.start_date ?? '',
|
unidad.promotion?.start_date ?? '',
|
||||||
|
Reference in New Issue
Block a user