diff --git a/ci4/app/Controllers/Configuracion/Papelesgenericos.php b/ci4/app/Controllers/Configuracion/Papelesgenericos.php index 628be5c4..861131df 100755 --- a/ci4/app/Controllers/Configuracion/Papelesgenericos.php +++ b/ci4/app/Controllers/Configuracion/Papelesgenericos.php @@ -298,13 +298,24 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController { if ($this->request->isAJAX()) { + $tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null; + $POD = null; + if($tirada != null){ + $POD_value = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD(); + if(intval($tirada) <= intval($POD_value)){ + $POD = true; + } + else{ + $POD = false; + } + } $tipo = goSanitize($this->request->getGet('tipo'))[0]; $selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null; $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); - $menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true); + $menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false, $POD); + $menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true, $POD); $newTokenHash = csrf_hash(); $csrfTokenName = csrf_token(); @@ -325,10 +336,21 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController if ($this->request->isAJAX()) { + $tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null; + $POD = null; + if($tirada != null){ + $POD_value = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD(); + if(intval($tirada) <= intval($POD_value)){ + $POD = true; + } + else{ + $POD = false; + } + } $tipo = goSanitize($this->request->getGet('tipo'))[0]; $cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0; - $items = $this->model->getPapelCliente($tipo, $cubierta, null, true); + $items = $this->model->getPapelCliente($tipo, $cubierta, null, true, $POD); $items = array_map(function ($item) { return [ 'id' => $item->id, diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index f0ae65af..a7f3d0be 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -522,6 +522,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController 'a_favor_fibra' => 1, ); + // Para POD siempre es HQ + if ($tirada[0] <= $POD) { + $isHq = true; + } + $input_data = array( 'uso' => 'interior', 'tipo_impresion_id' => $tipo_impresion_id, @@ -1509,6 +1514,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $info['merma'] = $datosPedido->merma; } + // Para POD siempre es HQ + if ($tirada[$t] <= $POD) { + $isHq = true; + } + $input_data = array( 'uso' => 'interior', 'tipo_impresion_id' => $tipo_impresion_id, diff --git a/ci4/app/Models/Configuracion/PapelGenericoModel.php b/ci4/app/Models/Configuracion/PapelGenericoModel.php index 63f0403e..70c0447c 100755 --- a/ci4/app/Models/Configuracion/PapelGenericoModel.php +++ b/ci4/app/Models/Configuracion/PapelGenericoModel.php @@ -313,7 +313,7 @@ class PapelGenericoModel extends \App\Models\BaseModel } - public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $tapa_dura = null, $papel_especial = false) + public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $tapa_dura = null, $papel_especial = false, $POD = null) { /* 1.-> Tipo impresion @@ -322,6 +322,13 @@ class PapelGenericoModel extends \App\Models\BaseModel 4.-> papeles genericos que aparecen en esos papeles impresion */ + if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) { + if($tipo == 'color') + $tipo = 'colorhq'; + else if($tipo == 'negro') + $tipo = 'negrohq'; + } + if ($selected_papel_id != null) { $builder = $this->db ->table($this->table . " t1") @@ -404,6 +411,14 @@ class PapelGenericoModel extends \App\Models\BaseModel if ($tipo == 'colorhq' || $tipo == 'negrohq') { $builder->where("t2.rotativa", 0); } + else{ + if($POD == false){ + $builder->where("t2.rotativa", 1); + } + else if ($POD == true){ + $builder->where("t2.rotativa", 0); + } + } if ($selected_papel_id != null) diff --git a/ci4/app/Services/PresupuestoClienteService.php b/ci4/app/Services/PresupuestoClienteService.php index 000a27e3..d066937d 100644 --- a/ci4/app/Services/PresupuestoClienteService.php +++ b/ci4/app/Services/PresupuestoClienteService.php @@ -523,6 +523,11 @@ class PresupuestoClienteService extends BaseService $linea_rotativa = array_merge($linea_rotativa, $lineas); } } + + $linea_rotativa = array_filter($linea_rotativa, function($item) { + return count($item['fields']['num_formas']) > 1; + }); + if (count($linea_rotativa) > 0) { usort( diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index 1aba14fd..a9495780 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -639,11 +639,11 @@ class PresupuestoService extends BaseService $calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h1_temp); // Si son mas de 2 formas if (count($calles) > 0) - $h1 = ($h1_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h1_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h1_temp : $h1_temp - 1; + $h1 = ($h1_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h1_temp - 1) * $calles[0]->internas < (floatval($maquina->ancho))) ? $h1_temp : $h1_temp - 1; else $h1 = $h1_temp; - $v1 = floor($maquina->alto_click / $altoForCalculo); + $v1 = floor(floatval($maquina->alto_click) / $altoForCalculo); $formas_h = $h1 * $v1; //p1 } // verticales @@ -651,10 +651,10 @@ class PresupuestoService extends BaseService $calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h2_temp); if (count($calles) > 0) - $h2 = ($h2_temp * $altoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h2_temp : $h2_temp - 1; + $h2 = ($h2_temp * $altoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < (floatval($maquina->ancho))) ? $h2_temp : $h2_temp - 1; else $h2 = $h2_temp; - $v2 = floor($maquina->alto_click / $anchoForCalculo); + $v2 = floor(floatval($maquina->alto_click) / $anchoForCalculo); $formas_v = $h2 * $v2; //p2 } @@ -1061,16 +1061,16 @@ class PresupuestoService extends BaseService ), 'cliente_id' => ($input_data['presupuesto'])->cliente_id, 'datosTipolog' => [ - (object) array( - 'negro' => $linea->rotativa_negro, - 'cyan' => $linea->rotativa_cyan, - 'magenta' => $linea->rotativa_magenta, - 'amarillo' => $linea->rotativa_amarillo, - 'cg' => $linea->rotativa_cg, - 'gota_negro' => $linea->rotativa_gota_negro, - 'gota_color' => $linea->rotativa_gota_color, - ) - ] + (object) array( + 'negro' => $linea->rotativa_negro, + 'cyan' => $linea->rotativa_cyan, + 'magenta' => $linea->rotativa_magenta, + 'amarillo' => $linea->rotativa_amarillo, + 'cg' => $linea->rotativa_cg, + 'gota_negro' => $linea->rotativa_gota_negro, + 'gota_color' => $linea->rotativa_gota_color, + ) + ] ]; $comp_data = PresupuestoService::obtenerComparadorRotativa($datos); @@ -1816,7 +1816,7 @@ class PresupuestoService extends BaseService } if ($uso == 'cubierta' || $uso == 'sobrecubierta') { - + $linea['fields']['dimension_desarrollo']['ancho'] = $datosPedido->anchoExteriores; $linea['fields']['dimension_desarrollo']['alto'] = $datosPedido->altoExteriores; } diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php index 3f9997af..2456bd2a 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php @@ -63,7 +63,7 @@ -
">
user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class=" calcular-solapas calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa" diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js index ce8f2226..5cb58bd9 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js @@ -572,8 +572,8 @@ class DatosGenerales { this.pagColorConsecutivas.prop('checked', datos.paginasColorConsecutivas); if (datos.paginasColorConsecutivas) { - this.divPapelDiferente.removeClass('d-none'); - this.papelDiferente.prop('checked', datos.papelInteriorDiferente).trigger('change'); + //this.divPapelDiferente.removeClass('d-none'); + //this.papelDiferente.prop('checked', datos.papelInteriorDiferente).trigger('change'); } this.posPaginasColor.val(datos.posPaginasColor); @@ -727,6 +727,8 @@ class DatosGenerales { } // Para recalcular el presupuesto + $('#divGramajeInterior').empty(); + $('#divGramajeInteriorColor').empty(); element.trigger('change'); } @@ -792,11 +794,11 @@ class DatosGenerales { #handPaginasConsecutivas() { if (this.pagColorConsecutivas.is(':checked')) { - this.divPapelDiferente.removeClass('d-none'); + //this.divPapelDiferente.removeClass('d-none'); } else { - this.divPapelDiferente.addClass('d-none'); - this.papelDiferente.prop('checked', false); + /*this.divPapelDiferente.addClass('d-none'); + this.papelDiferente.prop('checked', false);*/ } } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js index 02669b39..61c0a0cb 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js @@ -42,15 +42,6 @@ class DisenioInterior { this.colorPremium_color = this.domItem.find("#colorPremiumColor"); this.gramaje_color = this.domItem.find(".check-interior-color-gramaje"); - this.gramaje70_color = this.domItem.find("#interiorGramaje70Color"); - this.gramaje80_color = this.domItem.find("#interiorGramaje80Color"); - this.gramaje90_color = this.domItem.find("#interiorGramaje90Color"); - this.gramaje100_color = this.domItem.find("#interiorGramaje100Color"); - this.gramaje115_color = this.domItem.find("#interiorGramaje115Color"); - this.gramaje120_color = this.domItem.find("#interiorGramaje120Color"); - this.gramaje135_color = this.domItem.find("#interiorGramaje135Color"); - this.gramaje150_color = this.domItem.find("#interiorGramaje150Color"); - this.gramaje170_color = this.domItem.find("#interiorGramaje170Color"); this.checksGramaje = $('.gramaje-interior'); @@ -121,6 +112,7 @@ class DisenioInterior { new Ajax('/papelesgenericos/getpapelcliente', { [this.csrf_token]: this.csrf_hash, + tirada: $('#tirada').val(), tipo: this.getTipoImpresion(), cubierta: 0, }, @@ -135,6 +127,7 @@ class DisenioInterior { new Ajax('/papelesgenericos/getpapelcliente', { [this.csrf_token]: this.csrf_hash, + tirada: $('#tirada').val(), tipo: this.getTipoImpresion(), cubierta: 0, }, @@ -859,6 +852,7 @@ class DisenioInterior { new Ajax('/papelesgenericos/getpapelcliente', { [this.csrf_token]: this.csrf_hash, + tirada: $('#tirada').val(), papel: papel, tipo: tipo, cubierta: 0, @@ -886,6 +880,7 @@ class DisenioInterior { new Ajax('/papelesgenericos/getpapelcliente', { [this.csrf_token]: this.csrf_hash, + tirada: $('#tirada').val(), papel: this.papelInterior, tipo: tipo, cubierta: 0, @@ -931,6 +926,7 @@ class DisenioInterior { new Ajax('/papelesgenericos/getpapelcliente', { [this.csrf_token]: this.csrf_hash, + tirada: $('#tirada').val(), papel: papel, tipo: tipo, cubierta: 0, @@ -954,6 +950,7 @@ class DisenioInterior { new Ajax('/papelesgenericos/getpapelcliente', { [this.csrf_token]: this.csrf_hash, + tirada: $('#tirada').val(), papel: this.papelInterior, tipo: tipo, cubierta: 0, diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js index 431b1d76..5ce4fa4a 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js @@ -78,7 +78,7 @@ class PresupuestoCliente { } - if (this.datosGenerales.excluirRotativa.length == 0) { + if ($('#divExcluirRotativa').hasClass('d-none')) { this.direcciones.direccionesCliente.setParams({ 'cliente_id': $("#clienteId").val() }) }