diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index 9fc72223..473253b8 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -344,7 +344,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $this->viewData['acabadosSobrecubierta'] = $this->getAcabadosSobrecubierta(); // Lineas Presupuesto - [$cambios_lineas, $this->viewData['lineasPresupuesto']] = $this->getLineasPresupuesto($presupuestoEntity); + [$cambios_lineas, $this->viewData['lineasPresupuesto']] = $this->loadLineasPresupuesto($presupuestoEntity); $this->viewData['presupuestoEntity']->cambios_lineas = $cambios_lineas; // Servicios @@ -542,6 +542,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $data['comparador']['lomoRedondo'] = $presupuesto->lomo_redondo; $data['comparador']['cabezada'] = $presupuesto->cabezada; + $data['lineasPresupuesto'] = $this->loadLineasPresupuesto($presupuesto); + /* @@ -909,6 +911,11 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController 'nombre' => $reqData['papel_generico'] ?? "", ]; + if($papel_generico['id'] != 0 && $papel_generico['nombre'] == ""){ + $modelPapelGenerico = new PapelGenericoModel(); + $papel_generico['nombre'] = $modelPapelGenerico->getNombre($papel_generico['id'])['nombre']; + } + $gramaje = $reqData['gramaje'] ?? 0; $cliente_id = $reqData['cliente_id'] ?? -1; @@ -1707,7 +1714,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController return model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value; } - protected function getLineasPresupuesto($presupuestoEntity) + protected function loadLineasPresupuesto($presupuestoEntity) { $lineas = (new PresupuestoLineaModel())->getLineasPresupuesto($presupuestoEntity->id); diff --git a/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php b/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php index 6a34a602..47e6ec82 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php @@ -330,8 +330,9 @@ class PresupuestoLineaModel extends \App\Models\BaseModel $builder = $this->db ->table($this->table . " t1") ->select( - "*" + "*, t2.nombre AS papel_generico" ) + ->join("lg_papel_generico t2", "t1.papel_id = t2.id", "left") ->where("t1.presupuesto_id", $presupuesto_id); return $builder->orderBy("t1.id", "asc")->get()->getResultObject(); 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 19e5920c..dc99b9d2 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js @@ -333,325 +333,6 @@ function change_focus(){ } -// Formatting function for row details - modify as you need -function format(d) { - - var value = ''+ - ''+ - ''+ - ''+ - '
' + - '
' + - window.Presupuestos.numeroPliegos + - ''+ - '
'+ - '
' + - window.Presupuestos.pliegosPedido + - ''+ - '
'+ - '
' + - window.Presupuestos.precioPliego + - ''+ - '
'+ - '
' + - window.Presupuestos.libro + - ''+ - '
'+ - '
' + - window.Presupuestos.totalPapelPedido + - ''+ - '
'+ - '' + - '
' + - '' + - '
'+ - '
' + - window.Presupuestos.click + - ''+ - '
'+ - '
' + - window.Presupuestos.totalClicks + - ''+ - '
'+ - '
' + - window.Presupuestos.horas + - ''+ - '
'+ - '
' + - window.Presupuestos.precioHora + - ''+ - '
'+ - '
' + - window.Presupuestos.precioImpresion + - ''+ - '
'+ - '
' + - '' + - '
'+ - '' + - '' + - '
' + - '' - - - - - value += '' - - if(d.maquinaTipo=='inkjet'){ - value += - ''+ - ''+ - ''+ - ''+ - '
' + - '
' + - '' + - '
'+ - '
' + - window.Presupuestos.numPagColor + - '' + - '
' + - ((d.row_id.includes('rot'))?'
' + - window.Presupuestos.saturacion + - '' + - '
':'') + - '
' + - window.Presupuestos.cobNegro + - '' + - '
' + - '
' + - window.Presupuestos.cobCyan + - '' + - '
' + - '
' + - window.Presupuestos.cobMagenta + - '' + - '
' + - '
' + - window.Presupuestos.cobAmarillo + - '' + - '
' + - ((!d.row_id.includes('rot'))? - '
' + - window.Presupuestos.cobCG + - '' + - '
':'') + - '
' + - window.Presupuestos.gotaNegro + - '' + - '
' + - '
' + - window.Presupuestos.gotaColor + - '' + - '
' + - '
' + - window.Presupuestos.aFavorFibra + - '' + - '
' + - '
' + - '' + - '
' + - '
' + - - '' + - '' + - ''+ - ''+ - ''+ - ''+ - '
' + - ((!d.row_id.includes('rot'))? - '
' + - window.Presupuestos.factorAltura + - '' + - '
' + - '
' + - window.Presupuestos.factorAnchura + - '' + - '
':'') + - (d.row_id.includes('rot')?'
': '' + - - (d.row_id.includes('rot')?'
' + - window.Presupuestos.resolucion + - '' + - '
':'') + - (d.row_id.includes('rot')?'
' + - window.Presupuestos.areaPaginas + - '' + - '
':'') + - '
' + - window.Presupuestos.gotasNegro + - '' + - '
' + - '
' + - window.Presupuestos.gotasCyan + - '' + - '
' + - '
' + - window.Presupuestos.gotasMagenta + - '' + - '
' + - '
' + - window.Presupuestos.gotasAmarillo + - '' + - '
' + - (!(d.row_id.includes('rot'))?'
' + - window.Presupuestos.gotasCG + - '' + - '
':'') + - '
' + - window.Presupuestos.precioPagNegro + - '' + - '
' + - '
' + - window.Presupuestos.precioPagColor + - '' + - '
' + - (d.row_id.includes('rot')? - '
' + - window.Presupuestos.factorAltura + - '' + - '
' + - '
' + - window.Presupuestos.factorAnchura + - '' + - '
':'') + - (d.row_id.includes('rot')?'
' + - window.Presupuestos.paginasPliego + - '' + - '
':'') + - '
' + - '' + - '' + - ''+ - ''+ - ''+ - ''+ - '
' + - (d.row_id.includes('rot')?'
': '' + - (d.row_id.includes('rot')?'
': '' + - (d.row_id.includes('rot')?'
' + - window.Presupuestos.clicksLibro + - '' + - '
':'') + - ((!d.row_id.includes('rot'))?'
' + - window.Presupuestos.saturacion + - '' + - '
':'') + - ((!d.row_id.includes('rot'))?'
' + - window.Presupuestos.paginasPliego + - '' + - '
':'') + - '
' + - window.Presupuestos.gTintaNegro + - '' + - '
' + - '
' + - window.Presupuestos.gTintaCyan + - '' + - '
' + - '
' + - window.Presupuestos.gTintaMagenta + - '' + - '
' + - '
' + - window.Presupuestos.gTintaAmarillo + - '' + - '
' + - (!(d.row_id.includes('rot'))?'
' + - window.Presupuestos.gTintaCG + - '' + - '
':'') + - ((!d.row_id.includes('rot'))?'
' + - window.Presupuestos.clicksLibro + - '' + - '
':'') + - '
' + - window.Presupuestos.clicksPedido + - '' + - '
' + - '
' + - window.Presupuestos.totalClicks + - '' + - '
' + - '
' + - window.Presupuestos.totalTinta + - '' + - '
' + - (d.row_id.includes('rot')?'
': '' + - '
' + - window.Presupuestos.totalImpresion + - '' + - '
' + - '
' + - '' + - '' + - ''+ - ''+ - ''+ - ''+ - '
' + - ((!d.row_id.includes('rot'))?'
' + - window.Presupuestos.resolucion + - '' + - '
':'') + - ((!d.row_id.includes('rot'))?'
' + - window.Presupuestos.areaPaginas + - '' + - '
':'') + - (d.row_id.includes('rot')?'
': '' + - (d.row_id.includes('rot')?'
': '' + - (d.row_id.includes('rot')?'
': '' + - '
' + - window.Presupuestos.gTintaNegroPed + - '' + - '
' + - '
' + - window.Presupuestos.gTintaCyanPed + - '' + - '
' + - '
' + - window.Presupuestos.gTintaMagentaPed + - '' + - '
' + - '
' + - window.Presupuestos.gTintaAmarilloPed + - ''+ - '
' + - (!(d.row_id.includes('rot'))?'
' + - window.Presupuestos.gTintaCGPed + - ''+ - '
':'') + - '
' + - '' + - '' - } - - return $(value).toArray(); -} - @@ -687,3699 +368,3 @@ $(document).on('click', '.btn-delete-lp', function(e) { - - -function processRowData(row, rowId, rowClass){ - - var icon = "" - if(rowId=='lp_bn'){ - if(row.tipo_maquina=='toner') - icon = '' - else - icon = '' - } - - else if(rowId=='lp_bnhq'){ - if(row.tipo_maquina=='toner') - icon = '' - else - icon = '' - } - else if(rowId=='lp_color'){ - if(row.tipo_maquina=='toner') - icon = '' - else - icon = '' - } - else if(rowId=='lp_colorhq'){ - if(row.tipo_maquina=='toner') - icon = '' - else - icon = '' - } - - else if(rowId=='lp_cubierta') - icon = '' - else if(rowId=='lp_sobrecubierta') - icon = '' - else if(rowId=='lp_guardas') - icon = '' - else if(rowId=='lp_rot_bn') - icon = '' - else if(rowId=='lp_rot_color') - icon = '' - - const blank_line = (typeof row.tarifa_impresion_id === 'undefined')?1:0; - var data = { - 'row_id': rowId, - 'row_class': rowClass, - - 'tarifa_impresion_id': blank_line?0:isNaN(parseInt(row.tarifa_impresion_id)) ? "" : parseInt(row.tarifa_impresion_id), - 'maquina_ancho': blank_line?0:isNaN(parseFloat(row.dimensiones_maquina[0])) ? "" : parseFloat(row.dimensiones_maquina[0]), - 'maquina_alto': blank_line?0:isNaN(parseFloat(row.dimensiones_maquina[1])) ? "" : parseFloat(row.dimensiones_maquina[1]), - 'maquina_impresion_ancho': blank_line?0:isNaN(parseFloat(row.dimensiones_maquina_impresion[0])) ? "" : parseFloat(row.dimensiones_maquina_impresion[0]), - 'maquina_impresion_alto': blank_line?0:isNaN(parseFloat(row.dimensiones_maquina_impresion[1])) ? "" : parseFloat(row.dimensiones_maquina_impresion[1]), - 'formas': blank_line?0:isNaN(parseInt(row.num_formas.value)) ? 0 : parseInt(row.num_formas.value), - 'formas_v': blank_line?0:isNaN(parseInt(row.num_formas.num_formas_verticales)) ? 0 : parseInt(row.num_formas.num_formas_verticales), - 'formas_h': blank_line?0:isNaN(parseInt(row.num_formas.num_formas_horizontales)) ? 0 : parseInt(row.num_formas.num_formas_horizontales), - 'formas_orientacion': blank_line?0:row.num_formas.posicion_formas, - - 'icon': icon, - 'paginas': blank_line?0:row.paginas, - 'paginas_impresion': rowId=='lp_guardas'?row.paginas_impresion:0, - 'papel': blank_line?"":row.papel_generico_id, - 'gramaje': blank_line?"":row.gramaje, - 'papel_impresion': blank_line?"":row.papel_impresion, - 'papel_impresion_id': blank_line?"":row.papel_impresion_id, - 'maquina': blank_line?"":row.maquina, - 'maquina_id': blank_line?"":row.maquina_id, - - 'tiempo': blank_line?"":row.tiempo_maquina, - 'lomo': isNaN(parseFloat(row.mano)) ? "" : parseFloat(row.mano).toFixed(2), - 'peso': isNaN(parseFloat(row.peso)) ? "" : parseFloat(row.peso).toFixed(2), - - 'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2), - - 'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(0), - 'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(0), - 'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6), - 'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2), - 'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2), - 'margenPapelPedido': isNaN(parseFloat(row.margen_papel_pedido)) ? "": parseFloat(row.margen_papel_pedido).toFixed(2), - 'click': isNaN(parseFloat(row.precio_click)) ? "" : parseFloat(row.precio_click).toFixed(6), - 'totalClicks': isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2), - 'margenClicks': isNaN(parseFloat(row.margen_click_pedido)) ? "" : parseFloat(row.margen_click_pedido).toFixed(2), - 'horasMaquina': isNaN(parseFloat(row.horas_maquina)) ? "" : parseFloat(row.horas_maquina).toFixed(4), - 'precioHora': isNaN(parseFloat(row.precio_hora)) ? "" : parseFloat(row.precio_hora).toFixed(2), - 'precioImpresion': isNaN(parseFloat(row.precio_impresion_horas)) ? "" : parseFloat(row.precio_impresion_horas).toFixed(2), - 'margenImpresion': isNaN(parseFloat(row.margen_impresion_horas)) ? "" : parseFloat(row.margen_impresion_horas).toFixed(2), - 'maquinaTipo': row.tipo_maquina, - 'check_papel_total': row.check_papel_total, - 'check_impresion_total': row.check_impresion_total, - } - - if(row.tipo_maquina=='inkjet'){ - - data.numPagColor = row.paginas_color - data.aFavorFibra = row.a_favor_fibra - data.cobNegro = isNaN(parseFloat(row.datosTipologias.negro)) ? "" : parseFloat(row.datosTipologias.negro).toFixed(2) - data.cobCyan = isNaN(parseFloat(row.datosTipologias.cyan)) ? "" : parseFloat(row.datosTipologias.cyan).toFixed(2) - data.cobMagenta = isNaN(parseFloat(row.datosTipologias.magenta)) ? "" : parseFloat(row.datosTipologias.magenta).toFixed(2) - data.cobAmarillo = isNaN(parseFloat(row.datosTipologias.amarillo)) ? "" : parseFloat(row.datosTipologias.amarillo).toFixed(2) - data.gotaNegro = isNaN(parseFloat(row.datosTipologias.gota_negro)) ? "" : parseFloat(row.datosTipologias.gota_negro).toFixed(2) - data.gotaColor = isNaN(parseFloat(row.datosTipologias.gota_color)) ? "" : parseFloat(row.datosTipologias.gota_color).toFixed(2) - - data.resolucion = isNaN(parseFloat(row.resolucion)) ? "" : parseFloat(row.resolucion).toFixed(0) - data.areaPaginas = isNaN(parseFloat(row.superficie)) ? "" : parseFloat(row.superficie).toFixed(2) - - data.gotasNegro = isNaN(parseFloat(row.num_gotas_negro)) ? "" : parseFloat(row.num_gotas_negro).toFixed(0) - data.gotasCyan = isNaN(parseFloat(row.num_gotas_cyan)) ? "" : parseFloat(row.num_gotas_cyan).toFixed(0) - data.gotasMagenta = isNaN(parseFloat(row.num_gotas_magenta)) ? "" : parseFloat(row.num_gotas_magenta).toFixed(0) - data.gotasAmarillo = isNaN(parseFloat(row.num_gotas_amarillo)) ? "" : parseFloat(row.num_gotas_amarillo).toFixed(0) - data.precioPagNegro = isNaN(parseFloat(row.precio_pagina_negro)) ? "" : parseFloat(row.precio_pagina_negro).toFixed(6) - data.precioPagColor = isNaN(parseFloat(row.precio_pagina_color)) ? "" : parseFloat(row.precio_pagina_color).toFixed(6) - data.factorAltura = isNaN(parseFloat(row.factor_altura)) ? "" : parseFloat(row.factor_altura).toFixed(2) - data.factorAnchura = isNaN(parseFloat(row.factor_anchura)) ? "" : parseFloat(row.factor_anchura).toFixed(2) - data.paginasPliego = isNaN(parseFloat(row.paginas_por_pliego)) ? "" : parseFloat(row.paginas_por_pliego).toFixed(2) - - if(rowId.includes('rot')){ - data.metrosMinuto = isNaN(parseFloat(row.maquina_velocidad)) ? "" : parseFloat(row.maquina_velocidad).toFixed(2) - data.metrosPapelLibro = isNaN(parseFloat(row.metros_papel_libro)) ? "" : parseFloat(row.metros_papel_libro).toFixed(2) - data.metrosPapelTotal = isNaN(parseFloat(row.metros_papel_total)) ? "" : parseFloat(row.metros_papel_total).toFixed(2) - data.velocidadCorte = isNaN(parseFloat(row.velocidad_corte)) ? "" : parseFloat(row.velocidad_corte).toFixed(2) - data.precioHoraCorte = isNaN(parseFloat(row.precio_hora_corte)) ? "" : parseFloat(row.precio_hora_corte).toFixed(2) - data.tiempoCorte = isNaN(parseFloat(row.tiempo_corte)) ? "" : parseFloat(row.tiempo_corte).toFixed(2) - data.totalCorte = isNaN(parseFloat(row.total_corte)) ? "" : parseFloat(row.total_corte).toFixed(2) - } - else{ - data.totalCorte = 0 - } - - data.clicksLibro = isNaN(parseFloat(row.clicks_libro)) ? "" : parseFloat(row.clicks_libro).toFixed(0) - data.gTintaNegro = isNaN(parseFloat(row.peso_gotas_negro)) ? "" : parseFloat(row.peso_gotas_negro).toFixed(2) - data.gTintaCyan = isNaN(parseFloat(row.peso_gotas_cyan)) ? "" : parseFloat(row.peso_gotas_cyan).toFixed(2) - data.gTintaMagenta = isNaN(parseFloat(row.peso_gotas_magenta)) ? "" : parseFloat(row.peso_gotas_magenta).toFixed(2) - data.gTintaAmarillo = isNaN(parseFloat(row.peso_gotas_amarillo)) ? "" : parseFloat(row.peso_gotas_amarillo).toFixed(2) - data.clicksPedido = isNaN(parseFloat(row.clicks_pedido)) ? "" : parseFloat(row.clicks_pedido).toFixed(0) - data.totalClicksPedido = isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2) - data.totalTinta = isNaN(parseFloat(row.precio_tinta)) ? "" : parseFloat(row.precio_tinta).toFixed(2) - - data.totalImpresion = isNaN(parseFloat(row.precio_click_pedido+row.precio_tinta+data.totalCorte)) ? "" : parseFloat(row.precio_click_pedido+row.precio_tinta+data.totalCorte).toFixed(2) - - data.gTintaNegroPed = isNaN(parseFloat(row.peso_gotas_negro_pedido)) ? "" : parseFloat(row.peso_gotas_negro_pedido).toFixed(2) - data.gTintaCyanPed = isNaN(parseFloat(row.peso_gotas_cyan_pedido)) ? "" : parseFloat(row.peso_gotas_cyan_pedido).toFixed(2) - data.gTintaMagentaPed = isNaN(parseFloat(row.peso_gotas_magenta_pedido)) ? "" : parseFloat(row.peso_gotas_magenta_pedido).toFixed(2) - data.gTintaAmarilloPed = isNaN(parseFloat(row.peso_gotas_amarillo_pedido)) ? "" : parseFloat(row.peso_gotas_amarillo_pedido).toFixed(2) - - if(!rowId.includes('rot')){ - data.cobCG = isNaN(parseFloat(row.datosTipologias.cg)) ? "" : parseFloat(row.datosTipologias.cg).toFixed(2) - data.gotasCG = isNaN(parseFloat(row.num_gotas_cg)) ? "" : parseFloat(row.num_gotas_cg).toFixed(2) - data.gTintaCG = isNaN(parseFloat(row.peso_gotas_cg)) ? "" : parseFloat(row.peso_gotas_cg).toFixed(2) - data.gTintaCGPed = isNaN(parseFloat(row.peso_gotas_cg_pedido)) ? "" : parseFloat(row.peso_gotas_cg_pedido).toFixed(2) - } - - - data.alto_click = row.alto_click - } - - return data -} - - - -$('.paginas-lp').on('change', function(){ - checkPaginasPresupuesto() -}) - - -function verCalculosInkjet(e){ - if($( ".calculos_" + e.data.rowId ).css('display') == 'none') - $( ".calculos_" + e.data.rowId ).css('display', 'table-row') - else{ - $( ".calculos_" + e.data.rowId ).css('display', 'none') - } -}; - - - -function clear_interior(row_id = ''){ - switch(row_id) { - case 'lp_bn': - clear_lp_bn(true); - break; - case 'lp_color': - clear_lp_color(true); - break; - case 'lp_bnhq': - clear_lp_bnhq(true); - break; - case 'lp_colorhq': - clear_lp_colorhq(true); - break; - default: - clear_lp_bn(true); - clear_lp_color(true); - clear_lp_bnhq(true); - clear_lp_colorhq(true); - break; - } - if(row_id.length>0) - tableLineasPresupuesto.row( row_id ) - .remove() - .draw(); - else{ - tableLineasPresupuesto.row( '#lp_bn' ) - .remove().draw() - tableLineasPresupuesto.row( '#lp_bnhq' ) - .remove().draw() - tableLineasPresupuesto.row( '#lp_color' ) - .remove().draw() - tableLineasPresupuesto.row( '#lp_colorhq' ) - .remove().draw() - } -} - - -function clear_rotativa(row_id = ''){ - switch(row_id) { - case 'lp_rot_bn': - clear_lp_rot_bn(true); - break; - case 'lp_rot_color': - clear_lp_rot_color(true); - break; - default: - clear_lp_rot_bn(true); - clear_lp_rot_color(true); - break; - } - if(row_id.length>0) - tableLineasPresupuesto.row( row_id ) - .remove() - .draw(); - else{ - tableLineasPresupuesto.row( '#lp_rot_bn' ) - .remove().draw() - tableLineasPresupuesto.row( '#lp_rot_color' ) - .remove().draw() - } -} - - -function clear_cubierta(){ - clear_lp_cubierta(true); -} - -function clear_sobrecubierta(){ - clear_lp_sobrecubierta(true); -} - - -$('.insertarLinea').on("click", function (e) { - - if(e.target.id.includes("Plana")){ - - clear_interior(); - clear_rotativa(); - - var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray(); - - for(row of rows){ - if(row['tipo'] =='bn'){ - fill_lp_bn(row, true); - } - else if(row['tipo'] =='bnhq'){ - fill_lp_bnhq(row, true); - } - else if(row['tipo'] =='color'){ - fill_lp_color(row, true); - } - else if(row['tipo'] =='colorhq'){ - fill_lp_colorhq(row, true); - } - } - } - if(e.target.id.includes("Rotativa")){ - - clear_rotativa(); - clear_interior(); - - var rows = $("#tableCompIntRotativa").DataTable().rows( '.selected' ).data().toArray(); - for(row of rows){ - if(row['paginasColor'] ==0){ - fill_lp_rot_bn(row, true); - } - else if(row['paginasColor'] >0){ - fill_lp_rot_color(row, true); - } - } - } - - if(e.target.id.includes("Cubierta")){ - - clear_cubierta(); - - var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray(); - for(row of rows){ - if(row.tipo == 'cubierta'){ - fill_lp_cubierta(row, true); - if($('#acabado_cubierta_id').val() > 0) - insertar_acabado_exterior($('#acabado_cubierta_id').val(), window.Presupuestos.cubierta) - } - } - - clear_sobrecubierta(); - - for(row of rows){ - if(row.tipo == 'sobrecubierta'){ - fill_lp_sobrecubierta(row, true); - if($('#acabado_sobrecubierta_id').val() > 0) - insertar_acabado_exterior($('#acabado_sobrecubierta_id').val(), window.Presupuestos.sobrecubierta) - } - } - } - - if(e.target.id.includes("Guardas")){ - - clear_guardas(); - - var rows = $("#tableCompGuardas").DataTable().rows( '.selected' ).data().toArray(); - for(row of rows){ - fill_lp_guardas(row, true); - } - servicioGuardas(true) - } - - - updatePresupuesto({ - update_lineas: false, - update_servicios: true, - update_envios: false, - update_resumen: true, - update_tiradas_alternativas: true}) - - -}); - - -$('#btn_addLinea').on("click", function (e) { - - var dataRows = tableLineasPresupuesto - .rows() - .data(); - - switch($('#addLineasPresupuesto').val()){ - // Se chequean todas las lineas de negro y todas las de color - // (solo una de cada en interior) - - case 'lp_bn': - var hayLinea = false - for(let number=0;number', {'value':data.menu[item].id, 'text':data.menu[item].text}) - $('#lp_bn_gramaje').append(option); - }); - if(mantenerSeleccion){ - $('#lp_bn_gramaje option').filter(function() { - return $(this).html() == previous; - }).prop('selected', true); - } - else{ - $('#lp_bn_gramaje').val('') - } - - } - }); -} - - - -async function set_lp_bn_papelImpresion(){ - - var datos = { - tipo: 'papelImpresion', - uso: 'negro', - datos: $('#lp_bn_papel option:selected').val() , - gramaje: $('#lp_bn_gramaje option:selected').text().trim() , - tipoLinea: "negro", - }; - datos = Object.assign(datos, window.token_ajax); - - await $.ajax({ - type: 'post', - url: window.routes_lp.menuItemsOfPresupuestoAdmin, - beforeSend: function() { - $('#lp_bn_papelImpresion').empty() - $('#lp_bn_maquina').empty() - clear_lp_bn(false) - }, - data: datos, - dataType: 'json', - success: function (data) { - yeniden(data[window.csrf_token]); - $.each(data.menu, function(item){ - var option = $('