mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
finalizado nuevo presupuesto cliente a falta de confirmar
This commit is contained in:
@ -65,17 +65,18 @@ class Resumen {
|
||||
|
||||
#btnPreview() {
|
||||
|
||||
if(this.divPreview.hasClass('d-none')){
|
||||
if (this.divPreview.hasClass('d-none')) {
|
||||
this.btnPreviewCubierta.text('Ocultar desarrollo cubierta');
|
||||
this.divPreview.removeClass('d-none');
|
||||
this.generate();
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.btnPreviewCubierta.text('Mostrar desarrollo cubierta');
|
||||
this.divPreview.addClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
generate() {
|
||||
|
||||
this.titulo.text(this.datosGenerales.titulo.val());
|
||||
@ -94,9 +95,12 @@ class Resumen {
|
||||
this.formato.text(this.datosGenerales.papelFormatoId.find('option:selected').text());
|
||||
}
|
||||
|
||||
|
||||
this.divPreview.empty();
|
||||
|
||||
new previewFormas(
|
||||
this.divPreview,
|
||||
this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
this.divPreview,
|
||||
this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
||||
"resumen",
|
||||
{
|
||||
@ -174,20 +178,43 @@ class Resumen {
|
||||
const tarjetaPrecio = $('.tarjeta-tiradas-precios').filter(function () {
|
||||
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
|
||||
});
|
||||
this.precio_unidad.text(tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').attr('data'));
|
||||
|
||||
|
||||
let precio_u_text = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').text();
|
||||
precio_u_text = precio_u_text.replace('€/u', '');
|
||||
precio_u_text = this.#changeDecimalFormat(precio_u_text);
|
||||
|
||||
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
|
||||
let base_text = this.#changeDecimalFormat(base);
|
||||
|
||||
const iva_porcentaje = this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? 0.21 : 0.04;
|
||||
const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
|
||||
this.total_base.text(base);
|
||||
let iva_text = this.#changeDecimalFormat(iva);
|
||||
|
||||
const total = (parseFloat(base) + parseFloat(iva)).toFixed(2);
|
||||
let total_text = this.#changeDecimalFormat(total);
|
||||
|
||||
this.precio_unidad.text(precio_u_text);
|
||||
this.total_base.text(base_text);
|
||||
this.iva_porcentaje.text(this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? '21' : '4');
|
||||
this.iva.text(iva);
|
||||
this.total.text((parseFloat(base) + parseFloat(iva)).toFixed(2));
|
||||
this.iva.text(iva_text);
|
||||
this.total.text(total_text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
|
||||
#changeDecimalFormat(number) {
|
||||
|
||||
let cleanedNumber = String(number).replace(/[^\d.]/g, '');
|
||||
let partes = cleanedNumber.split('.');
|
||||
partes[0] = partes[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.');
|
||||
return partes.join(',');
|
||||
}
|
||||
}
|
||||
|
||||
export default Resumen;
|
||||
Reference in New Issue
Block a user