mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta update servicios
This commit is contained in:
@ -84,9 +84,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$datos = [
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => $tiempo,
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
'proveedor' => $tarifa_proveedor->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa_proveedor->proveedor_id,
|
||||
@ -117,10 +119,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'nombre'=> $tarifa['tarifa_nombre'],
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
]);
|
||||
}
|
||||
@ -135,9 +139,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
array_push($result_array, (object)[
|
||||
'tarifa_id'=> $tarifa_proveedor->tarifa_enc_id,
|
||||
'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => null,
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen'=> $result_data[2],
|
||||
'proveedor' => $tarifa_proveedor->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa_proveedor->proveedor_id,
|
||||
@ -159,10 +165,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'nombre'=> $tarifa['tarifa_nombre'],
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
]);
|
||||
}
|
||||
@ -173,17 +181,17 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getProveedoresForSelector($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto){
|
||||
public function getProveedoresForSelector($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $paginasCuadernillo = 32){
|
||||
|
||||
$proveedores = [];
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
|
||||
if($modelTarifa->isTarifaPorHoras($tarifa_encuadernacion_id)){
|
||||
$tiempo = $this->calcularTiempoCosido(16, $paginas, $tirada, $paginasCuadernillo); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacionHoras($tarifa_encuadernacion_id, $tiempo, $tirada);
|
||||
}
|
||||
else{
|
||||
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto);
|
||||
}
|
||||
if (count($tarifa_value)>0) {
|
||||
@ -215,9 +223,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_enc_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => null,
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen'=> $result_data[2],
|
||||
'proveedor' => $tarifa->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa->proveedor_id,
|
||||
@ -237,10 +247,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_encuadernacion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen'=> 0,
|
||||
];
|
||||
return $ret_array;
|
||||
@ -286,9 +298,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa_proveedor->tarifa_enc_id,
|
||||
'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => $tiempo,
|
||||
'paginas_por_cuadernillo' => $paginas_cuadernillo,
|
||||
'precio_total'=> $result_data[1],
|
||||
'total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
'proveedor' => $tarifa_proveedor->proveedor_nombre,
|
||||
@ -310,11 +324,13 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_encuadernacion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'paginas_por_cuadernillo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
return $ret_array;
|
||||
|
||||
@ -50,28 +50,37 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaManipuladoModel');
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoManipulado($tarifa_manipulado_id, $tirada);
|
||||
if (count($tarifa_value)>0) {
|
||||
$ret_array = [];
|
||||
foreach($tarifa_value as $tarifa){
|
||||
$result_data = $this->calcularTarifa($tarifa, $tirada, $POD<$tirada?false:true);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_manipulado_nombre,
|
||||
'nombre'=> $tarifa->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
]);
|
||||
}
|
||||
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio_total <=> $b->precio_total;
|
||||
});
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0], $tirada, $POD<$tirada?false:true);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaManipulado($tarifa_manipulado_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaManipulado($tarifa_manipulado_id)[0]->nombre,
|
||||
'precio_unidad' => 0,
|
||||
'total'=> 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
private function calcularTarifa($tarifa, $tirada, $is_POD=false){
|
||||
@ -170,8 +179,10 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
array_push($tarifas, (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen'=> $result_data[2],
|
||||
]);
|
||||
}
|
||||
@ -180,8 +191,10 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'nombre'=> $tarifa['tarifa_nombre'],
|
||||
'precio_unidad' => 0,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -51,19 +51,30 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoPreimpresion($tarifa_preimpresion_id);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0]);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_preimpresion_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
];
|
||||
|
||||
$ret_array = [];
|
||||
foreach ($tarifa_value as $tarifa) {
|
||||
$result_data = $this->calcularTarifa($tarifa);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_preimpresion_nombre,
|
||||
'nombre'=> $tarifa->tarifa_preimpresion_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
]);
|
||||
}
|
||||
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio <=> $b->precio;
|
||||
});
|
||||
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_preimpresion_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_preimpresion_id)[0]->nombre,
|
||||
'precio' => 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
@ -146,7 +157,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.tarifa_preimpresion_id AS tarifa_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
|
||||
@ -50,19 +50,27 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoExtra($tarifa_extra_id);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0]);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_extra_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_extra_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
];
|
||||
$ret_array = [];
|
||||
foreach($tarifa_value as $tarifa){
|
||||
$result_data = $this->calcularTarifa($tarifa);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_extra_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_extra_nombre,
|
||||
'nombre'=> $tarifa->tarifa_extra_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
]);
|
||||
}
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio <=> $b->precio;
|
||||
});
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_extra_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
|
||||
'tarifa'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
|
||||
'precio' => 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user