From d7574a0e2fe488c89fc874cf774cbea14de0f2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez=20Ortega?= Date: Wed, 1 Nov 2023 19:17:04 +0100 Subject: [PATCH] hecho el html de las lineas de presupuesto --- ci4/app/Controllers/Test.php | 25 +- ci4/app/Language/en/Presupuestos.php | 38 +- ci4/app/Language/es/Presupuestos.php | 46 +- .../Configuracion/PapelGenericoModel.php | 18 +- ci4/app/Services/PresupuestoService.php | 14 +- .../_lineasPresupuestoItems.php | 817 +++++++++++++++++- .../cosidotapablanda/comparador.js | 16 +- .../viewCosidotapablandaForm.php | 84 +- httpdocs/themes/vuexy/css/sk-datatables.css | 48 + 9 files changed, 997 insertions(+), 109 deletions(-) diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php index 93c983c9..f6f20f20 100644 --- a/ci4/app/Controllers/Test.php +++ b/ci4/app/Controllers/Test.php @@ -4,6 +4,7 @@ namespace App\Controllers; use App\Controllers\BaseController; use App\Models\Configuracion\MaquinasTarifasImpresionModel; +use App\Models\Configuracion\PapelGenericoModel; use App\Models\Configuracion\MaquinaModel; use App\Services\PresupuestoService; @@ -16,7 +17,21 @@ class Test extends BaseController public function index() { - $this->testLineasCubierta(); + $this->testLineasIntPlana(); + } + + public function getPapelesHQ(){ + $model = model('App\Models\Configuracion\PapelGenericoModel'); + $data = $model->getPapelForComparador('colorhq', false, false); + + var_dump($data); + } + + public function getGramaje(){ + $model = new PapelGenericoModel(); + $data = $model->getGramajeComparador("AHUESADO OFFSET", "bnhq" ); + + var_dump($data); } public function testGetPrecioPliegoRotativa() @@ -58,8 +73,8 @@ class Test extends BaseController public static function testLineasIntPlana() { - $uso = 'negro'; - $tipo = 'color'; + $uso = 'interior'; + $tipo = 'colorhq'; $datosPedido = (object)array( 'paginas' => 200, 'tirada' => 500, @@ -73,7 +88,7 @@ class Test extends BaseController $maquina_model = new \App\Models\Configuracion\MaquinaModel(); $opciones_papel = array( - 'bn' => 1, + 'color' => 1, 'cubierta' => 0, 'sobrecubierta' => 0, 'rotativa' => 0, @@ -88,7 +103,7 @@ class Test extends BaseController echo '-------------------------------'; $maquinas = $maquina_model->getMaquinaImpresionForPresupuesto( is_rotativa: $papel->rotativa, - tarifa_tipo: 'negro', + tarifa_tipo: 'colorhq', tirada: $datosPedido->tirada + $datosPedido->merma, papel_impresion_id: $papel->id, ); diff --git a/ci4/app/Language/en/Presupuestos.php b/ci4/app/Language/en/Presupuestos.php index f19e9034..dc64feb9 100644 --- a/ci4/app/Language/en/Presupuestos.php +++ b/ci4/app/Language/en/Presupuestos.php @@ -99,7 +99,43 @@ return [ 'rotativa' => 'rotary', 'lineasPresupuesto' => 'Budget Lines', 'tiempo' => 'Time', - + + 'porDefecto' => 'Deafult', + 'tipoImpresion' => 'Print', + 'numPagColor' => 'No Color Pages', + 'saturacion' => 'Saturation', + 'cobNegro' => 'Cov. % Black', + 'cobCyan' => 'Cov. % Cyan', + 'cobMagenta' => 'Cov. % Magenta', + 'cobAmarillo' => 'Cov. % Yellow', + 'gotaNegro' => 'Black drop', + 'gotaColor' => 'Color drop', + 'totalLinea' => 'TOTAL LINE', + 'verCalculos' => 'Calculations', + 'metrosMinuto' => 'Meters x min.', + 'resolucion' => 'Resolution (dpi)', + 'areaPaginas' => 'Pages area (in)', + 'gotasNegro' => 'No black drops', + 'gotasCyan' => 'No color drops', + 'gotasMagenta' => 'No magenta drops', + 'gotasAmarillo' => 'No yellow drops', + 'precioPagNegro' => 'Price black pages', + 'precioPagColor' => 'Price color pages', + 'factorAltura' => 'Height factor', + 'factorAnchura' => 'Width factor', + 'paginasPliego' => 'Pages/sheet', + 'metrosPapelLibro' => 'M. Paper Book', + 'metrosPapelTotal' => 'M. Paper Total', + 'clicksLibro' => 'Clicks/Book', + 'gTintaNegro' => 'G. Black Ink', + 'gTintaCyan' => 'G. Cyan Ink', + 'gTintaMagenta' => 'G. Magenta Ink', + 'gTintaAmarillo' => 'G. Yellow Ink', + 'clicksPedido' => 'Clicks Order', + 'totalClicks' => 'Total Clicks', + 'totalTinta' => 'Total Ink', + 'totalCorte' => 'Total Cut', + 'totalImpresion' => 'TOTAL PRINT', /* '4x0' => '4x0', '4x4' => '4x4', diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 3f5e4f2b..c576203b 100644 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -78,7 +78,7 @@ return [ 'totalTinta' => 'Total tinta', 'totalCorte' => 'Total corte', 'total' => 'Total', - 'aFavorFibra' => 'A favor fibra', + 'aFavorFibra' => 'A favor de fibra', 'cubierta' => 'Cubierta', 'sobrecubierta' => 'Sobrecubierta', 'encuadernacion' => 'Encuadernación', @@ -98,6 +98,50 @@ return [ 'rotativa' => 'rotativa', 'lineasPresupuesto' => 'Líneas Presupuesto', 'tiempo' => 'Tiempo', + + 'porDefecto' => 'Por defecto', + 'tipoImpresion' => 'Impresion', + 'numPagColor' => 'Nº Paginas Color', + 'saturacion' => 'Saturación', + 'cobNegro' => 'Cob. % Negro', + 'cobCyan' => 'Cob. % Cyan', + 'cobMagenta' => 'Cob. % Magenta', + 'cobAmarillo' => 'Cob. % Amarillo', + 'gotaNegro' => 'Gota negro', + 'gotaColor' => 'Gota color', + 'totalLinea' => 'TOTAL LÍNEA', + 'verCalculos' => 'Cálculos', + 'metrosMinuto' => 'Metros x min.', + 'resolucion' => 'Resolución (dpi)', + 'areaPaginas' => 'Área páginas (in)', + 'gotasNegro' => 'Nº gotas negro', + 'gotasCyan' => 'Nº gotas cyan', + 'gotasMagenta' => 'Nº gotas magenta', + 'gotasAmarillo' => 'Nº gotas amarillo', + 'precioPagNegro' => 'Precio pág. Negro', + 'precioPagColor' => 'Precio pág. Color', + 'factorAltura' => 'Factor altura', + 'factorAnchura' => 'Factor anchura', + 'paginasPliego' => 'Páginas/pliego', + 'metrosPapelLibro' => 'M. Papel Libro', + 'metrosPapelTotal' => 'M. Papel Total', + 'clicksLibro' => 'Clicks/Libro', + 'gTintaNegro' => 'G. tinta Negro', + 'gTintaCyan' => 'G. tinta Cyan', + 'gTintaMagenta' => 'G. tinta Magenta', + 'gTintaAmarillo' => 'G. tinta Amarillo', + 'clicksPedido' => 'Clicks Pedido', + 'totalClicks' => 'Total Clicks', + 'totalTinta' => 'Total Tinta', + 'totalCorte' => 'Total Corte', + 'totalImpresion' => 'TOTAL IMPRES.', + 'velocidadCorte' => 'Velocidad corte', + 'precioHoraCorte' => 'Precio hora corte', + 'tiempoCorte' => 'Tiempo corte', + 'gTintaNegroPed' => 'G.T. Negro Ped.', + 'gTintaCyanPed' => 'G.T. Cyan Ped.', + 'gTintaMagentaPed' => 'G.T. Magenta Ped.', + 'gTintaAmarilloPed' => 'G.T. Amarillo Ped.', 'servicioAcabado' => 'Servicio de acabado', 'servicioPreimpresion' => 'Servicio de preimpresión', diff --git a/ci4/app/Models/Configuracion/PapelGenericoModel.php b/ci4/app/Models/Configuracion/PapelGenericoModel.php index 32bddfeb..eb971ea2 100644 --- a/ci4/app/Models/Configuracion/PapelGenericoModel.php +++ b/ci4/app/Models/Configuracion/PapelGenericoModel.php @@ -114,6 +114,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel ->where("t1.is_deleted", 0) ->where("t2.is_deleted", 0) + ->where("t3.active", 1) ->where("t4.is_deleted", 0) ->where("t4.tipo", "impresion") ->where("t5.tipo", $tipo); @@ -134,21 +135,34 @@ class PapelGenericoModel extends \App\Models\GoBaseModel public function getGramajeComparador(string $papel_generico_nombre="", $uso="") { + $tipo=$uso; // color y colorhq valen para los dos + if($uso == 'bn') + $tipo="negro"; + if($uso == 'bnhq') + $tipo="negrohq"; + $builder = $this->db ->table($this->table . " t1") ->select( "t2.gramaje AS text" ) ->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("t2.isActivo", 1) + ->where("t3.active", 1) + ->where("t4.is_deleted", 0) + ->where("t4.tipo", "impresion") + ->where("t5.tipo", $tipo) ->where("t1.nombre", $papel_generico_nombre); - if($uso == 'bn') + if($uso == 'bn' || $uso == 'bnhq') $builder->where("t2.bn", 1); - else if ($uso == 'color') + else if ($uso == 'color' || $uso == 'colorhq') $builder->where("t2.color", 1); else if ($uso == 'cubierta') $builder->where("t2.cubierta", 1); diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index 14d4a374..c3a05d5c 100644 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -361,10 +361,18 @@ class PresupuestoService extends BaseService } public static function getTiempoMaquina($totalClicks, $precioClick, $velocidadMaquina) { + try { + + if($precioClick>0 && $velocidadMaquina>0) + $minutos = (1.0*$totalClicks/$precioClick)/$velocidadMaquina; + else + $minutos = 0; - $minutos = (1.0*$totalClicks/$precioClick)/$velocidadMaquina; - - return gmdate("H:i:s", round($minutos*60,0)); + return gmdate("H:i:s", round($minutos*60,0)); + + } catch (Exception $e) { + return gmdate("H:i:s", round(0,0)); + } } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index e5fef0a9..88cd20a4 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -12,27 +12,784 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + + + + + + +
+ + + + + + + +
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
@@ -40,4 +797,26 @@ - \ No newline at end of file + + + + + +section("additionalInlineJs") ?> + +$('#lp_rot_color_vercalculos').on("click", function () { + if($( ".calculos_rot_color" ).css('display') == 'none') + $( ".calculos_rot_color" ).css('display', 'flex') + else{ + $( ".calculos_rot_color" ).css('display', 'none') + } +}); + +$('#lp_rot_bn_vercalculos').on("click", function () { + if($( ".calculos_rot_bn" ).css('display') == 'none') + $( ".calculos_rot_bn" ).css('display', 'flex') + else{ + $( ".calculos_rot_bn" ).css('display', 'none') + } +}); +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js index b33a663e..6194f0ec 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js @@ -50,15 +50,19 @@ $('#compPaginasNegrohq').on("change", function () { }); $('#compPaginasColorhq').on("change", function () { - if (document.getElementById('paginas').value < document.getElementById('compPaginasColorhq').value) { - document.getElementById('compPaginasColorhq').value = document.getElementById('paginas').value; - } + const paginas = parseInt(document.getElementById('paginas').value); + var color = parseInt(document.getElementById('compPaginasColorhq').value); + var negro = parseInt(document.getElementById('compPaginasNegrohq').value); - if (document.getElementById('compPaginasNegrohq').value + document.getElementById('compPaginasColorhq').value > document.getElementById('paginas').value) { - var newValue = document.getElementById('paginas').value - document.getElementById('compPaginasColorhq').value; + if (paginas < color) { + document.getElementById('compPaginasColorhq').value = paginas; + color = paginas + } + var newValue = paginas - color; + if (newValue != negro) { document.getElementById('compPaginasNegrohq').value = newValue >= 0 ? newValue : 0; + $('#compPaginasNegrohq').change(); } - }); $('#paginas').on("change", function () { diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php index e73e9d02..5b92d14c 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php @@ -116,6 +116,10 @@ allowClear: false, }); + $('#compGramajeColorhq').select2({ + allowClear: false, + }); + $('#compPapelCubierta').select2({ allowClear: false, }); @@ -334,6 +338,9 @@ ] }); + const papelGenericoNegroList = ; + + var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{ scrollX: true, searching: false, @@ -345,73 +352,7 @@ language: { url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" }, - columns: [ - { 'data': 'tipo', - 'render': function ( data, type, row, meta ) { - if(data=='bn') - return '\" />'; - else if(data=='bnhq') - return '\" />'; - else if(data=='color') - return '\" />'; - else if(data=='colorhq') - return '\" />'; - else if(data=='rotativabn') - return '\" />'; - else if(data=='rotativacolor') - return '\" />'; - else - return ''; - } - }, - { 'data': 'paginas' }, - { 'data': 'papel' }, - { 'data': 'gramaje' }, - { 'data': 'marca' }, - { 'data': 'maquina' }, - { 'data': 'tiempo' }, - { 'data': 'numeroPliegos' }, - { 'data': 'pliegosPedido' }, - { 'data': 'precioPliego' }, - { 'data': 'libro' }, - { 'data': 'totalPapelPedido' }, - { 'data': 'chekPapel', - render: function (data,type,row) { - if (data == true) { - return ''; - } else { - return ''; - } - return data; - } - }, - { 'data': 'lomo' }, - { 'data': 'peso' }, - { 'data': 'click' }, - { 'data': 'totalClicks' }, - { 'data': 'chekClicks', - render: function (data,type,row) { - if (data == true) { - return ''; - } else { - return ''; - } - return data; - } - }, - { 'data': 'maquinaId'}, - { 'data': 'tiempoMaquina'}, - { 'data': 'maquinaVelocidad'}, - { 'data': 'papelGenericoId'}, - { 'data': 'papelImpresionId'} - ], - columnDefs: [ - { - target: [18,19,20,21,22], - visible: false, - searchable: false - }, - ] + }); @@ -458,7 +399,7 @@ url: "/cosidotapablanda/datatable", data: datos, success: function (data) { - + console.log(data) clearIntLineas(is_color); if(data.lineas.length >0){ @@ -644,8 +585,7 @@ elementos = getIDsComparador(is_color, is_hq) - if ($('#compPaginasNegro').val() && - $(''+ elementos.papel).select2('data').length > 0 && + if ($(''+ elementos.papel).select2('data').length > 0 && $(''+ elementos.gramaje).select2('data').length > 0 && parseInt($(''+ elementos.paginas).val()) > 0 && checkDatosPedidoForComp()) { @@ -732,7 +672,7 @@ data: function (params) { return { tipo: 'gramaje', - uso: 'bn', + uso: 'bnhq', datos: $('#compPapelNegrohq').select2('data')[0].text.trim() , : v }; @@ -820,7 +760,7 @@ data: function (params) { return { tipo: 'gramaje', - uso: 'color', + uso: 'colorhq', datos: $('#compPapelColorhq').select2('data')[0].text.trim() , : v }; diff --git a/httpdocs/themes/vuexy/css/sk-datatables.css b/httpdocs/themes/vuexy/css/sk-datatables.css index 00678af4..40066c00 100644 --- a/httpdocs/themes/vuexy/css/sk-datatables.css +++ b/httpdocs/themes/vuexy/css/sk-datatables.css @@ -40,4 +40,52 @@ table.dataTable.table-hover>tbody>tr.selected:hover>* { .comparator-table td.dt-result-value { text-align: left; +} + + +.lp-cell { + padding-left: 1px; + padding-right: 1px; + margin:0; +} + +.lp-input { + min-width: 40px; + width: 100%; + border-radius: 0.25rem !important; +} + +.lp-select { + padding-top: 2px; + padding-bottom: 2px; + width: 100%; + font-size:0.7rem !important; +} + +.lp-td { + padding-left: 1px; + padding-right: 1px; + margin:0 !important; +} + +.lp-header { + text-align: center !important; + padding-left: 1px !important; + padding-right: 1px !important; + padding-top: 1px !important; + padding-bottom: 5px !important; + margin:0 !important; +} + +.lp-cell-disabled { + background-color: Gainsboro; +} + +.lp-button{ + font-size: 1.1em; + padding-left: 3px; + padding-right: 3px; + width: 100%; + height: 25px; + margin-top: 6px; } \ No newline at end of file