From 58af5bf90f3a2321128aaa026a1d6a38c28f9a0b Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Ortega Date: Mon, 20 Nov 2023 21:11:20 +0100 Subject: [PATCH] trabajando en servicios encuadernacion --- .../PresupuestoEncuadernaciones.php | 4 +- ci4/app/Controllers/Test.php | 12 +- .../TipoPresupuestoTarifaEncuadernacion.php | 24 + .../PresupuestoEncuadernacionesModel.php | 15 + .../Models/Presupuestos/PresupuestoModel.php | 2 +- ...poPresupuestoTarifaEncuadernacionModel.php | 38 + .../_cosidotapablandaFormItems.php | 1303 ----------------- .../_datosPresupuestoItems.php | 2 +- .../cosidotapablanda/_datosServiciosItems.php | 8 +- .../cosidotapablanda/_previewItems.php | 2 +- .../cosidotapablanda/comparador.js | 20 +- .../viewCosidotapablandaForm.php | 2 + 12 files changed, 114 insertions(+), 1318 deletions(-) create mode 100644 ci4/app/Entities/Presupuestos/TipoPresupuestoTarifaEncuadernacion.php create mode 100644 ci4/app/Models/Presupuestos/TipoPresupuestoTarifaEncuadernacionModel.php delete mode 100644 ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_cosidotapablandaFormItems.php diff --git a/ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php b/ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php index c7a7687c..b9d4e00d 100644 --- a/ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php +++ b/ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php @@ -50,8 +50,10 @@ class PresupuestoEncuadernaciones extends \App\Controllers\GoBaseResourceControl $dir = $reqData['order']['0']['dir'] ?? 'asc'; $id_P = $reqData['id_presupuesto'] ?? -1; + $tipoPresupuesto = $reqData['tipo_presupuesto'] ?? -1; + $solapas = $reqData['solapas'] ?? false; - $resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $resourceData = $this->model->getResource($id_P, $tipoPresupuesto, $solapas)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); return $this->respond(Collection::datatable( $resourceData, diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php index 66a1e000..99036a03 100644 --- a/ci4/app/Controllers/Test.php +++ b/ci4/app/Controllers/Test.php @@ -17,9 +17,15 @@ class Test extends BaseController public function index() { - $this->getLP(); + var_dump($this->get_tarifas_encuadernacion(4, true)); } + + public function get_tarifas_encuadernacion($tipo_presupuesto, $solapas){ + $model = model('App\Models\Presupuestos\TipoPresupuestoTarifaEncuadernacionModel'); + return $model->get_tarifas($tipo_presupuesto,$solapas); + } + public function timeToSeconds(){ $time = '99:59:59'; @@ -34,8 +40,8 @@ class Test extends BaseController $papel_imp_model = model('App\Models\Configuracion\PapelImpresionModel'); $maquina_model = model('App\Models\Configuracion\MaquinaModel'); foreach($data as $linea){ - $linea->papel_impresion_id = $papel_imp_model->getValue_Nombre($linea->papel_impresion_id)[0]; - $linea->maquina_id = $maquina_model->getValue_Nombre($linea->maquina_id)[0]; + //$linea->papel_impresion_id = $papel_imp_model->getValue_Nombre($linea->papel_impresion_id)[0]; + //$linea->maquina_id = $maquina_model->getValue_Nombre($linea->maquina_id)[0]; var_dump($linea->papel_impresion_id); var_dump($linea->maquina_id); } diff --git a/ci4/app/Entities/Presupuestos/TipoPresupuestoTarifaEncuadernacion.php b/ci4/app/Entities/Presupuestos/TipoPresupuestoTarifaEncuadernacion.php new file mode 100644 index 00000000..9fedb453 --- /dev/null +++ b/ci4/app/Entities/Presupuestos/TipoPresupuestoTarifaEncuadernacion.php @@ -0,0 +1,24 @@ + null, + "tipo_presupuesto_id" => null, + "tarifa_encuadernacion_id" => null, + "solapas" => null, + "is_deleted" => 0, + "deleted_at" => null, + "created_at" => null, + "updated_at" => null, + ]; + protected $casts = [ + "tipo_presupuesto_id" => "int", + "tarifa_encuadernacion_id" => "int", + "solapas" => "int", + "is_deleted" => "int", + ]; +} diff --git a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php index 0ad3cf6e..94142246 100644 --- a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php @@ -45,6 +45,21 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel ]; + + public function initPresupuesto($tipoPresupuesto, $solapas){ + + $model = model('App\Models\Presupuestos\TipoPresupuestoTarifaEncuadernacionModel'); + $tarifas_ids = $model->get_tarifas($tipo_presupuesto,$solapas); + } + + public function delete($presupuesto_id){ + + $builder = $this->db + ->table($this->table . " t1") + ->where('t1.presupuesto_id', $presupuesto_id) + ->delete(); + } + /** * Get resource data. * diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index 285ef003..f8d6bfa9 100644 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -211,7 +211,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel protected $validationRulesAdd = [ "autor" => [ "label" => "Presupuestos.autor", - "rules" => "trim|required|max_length[150]", + "rules" => "trim|max_length[150]", ], "titulo" => [ "label" => "Presupuestos.titulo", diff --git a/ci4/app/Models/Presupuestos/TipoPresupuestoTarifaEncuadernacionModel.php b/ci4/app/Models/Presupuestos/TipoPresupuestoTarifaEncuadernacionModel.php new file mode 100644 index 00000000..71f093e5 --- /dev/null +++ b/ci4/app/Models/Presupuestos/TipoPresupuestoTarifaEncuadernacionModel.php @@ -0,0 +1,38 @@ +db + ->table($this->table . " t1") + ->select("t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id") + ->where("t1.tipo_presupuesto_id", $tipo_presupuesto) + ->where($where); + return $builder->get()->getResultArray(); + } +} diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_cosidotapablandaFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_cosidotapablandaFormItems.php deleted file mode 100644 index 58a1d1f2..00000000 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_cosidotapablandaFormItems.php +++ /dev/null @@ -1,1303 +0,0 @@ -
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - - - - - - - - - - - - - - - - - - - - -
-
- - -
-
- -
- - -
- - - -
-
- - -
-
- -
- - -
- - - - - - - - - - - -
- - -
- -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- - -
-
- -
-
-
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
- - -
- -
- -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
\ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php index f0d3dd22..97fc661e 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php @@ -81,7 +81,7 @@
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 c10c3aa0..715b2442 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php @@ -242,6 +242,7 @@ }); var theTable = $('#tableOfServiciosAcabado').DataTable( { + draw: 1, serverSide: true, processing: true, autoWidth: true, @@ -261,7 +262,7 @@ }, method: 'POST', headers: {'X-Requested-With': 'XMLHttpRequest'}, - async: true, + async: false, }), columns: [ {'data': 'tarifa_acabado_id', @@ -375,6 +376,7 @@ var theTable2 = $('#tableOfServiciosEncuadernacion').DataTable( { + draw: 2, serverSide: true, processing: true, autoWidth: true, @@ -391,6 +393,8 @@ url: '', data: { id_presupuesto: id, + tipo_presupuesto: 4, + solapas: $('#solapas').is(':checked'), }, method: 'POST', headers: {'X-Requested-With': 'XMLHttpRequest'}, @@ -511,6 +515,7 @@ var theTable3 = $('#tableOfServiciosManipulado').DataTable( { + draw: 3, serverSide: true, processing: true, autoWidth: true, @@ -648,6 +653,7 @@ var theTable4 = $('#tableOfServiciosPreimpresion').DataTable( { + draw: 4, serverSide: true, processing: true, autoWidth: true, diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php index 10ab1d66..11986083 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php @@ -5,7 +5,7 @@ data-bs-target="#accordionPreviewTip" aria-expanded="false" aria-controls="accordionPreviewTip">

- +
= 0 ? newValue : 0; $('#compPaginasColor').change(); } - } }); @@ -37,16 +36,23 @@ $('#compPaginasColor').on("change", function () { }); $('#compPaginasNegrohq').on("change", function () { - if (document.getElementById('paginas').value < document.getElementById('compPaginasNegrohq').value) { - document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value; - } - if ($('#tipoImpresion').select2('data')[0].id == 'color') { - if (document.getElementById('compPaginasNegrohq').value + document.getElementById('compPaginasColorhq').value > document.getElementById('paginas').value) { - var newValue = document.getElementById('paginas').value - document.getElementById('compPaginasNegrohq').value; + var negro = parseInt(document.getElementById('compPaginasNegrohq').value); + const paginas = parseInt(document.getElementById('paginas').value); + if (paginas < negro) { + document.getElementById('compPaginasNegrogq').value = paginas; + negro = paginas; + } + var color = parseInt(document.getElementById('compPaginasColorhq').value); + if ($('#tipoImpresion').select2('data')[0].id == 'colorhq') { + + var newValue = paginas - negro; + if (newValue != color) { document.getElementById('compPaginasColorhq').value = newValue >= 0 ? newValue : 0; + $('#compPaginasColorhq').change(); } } + }); $('#compPaginasColorhq').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 315d4c25..928468d5 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 @@ -133,6 +133,8 @@ $('#presupuestoForm').on( "submit", function( event ) { return false; //stop the actual form post !important! }); + + endSection() ?>