selectores de papel y gramaje. falta validacion

This commit is contained in:
2024-11-21 21:57:06 +01:00
parent 9a19c67cd9
commit 19bd409efa
7 changed files with 70 additions and 96 deletions

View File

@ -350,55 +350,5 @@ class PapelImpresionModel extends \App\Models\BaseModel
return "";
}
public function getGramajePresupuestoCliente($papel_generico_id = -1, $tipo = 'interior', $cubierta = 0, $papel_especial = 0)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.gramaje AS text"
)
->join("lg_papel_generico t2", "t2.id = t1.papel_generico_id", "inner")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
->where("t1.is_deleted", 0)
->where("t1.isActivo", 1)
->where("t1.use_in_client", 1)
->where("t2.id", $papel_generico_id)
->where("t2.show_in_client", 1)
->where("t2.is_deleted", 0)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $tipo)
->distinct("t1.gramaje");
if($papel_especial){
$builder->where('t2.show_in_client_special');
}
$uso_tarifa = 'interior';
if ($cubierta) {
$uso_tarifa = 'cubierta';
$builder->where("t1.cubierta", 1);
} else {
if ($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t1.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t1.color", 1);
}
$builder->where("t5.uso", $uso_tarifa);
$values = $builder->orderBy("t1.gramaje", "asc")->get()->getResultObject();
foreach ($values as $value) {
$value->id = $value->text;
}
//$query=$this->db->getLastQuery();
return $values;
}
}