Merge branch 'dev/fixes' of https://git.imnavajas.es/jjimenez/safekat into dev/fixes

This commit is contained in:
imnavajas
2023-10-29 22:01:31 +01:00
17 changed files with 1787 additions and 551 deletions

View File

@ -53,8 +53,8 @@ class MaquinaModel extends \App\Models\GoBaseModel
"velocidad_corte",
"precio_hora_corte",
"metrosxminuto",
"forzar_num_formas_horizontales_portada",
"forzar_num_formas_verticales_portada",
"forzar_num_formas_horizontales_cubierta",
"forzar_num_formas_verticales_cubierta",
"observaciones",
"deleted_at",
"is_deleted",
@ -95,11 +95,11 @@ class MaquinaModel extends \App\Models\GoBaseModel
"label" => "Maquinas.duracionJornada",
"rules" => "required|integer",
],
"forzar_num_formas_horizontales_portada" => [
"forzar_num_formas_horizontales_cubierta" => [
"label" => "Maquinas.forzarNumFormasHorizontalesPortada",
"rules" => "integer|permit_empty",
],
"forzar_num_formas_verticales_portada" => [
"forzar_num_formas_verticales_cubierta" => [
"label" => "Maquinas.forzarNumFormasVerticalesPortada",
"rules" => "integer|permit_empty",
],
@ -176,11 +176,11 @@ class MaquinaModel extends \App\Models\GoBaseModel
"integer" => "Maquinas.validation.duracion_jornada.integer",
"required" => "Maquinas.validation.duracion_jornada.required",
],
"forzar_num_formas_horizontales_portada" => [
"integer" => "Maquinas.validation.forzar_num_formas_horizontales_portada.integer",
"forzar_num_formas_horizontales_cubierta" => [
"integer" => "Maquinas.validation.forzar_num_formas_horizontales_cubierta.integer",
],
"forzar_num_formas_verticales_portada" => [
"integer" => "Maquinas.validation.forzar_num_formas_verticales_portada.integer",
"forzar_num_formas_verticales_cubierta" => [
"integer" => "Maquinas.validation.forzar_num_formas_verticales_cubierta.integer",
],
"max" => [
"integer" => "Maquinas.validation.max.integer",
@ -277,7 +277,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_portada AS forzar_num_formas_horizontales_portada, t1.forzar_num_formas_verticales_portada AS forzar_num_formas_verticales_portada, t1.observaciones AS observaciones, t2.nombre AS padre"
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta, t1.forzar_num_formas_verticales_cubierta AS forzar_num_formas_verticales_cubierta, t1.observaciones AS observaciones, t2.nombre AS padre"
);
$builder->join("lg_maquinas t2", "t1.padre_id = t2.id", "left");
@ -306,8 +306,8 @@ class MaquinaModel extends \App\Models\GoBaseModel
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_portada", $search)
->orLike("t1.forzar_num_formas_verticales_portada", $search)
->orLike("t1.forzar_num_formas_horizontales_cubierta", $search)
->orLike("t1.forzar_num_formas_verticales_cubierta", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.id", $search)
->orLike("t1.id", $search)
@ -329,8 +329,8 @@ class MaquinaModel extends \App\Models\GoBaseModel
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_portada", $search)
->orLike("t1.forzar_num_formas_verticales_portada", $search)
->orLike("t1.forzar_num_formas_horizontales_cubierta", $search)
->orLike("t1.forzar_num_formas_verticales_cubierta", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.nombre", $search)
->groupEnd();
@ -350,7 +350,11 @@ class MaquinaModel extends \App\Models\GoBaseModel
->select(
"t1.id AS maquina_id, t1.nombre AS maquina, t1.ancho_impresion AS ancho_impresion,
t1.alto_impresion AS alto_impresion, t1.ancho AS ancho, t1.alto AS alto,
t1.is_rotativa AS is rotativa, t1.alto_click AS alto_click"
t1.is_rotativa AS is rotativa, t1.alto_click AS alto_click,
t1.precio_tinta_negro AS precio_tinta_negro, t1.precio_tinta_color AS precio_tinta_color,
t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte,
t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta,
t1.forzar_num_formas_verticales_cubierta AS forzar_num_formas_verticales_cubierta"
)
->join("lg_maquinas_tarifas_impresion t2", "t1.id = t2.maquina_id", "left")
->join("lg_maquina_papel_impresion t3", "t1.id = t3.maquina_id", "left")
@ -360,12 +364,20 @@ class MaquinaModel extends \App\Models\GoBaseModel
->where("t1.tipo", "impresion")
->where("t1.is_rotativa", $is_rotativa)
->where("t2.is_deleted", 0)
->where("t2.tipo", $tarifa_tipo)
->where("t3.papel_impresion_id", $papel_impresion_id)
->where("t3.active", 1)
->where("t1.min <=", $tirada)
->where("t1.max >=", $tirada);
if(is_array($tarifa_tipo)){
foreach($tarifa_tipo as $tarifa){
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.is_deleted=0)");
}
}
else{
$builder->where("t2.tipo", $tarifa_tipo);
}
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
}

View File

@ -29,6 +29,11 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
const SORTABLE_2 = [
0 => "t1.active",
1 => "t2.nombre",
2 => "t2.ancho",
3 => "t2.alto",
4 => "t2.ancho_impresion",
5 => "t2.alto_impresion",
];

View File

@ -130,7 +130,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
public function getGramajeComparador(string $papel_generico_nombre="")
public function getGramajeComparador(string $papel_generico_nombre="", $uso="")
{
$builder = $this->db
->table($this->table . " t1")
@ -141,8 +141,21 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0)
->where("t2.isActivo", 1)
->where("t1.nombre", $papel_generico_nombre);
if($uso == 'bn')
$builder->where("t2.bn", 1);
else if ($uso == 'color')
$builder->where("t2.color", 1);
else if ($uso == 'cubierta')
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t2.sobrecubierta", 1);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
$id = 1;
foreach ($values as $value){

View File

@ -109,18 +109,21 @@ class PapelImpresionTipologiaModel extends \App\Models\GoBaseModel
return $result;
}
public function findTipologiasForPapelImpresion(int $papelImpresionID){
public function findTipologiasForPapelImpresion(int $papelImpresionID, $tipo=null){
$builder = $this->db
->table($this->table )
->select("*")
->where("papel_impresion_id", $papelImpresionID);
if(!is_null($tipo)){
$builder->where("tipo", $tipo);
}
return $builder;
}
public function removeForPapelImpresion($papel_impresion_id){
$builder = $this->db
->table($this->table . " t1")