mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ya funcionando la consulta de papel_impresion/maquinas
This commit is contained in:
@ -209,4 +209,52 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $papel_generico_id
|
||||
* @param null $gramaje
|
||||
* @param mixed $options
|
||||
* array con las opciones para bn,color,cubierta,sobrecubierta,rotativa
|
||||
* @param mixed $is_activo=true
|
||||
*
|
||||
* @return [type]
|
||||
*/
|
||||
public function getIdPapelesImpresionForPresupuesto($papel_generico_id = null, $gramaje = null, $options=[]){
|
||||
$bn = array_key_exists('bn', $options) ? $options['bn'] : null;
|
||||
$color = array_key_exists('color', $options)? $options['color'] : null;
|
||||
$cubierta = array_key_exists('cubierta', $options)? $options['cubierta'] : null;
|
||||
$sobrecubierta = array_key_exists('sobrecubierta', $options)? $options['sobrecubierta'] : null;
|
||||
$rotativa = array_key_exists('rotativa', $options)? $options['rotativa'] : null;
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->distinct("t1.id")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.papel_generico_id AS papel_generico_id,
|
||||
t1.gramaje as gramaje, t1.espesor AS espesor, t1.precio_tonelada AS precio_tonelada, t1.rotativa AS rotativa");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
|
||||
$builder->where("t1.papel_generico_id", $papel_generico_id);
|
||||
$builder->where("t1.gramaje", $gramaje);
|
||||
|
||||
if(!is_null($bn)){
|
||||
$builder->where("t1.bn", $bn);
|
||||
}
|
||||
if(!is_null($color)){
|
||||
$builder->where("t1.color", $color);
|
||||
}
|
||||
if(!is_null($cubierta)){
|
||||
$builder->where("t1.cubierta", $cubierta);
|
||||
}
|
||||
if(!is_null($sobrecubierta)){
|
||||
$builder->where("t1.sobrecubierta", $sobrecubierta);
|
||||
}
|
||||
if(!is_null($rotativa)){
|
||||
$builder->where("t1.rotativa", $rotativa);
|
||||
}
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user