terminada cubierta sin acabados

This commit is contained in:
jaimejimenezortega
2024-05-01 18:44:44 +02:00
parent f289baa830
commit 2ba6f40c6d
4 changed files with 3451 additions and 12 deletions

View File

@ -630,6 +630,13 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
**********************/
protected function getLineasPresupuesto($reqData)
{
$error =(object)[
'interior' => "",
'cubierta' => "",
'sobrecubierta' => "",
'guardas' => "",
];
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
$tirada = $reqData['tirada'] ?? 0;
@ -678,10 +685,7 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
}
if ($costeInterior <= 0) {
return [
'error' => lang('Presupuestos.errores.noInterior'),
'precio_u' => 0,
];
$error->interior = lang('Presupuestos.errores.noInterior');
}
// Si es POD hay que volver a calcular para incluir la merma correcta
@ -705,12 +709,11 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
}
}
if ($costeInterior <= 0) {
return [
'error' => lang('Presupuestos.errores.noInterior'),
'precio_u' => 0,
];
}
if ($costeInterior <= 0)
$error->interior = lang('Presupuestos.errores.noInterior');
else
$error->interior = "";
// Cubierta
$papel_generico = [
@ -729,8 +732,19 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
$input_data['uso'] = 'cubierta';
$cubierta = PresupuestoClienteService::obtenerCubierta($input_data);
$coste_cubierta = 0.0;
if (count($cubierta) > 0) {
$coste_cubierta += floatval($cubierta['total_impresion']);
}
if($coste_cubierta <= 0)
$error->cubierta = lang('Presupuestos.errores.noCubierta');
else
$error->cubierta = "";
return [
'errors' => $error,
'total_lp' => $costeInterior+$coste_cubierta,
'interior' => $interior,
'cubierta' => $cubierta,
];

View File

@ -163,6 +163,10 @@
</div>
</div>
<div id="errorInterior" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<h6> Color del interior </h6>
<div class="row">
@ -259,6 +263,10 @@
</div>
</div>
<div id="errorCubierta" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<h6> Papel </h6>
<div class="row">

View File

@ -584,11 +584,11 @@ async function calcularPresupuesto() {
isColor: $('#colorNegroDiv').hasClass('checked') ? 0 : 1,
isHq: $('#calidadEstandarDiv').hasClass('checked') ? 0 : 1,
papelInterior: $('#papelInterior option:selected').val(),
papelInteriorNombre: $('#papelInterior option:selected').text(),
papelInteriorNombre: $('#papelInterior option:selected').text().trim(),
gramajeInterior: $('#gramajeInterior option:selected').text(),
excluirRotativa: $('#excluirRotativa').is(':checked')? 1 : 0,
papelCubierta: $('#papelCubierta option:selected').val(),
papelCubiertaNombre: $('#papelCubierta option:selected').text(),
papelCubiertaNombre: $('#papelCubierta option:selected').text().trim(),
gramajeCubierta: $('#gramajeCubierta option:selected').text(),
carasCubierta: $('#carasCubierta').val(),
acabadoCubierta: $('#acabadosCubierta').val(),
@ -604,6 +604,7 @@ async function calcularPresupuesto() {
if ($('.enable-sobrecubierta').is(':visible')) {
datos.sobrecubierta = {
papel: $('#papelSobrecubierta option:selected').val(),
papel_nombre: $('#papelSobrecubierta option:selected').text().trim(),
gramaje: $('#gramajeSobrecubierta option:selected').text(),
acabado: $('#acabadosSobrecubierta').val()
}
@ -615,6 +616,7 @@ async function calcularPresupuesto() {
if ($('.guardas').is(':visible')) {
datos.guardas = {
papel: $('#papelGuardas option:selected').val(),
papel_nombre: $('#papelGuardas option:selected').text().trim(),
caras: $('#impresionGuardas option:selected').val()
}
}
@ -629,6 +631,14 @@ async function calcularPresupuesto() {
type: 'POST',
data: datos,
success: function (response) {
if(response.errors.interior.length > 0)
$('#errorInterior').show();
else
$('#errorInterior').hide();
if(response.errors.cubierta.length > 0)
$('#errorCubierta').show();
else
$('#errorCubierta').hide();
console.log(response);
$('#loader').hide();
},

3407
xdebug.log

File diff suppressed because one or more lines are too long