mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'bug/add-presu-cliente' into 'main'
Bug/add presu cliente See merge request jjimenez/safekat!254
This commit is contained in:
@ -81,12 +81,12 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_antes_descuento" => null,
|
"total_antes_descuento" => null,
|
||||||
"total_descuento" => null,
|
"total_descuento" => null,
|
||||||
"total_descuentoPercent" => null,
|
"total_descuentoPercent" => null,
|
||||||
"total_presupuesto" => null,
|
|
||||||
"total_precio_unidad" => null,
|
"total_precio_unidad" => null,
|
||||||
"total_factor" => null,
|
"total_factor" => null,
|
||||||
"total_factor_ponderado" => null,
|
"total_factor_ponderado" => null,
|
||||||
'total_aceptado' => null,
|
'total_aceptado' => null,
|
||||||
'iva_reducido' => null,
|
'iva_reducido' => null,
|
||||||
|
'excluir_rotativa' => null,
|
||||||
"acabado_cubierta_id" => null,
|
"acabado_cubierta_id" => null,
|
||||||
"acabado_sobrecubierta_id" => null,
|
"acabado_sobrecubierta_id" => null,
|
||||||
"is_duplicado" => false,
|
"is_duplicado" => false,
|
||||||
@ -151,6 +151,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_factor_ponderado" => "?float",
|
"total_factor_ponderado" => "?float",
|
||||||
'total_aceptado' => "?float",
|
'total_aceptado' => "?float",
|
||||||
'iva_reducido' => "?boolean",
|
'iva_reducido' => "?boolean",
|
||||||
|
'excluir_rotativa' => "?boolean",
|
||||||
"acabado_cubierta_id" => "int",
|
"acabado_cubierta_id" => "int",
|
||||||
"acabado_sobrecubierta_id" => "int",
|
"acabado_sobrecubierta_id" => "int",
|
||||||
"is_duplicado" => "boolean",
|
"is_duplicado" => "boolean",
|
||||||
|
|||||||
@ -122,6 +122,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
|||||||
"total_factor_ponderado",
|
"total_factor_ponderado",
|
||||||
'total_aceptado',
|
'total_aceptado',
|
||||||
'iva_reducido',
|
'iva_reducido',
|
||||||
|
'excluir_rotativa',
|
||||||
"acabado_cubierta_id",
|
"acabado_cubierta_id",
|
||||||
"acabado_sobrecubierta_id",
|
"acabado_sobrecubierta_id",
|
||||||
"is_duplicado"
|
"is_duplicado"
|
||||||
|
|||||||
@ -172,11 +172,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
window.estado = <?= $presupuestoEntity->estado_id ?>;
|
window.estado = <?= $presupuestoEntity->estado_id ?? 1?>;
|
||||||
window.tirada = <?= $presupuestoEntity->selected_tirada ?>;
|
window.tirada = <?= $presupuestoEntity->selected_tirada ?? 0?>;
|
||||||
window.total = <?= $presupuestoEntity->total_aceptado ?>;
|
window.total = <?= $presupuestoEntity->total_aceptado ?? 0?>;
|
||||||
window.total_unidad = <?= $presupuestoEntity->total_precio_unidad ?>;
|
window.total_unidad = <?= $presupuestoEntity->total_precio_unidad ?? 0 ?>;
|
||||||
window.iva_reducido= <?= $presupuestoEntity->iva_reducido ?>;
|
|
||||||
window.routes_resumen = {
|
window.routes_resumen = {
|
||||||
guardarPresupuesto: "<?= route_to('guardarPresupuesto') ?>",
|
guardarPresupuesto: "<?= route_to('guardarPresupuesto') ?>",
|
||||||
duplicarPresupuesto: "<?= route_to('duplicarPresupuesto') ?>",
|
duplicarPresupuesto: "<?= route_to('duplicarPresupuesto') ?>",
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
const clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente');
|
const clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente');
|
||||||
if (typeof clientePresupuestoWizard !== undefined && clientePresupuestoWizard !== null) {
|
if (typeof clientePresupuestoWizard !== undefined && clientePresupuestoWizard !== null ) {
|
||||||
// Wizard form
|
// Wizard form
|
||||||
const clientePresupuestoWizardForm = clientePresupuestoWizard.querySelector('#presupuesto-cliente-form');
|
const clientePresupuestoWizardForm = clientePresupuestoWizard.querySelector('#presupuesto-cliente-form');
|
||||||
// Wizard steps
|
// Wizard steps
|
||||||
@ -25,21 +25,26 @@
|
|||||||
const clientePresupuestoWizardNext = [].slice.call(clientePresupuestoWizardForm.querySelectorAll('.btn-next'));
|
const clientePresupuestoWizardNext = [].slice.call(clientePresupuestoWizardForm.querySelectorAll('.btn-next'));
|
||||||
const clientePresupuestoWizardPrev = [].slice.call(clientePresupuestoWizardForm.querySelectorAll('.btn-prev'));
|
const clientePresupuestoWizardPrev = [].slice.call(clientePresupuestoWizardForm.querySelectorAll('.btn-prev'));
|
||||||
|
|
||||||
|
let FormValidation2;
|
||||||
|
let FormValidation3;
|
||||||
|
let FormValidation4;
|
||||||
|
let FormValidation5;
|
||||||
|
|
||||||
let validationStepper = new Stepper(clientePresupuestoWizard, {
|
let validationStepper = new Stepper(clientePresupuestoWizard, {
|
||||||
linear: true
|
linear: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// select2 (clienteId)
|
if(clientePresupuestoWizardFormStep2 != null) {
|
||||||
const clienteId = $('#clienteId');
|
// select2 (clienteId)
|
||||||
|
const clienteId = $('#clienteId');
|
||||||
|
|
||||||
clienteId.on('change.select2', function () {
|
clienteId.on('change.select2', function () {
|
||||||
// Revalidate the clienteId field when an option is chosen
|
// Revalidate the clienteId field when an option is chosen
|
||||||
FormValidation2.revalidateField('clienteId');
|
FormValidation2.revalidateField('clienteId');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deal Details
|
// Deal Details
|
||||||
if(clientePresupuestoWizardFormStep2 !== null){
|
FormValidation2 = FormValidation.formValidation(clientePresupuestoWizardFormStep2, {
|
||||||
const FormValidation2 = FormValidation.formValidation(clientePresupuestoWizardFormStep2, {
|
|
||||||
fields: {
|
fields: {
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
@ -60,7 +65,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Deal Usage
|
// Deal Usage
|
||||||
const FormValidation3 = FormValidation.formValidation(clientePresupuestoWizardFormStep3, {
|
FormValidation3 = FormValidation.formValidation(clientePresupuestoWizardFormStep3, {
|
||||||
fields: {
|
fields: {
|
||||||
titulo: {
|
titulo: {
|
||||||
validators: {
|
validators: {
|
||||||
@ -223,7 +228,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Direcciones
|
// Direcciones
|
||||||
const FormValidation4 = FormValidation.formValidation(clientePresupuestoWizardFormStep4, {
|
FormValidation4 = FormValidation.formValidation(clientePresupuestoWizardFormStep4, {
|
||||||
fields: {
|
fields: {
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -252,92 +257,92 @@
|
|||||||
$('#errorDirecciones').show();
|
$('#errorDirecciones').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deal Usage
|
|
||||||
const FormValidation5 = FormValidation.formValidation(clientePresupuestoWizardFormStep5, {
|
|
||||||
fields: {
|
|
||||||
// * Validate the fields here based on your requirements
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
trigger: new FormValidation.plugins.Trigger(),
|
|
||||||
bootstrap5: new FormValidation.plugins.Bootstrap5({
|
|
||||||
// Use this for enabling/changing valid/invalid class
|
|
||||||
// eleInvalidClass: '',
|
|
||||||
eleValidClass: '',
|
|
||||||
rowSelector: '.col-md-12'
|
|
||||||
}),
|
|
||||||
autoFocus: new FormValidation.plugins.AutoFocus(),
|
|
||||||
submitButton: new FormValidation.plugins.SubmitButton()
|
|
||||||
}
|
|
||||||
}).on('core.form.valid', function () {
|
|
||||||
// You can submit the form
|
|
||||||
// clientePresupuestoWizardForm.submit()
|
|
||||||
// or send the form data to server via an Ajax request
|
|
||||||
// To make the demo simple, I just placed an alert
|
|
||||||
//alert('Submitted..!!');
|
|
||||||
});
|
|
||||||
|
|
||||||
clientePresupuestoWizardNext.forEach(item => {
|
|
||||||
item.addEventListener('click', event => {
|
|
||||||
// When click the Next button, we will validate the current step
|
|
||||||
switch (validationStepper._currentIndex) {
|
|
||||||
case 0:
|
|
||||||
FormValidation2.validate();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
FormValidation3.validate();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
FormValidation4.validate();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
FormValidation5.validate();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
validationStepper.next();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
clientePresupuestoWizardPrev.forEach(item => {
|
|
||||||
item.addEventListener('click', event => {
|
|
||||||
switch (validationStepper._currentIndex) {
|
|
||||||
case 4:
|
|
||||||
validationStepper.previous();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
validationStepper.previous();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
for (let i = 0; i < 4; i++) {
|
|
||||||
let id = "tiradaPrecio" + i;
|
|
||||||
if ($('#' + id).length > 0) {
|
|
||||||
$('#' + id).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
validationStepper.previous();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
validationStepper.previous();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0:
|
|
||||||
window.location.href = document.location.origin + '/presupuestocliente/list';
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
// Deal Usage
|
||||||
|
FormValidation5 = FormValidation.formValidation(clientePresupuestoWizardFormStep5, {
|
||||||
|
fields: {
|
||||||
|
// * Validate the fields here based on your requirements
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
trigger: new FormValidation.plugins.Trigger(),
|
||||||
|
bootstrap5: new FormValidation.plugins.Bootstrap5({
|
||||||
|
// Use this for enabling/changing valid/invalid class
|
||||||
|
// eleInvalidClass: '',
|
||||||
|
eleValidClass: '',
|
||||||
|
rowSelector: '.col-md-12'
|
||||||
|
}),
|
||||||
|
autoFocus: new FormValidation.plugins.AutoFocus(),
|
||||||
|
submitButton: new FormValidation.plugins.SubmitButton()
|
||||||
|
}
|
||||||
|
}).on('core.form.valid', function () {
|
||||||
|
// You can submit the form
|
||||||
|
// clientePresupuestoWizardForm.submit()
|
||||||
|
// or send the form data to server via an Ajax request
|
||||||
|
// To make the demo simple, I just placed an alert
|
||||||
|
//alert('Submitted..!!');
|
||||||
|
});
|
||||||
|
|
||||||
|
clientePresupuestoWizardNext.forEach(item => {
|
||||||
|
item.addEventListener('click', event => {
|
||||||
|
// When click the Next button, we will validate the current step
|
||||||
|
switch (validationStepper._currentIndex) {
|
||||||
|
case 0:
|
||||||
|
FormValidation2.validate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
FormValidation3.validate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
FormValidation4.validate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
FormValidation5.validate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
validationStepper.next();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
clientePresupuestoWizardPrev.forEach(item => {
|
||||||
|
item.addEventListener('click', event => {
|
||||||
|
switch (validationStepper._currentIndex) {
|
||||||
|
case 4:
|
||||||
|
validationStepper.previous();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
validationStepper.previous();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
|
let id = "tiradaPrecio" + i;
|
||||||
|
if ($('#' + id).length > 0) {
|
||||||
|
$('#' + id).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
validationStepper.previous();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
validationStepper.previous();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
window.location.href = document.location.origin + '/presupuestocliente/list';
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@ -78,44 +78,33 @@ function generarResumen(){
|
|||||||
$('.resumen-extras').hide();
|
$('.resumen-extras').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(window.estado==1){
|
for (i = 1; i <= 4; i++) {
|
||||||
for (i = 1; i <= 4; i++) {
|
let id = "tiradaPrecio" + i;
|
||||||
let id = "tiradaPrecio" + i;
|
if ($('#' + id).length > 0) {
|
||||||
if ($('#' + id).length > 0) {
|
|
||||||
|
|
||||||
const envio = getTotalEnvio();
|
const envio = getTotalEnvio();
|
||||||
|
|
||||||
let tirada_id = "ud_tiradaPrecio" + i;
|
let tirada_id = "ud_tiradaPrecio" + i;
|
||||||
if(parseInt($('#' + tirada_id).text().replace(' ud.', '')) != tirada){
|
if(parseInt($('#' + tirada_id).text().replace(' ud.', '')) != tirada){
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
let total_id = "tot_tiradaPrecio" + i;
|
|
||||||
|
|
||||||
let total = parseFloat($('#' + total_id).text().replace('€', '').replace('Total: ', '')) + envio;
|
|
||||||
let total_iva = 0.0;
|
|
||||||
if($('#ivaReducido').val() == '1'){
|
|
||||||
total_iva = total * 1.04;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
total_iva = total * 1.21;
|
|
||||||
}
|
|
||||||
const precio_u = total_iva/tirada;
|
|
||||||
$('#resumenTotalIVA').text('Total (I.V.A. ' + (($('#ivaReducido').val() == '1')?'4':'21') + '%): ' + total_iva.toFixed(2) + '€');
|
|
||||||
$('#resumenPrecioU').text(precio_u.toFixed(4) + '€/ud');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let total_id = "tot_tiradaPrecio" + i;
|
||||||
|
|
||||||
|
let total = parseFloat($('#' + total_id).text().replace('€', '').replace('Total: ', '')) + envio;
|
||||||
|
let total_iva = 0.0;
|
||||||
|
if($('#ivaReducido').val() == '1'){
|
||||||
|
total_iva = total * 1.04;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
total_iva = total * 1.21;
|
||||||
|
}
|
||||||
|
const precio_u = total_iva/tirada;
|
||||||
|
$('#resumenTotalIVA').text('Total (I.V.A. ' + (($('#ivaReducido').val() == '1')?'4':'21') + '%): ' + total_iva.toFixed(2) + '€');
|
||||||
|
$('#resumenPrecioU').text(precio_u.toFixed(4) + '€/ud');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
let iva = 1.04;
|
|
||||||
if(window.iva_reducido == 0){
|
|
||||||
iva = 1.21;
|
|
||||||
}
|
|
||||||
let total = window.total*iva;
|
|
||||||
let p_unidad = total/window.tirada;
|
|
||||||
$('#resumenTotalIVA').text('Total (I.V.A. ' + (total.toFixed(2)) + '€');
|
|
||||||
$('#resumenPrecioU').text(p_unidad.toFixed(4) + '€/ud');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13203
xdebug.log
13203
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user