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');

View File

@ -32,8 +32,12 @@ class PresupuestoAdminEdit {
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip'),
{
checkPaginasPresupuesto: this.checkPaginasPresupuesto,
getDimensionLibro: this.getDimensionLibro,
});
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'),
{
getDimensionLibro: this.getDimensionLibro,
});
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'));
this.lineasPresupuesto = new LineasPresupuesto(this.domItem.find('#accordionLineasPresupuestoTip'),
{
getDimensionLibro: this.getDimensionLibro,

View File

@ -4,10 +4,12 @@ import Ajax from '../../../components/ajax.js';
class Comparador {
constructor(domItem) {
constructor(domItem, functions = {}) {
this.domItem = domItem;
this.getDimensionLibro = functions.getDimensionLibro;
this.tipo_impresion_id = parseInt($('#tipo_impresion_id').val());
this.csrf_token = getToken();
@ -23,6 +25,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'negro',
});
@ -33,6 +39,10 @@ class Comparador {
papel_generico: () => this.papelNegro.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'negro',
});
this.paginasColor = $('#compPaginasColor');
@ -42,6 +52,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'color',
});
@ -52,6 +66,10 @@ class Comparador {
papel_generico: () => this.papelColor.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'color',
});
@ -62,6 +80,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'negrohq',
});
@ -72,6 +94,10 @@ class Comparador {
papel_generico: () => this.papelNegrohq.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'negrohq',
});
@ -82,6 +108,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'colorhq',
});
@ -92,6 +122,10 @@ class Comparador {
papel_generico: () => this.papelColorhq.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'colorhq',
});
@ -102,6 +136,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: () => $('#solapas').prop('checked') ? $('#solapas_ancho').val() : 0,
lomo: () => $('#lomo_cubierta').val(),
tipo: 'colorhq',
uso: 'cubierta',
});
@ -112,6 +150,10 @@ class Comparador {
papel_generico: () => this.papelCubierta.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: () => $('#solapas').prop('checked') ? $('#solapas_ancho').val() : 0,
lomo: () => $('#lomo_cubierta').val(),
tipo: 'colorhq',
uso: 'cubierta',
});
@ -123,6 +165,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: () => $('#solapas').prop('checked') ? $('#solapas_ancho').val() : 0,
lomo: () => $('#lomo_sobrecubierta').val(),
tipo: 'colorhq',
uso: 'sobrecubierta',
});
@ -133,6 +179,10 @@ class Comparador {
papel_generico: () => this.papelSobrecubierta.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: () => $('#solapas').prop('checked') ? $('#solapas_ancho').val() : 0,
lomo: () => $('#lomo_sobrecubierta').val(),
tipo: 'colorhq',
uso: 'sobrecubierta',
});
@ -145,6 +195,10 @@ class Comparador {
[this.csrf_token]: this.csrf_hash,
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'colorhq',
uso: 'guardas',
});
@ -155,6 +209,10 @@ class Comparador {
papel_generico: () => this.papelCubierta.getVal(),
tipo_impresion: this.tipo_impresion_id,
tirada: () => $('#tirada').val(),
ancho: () => this.getDimensionLibro().ancho,
alto: () => this.getDimensionLibro().alto,
sopalas: 0,
lomo: 0,
tipo: 'colorhq',
uso: 'guardas',
});
@ -245,7 +303,7 @@ class Comparador {
this.papelSobrecubierta.onChange(() => self.gramajeSobrecubierta.empty());
this.sobrecubierta.on('change', () => {
if (this.sobrecubierta.select2('data')[0].id == 1) {
if($('#solapas_sobrecubierta').prop('checked') == false){
if ($('#solapas_sobrecubierta').prop('checked') == false) {
this.sobrecubierta.val(0);
popErrorAlert(window.language.Presupuestos.errores.error_sobrecubierta_sin_solapas, 'divAlarmasComparador')
}
@ -1492,7 +1550,7 @@ class Comparador {
}
}
catch (e) {
}
$.extend(data, bn_obj);
}

View File

@ -8,6 +8,7 @@ class DatosLibro {
this.domItem = domItem;
this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto;
this.getDimensionLibro = functions.getDimensionLibro;
this.csrf_token = getToken();
this.csrf_hash = $('#mainContainer').find('input[name="' + this.csrf_token + '"]').val();

View File

@ -33,6 +33,12 @@ class DisenioCubierta {
[this.csrf_token]: this.csrf_hash,
tipo: 'colorhq',
cubierta: 1,
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
solapas: () => {return $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val()},
lomo: () => {return $('#lc').val()},
tapa_dura: () => {return this.tapaBlanda.hasClass("selected") ? 0 : 1},
tirada: this.presupuestoCliente.datosGenerales.getTiradas()[0],
}
);
@ -758,7 +764,12 @@ class DisenioCubierta {
[this.csrf_token]: this.csrf_hash,
tipo: 'colorhq',
cubierta: 1,
tapa_dura: tapa_dura
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val(),
lomo: $('#lc').val(),
tapa_dura: tapa_dura,
tirada: this.presupuestoCliente.datosGenerales.getTiradas()[0],
},
{},
(response) => { this.fillPapeles(response); },
@ -780,7 +791,12 @@ class DisenioCubierta {
papel: this.papelCubierta,
tipo: 'colorhq',
cubierta: 1,
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val(),
lomo: $('#lc').val(),
tapa_dura: tapa_dura,
tirada: this.presupuestoCliente.datosGenerales.getTiradas()[0],
},
{},
this.fillGramajes.bind(context),
@ -907,7 +923,12 @@ class DisenioCubierta {
papel: papel,
tipo: 'colorhq',
cubierta: 1,
tapa_dura: tapa_dura
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val(),
lomo: $('#lc').val(),
tapa_dura: tapa_dura,
tirada: this.presupuestoCliente.datosGenerales.getTiradas()[0],
},
{},
this.fillGramajes.bind(context),

View File

@ -57,6 +57,11 @@ class DisenioInterior {
{
[this.csrf_token]: this.csrf_hash,
tipo: this.getTipoImpresion(),
tirada: () => {return $('#tirada').val()},
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
solapas: 0,
lomo: 0,
cubierta: 0,
}
);
@ -67,6 +72,11 @@ class DisenioInterior {
{
[this.csrf_token]: this.csrf_hash,
tipo: this.getTipoImpresionColor(),
tirada: () => {return $('#tirada').val()},
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
solapas: 0,
lomo: 0,
cubierta: 0,
}
);
@ -116,6 +126,10 @@ class DisenioInterior {
[this.csrf_token]: this.csrf_hash,
tirada: $('#tirada').val(),
tipo: this.getTipoImpresion(),
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: 0,
lomo: 0,
cubierta: 0,
},
{},
@ -131,6 +145,10 @@ class DisenioInterior {
[this.csrf_token]: this.csrf_hash,
tirada: $('#tirada').val(),
tipo: this.getTipoImpresion(),
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: 0,
lomo: 0,
cubierta: 0,
},
{},
@ -888,6 +906,10 @@ class DisenioInterior {
tirada: $('#tirada').val(),
papel: papel,
tipo: tipo,
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: 0,
lomo: 0,
cubierta: 0,
},
{},
@ -916,6 +938,10 @@ class DisenioInterior {
tirada: $('#tirada').val(),
papel: this.papelInterior,
tipo: tipo,
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: 0,
lomo: 0,
cubierta: 0,
},
{},
@ -962,6 +988,10 @@ class DisenioInterior {
tirada: $('#tirada').val(),
papel: papel,
tipo: tipo,
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: 0,
lomo: 0,
cubierta: 0,
},
{},
@ -986,6 +1016,10 @@ class DisenioInterior {
tirada: $('#tirada').val(),
papel: this.papelInterior,
tipo: tipo,
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
solapas: 0,
lomo: 0,
cubierta: 0,
},
{},