mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando
This commit is contained in:
@ -18,8 +18,11 @@ class TipoPapelGenericoModel extends \App\Models\BaseModel
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\TipoPapelGenerico";
|
||||
|
||||
public function getTiposPapel($data)
|
||||
public function getTiposPapelCliente($data)
|
||||
{
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
@ -39,11 +42,11 @@ class TipoPapelGenericoModel extends \App\Models\BaseModel
|
||||
->where("t3.use_in_client", 1)
|
||||
->where("t4.active", 1)
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.min <= ", $data['tirada'] ?? 0)
|
||||
->where("t5.max >= ", $data['tirada'] ?? 0)
|
||||
->where("t5.min <= ", $data->tirada ?? 0)
|
||||
->where("t5.max >= ", $data->tirada ?? 0)
|
||||
->where("t5.tipo", "impresion")
|
||||
->where("t6.is_deleted", 0)
|
||||
->where("t6.tipo", $data['tipo'] ?? null)
|
||||
->where("t6.tipo", $data->tipo ?? null)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||
@ -57,18 +60,54 @@ class TipoPapelGenericoModel extends \App\Models\BaseModel
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t5.ancho_impresion >", $data['ancho'] ?? 0)
|
||||
->where("t5.alto_impresion >", $data['alto'] ?? 0)
|
||||
->where("t5.ancho_impresion >", $data->ancho ?? 0)
|
||||
->where("t5.alto_impresion >", $data->alto ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data['alto'] ?? 0)
|
||||
->where("t5.alto_impresion >", $data['ancho'] ?? 0)
|
||||
->where("t5.ancho_impresion >", $data->alto ?? 0)
|
||||
->where("t5.alto_impresion >", $data->ancho ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data['alto'] ?? 0)
|
||||
->where("t5.ancho_impresion >", $data->alto ?? 0)
|
||||
->where("t5.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t3.cubierta", 1);
|
||||
$builder->where("t6.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t3.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t3.sobrecubierta", 1);
|
||||
$builder->where("t6.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t3.guardas", 1);
|
||||
$builder->where("t6.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t3.interior", 1);
|
||||
$builder->where("t6.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t3.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t3.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false) {
|
||||
$builder->where("t3.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$return_data = $builder->orderBy("t1.clave", "asc")->get()->getResultObject();
|
||||
//$query = $this->db->getLastQuery();
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user