diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php index e607eebb..9c38f178 100755 --- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php +++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php @@ -350,7 +350,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController 'ferro' => 24, 'prototipo' => 9, 'fajaColor' => 16, - ]; + ]; $this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO @@ -538,7 +538,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController if($type=='sobrecubierta') $datosPedido->lomo_cubierta = $reqData['lomo_cubierta']; - $datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($datosPedido); + $datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($tipo_impresion_id, $datosPedido); + $datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($tipo_impresion_id, $datosPedido); // Cubierta y sobrecubierta siempre color HQ $resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, 1, $cliente_id); diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index 47cac273..763b9360 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -45,7 +45,8 @@ class PresupuestoService extends BaseService if ($uso!='rotativa') { $ancho_calculo = ($uso=='cubierta' || $uso=='sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho; - $formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $datosPedido->alto, $datosPedido->isCosido, $forzar_a_favor_fibra); + $alto_calculo = ($uso=='cubierta' || $uso=='sobrecubierta') ? $datosPedido->altoExteriores : $datosPedido->ancho; + $formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $alto_calculo, $datosPedido->isCosido, $forzar_a_favor_fibra); $response['fields'] = $formas; } @@ -521,23 +522,51 @@ class PresupuestoService extends BaseService /** * Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo. */ - public static function getAnchoTotalExteriores($datosPedido=null) + public static function getAnchoTotalExteriores($tipo_impresion_id, $datosPedido=null) { $ancho_total = 0; if ($datosPedido) { - $ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo); - $ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0; + // Tapa blanda (cosido y fresado) + if($tipo_impresion_id == 2 || $tipo_impresion_id == 4){ + $ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo); + $ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0; - // añadimos ancho de las solapas - // si se añaden solapas hay que sumar 3mm de los dobleces - if ($datosPedido->solapas) { - $ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + 6; + // añadimos ancho de las solapas + // si se añaden solapas hay que sumar 3mm de los dobleces + if ($datosPedido->solapas) { + $ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + 6; + } + } + // Tapa dura cosido y fresado + else if($tipo_impresion_id == 1 || $tipo_impresion_id == 3){ + $ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo); + $ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0; + // Se añaden 20mm de sangre por cada lado + 2 * 0.6mm de portada y contraportada -> total 41.2 + $ancho_total += 41.2; } } return $ancho_total; } + /** + * Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo. + */ + public static function getAltoTotalExteriores($tipo_impresion_id, $datosPedido=null) + { + $alto_total = 0; + + if ($datosPedido) { + // Tapa blanda (cosido y fresado) + $alto_total = floatval($datosPedido->alto); + if($tipo_impresion_id == 1 || $tipo_impresion_id == 3){ + // Se añaden 20mm de sangre por cada lado + 0.7mm extra que sobresale -> total 40.7 + $alto_total += 40.7; + } + } + return $alto_total; + } + /** * Devuelve la dimensión del lomo interior. */ diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php index 0ac6cc15..00c3a6db 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php @@ -360,7 +360,7 @@ $('#papelFormatoPersonalizado').on("click",function(){ " x )*"; } else{ - document.getElementById("papelFormatoAncho").value= ""; + document.getElementById("papelFormatoAncho").value= ""; document.getElementById("papelFormatoAlto").value= ""; document.getElementById("papelFormatoAncho").style.display = "none"; document.getElementById("papelFormatoAlto").style.display = "none"; diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php index 3074eae3..56e028a8 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php @@ -650,7 +650,7 @@ } ); if(row_indexes.length > 0){ tableServiciosAcabado.row(row_indexes[0]).remove().draw() - check_serv_acabado_error() + check_serv_acabado_error() } } }