diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php index 72dc9ea5..41b01c3d 100644 --- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php +++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php @@ -7,7 +7,7 @@ use App\Controllers\GoBaseResourceController; use App\Models\Collection; use App\Entities\Presupuestos\PresupuestoEntity; - +use App\Models\Configuracion\PapelGenericoModel; use App\Models\Presupuestos\PresupuestoModel; class Cosidotapablanda extends \App\Controllers\GoBaseResourceController @@ -135,6 +135,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController $this->viewData['incReiList'] = array('incidencia'=>lang('Presupuestos.incidencia'), 'reimpresion'=>lang('Presupuestos.reimpresion'), 'sin_cargo'=>lang('Presupuestos.sinCargo')); $this->viewData['paisList'] = $this->getPaisListItems(); $this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null); + $this->viewData['papelGenericoNegroList'] = $this->getPapelGenericoNegro(); + $this->viewData['papelGenericoNegroHQList'] = $this->getPapelGenericoNegroHQ(); + $this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor(); + $this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ(); + $this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta(); + $this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta(); + /* @@ -356,6 +363,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController $this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions(); $this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions(); + $this->viewData['papelGenericoNegroList'] = $this->getPapelGenericoNegro(); + $this->viewData['papelGenericoNegroHQList'] = $this->getPapelGenericoNegroHQ(); + $this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor(); + $this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ(); + $this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta(); + $this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta(); + + $this->viewData['formAction'] = route_to('updatePresupuesto', $id); $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Presupuestos.moduleTitle') . ' ' . lang('Basic.global.edit3'); @@ -455,17 +470,23 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController public function menuItems() { if ($this->request->isAJAX()) { + + $reqData = $this->request->getPost(); + + $tipo = $reqData['tipo'] ?? null; + $datos = $reqData['datos'] ?? null; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; - $reqId = goSanitize($this->request->getPost('id'))[0]; - $reqText = goSanitize($this->request->getPost('text'))[0]; - $onlyActiveOnes = false; - $columns2select = [$reqId ?? 'id', $reqText ?? 'titulo']; - $onlyActiveOnes = false; - $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); - $nonItem = new \stdClass; - $nonItem->id = ''; - $nonItem->text = '- ' . lang('Basic.global.None') . ' -'; - array_unshift($menu, $nonItem); + + + if ($tipo == 'gramaje'){ + // En este caso contiene el nombre del papel generico + $model = new PapelGenericoModel(); + $menu = $model->getGramajeComparador($datos, $searchStr); + $nonItem = new \stdClass; + $nonItem->text = '- ' . lang('Basic.global.None') . ' -'; + array_unshift($menu, $nonItem); + } + $newTokenHash = csrf_hash(); $csrfTokenName = csrf_token(); @@ -511,6 +532,54 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController return $data; } + protected function getPapelGenericoNegro() + { + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('negro', false, false); + array_unshift($data, lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])); + return $data; + } + + protected function getPapelGenericoNegroHQ() + { + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('negrohq', false, false); + array_unshift($data, lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])); + return $data; + } + + protected function getPapelGenericoColor() + { + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('color', false, false); + array_unshift($data, lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])); + return $data; + } + + protected function getPapelGenericoColorHQ() + { + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('colorhq', false, false); + array_unshift($data, lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])); + return $data; + } + + protected function getPapelGenericoCubierta() + { + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('color', true, false); + array_unshift($data, lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])); + return $data; + } + + protected function getPapelGenericoSobreCubierta() + { + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('color', false, true); + array_unshift($data, lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])); + return $data; + } + /* diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php index 99e248c3..29368205 100644 --- a/ci4/app/Controllers/Test.php +++ b/ci4/app/Controllers/Test.php @@ -2,7 +2,7 @@ namespace App\Controllers; -use App\Services\PresupuestoService; +use App\Models\Configuracion\PapelGenericoModel; class Test extends BaseController { @@ -15,8 +15,10 @@ class Test extends BaseController public function index() { - $text = PresupuestoService::example(); - echo $text; + $model = new PapelGenericoModel(); + echo '
';
+ var_dump($model->getGramajeComparador('CARTULINA GRÁFICA ESTUCADA 1/C'));
+ echo '';
}
}
\ No newline at end of file
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
index 9238c517..c5b91ca7 100644
--- a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
+++ b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
@@ -21,6 +21,10 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"estado_id" => 1,
"inc_rei" => null,
"causa_cancelacion" => null,
+ "retractilado" => false,
+ "retractilado5" => false,
+ "guardas" => false,
+ "faja_color" => false,
"recoger_en_taller" => false,
"ferro" => false,
"ferro_digital" => false,
@@ -186,6 +190,10 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"catalogo_id" => "?int",
"estado_id" => "int",
"inc_rei" => "?int",
+ "retractilado" => "boolean",
+ "retractilado5" => "boolean",
+ "guardas" => "boolean",
+ "faja_color" => "boolean",
"recoger_en_taller" => "boolean",
"ferro" => "boolean",
"ferro_digital" => "boolean",
diff --git a/ci4/app/Language/en/Presupuestos.php b/ci4/app/Language/en/Presupuestos.php
index 3442f0a4..ad58d4b4 100644
--- a/ci4/app/Language/en/Presupuestos.php
+++ b/ci4/app/Language/en/Presupuestos.php
@@ -47,7 +47,7 @@ return [
'merma' => 'Weakening',
'mermaportada' => 'Cover weakening',
'tipoImpresion' => 'Printing type',
- 'papelesComparador' => 'Interior, cover and dust jacket papers',
+ 'papelesComparadorCosidoTapaBlanda' => 'Interior and cover papers',
'posicionPagColor' => 'Color pages position',
'colorPageInstructions' => 'Enter the position of the color pages within the book. E.g., 3,5,7 or 4-10,20,155.',
'numeroPaginas' => 'Nº Pages',
diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php
index 44429022..565873a3 100644
--- a/ci4/app/Language/es/Presupuestos.php
+++ b/ci4/app/Language/es/Presupuestos.php
@@ -47,7 +47,7 @@ return [
'merma' => 'Merma',
'mermaportada' => 'Merma portada',
'tipoImpresion' => 'Tipo de impresión',
- 'papelesComparador' => 'Papeles interior, cubierta y sobrecubierta',
+ 'papelesComparadorCosidoTapaBlanda' => 'Papeles interior y cubierta',
'posicionPagColor' => 'Posición páginas a color',
'colorPageInstructions' => 'Introduzca la posición de las páginas a color dentro del libro. Ej: 3,5,7 ó 4-10,20,155',
'numeroPaginas' => 'Nº Páginas',
diff --git a/ci4/app/Models/Configuracion/PapelGenericoModel.php b/ci4/app/Models/Configuracion/PapelGenericoModel.php
index 88a2e6a7..1df24bcc 100644
--- a/ci4/app/Models/Configuracion/PapelGenericoModel.php
+++ b/ci4/app/Models/Configuracion/PapelGenericoModel.php
@@ -1,4 +1,5 @@
"t1.show_in_client",
];
- protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client","deleted_at","is_deleted"];
+ protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "deleted_at", "is_deleted"];
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
protected $useTimestamps = true;
@@ -79,15 +80,79 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
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();
+ }
+
+
+ public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null)
+ {
+ /*
+ 1.-> Tipo impresion
+ 2.-> Maquina
+ 3.-> Papeles impresion asociados a esa maquina
+ 4.-> papeles genericos que aparecen en esos papeles impresion
+ */
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t1.nombre AS papel_generico"
+ )
+ ->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("t4.is_deleted", 0)
+ ->where("t4.tipo", "impresion")
+ ->where("t5.tipo", $tipo);
+
+ if(!is_null($is_cubierta)){
+ if($is_cubierta==true){
+ $builder->where("t2.cubierta", 1);
+ }
+ else if($is_sobrecubierta==true){
+ $builder->where("t2.sobrecubierta", 1);
+ }
+ }
+
+ return array_unique(array_column($builder->orderBy("t1.nombre", "asc")->get()->getResultArray(), 'papel_generico'));
+ }
+
+ public function getGramajeComparador(string $papel_generico_nombre="")
+ {
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t2.gramaje AS text"
+ )
+ ->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
+
+ ->where("t1.is_deleted", 0)
+ ->where("t2.is_deleted", 0)
+ ->where("t1.nombre", $papel_generico_nombre);
+
+ $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));
+
}
}
diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php
index 41c6a0eb..39ea2f6f 100644
--- a/ci4/app/Models/Presupuestos/PresupuestoModel.php
+++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php
@@ -42,6 +42,10 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"estado_id",
"inc_rei",
"causa_cancelacion",
+ "retractilado",
+ "retractilado5",
+ "guardas",
+ "faja_color",
"recoger_en_taller",
"ferro",
"ferro_digital",
diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php
index 79366e7f..6c2eb28d 100644
--- a/ci4/app/Services/PresupuestoService.php
+++ b/ci4/app/Services/PresupuestoService.php
@@ -4,6 +4,7 @@ namespace App\Services;
use CodeIgniter\Config\BaseService;
+use App\Models\Configuracion\PapelGenericoModel;
class PresupuestoService extends BaseService
{
@@ -20,8 +21,7 @@ class PresupuestoService extends BaseService
* @param mixed $dimensiones
* @return mixed
*/
- public static function getPapelForMenu($tipo_impresion, $dimensiones){
- return $data;
+ public static function test(){
}
}
\ No newline at end of file
diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php
index 1ccd6713..7b4ac9be 100644
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php
@@ -14,18 +14,18 @@
= lang('MaquinasTarifasImpresions.negrohq') ?>
+= lang('MaquinasTarifasImpresions.bicolor') ?>
+= lang('MaquinasTarifasImpresions.colorhq') ?>
= lang('PapelImpresion.cubierta') ?>
@@ -138,10 +185,17 @@= lang('PapelImpresion.sobrecubierta') ?>
-