linea de presupuesto bn funcionando a falta de borrar

This commit is contained in:
Jaime Jiménez Ortega
2023-11-06 09:11:05 +01:00
parent 876d763abd
commit 71706158ca
8 changed files with 425 additions and 437 deletions

View File

@ -135,7 +135,10 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
public function getGramajeComparador(string $papel_generico_nombre="", $uso="")
{
$tipo=$uso; // color y colorhq valen para los dos
if($uso == 'cubierta' || $uso == 'sobrecubierta')
$tipo = 'color';
else
$tipo=$uso; // color y colorhq valen para los dos
if($uso == 'bn')
$tipo="negro";
if($uso == 'bnhq')
@ -168,10 +171,58 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t2.sobrecubierta", 1);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
$id = 1;
foreach ($values as $value){
$value->id = $id;
$id++;
}
$values_array = array_map( function( $value ) {
return $value->text;
}, $values );
$unique_values = array_unique($values_array);
return array_values(array_intersect_key($values, $unique_values));
}
//tipo: negro, negrohq, color, colorhq
//uso: interior, rotativa, cubierta, sobrecubierta
public function getGramajeLineasPresupuesto($papel_generico_id=0, $tipo="", $uso="")
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t2.gramaje AS text"
)
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
->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.tipo", $tipo)
->where("t1.id", $papel_generico_id);
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t2.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t2.color", 1);
if ($uso == 'cubierta')
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t2.sobrecubierta", 1);
if($uso=='rotativa')
$builder->where("t2.rotativa", 1);
else
$builder->where("t2.rotativa", 0);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
$id = 1;
foreach ($values as $value){