diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
index 2d654e69..ce26e620 100755
--- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
+++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
@@ -189,6 +189,28 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
// JJO
$sanitizedData['user_updated_id'] = $session->id_user;
+ if ($this->request->getPost('retractilado') == null) {
+ $sanitizedData['retractilado'] = false;
+ }
+ if ($this->request->getPost('retractilado5') == null) {
+ $sanitizedData['retractilado5'] = false;
+ }
+ if ($this->request->getPost('ferro') == null) {
+ $sanitizedData['ferro'] = false;
+ }
+ if ($this->request->getPost('ferro_digital') == null) {
+ $sanitizedData['ferro_digital'] = false;
+ }
+ if ($this->request->getPost('prototipo') == null) {
+ $sanitizedData['prototipo'] = false;
+ }
+ if ($this->request->getPost('marcapaginas') == null) {
+ $sanitizedData['marcapaginas'] = false;
+ }
+ if ($this->request->getPost('faja_color') == null) {
+ $sanitizedData['faja_color'] = false;
+ }
+
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@@ -295,6 +317,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['POD'] = $this->getPOD();
+ $this->viewData['serviciosCheckboxes'] = [
+ 'retractilado' => 3,
+ 'retractilado5' => 5,
+ 'ferro' => 24,
+ 'prototipo' => 9,
+ 'fajaColor' => 16,
+ ];
+
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php
index e27c9841..441a6b9c 100755
--- a/ci4/app/Controllers/Test.php
+++ b/ci4/app/Controllers/Test.php
@@ -17,9 +17,9 @@ class Test extends BaseController
public function index()
{
- $model = model('App\Models\Tarifas\TarifaEnvioPrecioModel');
+
echo '
';
- var_dump($model->getEnvioPrecio(2, 1.5, "cajas"));
+ var_dump($this->get_tarifa_enc(18, 150, 100, 98,148));
echo '';
}
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
index 9d29fe8d..579aca2c 100755
--- a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
+++ b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
@@ -49,7 +49,6 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"sobrecubiertas_ancho" => 0.0,
"merma" => null,
"merma_portada" => 6.0,
- "imagenes_bn_interior" => false,
"comentarios_cliente" => null,
"comentarios_safekat" => null,
"comentarios_pdf" => null,
@@ -215,7 +214,6 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"sobrecubiertas_ancho" => "float",
"merma" => "float",
"merma_portada" => "float",
- "imagenes_bn_interior" => "boolean",
"en_produccion" => "boolean",
"en_espera" => "boolean",
"modo_comparador" => "boolean",
diff --git a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php
index ae47dd9e..10d4d387 100755
--- a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php
+++ b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php
@@ -158,10 +158,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
public function getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id, $POD){
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
- if($proveedor_id != -1)
+ if($proveedor_id != -1){
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id);
- else
+ }
+ else{
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto);
+ }
if (count($tarifa_value)>0) {
$result_data = $this->calcularTarifa($tarifa_value[0], $paginas, $POD<$tirada?false:true);
diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php
index d0dcc543..19e50f1f 100755
--- a/ci4/app/Models/Presupuestos/PresupuestoModel.php
+++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php
@@ -69,7 +69,6 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"sobrecubiertas_ancho",
"merma",
"merma_portada",
- "imagenes_bn_interior",
"comentarios_cliente",
"comentarios_safekat",
"comentarios_pdf",
diff --git a/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php b/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php
index 84a60339..c4eb90e9 100755
--- a/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php
+++ b/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php
@@ -158,11 +158,11 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
$builder->where('t2.tirada_min <=', $tirada);
$builder->where('t2.tirada_max >=', $tirada);
$builder->where('t3.paginas_libro_min <=', $paginas);
- $builder->where('t3.paginas_libro_max >', $paginas);
+ $builder->where('t3.paginas_libro_max >=', $paginas);
$builder->where('t4.ancho_min <=', $ancho);
- $builder->where('t4.ancho_max >', $ancho);
+ $builder->where('t4.ancho_max >=', $ancho);
$builder->where('t4.alto_min <=', $alto);
- $builder->where('t4.alto_max >', $alto);
+ $builder->where('t4.alto_max >=', $alto);
if($proveedor_id != -1){
$builder->where('t2.proveedor_id', $proveedor_id);
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 b5c3bef2..280f83c2 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php
@@ -233,33 +233,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -358,11 +333,37 @@ $('#papelFormatoPersonalizado').on("click",function(){
var ancho_libro = getDimensionLibro().ancho;
var alto_libro = getDimensionLibro().alto;
+
+ $('#retractilado').on("change", function () {
+ checkRetractiladoComparador(this);
+ servicioRetractilado()
+ });
+
+
+ $('#retractilado5').on("change", function () {
+ checkRetractiladoComparador(this);
+ servicioRetractilado5()
+ });
+
+ $('#fajaColor').on("change", function () {
+ servicioFajaColor()
+ });
+
+ $('#ferro').on("change", function () {
+ servicioFerro()
+ });
+
+ $('#prototipo').on("change", function () {
+ servicioPrototipo()
+ servicioFerro()
+ });
+
$('#papelFormatoId').on('select2:select', function (e){
ancho_libro = getDimensionLibro().ancho;
alto_libro = getDimensionLibro().alto;
+ update_servicios(false)
})
$('#papelFormatoAncho').on('change', function (e){
diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php
index 14dc6b08..5babbed0 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php
@@ -1331,6 +1331,7 @@
else{
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
+ $('#compGramajeCubierta').empty().trigger("change");
$('#compGramajeCubierta').val('').trigger('change');
$('#compGramajeCubierta').prop('disabled', false);
$('#compPapelCubierta').find('option[value="0"]').remove();
diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php
index 94d8b148..7f23f7a1 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php
@@ -404,6 +404,7 @@
$('#precio_total_acabado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
$('#acabado_margen_' + line[0].tarifa_id).text(parseFloat(line[0].margen).toFixed(2))
});
+ check_serv_acabado_error()
yeniden(data.= csrf_token() ?>);
}).then(
fetch(domain + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
@@ -424,10 +425,12 @@
.then(response => response.json())
.then(data => {
data.lines.forEach((line) => {
-
+
$('#proveedor_enc_' + line[0].tarifa_id).off('change')
- if(line[0].hasOwnProperty('proveedor_id'))
- $('#proveedor_enc_' + line[0].tarifa_id).val(line[0].proveedor_id)
+ if(line[0].hasOwnProperty('proveedor_id')){
+ $('#proveedor_enc_' + line[0].tarifa_id)
+ .append('')
+ }
else{
$('#proveedor_enc_' + line[0].tarifa_id).empty()
.append('')
@@ -437,6 +440,7 @@
$('#enc_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
$('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event)
});
+ check_serv_enc_error()
yeniden(data.= csrf_token() ?>);
}).then(
fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , {
@@ -458,6 +462,7 @@
$('#precio_total_manipulado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
$('#manipulado_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
});
+ check_serv_manipulado_error()
yeniden(data.= csrf_token() ?>);
}).then(function(){
if(update_preimpresion){
@@ -478,7 +483,7 @@
$('#precio_preimpresion_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
$('#preimpresion_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
});
-
+ check_serv_preimpresion_error()
yeniden(data.= csrf_token() ?>);
})
}
@@ -604,6 +609,54 @@
return false;
}
+ function servicioRetractilado(){
+ if($('#retractilado').prop('checked')){
+ $('#add_servicio_acabado_list').val()
+ $('#insertar_serv_acabado').click()
+ }
+ else{
+ var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
+ return tableServiciosAcabado.cell( rowIdx, 0 ).data() == ? true : false;
+ } );
+ if(row_indexes.length > 0){
+ tableServiciosAcabado.row(row_indexes[0]).remove().draw()
+ check_serv_acabado_error()
+ }
+ }
+ }
+
+ function servicioRetractilado5(){
+ if($('#retractilado5').prop('checked')){
+ $('#add_servicio_acabado_list').val()
+ $('#insertar_serv_acabado').click()
+ }
+ else{
+ var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
+ return tableServiciosAcabado.cell( rowIdx, 0 ).data() == ? true : false;
+ } );
+ if(row_indexes.length > 0){
+ tableServiciosAcabado.row(row_indexes[0]).remove().draw()
+ check_serv_acabado_error()
+ }
+ }
+ }
+
+ function servicioFajaColor(){
+ if($('#fajaColor').prop('checked')){
+ $('#add_servicio_acabado_list').val()
+ $('#insertar_serv_acabado').click()
+ }
+ else{
+ var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
+ return tableServiciosAcabado.cell( rowIdx, 0 ).data() == ? true : false;
+ } );
+ if(row_indexes.length > 0){
+ tableServiciosAcabado.row(row_indexes[0]).remove().draw()
+ check_serv_acabado_error()
+ }
+ }
+ }
+
$('#insertar_serv_acabado').on('click', function(){
const tarifa_text = $('#add_servicio_acabado_list').select2('data')[0].text.trim()
@@ -788,8 +841,9 @@
var htmlString = '';
- if($('#tableOfServiciosEncuadernacion tr > td:contains(' + '= lang("Presupuestos.no_disponible") ?>' + ')').length > 0){
- htmlString = `
+ $('#tableOfServiciosEncuadernacion tr').each(function(){
+ if($(this).find('td').eq(3).text() == '0.00'){
+ htmlString = `
@@ -798,7 +852,8 @@
= lang("Presupuestos.errores.error_servicios_anadidos") ?>
`;
- }
+ }
+ })
$('#serv-enc-error').html(htmlString)
}
@@ -1231,6 +1286,41 @@
return false;
}
+
+ function servicioPrototipo(){
+ if($('#prototipo').prop('checked')){
+ $('#add_servicio_preimpresion_list').val()
+ $('#insertar_serv_preimpresion').click()
+ }
+ else{
+ var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
+ return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == ? true : false;
+ } );
+ if(row_indexes.length > 0){
+ tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
+ check_serv_preimpresion_error()
+ }
+ }
+ }
+
+ function servicioFerro(){
+ var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
+ return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == ? true : false;
+ } );
+ if($('#ferro').prop('checked')){
+ if(row_indexes.length == 0){
+ $('#add_servicio_preimpresion_list').val()
+ $('#insertar_serv_preimpresion').click()
+ }
+ }
+ else{
+ if(row_indexes.length > 0){
+ tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
+ check_serv_preimpresion_error()
+ }
+ }
+ }
+
$('#insertar_serv_preimpresion').on('click', function(){
const tarifa_text = $('#add_servicio_preimpresion_list').select2('data')[0].text.trim()
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 008f9db8..b14304f5 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js
@@ -72,33 +72,12 @@ $('#compPaginasColorhq').on("change", function () {
});
-$('#compRetractilado').on("change", function () {
- checkRetractiladoComparador(this);
+
+$('#prototipo').on("change", function () {
+ $('#ferro').prop('checked', true)
});
-$('#compRetractilado5').on("change", function () {
- checkRetractiladoComparador(this);
-});
-
-
-$('#imagenesBnInterior').on("change", function () {
- var e = document.getElementById('tipoImpresion');
- var optionToHide = e.querySelector("option[value='negro']");
-
- if (document.getElementById('imagenesBnInterior').checked) {
- optionToHide.setAttribute('disabled', 'disabled')
-
- if (e.value == 'negro') {
- e.value = 'negrohq';
- }
- }
- else {
- optionToHide.removeAttribute('disabled');
- }
- $('#tipoImpresion').select2();
-});
-
$('#compPosPaginasColor').on("keyup", function () {
computarPaginasColor(this.value);
@@ -108,21 +87,21 @@ $('#compPosPaginasColor').on("keyup", function () {
// Este evento recoloca los headers de las tablas cuando se pulsa el
// boton del acordeon
$('.accordion-button').on('click', function (e) {
-
- if(e.target.id.includes("plana")){
+
+ if (e.target.id.includes("plana")) {
$("#tableCompIntPlana").DataTable().columns.adjust();
}
- else if(e.target.id.includes("rotativa")){
+ else if (e.target.id.includes("rotativa")) {
$("#tableCompIntRotativa").DataTable().columns.adjust();
}
- else if(e.target.id.includes("cubierta")){
+ else if (e.target.id.includes("cubierta")) {
$("#tableCompCubierta").DataTable().columns.adjust();
}
- else if(e.target.id.includes("LineasPresupuesto")){
+ else if (e.target.id.includes("LineasPresupuesto")) {
$("#tableLineasPresupuesto").DataTable().columns.adjust();
}
-
-
+
+
});
@@ -168,7 +147,7 @@ function getRowFromLineaRot(linea) {
'papel': linea.fields.papel_generico,
'gramaje': linea.fields.gramaje,
'marca': linea.fields.papel_impresion,
- 'aFavorFibra':linea.fields.a_favor_fibra==1?'si':'no',
+ 'aFavorFibra': linea.fields.a_favor_fibra == 1 ? 'si' : 'no',
'maquina': linea.fields.maquina,
'numeroPliegos': isNaN(parseFloat(linea.fields.pliegos_libro)) ? "" : parseFloat(linea.fields.pliegos_libro).toFixed(2),
'pliegosPedido': isNaN(parseFloat(linea.fields.pliegos_pedido)) ? "" : parseFloat(linea.fields.pliegos_pedido).toFixed(2),
@@ -181,8 +160,8 @@ function getRowFromLineaRot(linea) {
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
'precioPagNegro': isNaN(parseFloat(linea.fields.precio_pagina_negro)) ? "" : parseFloat(linea.fields.precio_pagina_negro).toFixed(6),
'precioPagColor': isNaN(parseFloat(linea.fields.precio_pagina_color)) ? "" : parseFloat(linea.fields.precio_pagina_color).toFixed(6),
- 'totalTinta':isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),
- 'totalCorte':isNaN(parseFloat(linea.fields.total_corte)) ? "" : parseFloat(linea.fields.total_corte).toFixed(2),
+ 'totalTinta': isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),
+ 'totalCorte': isNaN(parseFloat(linea.fields.total_corte)) ? "" : parseFloat(linea.fields.total_corte).toFixed(2),
'total': isNaN(parseFloat(linea.fields.total_impresion)) ? "" : (parseFloat(linea.fields.total_impresion)).toFixed(2),
'maquinaId': linea.fields.maquina_id,
'maquinaVelocidad': linea.fields.maquina_velocidad,
@@ -230,14 +209,14 @@ function computarPaginasColor(string) {
function checkRetractiladoComparador(element) {
switch (element.id) {
- case 'compRetractilado':
- if (document.getElementById(element.id).checked) {
- document.getElementById('compRetractilado5').checked = false;
+ case 'retractilado':
+ if ($('#' + element.id).prop('checked')) {
+ $('#retractilado5').prop('checked', false);
}
break;
- case 'compRetractilado5':
- if (document.getElementById(element.id).checked) {
- document.getElementById('compRetractilado').checked = false;
+ case 'retractilado5':
+ if ($('#' + element.id).prop('checked')) {
+ $('#retractilado').prop('checked', false);
}
break;
default:
@@ -322,13 +301,13 @@ function updatePapelesComparador() {
-function clearIntLineas(is_color){
+function clearIntLineas(is_color) {
//$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
var tabla = $('#tableCompIntPlana').DataTable();
tabla
- .rows( function ( idx, data, node ) {
- return data['tipo'].includes(is_color?'color':'bn');
- } )
+ .rows(function (idx, data, node) {
+ return data['tipo'].includes(is_color ? 'color' : 'bn');
+ })
.remove()
.draw();
//$('#tableCompIntPlana').DataTable().clear().draw();
@@ -336,132 +315,132 @@ function clearIntLineas(is_color){
}
-function clearCubierta(){
-
+function clearCubierta() {
+
$('#tableCompCubierta').DataTable().clear().draw();
$('#insertarCubiertaBtn').css('display', 'none');
}
-function clearIntRot(){
-
+function clearIntRot() {
+
$('#errorComRot').html('');
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#insertarRotativaBtn').css('display', 'none');
}
-
-function selectIntLineas(){
+
+function selectIntLineas() {
var negro_selected = false;
var color_selected = false;
- $("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
- $("#tableCompIntPlana").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
- if( !negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn') ){
- $("#tableCompIntPlana").DataTable().row( rowIdx ).nodes().to$().toggleClass( 'selected' );
+ $("#tableCompIntPlana").DataTable().rows('.selected').deselect();
+ $("#tableCompIntPlana").DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
+ if (!negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn')) {
+ $("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
negro_selected = true;
}
- if( !color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color') ){
- $("#tableCompIntPlana").DataTable().row( rowIdx ).nodes().to$().toggleClass( 'selected' );
+ if (!color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color')) {
+ $("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
color_selected = true;
}
});
var table = $("#tableCompIntPlana").DataTable();
- var rows = table.rows( '.selected' ).indexes();
- var data = table.rows( rows ).data();
+ var rows = table.rows('.selected').indexes();
+ var data = table.rows(rows).data();
var value_total = 0.00;
-
- for (let i = 0; i < data.length ; i++) {
-
+
+ for (let i = 0; i < data.length; i++) {
+
value_total += parseFloat(data[i]['total'])
}
-
+
$('#total_comp_plana').html(value_total.toFixed(2));
}
-function selectIntRotLineas(){
+function selectIntRotLineas() {
+
+ $("#tableCompIntRotativa").DataTable().rows('.selected').deselect();
- $("#tableCompIntRotativa").DataTable().rows( '.selected' ).deselect();
-
let value_total = 0.00;
- if($("#tableCompIntRotativa").DataTable().rows().count()>0) {
-
- $("#tableCompIntRotativa").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
- value_total = parseFloat($("#tableCompIntRotativa").DataTable().rows( 0 ).data()[0]['total'])
+ if ($("#tableCompIntRotativa").DataTable().rows().count() > 0) {
+
+ $("#tableCompIntRotativa").DataTable().row(0).nodes().to$().toggleClass('selected');
+ value_total = parseFloat($("#tableCompIntRotativa").DataTable().rows(0).data()[0]['total'])
};
-
+
$('#total_comp_rot').html(value_total.toFixed(2));
}
-function selectCubiertaLineas(){
-
- $("#tableCompCubierta").DataTable().rows( '.selected' ).deselect();
-
+function selectCubiertaLineas() {
+
+ $("#tableCompCubierta").DataTable().rows('.selected').deselect();
+
let value_total = 0.00;
- if($("#tableCompCubierta").DataTable().rows().count()>0) {
-
- $("#tableCompCubierta").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
- value_total = parseFloat($("#tableCompCubierta").DataTable().rows( 0 ).data()[0]['total'])
+ if ($("#tableCompCubierta").DataTable().rows().count() > 0) {
+
+ $("#tableCompCubierta").DataTable().row(0).nodes().to$().toggleClass('selected');
+ value_total = parseFloat($("#tableCompCubierta").DataTable().rows(0).data()[0]['total'])
};
-
+
$('#total_comp_cubierta').html(value_total.toFixed(2));
}
-function getIDsComparador(is_color, is_hq){
-
- if(!is_color){
- if(is_hq){
+function getIDsComparador(is_color, is_hq) {
+
+ if (!is_color) {
+ if (is_hq) {
var papel = '#compPapelNegrohq';
var gramaje = '#compGramajeNegrohq';
var paginas = '#compPaginasNegrohq';
}
- else{
+ else {
var papel = '#compPapelNegro';
var gramaje = '#compGramajeNegro';
var paginas = '#compPaginasNegro';
}
}
- else{
- if(is_hq){
+ else {
+ if (is_hq) {
var papel = '#compPapelColorhq';
var gramaje = '#compGramajeColorhq';
var paginas = '#compPaginasColorhq';
}
- else{
+ else {
var papel = '#compPapelColor';
var gramaje = '#compGramajeColor';
var paginas = '#compPaginasColor';
}
}
- return{
+ return {
papel: papel,
gramaje: gramaje,
paginas: paginas,
}
}
-function getDimensionLibro(){
+function getDimensionLibro() {
var ancho = 0;
var alto = 0;
-
- if($('#papelFormatoId').select2('data').length > 0){
- if($('#papelFormatoId').select2('data')[0].id.length > 0){
+
+ if ($('#papelFormatoId').select2('data').length > 0) {
+ if ($('#papelFormatoId').select2('data')[0].id.length > 0) {
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
}
- else if(document.getElementById('papelFormatoPersonalizado').checked){
+ else if (document.getElementById('papelFormatoPersonalizado').checked) {
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}
}
-
- else if(document.getElementById('papelFormatoPersonalizado').checked){
+
+ else if (document.getElementById('papelFormatoPersonalizado').checked) {
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}
@@ -471,75 +450,75 @@ function getDimensionLibro(){
}
}
-function checkInputsForRotativa(){
+function checkInputsForRotativa() {
// Si es color, el gramaje y el papel tiene que ser el mismo
- try{
-
+ try {
+
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
- if($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
- $('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim() ){
+ if ($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
+ $('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim()) {
return true;
}
}
else if ($('#tipoImpresion').select2('data')[0].id == 'negro') {
- if($('#compPapelNegro').select2('data')[0].id.length>0 &&
- $('#compGramajeNegro').select2('data')[0].text.length>0){
- return true;
- }
+ if ($('#compPapelNegro').select2('data')[0].id.length > 0 &&
+ $('#compGramajeNegro').select2('data')[0].text.length > 0) {
+ return true;
+ }
}
-
+
}
- catch(error){
+ catch (error) {
return false;
}
-
+
return false;
}
-function fillIntPlana(data, is_color, is_hq){
+function fillIntPlana(data, is_color, is_hq) {
let sorted = data.lineas.sort(
- (p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
- -1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
- sorted.forEach(function(linea) {
- if(typeof linea.error == "undefined")
- $('#tableCompIntPlana').DataTable().row
- .add(getRowFromLineaInt(is_color?(is_hq?'colorhq':'color'):(is_hq?'bnhq':'bn'), linea))
+ (p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
+ -1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
+ sorted.forEach(function (linea) {
+ if (typeof linea.error == "undefined")
+ $('#tableCompIntPlana').DataTable().row
+ .add(getRowFromLineaInt(is_color ? (is_hq ? 'colorhq' : 'color') : (is_hq ? 'bnhq' : 'bn'), linea))
.draw()
- })
+ })
}
-function fillIntRot(data){
+function fillIntRot(data) {
let sorted = data.lineas.sort(
- (p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
- -1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
- sorted.forEach(function(linea) {
- if(typeof linea.error == "undefined"){
+ (p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
+ -1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
+ sorted.forEach(function (linea) {
+ if (typeof linea.error == "undefined") {
$('#tableCompIntRotativa').DataTable().row
- .add(getRowFromLineaRot(linea))
- .draw()
- }
- })
+ .add(getRowFromLineaRot(linea))
+ .draw()
+ }
+ })
}
-function fillCubierta(data, is_color, is_hq){
-
+function fillCubierta(data, is_color, is_hq) {
+
let sorted = data.lineas.sort(
- (p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
- -1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
- sorted.forEach(function(linea) {
- if(typeof linea.error == "undefined")
- $('#tableCompCubierta').DataTable().row
+ (p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
+ -1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
+ sorted.forEach(function (linea) {
+ if (typeof linea.error == "undefined")
+ $('#tableCompCubierta').DataTable().row
.add(getRowFromLineaInt('cubierta', linea))
.draw()
- })
+ })
}
-function clearCompTable(){
+function clearCompTable() {
$('#insertarPlanaBtn').addClass('d-none')
$('#insertarRotativaBtn').addClass('d-none')
@@ -547,95 +526,91 @@ function clearCompTable(){
$('#total_comp_rot').html('0.00')
}
-function generateCompJSON(){
-
+function generateCompJSON() {
+
data = {}
-
- if( $('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color')
- {
- try{
+
+ if ($('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color') {
+ try {
bn_obj = {
- "bn":{
+ "bn": {
'paginas': $('#compPaginasNegro').val(),
'papel_id': $('#compPapelNegro').select2('data')[0].id,
'gramaje': $('#compGramajeNegro').select2('data')[0].text.trim(),
}
}
}
- catch (e){
+ catch (e) {
bn_obj = {}
}
- $.extend( data, bn_obj );
+ $.extend(data, bn_obj);
}
- if( $('#tipoImpresion').select2('data')[0].id == 'negrohq' || $('#tipoImpresion').select2('data')[0].id == 'colorhq')
- {
- try{
+ if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' || $('#tipoImpresion').select2('data')[0].id == 'colorhq') {
+ try {
bnhq_obj = {
- "bnhq":{
+ "bnhq": {
'paginas': $('#compPaginasNegrohq').val(),
'papel_id': $('#compPapelNegrohq').select2('data')[0].id,
'gramaje': $('#compGramajeNegrohq').select2('data')[0].text.trim(),
}
}
}
- catch (e){
+ catch (e) {
bnhq_obj = {}
}
- $.extend( data, bnhq_obj );
+ $.extend(data, bnhq_obj);
}
-
- if($('#tipoImpresion').select2('data')[0].id == 'color')
- {
- try{
+
+ if ($('#tipoImpresion').select2('data')[0].id == 'color') {
+ try {
color_obj = {
- "color":{
+ "color": {
'paginas': $('#compPaginasColor').val(),
'papel_id': $('#compPapelColor').select2('data')[0].id,
'gramaje': $('#compGramajeColor').select2('data')[0].text.trim(),
},
}
}
- catch (e){
+ catch (e) {
color_obj = {}
}
- $.extend( data, color_obj );
-
+ $.extend(data, color_obj);
+
}
- if($('#tipoImpresion').select2('data')[0].id == 'colorhq')
- {
- try{
+ if ($('#tipoImpresion').select2('data')[0].id == 'colorhq') {
+ try {
colorhq_obj = {
- "colorhq":{
+ "colorhq": {
'paginas': $('#compPaginasColorhq').val(),
'papel_id': $('#compPapelColorhq').select2('data')[0].id,
'gramaje': $('#compGramajeColorhq').select2('data')[0].text.trim(),
},
}
}
- catch (e){
+ catch (e) {
colorhq_obj = {}
}
- $.extend( data, colorhq_obj );
+ $.extend(data, colorhq_obj);
}
- try{
+ try {
cubierta_obj = {
- "cubierta":{
+ "cubierta": {
'paginas': $('#compCarasCubierta').select2('data')[0].id,
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
},
}
}
- catch (e){
+ catch (e) {
cubierta_obj = {}
}
- $.extend( data, cubierta_obj );
+ $.extend(data, cubierta_obj);
data_str = JSON.stringify(data)
$('#comparador_json_data').val(data_str)