mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
rehecho papeles impresion. Lista de tarifas a 50 elementos por defecto
This commit is contained in:
@ -26,6 +26,12 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
8 => "t3.rotativa",
|
||||
];
|
||||
|
||||
const SORTABLE_2 = [
|
||||
0 => "t1.active",
|
||||
1 => "t2.nombre",
|
||||
|
||||
];
|
||||
|
||||
protected $allowedFields = ["maquina_id", "papel_impresion_id", "active"];
|
||||
protected $returnType = "App\Entities\Configuracion\MaquinasPapelesImpresionEntity";
|
||||
|
||||
@ -99,6 +105,42 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get resource data for Papeles impresion.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource_maquinas(string $search = "", $papel_id = -1, $isRotativa = -1, $ancho =-1, $alto = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.maquina_id AS maquina_id, t1.papel_impresion_id AS papel_impresion_id, t1.active AS active, t2.nombre AS maquina,
|
||||
t2.ancho AS ancho, t2.alto AS alto, t2.ancho_impresion AS anchoimpresion, t2.alto_impresion AS altoimpresion"
|
||||
)
|
||||
->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left")
|
||||
->join("lg_papel_impresion t3", "t1.papel_impresion_id = t3.id", "left");
|
||||
|
||||
$builder->where("t1.papel_impresion_id", $papel_id);
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
$builder->where("t2.is_rotativa", $isRotativa);
|
||||
$builder->where("t2.ancho >", $ancho);
|
||||
$builder->where("t2.alto >", $alto);
|
||||
$builder->where("t3.is_deleted", 0);
|
||||
$builder->where("t3.isActivo", 1);
|
||||
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
public function getInitData($isRotativa = 0, $tarifas = [], $maquina_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
@ -148,6 +190,38 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
return $builder;
|
||||
}
|
||||
|
||||
|
||||
// Funcion para obtener todas las máquinas seleccionadas para un papel
|
||||
public function getInitSelectedMachines($papel_impresion_id= -1, $isRotativa, $ancho, $alto)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.*"
|
||||
);
|
||||
|
||||
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
|
||||
|
||||
$builder->where("t1.papel_impresion_id", $papel_impresion_id);
|
||||
$builder->where("t1.active", 1);
|
||||
|
||||
// Se aplican las condiciones que tienen que cumplir
|
||||
$builder->where("t2.is_rotativa", $isRotativa);
|
||||
$builder->where("t2.ancho >", $ancho);
|
||||
$builder->where("t2.alto >", $alto);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
// Borrar todas las filas para un papel impresion determinado
|
||||
public function deleteForPapelImpresion($papel_impresion_id= -1){
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where("papel_impresion_id", $papel_impresion_id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
|
||||
// Funcion para consultar los papeles activos con un gramaje
|
||||
// determinado seleccionados para una máquina
|
||||
public function getPapelActivo($maquina_id=-1, $gramaje=-1){
|
||||
|
||||
Reference in New Issue
Block a user