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

View File

@ -163,6 +163,10 @@
</div> </div>
</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> <h6> Color del interior </h6>
<div class="row"> <div class="row">
@ -259,6 +263,10 @@
</div> </div>
</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> <h6> Papel </h6>
<div class="row"> <div class="row">

View File

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

3407
xdebug.log

File diff suppressed because one or more lines are too long