diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php
index b4171b03..37d0bb7c 100644
--- a/ci4/app/Config/Routes.php
+++ b/ci4/app/Config/Routes.php
@@ -582,6 +582,7 @@ $routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos
$routes->get('cargar/(:any)', 'Presupuestoadmin::cargar/$1');
$routes->post('comparadorinterior', 'Presupuestoadmin::obtenerComparadorInterior');
$routes->post('comparadorexteriores', 'Presupuestoadmin::obtenerComparadorExteriores');
+ $routes->post('comparadorguardas', 'Presupuestoadmin::obtenerComparadorGuardas');
$routes->get('papelgenerico', 'Presupuestoadmin::getPapelGenerico');
$routes->get('papelgramaje', 'Presupuestoadmin::getGramaje');
});
diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php
index 5b3d4b82..b436fe5c 100644
--- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php
+++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php
@@ -538,6 +538,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$item['papel_nombre'] = $modelPapelGenerico->getNombre($item['papel_id'])['nombre'];
}
$data['comparador']['posPagColor'] = $presupuesto->comp_pos_paginas_color;
+ $data['comparador']['lomoRedondo'] = $presupuesto->lomo_redondo;
+ $data['comparador']['cabezada'] = $presupuesto->cabezada;
/*
@@ -689,8 +691,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
'papel_generico' => $papel_generico,
'gramaje' => $gramaje,
'paginas_color' => $paginas_color,
- 'isColor' => $isColor,
- 'isHq' => $isHq,
+ 'isColor' => 1, // cubierta y sobre cubierta colorhq
+ 'isHq' => 1, // cubierta y sobre cubierta colorhq
'tipo_impresion_id' => $tipo_impresion_id,
'uso' => $uso,
'lomoRedondo' => $lomoRedondo
@@ -714,8 +716,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
'papel_generico' => $papel_generico,
'gramaje' => $gramaje,
'paginas_color' => $paginas_color,
- 'isColor' => $isColor,
- 'isHq' => $isHq,
+ 'isColor' => 1, // cubierta y sobre cubierta colorhq
+ 'isHq' => 1, // cubierta y sobre cubierta colorhq
'tipo_impresion_id' => $tipo_impresion_id,
'uso' => $uso
);
@@ -737,6 +739,58 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
}
+ public function obtenerComparadorGuardas()
+ {
+
+ if ($this->request->isAJAX()) {
+
+ $cliente_id = $this->request->getPost('cliente_id');
+ $datosPedido = $this->request->getPost('datosPedido');
+ $papel_generico = $this->request->getPost('papel_generico');
+ $gramaje = $this->request->getPost('gramaje');
+ $paginas_color = $this->request->getPost('paginas_color');
+ $isColor = $this->request->getPost('isColor');
+ $isHq = $this->request->getPost('isHq');
+ $tipo_impresion_id = $this->request->getPost('tipo_impresion_id');
+ $uso = $this->request->getPost('uso');
+
+ // Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
+ // y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
+ // o wire-o tapa dura, las guardas se imprimen como hojas sueltas
+ if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3) {
+ $datosPedido['isCosido'] = true;
+ } else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) {
+ $datosPedido['isCosido'] = false;
+ }
+
+ $datosPedido['paginas_impresion'] = $datosPedido['paginas'];
+
+ $data = array(
+ 'cliente_id' => $cliente_id,
+ 'datosPedido' => (object) $datosPedido,
+ 'papel_generico' => $papel_generico,
+ 'gramaje' => $gramaje,
+ 'papelInteriorDiferente' => true,
+ 'paginas_color' => $paginas_color,
+ 'isColor' => $isColor,
+ 'isHq' => $isHq,
+ 'tipo_impresion_id' => $tipo_impresion_id,
+ 'uso' => $uso
+ );
+
+ $lineas = PresupuestoClienteService::obtenerGuardas($data, true);
+ return $this->respond(
+ [
+ 'status' => 1,
+ 'data' => $lineas
+ ]
+ );
+ } else {
+ return $this->failUnauthorized('Invalid request', 403);
+ }
+ }
+
+
public function datatable()
{
if ($this->request->isAJAX()) {
diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php
index 3effc193..253ce34d 100755
--- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php
+++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php
@@ -1205,9 +1205,17 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$data['datosGenerales']['retractilado5'] = $presupuesto->retractilado5;
$datos_papel = $this->obtenerDatosPapel($presupuesto->id);
- $data['interior'] = $datos_papel['interior'] ? $datos_papel['interior'] : [];
+ if (array_key_exists('interior', $datos_papel)) {
+ $data['interior'] = $datos_papel['interior'];
+ } else {
+ $data['interior'] = [];
+ }
- $data['cubierta'] = $datos_papel['cubierta'] ? $datos_papel['cubierta'] : [];
+ if (array_key_exists('cubierta', $datos_papel)) {
+ $data['cubierta'] = $datos_papel['cubierta'];
+ } else {
+ $data['cubierta'] = [];
+ }
$data['cubierta']['tapa'] = $this->obtenerTipoTapa($presupuesto->tipo_impresion_id ?? null);
$data['cubierta']['lomoRedondo'] = $presupuesto->lomo_redondo ? 1 : 0;
$data['cubierta']['solapas'] = $presupuesto->solapas ? 1 : 0;
diff --git a/ci4/app/Services/PresupuestoClienteService.php b/ci4/app/Services/PresupuestoClienteService.php
index a4a3c491..17c4acc8 100644
--- a/ci4/app/Services/PresupuestoClienteService.php
+++ b/ci4/app/Services/PresupuestoClienteService.php
@@ -186,7 +186,7 @@ class PresupuestoClienteService extends BaseService
return $lineas_sobrecubierta;
}
- public static function obtenerGuardas($data)
+ public static function obtenerGuardas($data, $return_raw=false)
{
$uso = $data['uso'];
@@ -220,6 +220,14 @@ class PresupuestoClienteService extends BaseService
}
if (count($lineas_guardas) > 0) {
+ if($return_raw){
+ $lineas_guardas = array_values(array_unique($lineas_guardas, SORT_REGULAR));
+
+ return[
+ 'guardas' => $lineas_guardas
+ ];
+ }
+
usort(
$lineas_guardas,
function ($a, $b) {
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php
index 9f5a062e..eb45cbe1 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php
@@ -222,27 +222,46 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -322,9 +341,11 @@
-
+
+
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js
index 185aacd1..19e5920c 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js
@@ -652,270 +652,8 @@ function format(d) {
return $(value).toArray();
}
-const lastColNr_lp = $('#tableLineasPresupuesto').find("tr:first th").length - 1;
-const actionBtns_lp = function(data) {
- return `
-
- `;
-};
-var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
- scrollX: true,
- searching: false,
- paging: false,
- info: false,
- ordering: true,
- responsive: true,
- select: false,
- rowId: 'row_id',
- language: {
- url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
- },
- columnDefs: [
- {
- targets: 0,
- className: 'dt-control',
- orderable: false,
- data: null,
- defaultContent: ''
- },
- {
- targets: [1,2,3,4,5,6,7,8,9],
- orderable: false,
- visible: false,
- },
- {
- targets: [11,12,13,14,15,16,17,18,19,20],
- orderable: false,
- },
- {
- targets: [10],
- orderable: true,
- visible: false,
- },
- {
- orderable: false,
- searchable: false,
- targets: [lastColNr_lp]
- },
- ],
- columns: [
- {data: null},
- {data: 'tarifa_impresion_id'},
- {data: 'maquina_ancho'},
- {data: 'maquina_alto'},
- {data: 'maquina_impresion_ancho'},
- {data: 'maquina_impresion_alto'},
- {data: 'formas'},
- {data: 'formas_v'},
- {data: 'formas_h'},
- {data: 'formas_orientacion'},
- {data: 'position',
- type: "num" ,
- render: function (data, type, row, meta){
- if(row.row_id.includes('_bn')){
- return 0;
- }
- else if(row.row_id.includes('_color')){
- return 1;
- }
- else if(row.row_id.includes('_cubierta')){
- return 2;
- }
- else if(row.row_id.includes('_sobrecubierta')){
- return 3;
- }
- else if(row.row_id.includes('_guardas')){
- return 4;
- }
- }
- },
- {data: 'icon',
- render: function ( data, type, row, meta ){
- return '
'
- }
- },
- {data: 'paginas',
- render: function ( data, type, row, meta ) {
- if(row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta" && row.row_id != "lp_guardas")
- return ' | ';
- else if(row.row_id == "lp_cubierta"){
- select = ''
-
- return select;
- }
- else if(row.row_id == "lp_guardas"){
- select = ''
-
- return select;
-
- }
- else{
- return '';
- }
- }
- },
- {data: 'papel',
- render: function ( data, type, row, meta ) {
- var select = $('