modificados todos los buscadores de papeles y gramajes para ver el alto y el ancho (admin y cliente)

This commit is contained in:
2025-01-28 18:47:20 +01:00
parent 2df3f5914e
commit e87e278dd0
8 changed files with 249 additions and 25 deletions

View File

@ -314,8 +314,15 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false, $POD);
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true, $POD);
$ancho = floatval($this->request->getGet('ancho') ?? 0);
$alto = floatval($this->request->getGet('alto') ?? 0);
$solapas = floatval($this->request->getGet('solapas') ?? 0);
$lomo = floatval($this->request->getGet('lomo') ?? 0);
$anchoLibro = 2* $ancho + 2 * $solapas + $lomo;
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
@ -349,8 +356,17 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
}
$tipo = goSanitize($this->request->getGet('tipo'))[0];
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$ancho = floatval($this->request->getGet('ancho') ?? 0);
$alto = floatval($this->request->getGet('alto') ?? 0);
$solapas = floatval($this->request->getGet('solapas') ?? 0);
$lomo = floatval($this->request->getGet('lomo') ?? 0);
$items = $this->model->getPapelCliente($tipo, $cubierta, null, true, $POD);
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
$anchoLibro = 2* $ancho + 2 * $solapas + $lomo;
$items = $this->model->getPapelCliente($tipo, $cubierta, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
$items = array_map(function ($item) {
return [
'id' => $item->id,

View File

@ -1062,6 +1062,13 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
$ancho = $this->request->getGet('ancho') ?? 0;
$alto = $this->request->getGet('alto') ?? 0;
$solapas = $this->request->getGet('solapas') ?? 0;
$lomo = $this->request->getGet('lomo') ?? 0;
$anchoLibro = 2* $ancho + 2 * $solapas + $lomo;
$tipo = $this->request->getGet("tipo");
$uso = $this->request->getGet("uso") ?? 'interior';
@ -1083,7 +1090,17 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
}
$model = model('App\Models\Configuracion\PapelGenericoModel');
$query = $model->getPapelForComparador($tipo, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
$query = $model->getPapelForComparador(
$tipo,
$cubierta,
$sobrecubierta,
$rotativa,
$guardas,
$tapa_dura,
$isPOD,
$anchoLibro,
$alto,
$tirada);
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("lg_papel_generico.nombre", $this->request->getGet("q"))
@ -1106,6 +1123,13 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$tirada = $this->request->getGet("tirada");
$isPOD = intval($tirada) <= intval($POD_value);
$ancho = $this->request->getGet('ancho') ?? 0;
$alto = $this->request->getGet('alto') ?? 0;
$solapas = $this->request->getGet('solapas') ?? 0;
$lomo = $this->request->getGet('lomo') ?? 0;
$anchoLibro = 2* $ancho + 2 * $solapas + $lomo;
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
@ -1130,7 +1154,17 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
}
$model = model('App\Models\Configuracion\PapelGenericoModel');
$query = $model->getGramajeForComparador($tipo, $papel_generico_id, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
$query = $model->getGramajeForComparador($tipo,
$papel_generico_id,
$cubierta,
$sobrecubierta,
$rotativa,
$guardas,
$tapa_dura,
$isPOD,
$anchoLibro,
$alto,
$tirada);
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("lg_papel_impresion.gramaje", $this->request->getGet("q"))

View File

@ -129,16 +129,16 @@ class PapelGenericoModel extends \App\Models\BaseModel
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.code", $search)
->orLike("t1.code_ot", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.code", $search)
->orLike("t1.code_ot", $search)
->groupEnd();
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.code", $search)
->orLike("t1.code_ot", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.code", $search)
->orLike("t1.code_ot", $search)
->groupEnd();
}
@ -149,7 +149,10 @@ class PapelGenericoModel extends \App\Models\BaseModel
$rotativa = false,
$is_guardas = false,
$tapa_dura = false,
$POD = false
$POD = false,
$ancho = 0,
$alto = 0,
$tirada = 0
) {
/*
1.-> Tipo impresion
@ -183,6 +186,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.tipo", "impresion")
->where("t4.min <= ", $tirada)
->where("t4.max >= ", $tirada)
->where("t5.is_deleted", 0)
->where("t5.tipo", $tipo)
->distinct('t1.id');
@ -196,6 +201,17 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t3_inner.active", 1);
});
$builder->groupStart()
->groupStart()
->where("t4.ancho_impresion >", $ancho)
->where("t4.alto_impresion >", $alto)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $alto)
->where("t4.alto_impresion >", $ancho)
->groupEnd()
->groupEnd();
if ($is_cubierta == true) {
$builder->where("t2.cubierta", 1);
$builder->where("t5.uso", 'cubierta');
@ -236,7 +252,10 @@ class PapelGenericoModel extends \App\Models\BaseModel
$rotativa = false,
$is_guardas = false,
$tapa_dura = false,
$POD = false
$POD = false,
$ancho = 0,
$alto = 0,
$tirada = 0
) {
if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) {
if ($tipo == 'color')
@ -264,6 +283,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t2.isActivo", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.min <= ", $tirada)
->where("t4.max >= ", $tirada)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $tipo)
@ -278,6 +299,17 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t3_inner.active", 1);
});
$builder->groupStart()
->groupStart()
->where("t4.ancho_impresion >", $ancho)
->where("t4.alto_impresion >", $alto)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $alto)
->where("t4.alto_impresion >", $ancho)
->groupEnd()
->groupEnd();
if ($is_cubierta == true) {
$builder->where("t2.cubierta", 1);
$builder->where("t5.uso", 'cubierta');
@ -370,8 +402,17 @@ class PapelGenericoModel extends \App\Models\BaseModel
}
public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $tapa_dura = null, $papel_especial = false, $POD = null)
{
public function getPapelCliente(
$tipo,
$is_cubierta = false,
$selected_papel_id = null,
$tapa_dura = null,
$papel_especial = false,
$POD = null,
$ancho = 0,
$alto = 0,
$tirada = 0
) {
/*
1.-> Tipo impresion
2.-> Maquina
@ -406,6 +447,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t2.use_in_client", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.min <= ", $tirada)
->where("t4.max >= ", $tirada)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $tipo)
@ -429,6 +472,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t2.use_in_client", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.min <= ", $tirada)
->where("t4.max >= ", $tirada)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $tipo)
@ -443,6 +488,17 @@ class PapelGenericoModel extends \App\Models\BaseModel
->where("t3_inner.active", 1);
});
$builder->groupStart()
->groupStart()
->where("t4.ancho_impresion >", $ancho)
->where("t4.alto_impresion >", $alto)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $alto)
->where("t4.alto_impresion >", $ancho)
->groupEnd()
->groupEnd();
if ($is_cubierta == true) {
$builder->where("t2.cubierta", 1);
$builder->where("t5.uso", 'cubierta');