diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index a2d6acb0..d3b2986e 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -666,7 +666,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $gramaje = $sobrecubierta['gramaje']; $paginas_color = $sobrecubierta['datosPedido']['paginas'] ?? 0; $tipo_impresion_id = $sobrecubierta['tipo_impresion_id']; - $uso = $sobrecubierta['uso']; + $faja = intval($sobrecubierta['faja'] ?? 0); + $uso = $faja==1? 'faja' : $sobrecubierta['uso']; + $data = array( 'cliente_id' => $cliente_id, @@ -960,7 +962,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $resourceData = PresupuestoService::obtenerComparadorRotativa($input_data); - } else if ($type == 'cubierta' || $type == 'sobrecubierta') { + } else if ($type == 'cubierta' || $type == 'sobrecubierta' || $type == 'faja') { $datosPedido->solapas = $reqData['solapas']; $datosPedido->solapas_ancho = $reqData['solapas_ancho']; diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index b508d9f2..24d404a3 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -83,8 +83,13 @@ class PresupuestoService extends BaseService $parametrosInkjet->rotativa_cg = $datosTipologias[0]->cg; } + $uso_tarifa = $uso; + if($uso == 'guardas') + $uso_tarifa = 'interior'; + else if ($uso == 'faja') + $uso_tarifa = 'sobrecubierta'; $tarifamodel = new \App\Models\Configuracion\MaquinasTarifasImpresionModel(); - $datos_tarifa = $tarifamodel->getTarifa($maquina->maquina_id, ($uso == 'guardas') ? 'interior' : $uso, $tipo); + $datos_tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso_tarifa, $tipo); if (count($datos_tarifa) > 0) { $tarifaId = $datos_tarifa[0]; $tarifa = $datos_tarifa[1]; @@ -128,7 +133,7 @@ class PresupuestoService extends BaseService $clientePreciosModel = new \App\Models\Clientes\ClientePreciosModel(); $config = (object) [ - "tipo" => ($uso == 'guardas') ? 'interior' : $uso, + "tipo" => $uso_tarifa, "tipo_maquina" => $maquina->is_inkjet ? 'inkjet' : 'toner', "tipo_impresion" => $tipo ]; @@ -334,8 +339,8 @@ class PresupuestoService extends BaseService if ($uso != 'rotativa') { - $ancho_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho; - $alto_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta') ? $datosPedido->altoExteriores : $datosPedido->alto; + $ancho_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta' || $uso == 'faja') ? $datosPedido->anchoExteriores : $datosPedido->ancho; + $alto_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta' || $uso == 'faja') ? $datosPedido->altoExteriores : $datosPedido->alto; $formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $alto_calculo, $datosPedido->isCosido, $forzar_a_favor_fibra); $response['fields'] = $formas; } @@ -366,10 +371,12 @@ class PresupuestoService extends BaseService $margen_click = $tarifa * ($tarifa_margen / 100.0); //interior (bn o color) - if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0) { + if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0 || $uso == 'faja') { // precio papel - $pliegos_libro = ceil(($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value']); - if ($pliegos_libro < 1) + $pliegos_libro = ($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value']; + if($uso != 'faja') + $pliegos_libro = ceil($pliegos_libro); + if ($uso != 'faja' && $pliegos_libro < 1) // faja pueden entrar más de una forma $pliegos_libro = 1; $pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma); $precio_libro = $pliegos_libro * ($precio_pliego_impresion + $margen_pliego_impresion); @@ -693,7 +700,7 @@ class PresupuestoService extends BaseService $h2_temp = 0; // El ancho si es cosido es el doble - if ($uso != 'cubierta' && $uso != 'sobrecubierta') { + if ($uso != 'cubierta' && $uso != 'sobrecubierta' && $uso != 'faja') { $anchoForCalculo = $isCosido ? $ancho * 2 : $ancho; } else { $anchoForCalculo = $ancho; @@ -931,7 +938,7 @@ class PresupuestoService extends BaseService if ($datosPedido) { $alto_total = floatval($datosPedido->alto); $sangre_cubierta = self::SANGRE_FORMAS_CUBIERTA; - if ($datosPedido->alto >= 297) { + if ($datosPedido->alto >= 267) { $sangre_cubierta = 10; } // Tapa dura (cosido y fresado) @@ -1761,7 +1768,8 @@ class PresupuestoService extends BaseService $tipo = $isColor ? ($isHq ? 'colorhq' : 'color') : ($isHq ? 'negrohq' : 'negro'); - $opciones_papel = PresupuestoService::get_opciones_papel($uso, $isColor); + $uso_papel = $uso == 'faja' ? 'sobrecubierta': $uso; + $opciones_papel = PresupuestoService::get_opciones_papel($uso_papel, $isColor); // Se obtienen los papeles disponibles $papelimpresionmodel = new PapelImpresionModel(); @@ -1779,7 +1787,7 @@ class PresupuestoService extends BaseService $maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto( is_rotativa: 0, tarifa_tipo: $tipo, - uso_tarifa: ($uso == 'guardas') ? 'interior' : $uso, + uso_tarifa: ($uso == 'guardas') ? 'interior' : $uso_papel, tirada: $datosPedido->tirada + $datosPedido->merma, papel_impresion_id: $papel->id, )->orderBy("t1.id", "asc")->get()->getResultObject(); @@ -1787,10 +1795,10 @@ class PresupuestoService extends BaseService // Se recorren las máquinas y se calcula el coste de linea por cada una foreach ($maquinas as $maquina) { - if ($uso == 'cubierta' || $uso == 'sobrecubierta') { + if ($uso == 'cubierta' || $uso == 'sobrecubierta' || $uso == 'faja') { - $datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso, $tipo_impresion_id, $datosPedido, $maquina->maquina_id, $lomoRedondo); - $datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso, $tipo_impresion_id, $datosPedido); + $datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso_papel, $tipo_impresion_id, $datosPedido, $maquina->maquina_id, $lomoRedondo); + $datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso_papel, $tipo_impresion_id, $datosPedido); } $data['uso'] = $uso; diff --git a/httpdocs/assets/js/safekat/components/preview.js b/httpdocs/assets/js/safekat/components/preview.js index 543f68ef..bcd53382 100644 --- a/httpdocs/assets/js/safekat/components/preview.js +++ b/httpdocs/assets/js/safekat/components/preview.js @@ -148,7 +148,7 @@ class previewFormas { let anchoPliegue = parseFloat(7); // mm let altoPliegue = parseFloat(7); // mm let sangre = parseFloat(20); // mm - if (this.isTapaDura && (this.ancho() >= 210 || this.alto() >= 297)) { + if (this.isTapaDura && (this.ancho() >= 210 || this.alto() >= 267)) { sangre = parseFloat(10); // mm } this.pvObj.anchoForma = ((2 * this.pvObj.anchoLibro) + (2 * anchoPliegue) + (2 * sangre) + this.pvObj.lomoLibro); @@ -201,7 +201,7 @@ class previewFormas { $(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + rowData.papel); $(pvName + '_pi').attr("href", $(pvName + '_pi').attr('sk-url') + rowData.papel_impresion_id); $(pvName + '_mi').attr("href", $(pvName + '_mi').attr('sk-url') + rowData.maquina_id); - $('#pv_ec_lomo').text(this.pvObj.lomoLibro); + $('#pv_ec_lomo').text(parseFloat(this.pvObj.lomoLibro).toFixed(1)); break; case 'rot_bn': @@ -482,7 +482,7 @@ class previewFormas { altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px } else { anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px + altoSangrado = (anchoSangrado * 0.6 > 650) ? 650 : anchoSangrado * 0.6; // px } altoLibro = altoSangrado * 0.97; @@ -497,7 +497,7 @@ class previewFormas { altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px } else { anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px + altoSangrado = (anchoSangrado * 0.6 > 650) ? 650 : anchoSangrado * 0.6; // px } altoLibro = altoSangrado * 0.95; anchoLibro = anchoSangrado * 0.28; @@ -676,7 +676,7 @@ class previewFormas { let styleCotas = { size: 12, family: 'Public Sans' }; let sangradoTexto = "Sangrado 20 mm"; let sangradoValor = parseFloat(20); // mm - if (this.ancho >= 210 || this.alto >= 297) { + if (this.ancho >= 210 || this.alto >= 267) { sangradoValor = parseFloat(10); // mm sangradoTexto = "Sangrado 10 mm"; } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index c9fffc26..b541b546 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -530,6 +530,11 @@ class Comparador { this.papelGuardas.setOption(datos.json_data.guardas.papel_id, datos.json_data.guardas.papel_nombre); this.gramajeGuardas.setOption(datos.json_data.guardas.gramaje, datos.json_data.guardas.gramaje); } + if (datos.json_data.faja) { + this.faja.val(1).trigger('change'); + this.papelFaja.setOption(datos.json_data.faja.papel_id, datos.json_data.faja.papel_nombre); + this.gramajeFaja.setOption(datos.json_data.faja.gramaje, datos.json_data.faja.gramaje); + } if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) { this.lomoRedondo.val(datos.lomoRedondo ? 1 : 0).trigger('change'); @@ -1504,6 +1509,7 @@ class Comparador { let datosComp = {}; datosComp.sobrecubierta = this.getDataForComp('faja'); + datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash; @@ -1862,6 +1868,21 @@ class Comparador { } + if (parseInt($('#compFaja').val()) == 1) { + let faja_obj = {}; + try { + faja_obj = { + "faja": { + 'papel_id': $('#compPapelFaja').select2('data')[0].id, + 'gramaje': $('#compGramajeFaja').select2('data')[0].text.trim(), + }, + } + } + catch (e) { + } + $.extend(data, faja_obj); + } + const data_str = JSON.stringify(data) $('#comparador_json_data').val(data_str) } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 09fb7842..48c754b2 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -1484,9 +1484,11 @@ class LineasPresupuesto { uso = 'cubierta'; break; case 'lp_sobrecubierta': - case 'lp_faja': uso = 'sobrecubierta'; break; + case 'lp_faja': + uso = 'faja'; + break; case 'lp_guardas': uso = 'guardas'; break; diff --git a/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_faja.png b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_faja.png new file mode 100644 index 00000000..bd2572ca Binary files /dev/null and b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_faja.png differ