diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoacabados.php b/ci4/app/Controllers/Presupuestos/Presupuestoacabados.php
index fd44b1da..c2e31fa7 100755
--- a/ci4/app/Controllers/Presupuestos/Presupuestoacabados.php
+++ b/ci4/app/Controllers/Presupuestos/Presupuestoacabados.php
@@ -73,7 +73,7 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
$datos_tarifas = $postData['datos'] ?? [];
$tirada = $postData['tirada'] ?? 0;
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
-
+
$result = $this->getServiciosAcabados($datos_tarifas, $tirada, $POD);
$newTokenHash = csrf_hash();
@@ -86,7 +86,8 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
return $this->respond($data);
}
- public function getServiciosAcabados($datos_tarifas, $tirada, $POD){
+ public function getServiciosAcabados($datos_tarifas, $tirada, $POD)
+ {
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
$result = [];
@@ -106,7 +107,7 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
public function cargar()
{
- if($this->request->isAJAX()) {
+ if ($this->request->isAJAX()) {
$presupuesto_id = $this->request->getGet('presupuesto_id') ?? null;
$rows = $this->model->getResource($presupuesto_id)->get()->getResultObject();
@@ -134,18 +135,29 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
$proveedor_id = $reqData['proveedor_id'] ?? -1;
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
+ $isTarifa = $reqData['isTarifa'] ?? 0;
+
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [];
- $model = model('App\Models\Tarifas\Acabados\TarifasAcabadoServiciosAcabadoModel');
- $tarifas = $model->getTarifasForServicio($tarifa_acabado_id);
-
- foreach ($tarifas as $tarifa) {
- $values = $this->model->getPrecioTarifa($tarifa, $tirada, $proveedor_id, $POD);
- $values[0]->tarifa_id = $tarifa;
+ if ($isTarifa == 1) {
+ $values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
+ $values[0]->tarifa_id = $tarifa_acabado_id;
array_push($data, $values[0]);
+ }
+ else {
+
+
+ $model = model('App\Models\Tarifas\Acabados\TarifasAcabadoServiciosAcabadoModel');
+ $tarifas = $model->getTarifasForServicio($tarifa_acabado_id);
+
+ foreach ($tarifas as $tarifa) {
+ $values = $this->model->getPrecioTarifa($tarifa, $tirada, $proveedor_id, $POD);
+ $values[0]->tarifa_id = $tarifa;
+ array_push($data, $values[0]);
+ }
}
//$values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
@@ -178,12 +190,11 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
]
)
->where("servicios_acabado.deleted_at", null);
-
- if($cubierta == 1){
+
+ if ($cubierta == 1) {
$query->where("servicios_acabado.acabado_cubierta", 1);
- }
- else if ($sobrecubierta == 1){
+ } else if ($sobrecubierta == 1) {
$query->where("servicios_acabado.acabado_sobrecubierta", 1);
}
@@ -244,5 +255,5 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
}
}
-
+
}
diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php
index 58abbb68..26ef21a9 100644
--- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php
+++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php
@@ -391,6 +391,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
'solapas_grandes_sobrecubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_sobrecubierta')->value,
'solapas_grandes_faja' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_faja')->value,
'lomo_redondo' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_lomo_redondo')->value,
+ 'ferro_digital' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro_digital')->value,
];
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php
index 3d95da2e..7413e5af 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php
@@ -332,6 +332,7 @@
diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php
index 6071ac08..f9822845 100644
--- a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php
+++ b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php
@@ -125,7 +125,7 @@
name: "precio_max",
attr: {
type: "text",
- name : "tirada_min",
+ name : "precio_max",
class :"autonumeric"
}
}, {
@@ -139,14 +139,14 @@
name: "precio_min",
attr: {
type: "text",
- name : "tirada_min",
+ name : "precio_min",
class :"autonumeric"
}
}, {
name: "margen",
attr: {
type: "text",
- name : "tirada_min",
+ name : "margen",
class :"autonumeric"
}
}, {
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js
index eef9bb59..8b1da5ea 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js
@@ -128,6 +128,7 @@ class DatosLibro {
this.retractilado5.on('change', this.checkRetractilado.bind(this));
this.ferro.on('change', this.changeFerro.bind(this));
this.prototipo.on('change', this.changePrototipo.bind(this));
+ this.ferroDigital.on('change', this.changeFerroDigital.bind(this));
this.tamanio.item.on('select2:select', this.changeFormato.bind(this));
$('.formato_libro').on('change', this.changeFormato.bind(this));
@@ -216,6 +217,19 @@ class DatosLibro {
}
}
+ changeFerroDigital() {
+
+ if (this.cargando)
+ return;
+
+ if (this.ferro.prop('checked')) {
+ $(document).trigger('add-servicio-lineas', 'ferroDigital');
+ }
+ else {
+ $(document).trigger('remove-servicio-lineas', 'ferroDigital');
+ }
+ }
+
changePrototipo() {
if (this.cargando)
@@ -242,6 +256,8 @@ class DatosLibro {
$(document).trigger('remove-servicio-lineas', 'retractilado5');
$(document).trigger('add-servicio-lineas', 'retractilado');
}
+ else
+ $(document).trigger('remove-servicio-lineas', 'retractilado');
break;
case 'retractilado5':
if ($('#' + event.currentTarget.id).prop('checked')) {
@@ -249,6 +265,8 @@ class DatosLibro {
$(document).trigger('remove-servicio-lineas', 'retractilado');
$(document).trigger('add-servicio-lineas', 'retractilado5');
}
+ else
+ $(document).trigger('remove-servicio-lineas', 'retractilado5');
break;
default:
break;
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js
index d6291372..adf9927f 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js
@@ -119,6 +119,11 @@ class Servicios {
if(!this.checkServiceInTable(this.serviciosExtra.table, id))
this.serviciosExtra.getPresupuestoExtra(id);
}
+ else if (servicio == 'ferroDigital') {
+ const id = $('#ferroDigital').attr('service-id');
+ if(!this.checkServiceInTable(this.serviciosExtra.table, id))
+ this.serviciosExtra.getPresupuestoExtra(id);
+ }
else if (servicio == 'prototipo') {
const id = $('#prototipo').attr('service-id');
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
@@ -127,12 +132,12 @@ class Servicios {
else if (servicio == 'retractilado') {
const id = $('#retractilado').attr('service-id');
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
- this.serviciosAcabado.getPresupuestoAcabado(id);
+ this.serviciosAcabado.getPresupuestoAcabado(id, null, null, true);
}
else if (servicio == 'retractilado5') {
const id = $('#retractilado5').attr('service-id');
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
- this.serviciosAcabado.getPresupuestoAcabado(id);
+ this.serviciosAcabado.getPresupuestoAcabado(id, null, null,true);
}
else if (servicio == 'plegado_guardas') {
const id = $('#plegado_guardas').attr('service-id');
@@ -188,45 +193,64 @@ class Servicios {
removeServicio(event, servicio) {
+ const self = this;
+
if (servicio == 'ferro') {
const id = $('#ferro').attr('service-id');
this.serviciosExtra.table.rows().every(function () {
let data = this.data();
if (data.tarifa_id == id) {
this.remove();
+ self.serviciosExtra.table.draw();
+ return;
}
});
- this.serviciosExtra.table.draw();
}
+
+ if (servicio == 'ferroDigital') {
+ const id = $('#ferroDigital').attr('service-id');
+ this.serviciosExtra.table.rows().every(function () {
+ let data = this.data();
+ if (data.tarifa_id == id) {
+ this.remove();
+ self.serviciosExtra.table.draw();
+ return;
+ }
+ });
+ }
+
else if (servicio == 'prototipo') {
const id = $('#prototipo').attr('service-id');
this.serviciosExtra.table.rows().every(function () {
var data = this.data();
if (data.tarifa_id == id) {
this.remove();
+ self.serviciosExtra.table.draw();
+ return;
}
});
- this.serviciosExtra.table.draw();
}
else if (servicio == 'retractilado') {
const id = $('#retractilado').attr('service-id');
- this.serviciosAcabado.table.rows().every(function () {
- let data = this.data();
- if (data.tarifa_id == id) {
- this.remove();
+ for(let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
+ let data = this.serviciosAcabado.table.row(i).data();
+ if (data && data.tarifa_id == id) {
+ this.serviciosAcabado.table.row(i).remove();
+ this.serviciosAcabado.table.draw();
+ return;
}
- });
- this.serviciosAcabado.table.draw();
+ }
}
else if (servicio == 'retractilado5') {
const id = $('#retractilado5').attr('service-id');
- this.serviciosAcabado.table.rows().every(function () {
- let data = this.data();
- if (data.tarifa_id == id) {
- this.remove().draw();
+ for(let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
+ let data = this.serviciosAcabado.table.row(i).data();
+ if (data && data.tarifa_id == id) {
+ this.serviciosAcabado.table.row(i).remove();
+ this.serviciosAcabado.table.draw();
+ return;
}
- });
- this.serviciosAcabado.table.draw();
+ }
}
else if (servicio == 'plegado_guardas') {
const id = $('#plegado_guardas').attr('service-id');
@@ -234,9 +258,10 @@ class Servicios {
var data = this.data();
if (data && data.tarifa_id == id) {
this.remove();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'solapas_cubierta') {
const id = $('#serv_solapas_cubierta').attr('service-id');
@@ -244,9 +269,10 @@ class Servicios {
let data = this.data();
if (data && parseInt(data.tarifa_id) == id) {
this.remove();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'solapas_sobrecubierta') {
const id = $('#serv_solapas_sobrecubierta').attr('service-id');
@@ -254,9 +280,10 @@ class Servicios {
let data = this.data();
if (data && data.tarifa_id == id) {
this.remove();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'solapas_faja') {
const id = $('#solapas_faja').attr('service-id');
@@ -264,9 +291,10 @@ class Servicios {
let data = this.data();
if (data && data.tarifa_id == id) {
this.remove().draw();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'solapas_grandes_cubierta') {
const id = $('#solapas_grandes_cubierta').attr('service-id');
@@ -274,9 +302,10 @@ class Servicios {
let data = this.data();
if (data && data.tarifa_id == id) {
this.remove();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'solapas_grandes_sobrecubierta') {
const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
@@ -284,9 +313,10 @@ class Servicios {
var data = this.data();
if (data && data.tarifa_id == id) {
this.remove();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'solapas_grandes_faja') {
const id = $('#solapas_grandes_faja').attr('service-id');
@@ -294,9 +324,10 @@ class Servicios {
var data = this.data();
if (data && data.tarifa_id == id) {
this.remove();
+ this.ServiciosManipulado.table.draw();
+ return;
}
});
- this.ServiciosManipulado.table.draw();
}
else if (servicio == 'acabadoCubierta') {
for (let i = 0; i < this.serviciosAcabado.table.rows().count(); i++) {
@@ -563,7 +594,7 @@ class ServiciosAcabado {
this.getPresupuestoAcabado(tarifa_id, uso, null);
}
- getPresupuestoAcabado(tarifa_id = -1, uso = null, updateSelect = null) {
+ getPresupuestoAcabado(tarifa_id = -1, uso = null, updateSelect = null, isTarifa = false) {
const self = this;
@@ -573,6 +604,7 @@ class ServiciosAcabado {
}
let datos = {
tirada: tirada,
+ isTarifa: isTarifa ? 1 : 0
};
if (updateSelect != null) {