mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'mod/papeles_imp_maquinas' into 'main'
rehecho papeles impresion. Lista de tarifas a 50 elementos por defecto See merge request jjimenez/safekat!43
This commit is contained in:
@ -252,6 +252,19 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getIdMaquinasForPapelImpresion($papel_impresion_id, $rotativa, $ancho, $alto){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"'".$papel_impresion_id."'". " as papel_impresion_id, t1.id AS maquina_id, '0' as active"
|
||||
);
|
||||
$builder->where("t1.is_rotativa", $rotativa);
|
||||
$builder->where("t1.ancho >", $ancho);
|
||||
$builder->where("t1.alto >", $alto);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
|
||||
@ -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){
|
||||
|
||||
@ -59,6 +59,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
|
||||
@ -15,8 +15,8 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
const SORTABLE = [
|
||||
0 => "t1.nombre",
|
||||
1 => "t2.nombre",
|
||||
2 => "t1.bn",
|
||||
3 => "t1.gramaje",
|
||||
2 => "t1.gramaje",
|
||||
3 => "t1.bn",
|
||||
4 => "t1.color",
|
||||
5 => "t1.cubierta",
|
||||
6 => "t1.sobrecubierta",
|
||||
|
||||
@ -121,6 +121,14 @@ class PapelImpresionTipologiaModel extends \App\Models\GoBaseModel
|
||||
|
||||
}
|
||||
|
||||
public function removeForPapelImpresion($papel_impresion_id){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->where('papel_impresion_id', $papel_impresion_id)
|
||||
->delete();
|
||||
|
||||
}
|
||||
|
||||
public function getResource($id)
|
||||
{
|
||||
$builder = $this->db
|
||||
@ -131,4 +139,23 @@ class PapelImpresionTipologiaModel extends \App\Models\GoBaseModel
|
||||
return $builder;
|
||||
|
||||
}
|
||||
|
||||
public function checkTipo($data, $id){
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table)
|
||||
->select("id")
|
||||
->where("papel_impresion_id", $data["papel_impresion_id"])
|
||||
->where("tipo", $data["tipo"]);
|
||||
|
||||
|
||||
if ($builder->countAllResults() > 0){
|
||||
if($builder->get()->getResultObject()[0]->id!=$id){
|
||||
return lang('ImpresionTipologias.validation.error_tipo_duplicado');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user