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,
|
'ferro' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro')->value,
|
||||||
'prototipo' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_prototipo')->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,
|
'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
|
$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'];
|
$anchoTotal += $interior[1]['mano'];
|
||||||
} else {
|
} else {
|
||||||
if (count($interior) > 0)
|
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) {
|
foreach ($resultado_presupuesto['values']['serviciosDefecto']['manipulado'] as $servicio) {
|
||||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
$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) {
|
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
|
// Servicios acabado
|
||||||
$this->guardarServicio($id, $servicio, 'acabado');
|
$this->guardarServicio($id, $servicio, 'acabado');
|
||||||
} else if ($servicio->tarifa_id == 24) {
|
} else if ($servicio->tarifa_id == $servicio_ferro->id || $servicio->tarifa_id == $servicio_prototipo->id) {
|
||||||
// Servicios preimpresion
|
|
||||||
$this->guardarServicio($id, $servicio, 'preimpresion');
|
|
||||||
} else if ($servicio->tarifa_id == 9) {
|
|
||||||
// Servicios extra
|
// Servicios extra
|
||||||
$this->guardarServicio($id, $servicio, 'extra');
|
$this->guardarServicio($id, $servicio, 'extra');
|
||||||
} else if ($servicio->tarifa_id == 62) {
|
} else if ($servicio->tarifa_id == $servicio_plegado_guardas->id) {
|
||||||
// Servicios manipulado
|
// Servicios manipulado
|
||||||
$this->guardarServicio($id, $servicio, '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
|
// Servicios manipulado
|
||||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||||
}
|
}
|
||||||
@ -2284,9 +2316,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Servicios
|
// Servicios
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$serviciosAutomaticos = [];
|
$serviciosAutomaticos = [];
|
||||||
$servicios = [];
|
$servicios = [];
|
||||||
|
|
||||||
@ -2310,9 +2339,17 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
'nombre' => 'plegado_guardas',
|
'nombre' => 'plegado_guardas',
|
||||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_guardas')->value
|
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_guardas')->value
|
||||||
];
|
];
|
||||||
$servicio_solapas_grandes = (object) [
|
$servicio_solapas_grandes_cubierta = (object) [
|
||||||
'nombre' => 'solapas_grandes',
|
'nombre' => 'solapas_grandes_cubierta',
|
||||||
'id' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas')->value
|
'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
|
// se comprueba si $datos guardas es un array
|
||||||
@ -2374,7 +2411,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$resultado = PresupuestoCLienteService::getServiciosExtra([
|
$resultado = PresupuestoCLienteService::getServiciosExtra([
|
||||||
'tarifa_id' => intval($servicio->id),
|
'tarifa_id' => intval($servicio->id),
|
||||||
]);
|
]);
|
||||||
array_push($serviciosAutomaticos, $resultado[0]);
|
|
||||||
if ($resultado[0]->precio <= 0) {
|
if ($resultado[0]->precio <= 0) {
|
||||||
|
|
||||||
$errorModel = new ErrorPresupuesto();
|
$errorModel = new ErrorPresupuesto();
|
||||||
@ -2392,6 +2429,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
return $return_data;
|
return $return_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
array_push($serviciosAutomaticos, $resultado[0]);
|
||||||
|
|
||||||
$coste_servicios += floatval($resultado[0]->precio);
|
$coste_servicios += floatval($resultado[0]->precio);
|
||||||
if ($extra_info) {
|
if ($extra_info) {
|
||||||
@ -2402,18 +2440,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Plegado de solapas grandes
|
// Plegado de solapas grandes
|
||||||
if (
|
if (intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630)
|
||||||
(intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630) ||
|
{
|
||||||
(is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630))
|
// Servicios manipulado
|
||||||
) {
|
|
||||||
|
|
||||||
// Servicios acabado
|
|
||||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||||
'tarifa_id' => intval($servicio_solapas_grandes->id),
|
'tarifa_id' => intval($servicio_solapas_grandes_cubierta->id),
|
||||||
'tirada' => $datosPedido->tirada,
|
'tirada' => $datosPedido->tirada,
|
||||||
'POD' => $POD,
|
'POD' => $POD,
|
||||||
]);
|
]);
|
||||||
array_push($serviciosAutomaticos, $resultado[0]);
|
|
||||||
|
|
||||||
if ($resultado[0]->total <= 0) {
|
if ($resultado[0]->total <= 0) {
|
||||||
|
|
||||||
@ -2421,7 +2455,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$errorModel->insertError(
|
$errorModel->insertError(
|
||||||
$datos_entrada['id'],
|
$datos_entrada['id'],
|
||||||
auth()->user()->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
|
$input_data
|
||||||
);
|
);
|
||||||
$return_data = [
|
$return_data = [
|
||||||
@ -2430,6 +2464,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
return $return_data;
|
return $return_data;
|
||||||
|
} else {
|
||||||
|
array_push($serviciosAutomaticos, $resultado[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$coste_servicios += floatval($resultado[0]->total);
|
$coste_servicios += floatval($resultado[0]->total);
|
||||||
@ -2437,9 +2473,45 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$totalServicios += floatval($resultado[0]->total);
|
$totalServicios += floatval($resultado[0]->total);
|
||||||
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
|
$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($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));
|
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2));
|
||||||
|
|
||||||
|
|||||||
@ -304,9 +304,15 @@
|
|||||||
<input type="checkbox" id="plegado_guardas" name="plegado_guardas" value="1"
|
<input type="checkbox" id="plegado_guardas" name="plegado_guardas" value="1"
|
||||||
class="form-check-input d-none" service="manipulado"
|
class="form-check-input d-none" service="manipulado"
|
||||||
service-id=<?= $serviciosAutomaticos['plegado_guardas'] ?>>
|
service-id=<?= $serviciosAutomaticos['plegado_guardas'] ?>>
|
||||||
<input type="checkbox" id="solapas_grandes" name="solapas_grandes" value="1"
|
<input type="checkbox" id="solapas_grandes_cubierta" name="solapas_grandes_cubierta" value="1"
|
||||||
class="form-check-input d-none" service="manipulado"
|
class="form-check-input d-none" service="manipulado"
|
||||||
service-id=<?= $serviciosAutomaticos['solapas_grandes'] ?>>
|
service-id=<?= $serviciosAutomaticos['solapas_grandes_cubierta'] ?>>
|
||||||
|
<input type="checkbox" id="solapas_grandes_sobrecubierta" name="solapas_grandes_sobrecubierta"
|
||||||
|
value="1" class="form-check-input d-none" service="manipulado"
|
||||||
|
service-id=<?= $serviciosAutomaticos['solapas_grandes_sobrecubierta'] ?>>
|
||||||
|
<input type="checkbox" id="solapas_grandes_faja" name="solapas_grandes_faja"
|
||||||
|
value="1" class="form-check-input d-none" service="manipulado"
|
||||||
|
service-id=<?= $serviciosAutomaticos['solapas_grandes_faja'] ?>>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -85,8 +85,8 @@ class PresupuestoAdminEdit {
|
|||||||
alto: () => this.getDimensionLibro().alto,
|
alto: () => this.getDimensionLibro().alto,
|
||||||
lomo: () => $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat($('#lomo_cubierta').val()),
|
lomo: () => $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat($('#lomo_cubierta').val()),
|
||||||
lomoSobrecubierta: () => $('#lomo_sobrecubierta').val() === '' ? parseFloat('0.0') : parseFloat($('#lomo_sobrecubierta').val()),
|
lomoSobrecubierta: () => $('#lomo_sobrecubierta').val() === '' ? parseFloat('0.0') : parseFloat($('#lomo_sobrecubierta').val()),
|
||||||
solapa: () => $('#solapas').prop('checked') ? parseFloat($('#solapas_ancho').val()) : 0,
|
solapas: () => $('#solapas').prop('checked') ? parseFloat($('#solapas_ancho').val()) : 0,
|
||||||
solapa_sobrecubierta: () => $('#solapas_sobrecubierta').prop('checked') ? parseFloat($('#solapas_ancho_sobrecubierta').val()) : 0,
|
solapas_sobrecubierta: () => $('#solapas_sobrecubierta').prop('checked') ? parseFloat($('#solapas_ancho_sobrecubierta').val()) : 0,
|
||||||
lomoRedondo: () => (this.tipo_impresion == 1 || this.tipo_impresion == 3) ? parseFloat($('#compLomoRedondo').val()) : 0,
|
lomoRedondo: () => (this.tipo_impresion == 1 || this.tipo_impresion == 3) ? parseFloat($('#compLomoRedondo').val()) : 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -219,6 +219,10 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'solapas');
|
$(document).trigger('remove-servicio-lineas', 'solapas');
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
// para que se actualice el comparador
|
||||||
|
$('paginas').trigger('change');
|
||||||
|
|
||||||
$(document).trigger('update-presupuesto', {
|
$(document).trigger('update-presupuesto', {
|
||||||
update_lineas : false,
|
update_lineas : false,
|
||||||
update_servicios : true,
|
update_servicios : true,
|
||||||
|
|||||||
Reference in New Issue
Block a user