mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
configurado todo a la espera del preview
This commit is contained in:
@ -694,19 +694,6 @@ class PresupuestoService extends BaseService
|
||||
|
||||
$altoForCalculo = $alto;
|
||||
|
||||
/*
|
||||
//Log ancho y alto de impresion y libro
|
||||
$info = [
|
||||
'ancho' => $anchoForCalculo,
|
||||
'alto' => $altoForCalculo,
|
||||
'maquina_ancho' => $maquina->ancho_impresion,
|
||||
'maquina_alto' => $maquina->alto_impresion,
|
||||
];
|
||||
|
||||
if ($uso == 'cubierta')
|
||||
log_message('error', 'ancho:{ancho} --- alto:{alto} --- ancho_m:{maquina_ancho} --- alto_m:{maquina_alto} ---', $info);
|
||||
*/
|
||||
|
||||
if ($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||
if (
|
||||
!is_null($maquina->forzar_num_formas_horizontales_cubierta) &&
|
||||
@ -733,8 +720,6 @@ class PresupuestoService extends BaseService
|
||||
$h2_temp = floor(floatval($maquina->ancho_impresion) / $altoForCalculo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// horizontales
|
||||
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h1_temp);
|
||||
// Si son mas de 2 formas
|
||||
@ -748,20 +733,6 @@ class PresupuestoService extends BaseService
|
||||
$v1 = floor($maquina->alto_impresion / $altoForCalculo);
|
||||
$formas_h = $h1 * $v1; //p1
|
||||
|
||||
/*
|
||||
//Log ancho y alto de impresion y libro
|
||||
$info = [
|
||||
'h1' => $h1,
|
||||
'v1' => $v1,
|
||||
'num_formas' => $formas_h,
|
||||
'h1_temp' => $h1_temp,
|
||||
|
||||
];
|
||||
|
||||
if($uso == 'cubierta' )
|
||||
log_message('error', 'h1:{h1} --- v1:{v1} --- num_formas:{num_formas} --- h1_temp:{h1_temp}', $info);
|
||||
*/
|
||||
|
||||
// verticales
|
||||
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h2_temp);
|
||||
if (count($calles) > 0)
|
||||
@ -867,7 +838,7 @@ class PresupuestoService extends BaseService
|
||||
* Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo.
|
||||
* El $uso tiene que ser "cubierta" o "sobrecubierta"
|
||||
*/
|
||||
public static function getAnchoTotalExteriores($uso = "cubierta", $tipo_impresion_id = 1, $datosPedido = null)
|
||||
public static function getAnchoTotalExteriores($uso = "cubierta", $tipo_impresion_id = 1, $datosPedido = null, $maquina_id = -1)
|
||||
{
|
||||
$ancho_total = 0;
|
||||
|
||||
@ -896,7 +867,35 @@ class PresupuestoService extends BaseService
|
||||
// Se añaden 5mm de sangre por cada lado + 2 * 7mm de vuelo portada y contraportada -> total 52
|
||||
else
|
||||
$ancho_total += (2 * 7 + 2 * self::SANGRE_FORMAS) + 7;
|
||||
} else {
|
||||
}
|
||||
// Wire-o y espiral (tapa blanda y tapa dura)
|
||||
else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 6 ||
|
||||
$tipo_impresion_id == 7 || $tipo_impresion_id == 8) {
|
||||
// En este caso, la cubierta se imprime como dos formas separadas, pero hay que dejar un
|
||||
// espacio entre ellas para poder cortarlas
|
||||
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina_id, 2);
|
||||
$ancho_total = floatval($datosPedido->ancho) * 2;
|
||||
|
||||
if (count($calles) > 0)
|
||||
$ancho_total += $calles[0]->internas;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Sangre externa (dependiendo si es tapa dura o blanda)
|
||||
// Tapa dura
|
||||
if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) {
|
||||
$ancho_total += (2 * self::SANGRE_FORMAS_CUBIERTA);
|
||||
}
|
||||
// Tapa blanda
|
||||
else {
|
||||
$ancho_total += (2 * self::SANGRE_FORMAS);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// En cualquier otro caso se le suma 5mm de sangre por cada lado
|
||||
$ancho_total += (2 * self::SANGRE_FORMAS);
|
||||
}
|
||||
@ -1284,10 +1283,17 @@ class PresupuestoService extends BaseService
|
||||
$opciones_papel = PresupuestoService::get_opciones_papel($data['uso'], true);
|
||||
$data['opciones_papel'] = $opciones_papel;
|
||||
|
||||
$data['datosPedido']->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($data['uso'], $tipo_impresion_id, $data['datosPedido']);
|
||||
$data['datosPedido']->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($data['uso'], $tipo_impresion_id, $data['datosPedido'], $maquina->maquina_id);
|
||||
$data['datosPedido']->altoExteriores = PresupuestoService::getAltoTotalExteriores($data['uso'], $tipo_impresion_id, $data['datosPedido']);
|
||||
|
||||
$output_data = PresupuestoService::getLineaPresupuestoPlana($data);
|
||||
|
||||
if ($tipo_impresion_id == 5 || $tipo_impresion_id == 6 ||
|
||||
$tipo_impresion_id == 7 || $tipo_impresion_id == 8) {
|
||||
|
||||
$output_data['fields']['num_formas']['num_formas_horizontales'] *= 2;
|
||||
$output_data['fields']['num_formas']['value'] *= 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $output_data;
|
||||
@ -1687,12 +1693,6 @@ class PresupuestoService extends BaseService
|
||||
|
||||
$tipo = $isColor ? ($isHq ? 'colorhq' : 'color') : ($isHq ? 'negrohq' : 'negro');
|
||||
|
||||
if ($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||
|
||||
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso, $tipo_impresion_id, $datosPedido);
|
||||
$datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso, $tipo_impresion_id, $datosPedido);
|
||||
}
|
||||
|
||||
$opciones_papel = PresupuestoService::get_opciones_papel($uso, $isColor);
|
||||
|
||||
// Se obtienen los papeles disponibles
|
||||
@ -1719,6 +1719,11 @@ 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') {
|
||||
|
||||
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso, $tipo_impresion_id, $datosPedido, $maquina->maquina_id);
|
||||
$datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso, $tipo_impresion_id, $datosPedido);
|
||||
}
|
||||
|
||||
$data['uso'] = $uso;
|
||||
$data['tipo'] = $tipo;
|
||||
@ -1735,6 +1740,15 @@ class PresupuestoService extends BaseService
|
||||
|
||||
$linea = PresupuestoService::getLineaPresupuestoPlana($data);
|
||||
|
||||
if ($tipo_impresion_id == 5 || $tipo_impresion_id == 6 ||
|
||||
$tipo_impresion_id == 7 || $tipo_impresion_id == 8) {
|
||||
|
||||
if ($uso == 'cubierta'){
|
||||
$linea['fields']['num_formas']['num_formas_horizontales'] *= 2;
|
||||
$linea['fields']['num_formas']['value'] *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($linea))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user