mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
modificando presupuestos. falta preguntar si añadir solapas (cubierta) y solapas (sobrecubierta)
This commit is contained in:
@ -333,7 +333,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
'ferro' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro')->value,
|
||||
'prototipo' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_prototipo')->value,
|
||||
'plegado_guardas' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_guardas')->value,
|
||||
'solapas_grandes' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas')->value,
|
||||
'solapas_grandes_cubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_cubierta')->value,
|
||||
'solapas_grandes_sobrecubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_sobrecubierta')->value,
|
||||
'solapas_grandes_faja' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_faja')->value,
|
||||
];
|
||||
|
||||
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
||||
|
||||
@ -758,7 +758,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$anchoTotal += $interior[1]['mano'];
|
||||
} else {
|
||||
if (count($interior) > 0)
|
||||
$anchoTotal += $interior['mano'];
|
||||
$anchoTotal += $interior[0]['mano'];
|
||||
}
|
||||
|
||||
|
||||
@ -1300,20 +1300,52 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
foreach ($resultado_presupuesto['values']['serviciosDefecto']['manipulado'] as $servicio) {
|
||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||
}
|
||||
$servicio_ferro = (object) [
|
||||
'nombre' => 'ferro',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro')->value
|
||||
];
|
||||
$servicio_prototipo = (object) [
|
||||
'nombre' => 'prototipo',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_prototipo')->value
|
||||
];
|
||||
$servicio_retractilado = (object) [
|
||||
'nombre' => 'retractilado',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_retractilado')->value
|
||||
];
|
||||
$servicio_retractilado5 = (object) [
|
||||
'nombre' => 'retractilado5',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_retractilado5')->value
|
||||
];
|
||||
$servicio_plegado_guardas = (object) [
|
||||
'nombre' => 'plegado_guardas',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_guardas')->value
|
||||
];
|
||||
$servicio_solapas_grandes_cubierta = (object) [
|
||||
'nombre' => 'solapas_grandes_cubierta',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_cubierta')->value
|
||||
];
|
||||
$servicio_solapas_grandes_sobrecubierta = (object) [
|
||||
'nombre' => 'solapas_grandes_sobrecubierta',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_sobrecubierta')->value
|
||||
];
|
||||
$servicio_solapas_grandes_faja = (object) [
|
||||
'nombre' => 'solapas_grandes_faja',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_faja')->value
|
||||
];
|
||||
|
||||
foreach ($resultado_presupuesto['values']['servicios_automaticos'] as $servicio) {
|
||||
if ($servicio->tarifa_id == 3 || $servicio->tarifa_id == 5 || $servicio->tarifa_id == 16) {
|
||||
if ($servicio->tarifa_id == $servicio_retractilado->id || $servicio->tarifa_id == $servicio_retractilado5->id) {
|
||||
// Servicios acabado
|
||||
$this->guardarServicio($id, $servicio, 'acabado');
|
||||
} else if ($servicio->tarifa_id == 24) {
|
||||
// Servicios preimpresion
|
||||
$this->guardarServicio($id, $servicio, 'preimpresion');
|
||||
} else if ($servicio->tarifa_id == 9) {
|
||||
} else if ($servicio->tarifa_id == $servicio_ferro->id || $servicio->tarifa_id == $servicio_prototipo->id) {
|
||||
// Servicios extra
|
||||
$this->guardarServicio($id, $servicio, 'extra');
|
||||
} else if ($servicio->tarifa_id == 62) {
|
||||
} else if ($servicio->tarifa_id == $servicio_plegado_guardas->id) {
|
||||
// Servicios manipulado
|
||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||
} else if ($servicio->tarifa_id == 73) {
|
||||
} else if ($servicio->tarifa_id == $servicio_solapas_grandes_cubierta->id ||
|
||||
$servicio->tarifa_id == $servicio_solapas_grandes_sobrecubierta->id ||
|
||||
$servicio->tarifa_id == $servicio_solapas_grandes_faja->id) {
|
||||
// Servicios manipulado
|
||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||
}
|
||||
@ -2284,12 +2316,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
// Servicios
|
||||
|
||||
|
||||
|
||||
$serviciosAutomaticos = [];
|
||||
$servicios = [];
|
||||
|
||||
|
||||
$servicio_ferro = (object) [
|
||||
'nombre' => 'ferro',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro')->value
|
||||
@ -2310,9 +2339,17 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
'nombre' => 'plegado_guardas',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_guardas')->value
|
||||
];
|
||||
$servicio_solapas_grandes = (object) [
|
||||
'nombre' => 'solapas_grandes',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas')->value
|
||||
$servicio_solapas_grandes_cubierta = (object) [
|
||||
'nombre' => 'solapas_grandes_cubierta',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_cubierta')->value
|
||||
];
|
||||
$servicio_solapas_grandes_sobrecubierta = (object) [
|
||||
'nombre' => 'solapas_grandes_sobrecubierta',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_sobrecubierta')->value
|
||||
];
|
||||
$servicio_solapas_grandes_faja = (object) [
|
||||
'nombre' => 'solapas_grandes_faja',
|
||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_faja')->value
|
||||
];
|
||||
|
||||
// se comprueba si $datos guardas es un array
|
||||
@ -2374,7 +2411,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$resultado = PresupuestoCLienteService::getServiciosExtra([
|
||||
'tarifa_id' => intval($servicio->id),
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
|
||||
if ($resultado[0]->precio <= 0) {
|
||||
|
||||
$errorModel = new ErrorPresupuesto();
|
||||
@ -2392,6 +2429,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->precio);
|
||||
if ($extra_info) {
|
||||
@ -2402,18 +2440,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
// Plegado de solapas grandes
|
||||
if (
|
||||
(intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630) ||
|
||||
(is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630))
|
||||
) {
|
||||
|
||||
// Servicios acabado
|
||||
if (intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630)
|
||||
{
|
||||
// Servicios manipulado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => intval($servicio_solapas_grandes->id),
|
||||
'tarifa_id' => intval($servicio_solapas_grandes_cubierta->id),
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
|
||||
if ($resultado[0]->total <= 0) {
|
||||
|
||||
@ -2421,7 +2455,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$errorModel->insertError(
|
||||
$datos_entrada['id'],
|
||||
auth()->user()->id,
|
||||
'No se puede obtener servicio de manupulado con id ' . ((string) $servicio),
|
||||
'No se puede obtener servicio de manupulado con ' . ((string) $servicio->nombre),
|
||||
$input_data
|
||||
);
|
||||
$return_data = [
|
||||
@ -2430,6 +2464,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
]),
|
||||
];
|
||||
return $return_data;
|
||||
} else {
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
}
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
@ -2437,8 +2473,44 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$totalServicios += floatval($resultado[0]->total);
|
||||
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630)){
|
||||
|
||||
// Servicios manipulado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => intval($servicio_solapas_grandes_sobrecubierta->id),
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
|
||||
if ($resultado[0]->total <= 0) {
|
||||
|
||||
$errorModel = new ErrorPresupuesto();
|
||||
$errorModel->insertError(
|
||||
$datos_entrada['id'],
|
||||
auth()->user()->id,
|
||||
'No se puede obtener servicio de manupulado ' . ((string) $servicio->nombre),
|
||||
$input_data
|
||||
);
|
||||
$return_data = [
|
||||
'errors' => (object) ([
|
||||
'status' => 1
|
||||
]),
|
||||
];
|
||||
return $return_data;
|
||||
} else {
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
}
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
if ($extra_info) {
|
||||
$totalServicios += floatval($resultado[0]->total);
|
||||
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
// TO-DO Faja
|
||||
|
||||
array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios) / $tirada[$t], 4));
|
||||
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2));
|
||||
|
||||
Reference in New Issue
Block a user