Matriz facturacion

This commit is contained in:
Juan Pablo Vial
2024-04-29 18:35:44 -04:00
parent 94d618b2a1
commit 9c024d1ef7
5 changed files with 182 additions and 307 deletions

View File

@ -887,178 +887,6 @@
].join("\n")
}
}
/*const output = [
'<div class="ui divider" data-index="'+propietario.props.index+'"></div>'+
'<div class="factura" data-index="'+propietario.props.index+'">'+
'<div class="ui compact grid">'+
'<div class="two columns row">'+
'<div class="twelve wide column">'+
'<strong>'+proyecto.inmobiliaria.nombre.toUpperCase()+'</strong><br/>'+
'GIRO: <br/>'+
'Dirección:'+proyecto.direccion+
'</div>'+
'<div class="four wide column">'+
'<div class="ui center aligned red segment">'+
'<strong>'+
'RUT:'+proyecto.inmobiliaria.rut.toUpperCase()+'<br/>'+
'FACTURA ELECTRÓNICA<br/>'+
'N° #'+
'</strong>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="row">'+
'<table class="ui table">'+
'<tr>'+
'<td class="grey"><strong>Señor(es)</strong></td>'+
'<td>'+propietario.props.nombre+'</td>'+
'<td class="grey"><strong>RUT</strong></td>'+
'<td>'+propietario.props.rut.toUpperCase()+'</td>'+
'</tr>'+
'<tr>'+
'<td class="grey"><strong>Giro</strong></td>'+
'<td>Otras Actividades Profesionales</td>'+
'<td class="grey"><strong>Fecha Emisión</strong></td>'+
'<td>'+formatters.date.format(propietario.props.fecha)+'</td>'+
'</tr>'+
'<tr>'+
'<td class="grey"><strong>Dirección</strong></td>'+
'<td>'+propietario.props.direccion+'</td>'+
'<td class="grey"><strong>Comuna</strong></td>'+
'<td>'+propietario.props.comuna.toUpperCase()+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="row">'+
'<table class="ui celled table">'+
'<thead>'+
'<tr class="grey">'+
'<th class="center aligned" colspan="6">DETALLES</th>'+
'</tr>'+
'<tr class="grey">'+
'<th>N°</th>'+
'<th class="center aligned">Descripción</th>'+
'<th class="center aligned">Cant/Unidad</th>'+
'<th class="center aligned">Prec. Unit.</th>'+
'<th class="center aligned">Ind</th>'+
'<th class="center aligned">Total</th>'+
'</tr>'+
'</thead>'
]
const unidadesData = []
let c = 1
const classes = [
'',
'',
'center aligned',
'right aligned',
'center aligned',
'right aligned'
]
const uf_mult = this.props.uf / uf
unidades.forEach(unidad => {
const descuento = parseFloat(proyecto.terreno) * parseFloat(unidad.prorrateo) * uf_mult
const bruto = parseFloat(unidad.base) * uf_mult - descuento
const neto = bruto / 1.19
const data = [
c ++,
unidad.descripcion + ' (UF ' + formatters.ufs.format(unidad.precio * this.props.proporcion * uf_mult) + ')',
'1 UNID',
formatters.pesos.format(neto * this.props.proporcion),
'AF',
formatters.pesos.format(neto * this.props.proporcion)
]
const row = ['<tr>']
data.forEach((value, i) => {
const cell = ['<td']
if (classes[i] !== '') {
cell.push(' class="'+classes[i]+'"')
}
cell.push('>'+value+'</td>')
row.push(cell.join(''))
})
row.push('</tr>')
unidadesData.push(row.join(''))
})
const emptyTerreno = '<div class="ui tiny red horizontal circular label">0</div>'
const data = [
c,
'Valor con Terreno ' + formatters.pesos.format((venta.base * uf_mult + venta.terreno * uf_mult) * this.props.proporcion) + ' - Menos valor terreno ' + ((venta.terreno > 0) ? formatters.pesos.format(-venta.terreno * uf_mult * this.props.proporcion) : emptyTerreno) + '<br />' +
'Base imponible ' + formatters.pesos.format(venta.base * uf_mult * this.props.proporcion) + '<br />' +
'IVA ' + formatters.pesos.format(venta.iva * uf_mult * this.props.proporcion) + '<br />' +
'SUBTOTAL ' + formatters.pesos.format(venta.subtotal * uf_mult * this.props.proporcion) + '<br />' +
'Mas valor terreno ' + ((venta.terreno > 0) ? formatters.pesos.format(venta.terreno * uf_mult * this.props.proporcion) : emptyTerreno) + '<br />' +
'TOTAL ' + formatters.pesos.format(venta.total * uf_mult * this.props.proporcion) + ';' + formatters.ufs.format(venta.totalUF * this.props.proporcion) + ' UF<br /><br />' +
'Descuento Terreno: ' + ((venta.terreno > 0) ? formatters.percent.format(venta.prorrateo * 100) : emptyTerreno) + '%<br /><br />' +
'UF: ' + formatters.ufs.format(uf),
'1 UNID',
formatters.pesos.format(venta.terreno * uf_mult * this.props.proporcion),
'EX',
formatters.pesos.format(venta.terreno * uf_mult * this.props.proporcion)
]
const row = ['<tr class="top aligned">']
data.forEach((value, i) => {
const cell = ['<td']
if (classes[i] !== '') {
cell.push(' class="'+classes[i]+'"')
}
cell.push('>'+value+'</td>')
row.push(cell.join(''))
})
unidadesData.push(row.join(''))
output.push('<tbody id="unidades">'+unidadesData.join('')+'</tbody>')
output.push(
'<tfoot>'+
'<tr>'+
'<td colspan="6">'+
'<br />'+
'<br />'+
'<br />'+
'<br />'+
'</td>'+
'</tr>'+
'</tfoot>'+
'</table>'+
'</div>'+
'<div class="row">'+
'<div class="ten wide column"></div>'+
'<div class="six wide column">'+
'<table class="ui celled very compact table">'+
'<thead>'+
'<tr>'+
'<th class="center aligned grey" colspan="2">TOTALES</th>'+
'</tr>'+
'</thead>'+
'<tbody>'+
'<tr>'+
'<td class="grey">Monto Neto</td>'+
'<td class="right aligned" id="neto">'+formatters.pesos.format(venta.neto * uf_mult * this.props.proporcion)+'</td>'+
'</tr>'+
'<tr>'+
'<td class="grey">Monto Exento</td>'+
'<td class="right aligned" id="exento">'+formatters.pesos.format(venta.exento * uf_mult * this.props.proporcion)+'</td>'+
'</tr>'+
'<tr>'+
'<td class="grey">19% IVA</td>'+
'<td class="right aligned" id="iva">'+formatters.pesos.format(venta.iva * uf_mult * this.props.proporcion)+'</td>'+
'</tr>'+
'<tr>'+
'<td class="grey">Monto Total</td>'+
'<td class="right aligned"><strong id="total">'+formatters.pesos.format(venta.total * uf_mult * this.props.proporcion)+'</strong></td>'+
'</tr>'+
'</tbody>'+
'</table>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'
)
return output.join('')*/
}
}