mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
finalizado el controlador máquinas
This commit is contained in:
@ -55,12 +55,9 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t3.is_deleted", 0);
|
||||
$builder->where("t4.is_deleted", 0);
|
||||
$builder->where("t3.isActivo", 1);
|
||||
|
||||
|
||||
$builder->where("t3.rotativa", $isRotativa);
|
||||
|
||||
|
||||
|
||||
$isFirst = true;
|
||||
$where_str = "(";
|
||||
//Si hay tarifas...
|
||||
@ -92,7 +89,7 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t3.bn", 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
@ -110,7 +107,6 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
"t1.*"
|
||||
);
|
||||
|
||||
|
||||
$builder->join("lg_papel_impresion t2", "t1.papel_impresion_id = t2.id", "left");
|
||||
|
||||
$builder->where("t1.maquina_id", $maquina_id);
|
||||
@ -118,11 +114,9 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t2.isActivo", 1);
|
||||
$builder->where("t2.rotativa", $isRotativa);
|
||||
$builder->where("t1.active", 1);
|
||||
|
||||
|
||||
|
||||
$isFirst = true;
|
||||
$where_str = "";
|
||||
$where_str = "(";
|
||||
//Si hay tarifas...
|
||||
if (!empty($tarifas)){
|
||||
foreach ($tarifas as $tarifa){
|
||||
@ -142,18 +136,37 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
$where_str .= "`t2`.`color`=1 ";
|
||||
}
|
||||
}
|
||||
$where_str .= ")";
|
||||
$builder->where($where_str);
|
||||
}
|
||||
// si no hay tarifas no hay que devolver nada
|
||||
else{
|
||||
// Se pone una condicion que no se puede dar
|
||||
$builder->where("t3.bn", 2);
|
||||
$builder->where("t2.bn", 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
// Funcion para consultar los papeles activos con un gramaje
|
||||
// determinado seleccionados para una máquina
|
||||
public function getPapelActivo($maquina_id=-1, $gramaje=-1){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.*"
|
||||
);
|
||||
$builder->join("lg_papel_impresion t2", "t1.papel_impresion_id = t2.id", "left");
|
||||
|
||||
$builder->where('t1.active', 1);
|
||||
$builder->where('t1.maquina_id', $maquina_id);
|
||||
$builder->where('t2.gramaje', $gramaje);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
|
||||
// Funcion que borra todos los registros de una máquina determinada
|
||||
public function deleteRows($maquina_id = -1){
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
@ -161,12 +174,15 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
->delete();
|
||||
}
|
||||
|
||||
|
||||
// Funcion que inserta valores en la tabla
|
||||
public function insertRows($values = []){
|
||||
if (!empty($values)){
|
||||
$this->db->table($this->table)->insertBatch($values);
|
||||
}
|
||||
}
|
||||
|
||||
// Funcion que actualiza valores en la tabla
|
||||
public function updateRows($values = []){
|
||||
if (!empty($values)){
|
||||
foreach($values as $value){
|
||||
|
||||
@ -13,15 +13,12 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.maquina_id",
|
||||
3 => "t1.tipo",
|
||||
4 => "t1.precio",
|
||||
5 => "t1.uso",
|
||||
6 => "t2.nombre",
|
||||
1 => "t1.tipo",
|
||||
2 => "t1.uso",
|
||||
3 => "t1.precio",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["maquina_id", "tipo", "precio", "uso"];
|
||||
protected $allowedFields = ["maquina_id", "tipo", "precio", "uso", "user_created_id", "user_updated_id", "is_deleted", "deleted_at", "created_at", "updated_at"];
|
||||
protected $returnType = "App\Entities\Configuracion\MaquinasTarifasImpresionEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
@ -95,7 +92,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso, t2.nombre AS maquina"
|
||||
"t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso"
|
||||
);
|
||||
|
||||
//JJO
|
||||
@ -112,13 +109,11 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.precio", $search)
|
||||
->orLike("t1.uso", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.maquina_id", $search)
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.precio", $search)
|
||||
->orLike("t1.uso", $search)
|
||||
->orLike("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,12 +231,12 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
public function getIdPapelesActivos($tarifas = [])
|
||||
public function getIdPapelesImpresion($maquina_id = -1, $tarifas = [])
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id"
|
||||
"'".$maquina_id."'". " as maquina_id, t1.id AS papel_impresion_id, '0' as active"
|
||||
);
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
Reference in New Issue
Block a user