trabajando en guardar LP

This commit is contained in:
Jaime Jiménez
2024-01-05 18:56:52 +01:00
parent 42d66ac614
commit 052a8a79e8
5 changed files with 741 additions and 693 deletions

View File

@ -93,7 +93,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
}
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null, $rotativa = null)
public function getPapelForComparador($tipo, $is_cubierta = false, $is_sobrecubierta = false, $rotativa = false)
{
/*
1.-> Tipo impresion
@ -105,6 +105,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
->table($this->table . " t1")
->select(
"t1.id as id, t1.nombre AS nombre"
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
)
->distinct('t1.id')
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
@ -114,36 +115,48 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0)
->where("t2.isActivo", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $tipo);
if(!is_null($is_cubierta)){
if($is_cubierta==true){
if($is_cubierta==true){
$builder->where("t2.cubierta", 1);
}
$builder->where("t5.uso", 'cubierta');
}
else{
$builder->where("t2.cubierta", 0);
$builder->where("t5.uso", 'interior');
}
if(!is_null($is_sobrecubierta)){
if($is_sobrecubierta==true){
if($is_sobrecubierta==true){
$builder->where("t2.sobrecubierta", 1);
}
$builder->where("t5.uso", 'sobrecubierta');
}
else{
$builder->where("t2.sobrecubierta", 0);
}
if(!is_null($rotativa)){
if($rotativa==true){
if($is_cubierta==false && $is_sobrecubierta==false){
$builder->where("t5.uso", 'interior');
}
if($rotativa==true){
$builder->where("t2.rotativa", 1);
}
}
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
//var_dump($this->db->getLastQuery());
return $data;
}
public function getGramajeComparador(string $papel_generico_nombre="", $uso="")
{
if($uso == 'cubierta' || $uso == 'sobrecubierta')
$tipo = 'color';
$tipo = 'colorhq';
else
$tipo=$uso; // color y colorhq valen para los dos
if($uso == 'bn')