From 41159d1588814d080eb822a49e6fd23dedd36176 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sat, 12 Apr 2025 23:53:28 +0200 Subject: [PATCH 01/13] select imposicion route --- ci4/app/Config/Routes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index eb781603..baad50d9 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -264,6 +264,8 @@ $routes->group('imposiciones', ['namespace' => 'App\Controllers\Configuracion'], $routes->post('datatable', 'Imposiciones::datatable', ['as' => 'dataTableOfImposiciones']); $routes->post('allmenuitems', 'Imposiciones::allItemsSelect', ['as' => 'select2ItemsOfImposiciones']); $routes->post('menuitems', 'Imposiciones::menuItems', ['as' => 'menuItemsOfImposiciones']); + $routes->get('select', 'Imposiciones::selectImposicion', ['as' => 'selectImposicion']); + }); $routes->resource('imposiciones', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Imposiciones', 'except' => 'show,new,create,update']); From ba9c4dc339777dc36748e8fcebce0c5893a26a0f Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sat, 12 Apr 2025 23:53:48 +0200 Subject: [PATCH 02/13] imposiciones --- .../Configuracion/Imposiciones.php | 15 +- .../Controllers/Produccion/Ordentrabajo.php | 11 +- ci4/app/Entities/Configuracion/Imposicion.php | 9 + .../Entities/Configuracion/PapelImpresion.php | 13 + .../Produccion/OrdenTrabajoEntity.php | 14 + .../Produccion/OrdenTrabajoTareaEntity.php | 7 + .../Tarifas/TarifaEncuadernacionEntity.php | 8 + ci4/app/Language/es/Produccion.php | 12 +- .../Models/Configuracion/ImposicionModel.php | 49 ++- .../Models/OrdenTrabajo/OrdenTrabajoModel.php | 7 +- ci4/app/Services/ProductionService.php | 36 +- .../vuexy/components/tables/ot_task_table.php | 2 +- .../form/produccion/viewOrdenTrabajoList.php | 2 + .../Views/themes/vuexy/pdfs/orden_trabajo.php | 100 ++--- .../components/datatables/otDatatable.js | 11 +- .../assets/js/safekat/pages/pdf/otDownload.js | 20 +- .../assets/js/safekat/pages/produccion/ot.js | 65 +++- httpdocs/themes/vuexy/css/ot.css | 17 + httpdocs/themes/vuexy/css/pdf.ot copy.css | 348 ------------------ 19 files changed, 293 insertions(+), 453 deletions(-) create mode 100644 httpdocs/themes/vuexy/css/ot.css delete mode 100644 httpdocs/themes/vuexy/css/pdf.ot copy.css diff --git a/ci4/app/Controllers/Configuracion/Imposiciones.php b/ci4/app/Controllers/Configuracion/Imposiciones.php index 9fabc2c1..58986982 100755 --- a/ci4/app/Controllers/Configuracion/Imposiciones.php +++ b/ci4/app/Controllers/Configuracion/Imposiciones.php @@ -1,4 +1,6 @@ -request->getPost()) : @@ -130,7 +132,7 @@ class Imposiciones extends \App\Controllers\BaseResourceController return $this->redirect2listView('sweet-error', $message); endif; - + if ($this->request->getPost()) : @@ -279,6 +281,9 @@ class Imposiciones extends \App\Controllers\BaseResourceController ]; return $orientacionOptions; } - - + public function selectImposicion() + { + $data = $this->model->querySelect($this->request->getGet('q')); + return $this->response->setJSON($data); + } } diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 103befb3..ef39f38a 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -141,7 +141,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F"); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo))) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -156,7 +156,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo))) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -171,7 +171,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo))) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -186,7 +186,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo))) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -232,6 +232,8 @@ class Ordentrabajo extends BaseController ->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmm_string($q->tiempo_estimado)) ->edit("tiempo_real", fn($q) => float_seconds_to_hhmm_string($q->tiempo_real)) ->edit("maquina_tarea", fn($q) => ["id" => $q->id, "maquina_id" => $q->maquina_tarea, "maquina_name" => $q->maquina_nombre]) + ->add("imposicion", fn($q) => ["id" => $q->id, "imposicion_id" => $q->imposicion_id, "name" => $q->imposicion_name,"is_presupuesto_linea" => $q->presupuesto_linea_id ? true : false ]) + ->toJson(true); } public function get_pdf($orden_trabajo_id) @@ -296,7 +298,6 @@ class Ordentrabajo extends BaseController } } catch (\Throwable $th) { return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode(500); - } } public function planning_rotativa_datatable() diff --git a/ci4/app/Entities/Configuracion/Imposicion.php b/ci4/app/Entities/Configuracion/Imposicion.php index 0acdc41c..fcb0ddaa 100755 --- a/ci4/app/Entities/Configuracion/Imposicion.php +++ b/ci4/app/Entities/Configuracion/Imposicion.php @@ -19,4 +19,13 @@ class Imposicion extends \CodeIgniter\Entity\Entity "alto" => "int", "unidades" => "?int", ]; + + public function getFullName() : string + { + $ancho_x_alto = $this->attributes["ancho"] ."x". $this->attributes["alto"]; + $unidades = $this->attributes["unidades"] ?? ""; + $orientacion = $this->attributes["orientacion"] ?? ""; + return implode("_",[$ancho_x_alto,$unidades,$orientacion]); + + } } diff --git a/ci4/app/Entities/Configuracion/PapelImpresion.php b/ci4/app/Entities/Configuracion/PapelImpresion.php index d977764c..617a3ec7 100755 --- a/ci4/app/Entities/Configuracion/PapelImpresion.php +++ b/ci4/app/Entities/Configuracion/PapelImpresion.php @@ -2,9 +2,11 @@ namespace App\Entities\Configuracion; use App\Models\Configuracion\MaquinasPapelesImpresionModel; +use App\Models\Configuracion\PapelGenericoModel; use App\Models\Configuracion\PapelImpresionMargenModel; use App\Models\Configuracion\PapelImpresionTipologiaModel; use CodeIgniter\Entity; +use CodeIgniter\Model; class PapelImpresion extends \CodeIgniter\Entity\Entity { @@ -68,4 +70,15 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity $m = model(PapelImpresionMargenModel::class); return $m->asArray()->where('papel_impresion_id',$this->attributes["id"])->findAll(); } + public function papel_generico() : ?PapelGenerico + { + $m = model(PapelGenericoModel::class); + return $m->find($this->attributes["papel_generico_id"]); + } + public function getPapelCodeOt() : ?string + { + $code_ot = $this->papel_generico()->code_ot; + $gramaje = $this->attributes["gramaje"]; + return implode(" ",[$code_ot,$gramaje]); + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index 67861987..e60a9671 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -134,4 +134,18 @@ class OrdenTrabajoEntity extends Entity { return $this->pedidoEsperaBy(); } + public function getPortadaPath(): ?string + { + helper('filesystem'); + $path = $this->attributes["portada_path"]; + $portada_path = null; + if($path){ + if(file_exists($path)){ + $portada_path = $path; + }else{ + $portada_path = null; + } + } + return $portada_path; + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php index b11c9812..946b3819 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php @@ -2,10 +2,12 @@ namespace App\Entities\Produccion; +use App\Entities\Configuracion\Imposicion; use App\Entities\Configuracion\Maquina; use App\Entities\Presupuestos\PresupuestoAcabadosEntity; use App\Entities\Presupuestos\PresupuestoLineaEntity; use App\Entities\Presupuestos\PresupuestoManipuladosEntity; +use App\Models\Configuracion\ImposicionModel; use App\Models\Configuracion\MaquinaModel; use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Models\Presupuestos\PresupuestoAcabadosModel; @@ -105,5 +107,10 @@ class OrdenTrabajoTareaEntity extends Entity $m = model(PresupuestoAcabadosModel::class); return $m->find($this->attributes["presupuesto_linea_id"]); } + public function imposicion() : ?Imposicion + { + $m = model(ImposicionModel::class); + return $m->find($this->attributes["imposicion_id"]); + } } diff --git a/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php b/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php index b8d01575..608ebf37 100755 --- a/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php @@ -33,6 +33,14 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity "user_updated_id" => "int", "is_deleted" => "int", ]; + + public function getNameInitials(): string + { + $words = explode(" ",$this->attributes["nombre"]); + $words_initial = array_map(fn($w) => substr(strtoupper($w),0,1),$words); + return implode("",$words_initial); + } + } diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index 98e81d76..603f21b3 100644 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -39,7 +39,8 @@ return [ "maquina_presupuesto" => "Máquina presupuesto", "maquina_actual" => "Máquina actual", "tiempo_estimado" => "Tiempo estimado", - "tiempo" => "Tiempo" + "tiempo" => "Tiempo", + "imposicion" => "Imposición" ], "finalizadas" => "Finalizadas", "pendiente_ferro" => "Ferro pendiente", @@ -79,6 +80,13 @@ return [ "solapa" => "Solapa", "papel_gramajes" => "Papel y gramajes", "estado" => "Estado", - "pedido_espera" => "Pedido en espera" + "pedido_espera" => "Pedido en espera", + "imposicion_no_label" => "Sin etiqueta", + "pliegos_de" => "pliegos de", + "size" => "Tamaño", + "ejemplares" => "Ejemplares", + "tipo" => "Tipo", + "lomo" => "Lomo" + ]; \ No newline at end of file diff --git a/ci4/app/Models/Configuracion/ImposicionModel.php b/ci4/app/Models/Configuracion/ImposicionModel.php index e9473566..b21def73 100755 --- a/ci4/app/Models/Configuracion/ImposicionModel.php +++ b/ci4/app/Models/Configuracion/ImposicionModel.php @@ -1,4 +1,5 @@ groupStart() - ->like("t1.id", $search) - ->orlike("t1.ancho", $search) - ->orLike("t1.alto", $search) - ->orLike("t1.unidades", $search) - ->orLike("t1.orientacion", $search) - ->orLike("t1.maquina", $search) - ->orLike("t1.etiqueta", $search) - ->orlike("t1.id", $search) - ->orLike("t1.ancho", $search) - ->orLike("t1.alto", $search) - ->orLike("t1.unidades", $search) - ->orLike("t1.orientacion", $search) - ->orLike("t1.maquina", $search) - ->orLike("t1.etiqueta", $search) - ->groupEnd(); + ->groupStart() + ->like("t1.id", $search) + ->orlike("t1.ancho", $search) + ->orLike("t1.alto", $search) + ->orLike("t1.unidades", $search) + ->orLike("t1.orientacion", $search) + ->orLike("t1.maquina", $search) + ->orLike("t1.etiqueta", $search) + ->orlike("t1.id", $search) + ->orLike("t1.ancho", $search) + ->orLike("t1.alto", $search) + ->orLike("t1.unidades", $search) + ->orLike("t1.orientacion", $search) + ->orLike("t1.maquina", $search) + ->orLike("t1.etiqueta", $search) + ->groupEnd(); + } + + public function querySelect(?string $q) + { + $query = $this->builder()->select([ + "id", + "CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL')) as name", + "COALESCE(lg_imposiciones.etiqueta,'" . lang("Produccion.imposicion_no_label") . "') as description" + ]); + if ($q) { + $query->orLike("CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto)", $q); + $query->orLike("lg_imposiciones.etiqueta", $q); + } + return $query + ->orderBy('id', 'ASC') + ->get()->getResultArray(); } } diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php index 713a925f..2554d37f 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php @@ -82,7 +82,9 @@ class OrdenTrabajoModel extends Model "tipos_presupuestos.codigo as tipo_presupuesto_impresion", "ordenes_trabajo.progreso", "presupuesto_linea.tipo as presupuesto_linea_tipo", - "orden_trabajo_dates.ferro_ok_at" + "orden_trabajo_dates.ferro_ok_at", + "CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL')) as imposicion_name" + ]) ->join("orden_trabajo_dates","orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id","left") ->join("pedidos","pedidos.id = ordenes_trabajo.pedido_id","left") @@ -92,6 +94,9 @@ class OrdenTrabajoModel extends Model ->join("clientes","clientes.id = presupuestos.cliente_id","left") ->join("tipos_presupuestos","presupuestos.tipo_impresion_id = tipos_presupuestos.id","left") ->join("ubicaciones","ubicaciones.id = pedidos_linea.ubicacion_id","left") + ->join("orden_trabajo_tareas","orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id","left") + ->join("lg_imposiciones","lg_imposiciones.id = orden_trabajo_tareas.imposicion_id","left") + ->whereIn("presupuesto_linea.tipo",["lp_bn","lp_bnhq","lp_rot_bn","lp_color","lp_colorhq","lp_rot_color"]) ->where("ordenes_trabajo.deleted_at",null) ->groupBy("ordenes_trabajo.id"); diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 8c9286cd..0a325cf9 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -3,6 +3,7 @@ namespace App\Services; use App\Entities\Clientes\ClienteEntity; +use App\Entities\Configuracion\Imposicion; use App\Entities\Pedidos\PedidoEntity; use App\Entities\Presupuestos\PresupuestoEntity; use App\Entities\Presupuestos\PresupuestoLineaEntity; @@ -414,9 +415,12 @@ class ProductionService extends BaseService "orden_trabajo_tareas.maquina_id as maquina_tarea", "lg_maquinas.nombre as maquina_nombre", "lg_imposiciones.id as imposicion_id", + "CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL'),'_',COALESCE(lg_imposiciones.etiqueta,'')) as imposicion_name", "orden_trabajo_tareas.tiempo_estimado", "orden_trabajo_tareas.tiempo_real", "orden_trabajo_tareas.comment", + "orden_trabajo_tareas.presupuesto_linea_id", + "presupuesto_linea.tipo", ]) ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left") @@ -657,39 +661,53 @@ class ProductionService extends BaseService "linea_impresion" => $this->presupuesto->presupuestoLineaImpresion(), "linea_cubierta" => $this->presupuesto->presupuestoLineaCubierta(), "peso_unidad" => $logistica_data["peso_unidad"], - "peso_pedido" => $logistica_data["peso_pedido"] + "peso_pedido" => $logistica_data["peso_pedido"], + "imposicion" => $this->getImposicionTareaImpresion() ]; } - public function getTareaImpresionSobreCubierta(): array + public function getImposicionTareaImpresion(): ?Imposicion + { + $imposicion = null; + $impresionInteriorBnImposicion = $this->getTareaImpresionInteriorBn()?->imposicion(); + $impresionInteriorColorImposicion = $this->getTareaImpresionInteriorColor()?->imposicion(); + if($impresionInteriorBnImposicion){ + $imposicion = $impresionInteriorBnImposicion; + } + if($impresionInteriorColorImposicion){ + $imposicion = $impresionInteriorColorImposicion; + } + return $imposicion; + } + public function getTareaImpresionSobreCubierta(): ?OrdenTrabajoTareaEntity { $q = $this->otTarea->select('orden_trabajo_tareas.*') ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left") ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id) - ->whereIn("presupuesto_linea.tipo", ["lp_sobrecubierta"])->findAll(); + ->whereIn("presupuesto_linea.tipo", ["lp_sobrecubierta"])->first(); return $q; } - public function getTareaImpresionCubierta(): array + public function getTareaImpresionCubierta(): ?OrdenTrabajoTareaEntity { $q = $this->otTarea->select('orden_trabajo_tareas.*') ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left") ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id) - ->whereIn("presupuesto_linea.tipo", ["lp_cubierta"])->findAll(); + ->whereIn("presupuesto_linea.tipo", ["lp_cubierta"])->first(); return $q; } - public function getTareaImpresionInteriorBn(): array + public function getTareaImpresionInteriorBn(): ?OrdenTrabajoTareaEntity { $q = $this->otTarea->select('orden_trabajo_tareas.*') ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left") ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id) - ->whereIn("presupuesto_linea.tipo", ["lp_rot_bn", "lp_bn", "lp_bnhq"])->findAll(); + ->whereIn("presupuesto_linea.tipo", ["lp_rot_bn", "lp_bn", "lp_bnhq"])->first(); return $q; } - public function getTareaImpresionInteriorColor(): array + public function getTareaImpresionInteriorColor(): ?OrdenTrabajoTareaEntity { $q = $this->otTarea->select('orden_trabajo_tareas.*') ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left") ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id) - ->whereIn("presupuesto_linea.tipo", ["lp_rot_color", "lp_color", "lp_colorhq"])->findAll(); + ->whereIn("presupuesto_linea.tipo", ["lp_rot_color", "lp_color", "lp_colorhq"])->first(); return $q; } public function getPresupuestoLineaImpresion() {} diff --git a/ci4/app/Views/themes/vuexy/components/tables/ot_task_table.php b/ci4/app/Views/themes/vuexy/components/tables/ot_task_table.php index cc9e048c..60dc55d3 100644 --- a/ci4/app/Views/themes/vuexy/components/tables/ot_task_table.php +++ b/ci4/app/Views/themes/vuexy/components/tables/ot_task_table.php @@ -7,7 +7,7 @@ - + diff --git a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php index 8fd39828..08de4ce3 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php @@ -52,6 +52,8 @@ section('css') ?> + + endSection() ?> section("additionalExternalJs") ?> diff --git a/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php b/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php index 753a17f5..9c8adc56 100644 --- a/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php +++ b/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php @@ -44,13 +44,13 @@ $settings = $session->get('settings');
- portada_path)): '/assets/img/portada_not_found.png' ?>" /> + portada_path)) : '/assets/img/portada_not_found.png' ?>" />
py-2 rounded border-1 border-secondary">
- fecha_encuadernado_at ? week_day_humanize(Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)->getDayOfWeek(), true) : "" ?> + fecha_encuadernado_at ? week_day_humanize(Time::createFromFormat("Y-m-d", $dates?->fecha_encuadernado_at)->getDayOfWeek(), true) : "" ?> Comercial: first_name . " " . $cliente->comercial()->last_name ?>
@@ -64,52 +64,52 @@ $settings = $session->get('settings');
-
"> - fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)?->format("d/m/Y") : "" ?> -
-
- RF -
+
"> + fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $dates?->fecha_encuadernado_at)?->format("d/m/Y") : "" ?> +
+
+ tarifa()->code ?? "?" : "?" ?> +
- - - - - - - - - - - - - - - - - - - - - -
IN
PO
PL
EN
MA
+ + + + + + + + + + + + + + + + + + + + + +
IN
PO
PL
EN
MA
-
- BCLF 100 +
+ papel_impresion()->papel_code_ot ?>
0:3
- EM 300 + papel_impresion()->papel_code_ot ?>
- BRILLO + tarifa()->code : "" ?>
@@ -130,26 +130,26 @@ $settings = $session->get('settings');
- +
- - + - - + - + - +
Cliente + Cliente nombre ?>
Titulo + Titulo titulo ?>
ISBNISBN isbn ?>
CIFCIF cif ?>
@@ -187,7 +187,7 @@ $settings = $session->get('settings'); - +
Imposicion??full_name ?>
@@ -198,6 +198,18 @@ $settings = $session->get('settings');
IMP. INTERIOR
+ + + + + + + + + + + +
?? tirada ?> tipo ?> lomo_cubierta ?>
@@ -288,7 +300,7 @@ $settings = $session->get('settings'); - +
Máquina $q->nombre, $acabados[0]->maquinas())) ?> Operariousers()->plastificado_by?->getFullName() ?? null ?> users()?->plastificado_by?->getFullName() ?? null ?>
@@ -307,7 +319,7 @@ $settings = $session->get('settings'); - + diff --git a/httpdocs/assets/js/safekat/components/datatables/otDatatable.js b/httpdocs/assets/js/safekat/components/datatables/otDatatable.js index d5c2f089..d3e9dd80 100644 --- a/httpdocs/assets/js/safekat/components/datatables/otDatatable.js +++ b/httpdocs/assets/js/safekat/components/datatables/otDatatable.js @@ -14,11 +14,14 @@ class OrdenTrabajoDatatable { { data: 'cliente_nombre', searchable: false, sortable: false }, { data: 'presupuesto_titulo', searchable: false, sortable: false }, { data: 'ubicacion_nombre', searchable: false, sortable: false }, - { data: 'total_tirada', searchable: false, sortable: false ,render : (d) => `${d}`}, + { data: 'total_tirada', searchable: false, sortable: false, render: (d) => `${d}` }, { data: 'tipo_presupuesto_impresion', searchable: false, sortable: false }, { data: 'logo', searchable: false, sortable: false, render: (d, t) => { - return `logo-impresion` + return `
+ logo-impresion + ${d.imposicion ? `${d.imposicion ?? ""}` : ''} +
` } }, { @@ -50,7 +53,7 @@ class OrdenTrabajoDatatable { bottomStart: 'info', bottomEnd: 'paging' }, - columnDefs : [ + columnDefs: [ { className: 'dt-center', targets: '_all' }, ], serverSide: true, @@ -71,7 +74,7 @@ class OrdenTrabajoDatatable { bottomStart: 'info', bottomEnd: 'paging' }, - columnDefs : [ + columnDefs: [ { className: 'dt-center', targets: '_all' }, ], serverSide: true, diff --git a/httpdocs/assets/js/safekat/pages/pdf/otDownload.js b/httpdocs/assets/js/safekat/pages/pdf/otDownload.js index e350cdaf..d8eb9caa 100644 --- a/httpdocs/assets/js/safekat/pages/pdf/otDownload.js +++ b/httpdocs/assets/js/safekat/pages/pdf/otDownload.js @@ -1,12 +1,12 @@ $(() => { - console.log("PDF") - var opt = { - margin: 2, - filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf", - image: { type: 'jpeg', quality: 1 }, - html2canvas: { scale: 3 }, - jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } - }; - let elementToPdf = $('body')[0] - html2pdf().set(opt).from(elementToPdf).save() + // console.log("PDF") + // var opt = { + // margin: 2, + // filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf", + // image: { type: 'jpeg', quality: 1 }, + // html2canvas: { scale: 3 }, + // jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } + // }; + // let elementToPdf = $('body')[0] + // html2pdf().set(opt).from(elementToPdf).save() }) \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/produccion/ot.js b/httpdocs/assets/js/safekat/pages/produccion/ot.js index 029abab2..335483c9 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/ot.js +++ b/httpdocs/assets/js/safekat/pages/produccion/ot.js @@ -26,7 +26,7 @@ class OrdenTrabajo { { data: 'nombre', searchable: true, sortable: true, width: "20%" }, { data: 'maquina_presupuesto_linea', searchable: true, sortable: true, width: "20%" }, { data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "20%" }, - // { data: 'imposicion_id', searchable: false, sortable: false }, + { data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this) }, { data: 'tiempo_estimado', searchable: false, sortable: false }, { data: 'tiempo_real', searchable: false, sortable: false }, { @@ -42,13 +42,13 @@ class OrdenTrabajo { nameId: "orden_trabajo_id", getUri: '/produccion/ordentrabajo/get_files', postUri: '/produccion/ordentrabajo/upload_files', - resourcePath : 'orden_trabajo/' + this.modelId + resourcePath: 'orden_trabajo/' + this.modelId } if ($(this.configUploadDropzone.domElement).length > 0) { this.fileUploadDropzone = new FileUploadDropzone(this.configUploadDropzone) } } - initDropFiles(){ + initDropFiles() { if ($(this.configUploadDropzone.domElement).length > 0) { this.fileUploadDropzone.init() } @@ -90,6 +90,7 @@ class OrdenTrabajo { eventTareas() { this.otForm.on("change", ".select-maquina-tarea-datatable", this.handleTareaChange.bind(this)) this.otForm.on("change", ".orden-tarea", this.handleTareaChange.bind(this)) + this.otForm.on("change", ".select-imposicion-tarea-datatable", this.handleTareaChange.bind(this)) this.otForm.on("click", ".increase-order", (event) => { const input_orden_tarea = $(event.currentTarget).parent().parent().find('.orden-tarea') let actual_value = parseInt(input_orden_tarea.val()) @@ -105,6 +106,7 @@ class OrdenTrabajo { } unbindEventTareas() { this.otForm.off("change", ".select-maquina-tarea-datatable") + this.otForm.off("change", ".select-imposicion-tarea-datatable") this.otForm.off("change", ".orden-tarea") this.otForm.off("click", ".increase-order") this.otForm.off("click", ".decrease-order") @@ -172,6 +174,14 @@ class OrdenTrabajo { ` + } + _renderImposicionSelectTable(d, t) { + + let render = `` + return render + } _renderActionCell(d, t) { @@ -204,6 +214,26 @@ class OrdenTrabajo { if (element.presupuesto_manipulado_id || element.is_corte) this.createSelectMaquinaManipulado(selectItem) if (element.presupuesto_preimpresion_id) this.createSelectMaquinaAll(selectItem) if (element.presupuesto_extra_id) this.createSelectMaquinaAll(selectItem) + if (this.summaryData.impresion_interior_bn) { + let isTareaImpresionInteriorBN = this.summaryData.impresion_interior_bn?.presupuesto_linea_id == element.presupuesto_linea_id + if (isTareaImpresionInteriorBN) { + let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id); + this.createSelectImposicion(selectItemImposicion) + } else { + let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id); + selectItemImposicion.addClass("d-none"); + } + } + if (this.summaryData.impresion_interior_color) { + let isTareaImpresionInteriorColor = this.summaryData.impresion_interior_color?.presupuesto_linea_id == element.presupuesto_linea_id + if (isTareaImpresionInteriorColor) { + let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id); + this.createSelectImposicion(selectItemImposicion) + } else { + let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id); + selectItemImposicion.addClass("d-none"); + } + } }); } catch (error) { } finally { @@ -262,6 +292,25 @@ class OrdenTrabajo { maquinaSelects.reset() } } + createSelectImposicion(selectItem) { + let imposicionId = selectItem.data("imposicion-id") + let imposicionSelect = new ClassSelect(selectItem, `/imposiciones/select`, "Seleccione una imposición", true); + + imposicionSelect.config.templateResult = (state) => { + let $state = $(` +
+ ${state.text} + ${state.desc ?? ''} +
`) + return $state; + } + imposicionSelect.init(); + if (imposicionId) { + imposicionSelect.setVal(imposicionId) + } else { + imposicionSelect.reset() + } + } @@ -294,7 +343,7 @@ class OrdenTrabajo { } handleSummaryError(error) { Notiflix.Block.remove('.section-block'); - } + } fillPreimpresionReview() { this.otForm.find("[name=fecha_entrega_warning]").prop("checked", this.summaryData.ot.fecha_entrega_warning) this.otForm.find("[name=fecha_entrega_warning_revised]").prop("checked", this.summaryData.ot.fecha_entrega_warning_revised) @@ -333,10 +382,10 @@ class OrdenTrabajo { this.espiral.setDate(this.summaryData.dates.fecha_impresion_at) this.embalaje.setDate(this.summaryData.dates.embalaje_at) this.envio.setDate(this.summaryData.dates.envio_at) - this.pedidoEnEsperaCheck.prop("checked",this.summaryData.ot.is_pedido_espera); - if(this.summaryData.ot.pedido_espera_by){ - this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name,this.summaryData.ot.pedido_espera_by.last_name].join(" ")) - }else{ + this.pedidoEnEsperaCheck.prop("checked", this.summaryData.ot.is_pedido_espera); + if (this.summaryData.ot.pedido_espera_by) { + this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name, this.summaryData.ot.pedido_espera_by.last_name].join(" ")) + } else { this.pedidoEnEsperaBy.text(""); } this.otEstado.val(this.summaryData.ot.estado) diff --git a/httpdocs/themes/vuexy/css/ot.css b/httpdocs/themes/vuexy/css/ot.css new file mode 100644 index 00000000..0cc848be --- /dev/null +++ b/httpdocs/themes/vuexy/css/ot.css @@ -0,0 +1,17 @@ +.imposicion-overlay-image +{ + position: absolute; + top: 75%; + left: 25%; + transform: translate(-10%, -10%); + background-color:rgb(255, 255, 255); + color: black; + font-size: 11px; + text-align: center; + border : 1px solid; + +} +.logo-container{ + position: relative; + display: inline-block; +} \ No newline at end of file diff --git a/httpdocs/themes/vuexy/css/pdf.ot copy.css b/httpdocs/themes/vuexy/css/pdf.ot copy.css deleted file mode 100644 index 1e75c6d8..00000000 --- a/httpdocs/themes/vuexy/css/pdf.ot copy.css +++ /dev/null @@ -1,348 +0,0 @@ -@page { - size: A4; - margin: 0; - } - @media print { - body,html { - width: 210mm; - height: 297mm; - max-width: 210mm; - max-height: 297mm; - print-color-adjust: exact; - } - /* ... the rest of the rules ... */ - } -html { - font-family: Arial, sans-serif; - width: 210mm; - height: 297mm; - max-width: 210mm; - font-size : 11px; - max-height: 297mm; - background-color: #f9f9f9; -} -body{ - border: 0px solid; - padding: 20px; - max-width: 210mm; - max-height: 297mm; - -} -.cubierta{ - color: #007bff; -} -.encuadernacion{ - color: green; -} -.impresion{ - color: #ff4000; -} -.container { - width: 100%; - width: 210mm; - height: 297mm; - background: #fff; - padding: 20px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); - border: 2px solid; - -} -.header { - display: flex; - justify-content: space-between; - align-items: center; -} -.cover{ - display: flex; - justify-content: start; - align-items: center; - gap: 10px; - margin-top: 10px; - margin-bottom: 10px; -} -.portada-info{ - display: flex; - flex-direction: column; - width: 100%; -} -.impresion-tipo-row{ - display: flex; - align-items: center; - justify-items: center; - justify-content: end; - width: 100%; - height: 5mm; - margin: 2px; -} -.portada-row{ - display: flex; - align-items: center; - justify-items: center; - justify-content: space-between; - background-color: #4ba0fccc; - width: 100%; - height: 5mm; - border: solid 2px; - margin: 2px; - border-color: black; - -} -.portada-row-2{ - display: flex; - align-items: center; - justify-items: center; - width: 100%; - height: 35mm; - margin: 2px; - border: 2px solid; - border-color: black; - -} -.portada{ - height: 40mm; -} -.presupuesto-title{ - color: #007bff; - font-size: medium; - line-height: 0; -} -.pl-2{ - padding-left: 0.5rem; -} -.pr-2{ - padding-right: 0.5rem; -} -.pt-2{ - padding-top: 0.5rem; -} -.flex-row{ - display: flex; - width: 100%; - justify-content: start; - align-items: flex-start; -} -.date{ - padding-left: 0.5rem; - padding-top: 0px; - width: 100%; - line-height: 0px; - stroke-width: 5px; - font-size: medium; -} -#presupuesto-section{ - width: 100%; -} -.flex-col{ - display: flex; - padding: 0; - flex-direction: column; -} -.cliente-title{ - color: red; - font-size: medium; - stroke-width: 10px; - line-height: 0px; -} - -.header .title { - font-size: 24px; - font-weight: bold; - color: #333; -} - -.section { - margin-top: 0.5rem; - border-top: 1px solid #ddd; - padding-top: 0.2rem; -} -.section-title { - font-weight: bold; - margin-bottom: 10px; -} -table { - width: 100%; - border-collapse: collapse; - margin-bottom: 5px; - font-size: 12px; -} -table th, table td { - border: 2px solid #000000; - text-align: center; -} -table th { - background-color: #f4f4f4; - font-weight: bold; -} -table td{ - font-weight: bold; -} -.comments { - color: #555; - font-style: italic; - margin-top: 0.2rem; -} -.comment-content { - line-height: 0; - width: 100%; - height: 50px; - border: solid; - border-width: 1px; -} -.footer { - text-align: center; - margin-top: 0.5rem; - - font-size: 14px; - color: #777; -} -.row-logo-impresion{ - text-align: center; -} -.portada-img{ - border: black; - border-style: solid; - border-width: 2px; - height: 40mm; - width: 100px; - max-width: 30mm; - border: 2px solid; - border-color: black; - border-radius: 5%; -} -.portada-text{ - color: white; -} - -.t-header{ - color: black; - width: 25%; -} -.t-cell{ - background-color: white; - color: black; - text-align: start; - padding-left: 0.2rem; -} -.t-row{ - font-size: 10px; -} -.esquema{ - display: flex; - justify-content:flex-end; - width: 100%; - justify-items: flex-end; - -} -.pagina-imposicion-outer-start{ - border-top: 2px solid; - border-left: 2px solid; - border-bottom: 2px solid; - width: 50px; - height: 100px; - display: flex; - align-items: center; - justify-content: center; -} -.pagina-imposicion-outer-end{ - border-top: 2px solid; - border-right: 2px solid; - border-bottom: 2px solid; - width: 50px; - height: 100px; - display: flex; - align-items: center; - justify-content: center; -} -.pagina-imposicion-outer{ - border-top: 2px solid; - border-bottom: 2px solid; - width: 50px; - height: 100px; - display: flex; - align-items: center; - justify-content: center; -} -.pagina-imposicion-inner{ - border: 2px solid; - font-size: 25px; - width: 40px; - height: 90px; - display: flex; - align-items: center; - justify-content: center; - -} -.square-wrapper{ - display: grid; - grid-template-columns: repeat(2,1fr); - margin-left: 5px; - -} -.square{ - width: 100px; - height: 50px; - font-size: 14px; - display: flex; - align-items: center; - justify-content: center; - font-weight: bold; -} -.cod{ - width: 150px; - height: 100px; - display: flex; - flex-direction: column; - background-color: orange; - margin-left : 20px; - color: white; - align-items: center; - justify-content: space-between; - font-weight: bold; -} -.cod-code{ - font-weight: bold; - color: white; -} -.esquema-imposicion-wrapper{ - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - margin-left: 2rem; - gap: 10px; -} -.imposicion{ - display: flex; - align-items: center; - justify-content: center; - width: 200px; -} -.imposicion td{ - font-size: large; -} -.cod-barras{ - width: 150px; - height: 80px; - text-align : center; - background-color: white; - align-content: center; -} -.cod-barras img { - padding : 1px; -} -.bg-white{ - background-color: white; - color: black; -} -.bg-red{ - background-color: red; - color: white; -} -.bg-gray{ - background-color: gray; - color:white -} -.bg-blue{ - background-color: blue; - color: white; -} From 08a91294b4f9c5c567e25b457068706a1a79f849 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sun, 13 Apr 2025 09:43:15 +0200 Subject: [PATCH 03/13] dates users ot --- ci4/app/Config/OrdenTrabajo.php | 42 ++++ .../Controllers/Produccion/Ordentrabajo.php | 1 + .../Produccion/OrdenTrabajoDateEntity.php | 78 ++------ .../Produccion/OrdenTrabajoUserEntity.php | 29 +-- ci4/app/Language/es/Produccion.php | 19 +- .../Models/OrdenTrabajo/OrdenTrabajoDate.php | 26 +-- .../Models/OrdenTrabajo/OrdenTrabajoUser.php | 29 +-- ci4/app/Services/ProductionService.php | 38 ++-- .../vuexy/form/produccion/ot/otProgress.php | 185 ++++++++++++------ 9 files changed, 278 insertions(+), 169 deletions(-) create mode 100644 ci4/app/Config/OrdenTrabajo.php diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php new file mode 100644 index 00000000..763bad87 --- /dev/null +++ b/ci4/app/Config/OrdenTrabajo.php @@ -0,0 +1,42 @@ + "interior_bn_user_id", + "interior_color_at" => "interior_color_user_id", + "cubierta_at" => "cubierta_user_id", + //ACABADO + "plastificado_at" => "plastificado_user_id", + "encuadernacion_at" => "encuadernacion_user_id", + "corte_at" => "corte_user_id", + "preparacion_interiores_at" => "preparacion_interior_user_id", + "entrada_manipulado_at" => "entrada_manipulado_user_id", + //FERRO + "pendiente_ferro_at" => "pendiente_ferro_user_id", + "ferro_en_cliente_at" => "ferro_en_cliente_user_id", + "ferro_ok_at" => "ferro_ok_user_id", + //ENVIO + "embalaje_at" => "embalaje_user_id", + "envio_at" => "envio_user_id", + //PREIMPRESION + "pre_formato_at" => "pre_formato_user_id", + "pre_lomo_at" => "pre_lomo_user_id", + "pre_solapa_at" => "pre_solapa_user_id", + "pre_codbarras_at" => "pre_codbarras_user_id", + "pre_imposicion_at" => "pre_imposicion_user_id", + + ]; + + public function __construct() + { + parent::__construct(); + } + +} diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index ef39f38a..54b9335d 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -131,6 +131,7 @@ class Ordentrabajo extends BaseController $this->viewData["presupuesto"] = $this->produccionService->getPresupuesto(); $this->viewData["cliente"] = $this->produccionService->getCliente(); $this->viewData["ot"] = $this->produccionService->getOrdenTrabajo(); + $this->viewData["user_dates"] = $this->produccionService->userDates(); return view(static::$viewPath . $this->editRoute, $this->viewData); } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php index f6b5e79c..352e3ac8 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php @@ -2,34 +2,38 @@ namespace App\Entities\Produccion; +use App\Models\Usuarios\UserModel; use CodeIgniter\Entity\Entity; +use Exception; class OrdenTrabajoDateEntity extends Entity { protected $attributes = [ "orden_trabajo_id" => null, "fecha_entrada_at" => null, - "fecha_entrega_change_at" => null, - "fecha_entrega_real_at" => null, - "fecha_entrega_real_warning" => null, - "fecha_impresion_at" => null, - "fecha_encuadernado_at" => null, - "fecha_externo_at" => null, - "fecha_entrega_warning" => null, - "fecha_entrega_warning_revised" => null, - "pendiente_ferro_at" => null, - "ferro_en_cliente_at" => null, - "ferro_ok_at" => null, + //IMPRESION "interior_bn_at" => null, "interior_color_at" => null, - "preparacion_interiores_at" => null, "cubierta_at" => null, + //ACABADO "plastificado_at" => null, "encuadernacion_at" => null, "corte_at" => null, + "preparacion_interiores_at" => null, + "entrada_manipulado_at" => null, + //FERRO + "pendiente_ferro_at" => null, + "ferro_en_cliente_at" => null, + "ferro_ok_at" => null, + //ENVIO "embalaje_at" => null, "envio_at" => null, - "entrada_manipulado_at" => null + //PREIMPRESION + "pre_formato_at" => null, + "pre_lomo_at" => null, + "pre_solapa_at" => null, + "pre_codbarras_at" => null, + "pre_imposicion_at" => null, ]; protected $datamap = []; @@ -37,51 +41,11 @@ class OrdenTrabajoDateEntity extends Entity 'created_at', 'updated_at', 'deleted_at', - // 'fecha_entrega_at', - // 'fecha_entrega_change_at', - // 'fecha_entrega_real_at', - // 'fecha_entrega_real_warning', - // 'fecha_impresion_at', - // 'fecha_encuadernado_at', - // 'fecha_externo_at', - // 'fecha_entrega_warning', - // 'fecha_entrega_warning_revised', - // 'pendiente_ferro_at', - // 'ferro_en_cliente_at', - // 'ferro_ok_at', - // 'interior_bn_at', - // 'interior_color_at', - // 'preparacion_interiores_at', - // 'cubierta_at', - // 'plastificado_at', - // 'encuadernacion_at', - // 'corte_at', - // 'embalaje_at', - // 'envio_at', - // 'entrada_manipulado_at' + ]; protected $casts = [ - // "fecha_entrada_at" => "?datetime", - // "fecha_entrega_change_at" => "?datetime", - // "fecha_entrega_real_at" => "?datetime", - // "fecha_entrega_real_warning" => "?bool", - // "fecha_impresion_at" => "?datetime", - // "fecha_encuadernado_at" => "?datetime", - // "fecha_externo_at" => "?datetime", - // "fecha_entrega_warning" => "?bool", - // "fecha_entrega_warning_revised" => "?bool", - // "pendiente_ferro_at" => "?datetime", - // "ferro_en_cliente_at" => "?datetime", - // "ferro_ok_at" => "?datetime", - // "interior_bn_at" => "?datetime", - // "interior_color_at" => "?datetime", - // "preparacion_interiores_at" => "?datetime", - // "cubierta_at" => "?datetime", - // "plastificado_at" => "?datetime", - // "encuadernacion_at" => "?datetime", - // "corte_at" => "?datetime", - // "embalaje_at" => "?datetime", - // "envio_at" => "?datetime", - // "entrada_manipulado_at" => "?datetime" ]; + + + } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php index c03df33a..4f516ecd 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php @@ -15,28 +15,35 @@ class OrdenTrabajoUserEntity extends Entity "orden_trabajo_id" => null, "user_created_id" => null, "user_update_id" => null, - "inaplazable_revised_change_user_id" => null, - "ferro_disponible_hecho_user_id" => null, - "ferro_disponible_ok_user_id" => null, - "ferro_entregado_user_id" => null, - "pendiente_ferro_user_id" => null, - "ferro_en_cliente_user_id" => null, - "ferro_ok_user_id" => null, + //IMPRESION "interior_bn_user_id" => null, "interior_color_user_id" => null, - "preparacion_interior_user_id" => null, "cubierta_user_id" => null, + //ACABADO "plastificado_user_id" => null, "encuadernacion_user_id" => null, "corte_user_id" => null, - "embalaje_user_id" => null, + "preparacion_interior_user_id" => null, "entrada_manipulado_user_id" => null, + //FERRO + "pendiente_ferro_user_id" => null, + "ferro_en_cliente_user_id" => null, + "ferro_ok_user_id" => null, + //ENVIO + "embalaje_user_id" => null, + "envio_user_id" => null, + //PREIMPRESION "pre_formato_user_id" => null, "pre_lomo_user_id" => null, "pre_solapa_user_id" => null, "pre_codbarras_user_id" => null, "pre_imposicion_user_id" => null, - "pre_imprimir_user_id" => null + //UNUSED + "inaplazable_revised_change_user_id" => null,//!DELETE + "ferro_disponible_hecho_user_id" => null,//!DELETE + "ferro_entregado_user_id" => null,//!DELETE + "pre_imprimir_user_id" => null, //!DELETE + "ferro_disponible_ok_user_id" => null, //!DELETE ]; // protected array $casts = [ // "orden_trabajo_id" => "integer", @@ -66,7 +73,7 @@ class OrdenTrabajoUserEntity extends Entity // "pre_imprimir_user_id" => "?integer" // ]; - protected function userBy(string $key): ?UserEntity + public function userBy(string $key): ?UserEntity { $user = null; if (isset($this->attributes[$key])) { diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index 603f21b3..d9719aeb 100644 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -57,7 +57,7 @@ return [ "fecha_entrega_estimada" => "Fecha entrega estimada", "formato" => "Formato", "paginas" => "Páginas", - "guillotina" => "Guillotina", + "guillotina" => "Guillotina/Corte", "tirada" => "Tirada", "merma" => "Merma", "pendiente_ferro" => "Pendiente ferro", @@ -86,7 +86,22 @@ return [ "size" => "Tamaño", "ejemplares" => "Ejemplares", "tipo" => "Tipo", - "lomo" => "Lomo" + "lomo" => "Lomo", + //IMPRESION + "impresion_bn" => "Impresión BN", + "cubierta" => "Cubierta/Portada", + //PREIMPRESION + "pre_formato" => "Revisión formato", + "pre_lomo" => "Revisión lomo", + "pre_solapa" => "Revisión solapa", + "pre_codbarras" => "Revisión código barras", + "pre_imposicion" => "Revisión imposición", + + + "errors" => [ + "date_not_exist" => "Esta fecha no existe en el modelo." + ] + ]; \ No newline at end of file diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php index d6a7d7c1..9feb110a 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php @@ -17,25 +17,29 @@ class OrdenTrabajoDate extends Model protected $allowedFields = [ "orden_trabajo_id", "fecha_entrada_at", - "fecha_entrega_at", - "fecha_entrega_real_at", - "fecha_entrega_change_at", - "fecha_impresion_at", - "fecha_encuadernado_at", - "fecha_externo_at", - "pendiente_ferro_at", - "ferro_en_cliente_at", - "ferro_ok_at", + //IMPRESION "interior_bn_at", "interior_color_at", - "preparacion_interiores_at", "cubierta_at", + //ACABADO "plastificado_at", "encuadernacion_at", "corte_at", + "preparacion_interiores_at", + "entrada_manipulado_at", + //FERRO + "pendiente_ferro_at", + "ferro_en_cliente_at", + "ferro_ok_at", + //ENVIO "embalaje_at", "envio_at", - "entrada_manipulado_at" + //PREIMPRESION + "pre_formato_at", + "pre_lomo_at", + "pre_solapa_at", + "pre_codbarras_at", + "pre_imposicion_at" ]; protected bool $allowEmptyInserts = false; diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php index c1a232f5..3bc18711 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php @@ -3,6 +3,7 @@ namespace App\Models\OrdenTrabajo; use App\Entities\Produccion\OrdenTrabajoUserEntity; +use App\Models\Usuarios\UserModel; use CodeIgniter\Database\MySQLi\Builder; use CodeIgniter\Model; @@ -18,28 +19,35 @@ class OrdenTrabajoUser extends Model "orden_trabajo_id", "user_created_id", "user_update_id", - "inaplazable_revised_change_user_id", - "ferro_disponible_hecho_user_id", - "ferro_disponible_ok_user_id", - "ferro_entregado_user_id", - "pendiente_ferro_user_id", - "ferro_en_cliente_user_id", - "ferro_ok_user_id", + //IMPRESION "interior_bn_user_id", "interior_color_user_id", - "preparacion_interior_user_id", "cubierta_user_id", + //ACABADO "plastificado_user_id", "encuadernacion_user_id", "corte_user_id", - "embalaje_user_id", + "preparacion_interior_user_id", "entrada_manipulado_user_id", + //FERRO + "pendiente_ferro_user_id", + "ferro_en_cliente_user_id", + "ferro_ok_user_id", + //ENVIO + "embalaje_user_id", + "envio_user_id", + //PREIMPRESION "pre_formato_user_id", "pre_lomo_user_id", "pre_solapa_user_id", "pre_codbarras_user_id", "pre_imposicion_user_id", - "pre_imprimir_user_id" + //UNUSED + "inaplazable_revised_change_user_id",//!DELETE + "ferro_disponible_hecho_user_id",//!DELETE + "ferro_entregado_user_id",//!DELETE + "pre_imprimir_user_id", //!DELETE + "ferro_disponible_ok_user_id", //!DELETE ]; protected bool $allowEmptyInserts = false; @@ -72,6 +80,5 @@ class OrdenTrabajoUser extends Model protected $beforeDelete = []; protected $afterDelete = []; - } diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 0a325cf9..eab9ef70 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -25,6 +25,7 @@ use CodeIgniter\Database\BaseResult; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\HTTP\Files\UploadedFile; use CodeIgniter\I18n\Time; +use Config\OrdenTrabajo; use Exception; /** @@ -46,22 +47,7 @@ class ProductionService extends BaseService protected string $defaultMaquinaCorteName = 'HT-1000'; protected MaquinaEntity $defaultMaquinaCorte; protected MaquinaModel $maquinaModel; - protected array $MAPPING_DATE_USER = [ - "fecha_encuadernado_at" => "encuadernacion_user_id", - // "fecha_externo_at" => "null", - "fecha_impresion_at" => null, - "pendiente_ferro_at" => "pendiente_ferro_user_id", - "ferro_en_cliente_at" => "ferro_en_cliente_user_id", - "ferro_ok_at" => "ferro_ok_user_id", - "interior_bn_at" => "interior_bn_user_id", - "interior_color_at" => "interior_color_user_id", - "preparacion_interiores_at" => "preparacion_interior_user_id", - "cubierta_at" => "cubierta_user_id", - "plastificado_at" => "plastificado_user_id", - "corte_at" => "corte_user_id", - "embalaje_at" => "embalaje_user_id", - "entrada_manipulado_at" => "entrada_manipulado_user_id" - ]; + protected OrdenTrabajo $ordenTrabajoConfig; /** * Pedido Entity @@ -84,6 +70,7 @@ class ProductionService extends BaseService $this->otUser = model(OrdenTrabajoUser::class); $this->userModel = model(UserModel::class); $this->otFileModel = model(OrdenTrabajoFileModel::class); + $this->ordenTrabajoConfig = config('OrdenTrabajo'); } public function init(int $orden_trabajo_id): self { @@ -627,6 +614,7 @@ class ProductionService extends BaseService "pedido" => $this->pedido, "presupuesto" => $this->presupuesto, "dates" => $this->ot->dates(), + "user_dates" => $this->userDates(), "tasks" => $this->ot->tareas(), "acabados" => $this->presupuesto->acabados(), "preimpresiones" => $this->presupuesto->preimpresiones(), @@ -757,8 +745,8 @@ class ProductionService extends BaseService ->update($data); $this->otDate->updateUserDateMap($this->ot->id, $data); $ot_users = $this->ot->users(); - if (isset($this->MAPPING_DATE_USER[$data["name"]])) { - $user_id = $ot_users->{$this->MAPPING_DATE_USER[$data["name"]]}; + if (isset($this->ordenTrabajoConfig->DATE_USER_MAPPING[$data["name"]])) { + $user_id = $ot_users->{$this->ordenTrabajoConfig->DATE_USER_MAPPING[$data["name"]]}; $user = $this->userModel->find($user_id); if ($user_id) { $result = ["user" => null, "status" => false]; @@ -1034,4 +1022,18 @@ class ProductionService extends BaseService } return $status; } + public function userDates() : array + { + $userDates = []; + foreach ($this->ordenTrabajoConfig->DATE_USER_MAPPING as $key => $value) { + $otUserEntity = $this->otUser->where("orden_trabajo_id",$this->ot->id)->first(); + $userEntity = $otUserEntity->userBy($value); + if($userEntity){ + $userDates[$key] = $userEntity->full_name; + }else{ + $userDates[$key] = null; + } + } + return $userDates; + } } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php index 380dfb68..e22dd511 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php @@ -21,69 +21,136 @@
- -
- - +
+ + +
+ + +
+
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
- -
- - +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
- -
- - +
+ + + +
+ + +
+ +
+ +
+ + +
+ +
- -
- - +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
From f3430713117d83ef994cb93e09c58d86805aa3f0 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sun, 13 Apr 2025 09:54:17 +0200 Subject: [PATCH 04/13] fix deleted at --- ci4/app/Models/Clientes/ClientePlantillaPreciosLineasModel.php | 2 +- ci4/app/Models/Clientes/ClientePreciosModel.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci4/app/Models/Clientes/ClientePlantillaPreciosLineasModel.php b/ci4/app/Models/Clientes/ClientePlantillaPreciosLineasModel.php index c15bbad2..c66ab4c5 100755 --- a/ci4/app/Models/Clientes/ClientePlantillaPreciosLineasModel.php +++ b/ci4/app/Models/Clientes/ClientePlantillaPreciosLineasModel.php @@ -151,7 +151,7 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel $builder->join("users t2", "t1.user_updated_id = t2.id", "left"); - $builder->where('t1.deleted_at', 0); + $builder->where('t1.deleted_at', null); $builder->where('t1.plantilla_id', $plantilla_id); if (empty($search)) diff --git a/ci4/app/Models/Clientes/ClientePreciosModel.php b/ci4/app/Models/Clientes/ClientePreciosModel.php index 17693fd2..9a1c25bc 100755 --- a/ci4/app/Models/Clientes/ClientePreciosModel.php +++ b/ci4/app/Models/Clientes/ClientePreciosModel.php @@ -388,7 +388,7 @@ class ClientePreciosModel extends \App\Models\BaseModel $builder->join("users t2", "t1.user_updated_id = t2.id", "left"); - $builder->where('t1.deleted_at', 0); + $builder->where('t1.deleted_at', null); $builder->where('t1.cliente_id', $cliente_id); if (empty($search)) From b28b8b761ea83d89c0036c32b4184225c7774476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Sun, 13 Apr 2025 14:13:05 +0200 Subject: [PATCH 05/13] reflejado diferentes ivas en total de factura --- .../Presupuestos/Presupuestoadmin.php | 2 +- .../form/facturas/_facturaLineasItems.php | 70 +++++++++++++++---- .../admin/viewPresupuestoadminForm.php | 5 ++ .../presupuestoAdmin/presupuestoAdminEdit.js | 4 +- .../presupuestoAdmin/sections/resumen.js | 3 + 5 files changed, 68 insertions(+), 16 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index 75ac450d..5039d115 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -1595,7 +1595,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $presupuestoServiciosExtraModel = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel'); foreach ($presupuestoServiciosExtraModel->where('presupuesto_id', $presupuesto->id)->findAll() as $servicioExtra) { $servicioExtra->presupuesto_id = $new_id; - $presupuestoServiciosExtraModel->insert($preimpresion); + $presupuestoServiciosExtraModel->insert($servicioExtra); } $presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel'); diff --git a/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php b/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php index 9cd3136e..00412097 100644 --- a/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php +++ b/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php @@ -35,9 +35,15 @@
- - - + + + + + + + + + @@ -124,17 +130,26 @@ const actionBtns = function(data) { const autoNumericSubtotal = new AutoNumeric('#subtotal-sum', 0, { decimalPlaces: 2, - digitGroupSeparator: ',', - decimalCharacter: '.', + digitGroupSeparator: '.', + decimalCharacter: ',', unformatOnSubmit: true, decimalPlacesShownOnFocus: 2, decimalPlacesShownOnBlur: 2, }); -const autoNumericIVA = new AutoNumeric('#total-iva-sum', 0, { +const autoNumericIVA_4 = new AutoNumeric('#total-iva-sum-4', 0, { decimalPlaces: 2, - digitGroupSeparator: ',', - decimalCharacter: '.', + digitGroupSeparator: '.', + decimalCharacter: ',', + unformatOnSubmit: true, + decimalPlacesShownOnFocus: 2, + decimalPlacesShownOnBlur: 2, +}); + +const autoNumericIVA_21 = new AutoNumeric('#total-iva-sum-21', 0, { + decimalPlaces: 2, + digitGroupSeparator: '.', + decimalCharacter: ',', unformatOnSubmit: true, decimalPlacesShownOnFocus: 2, decimalPlacesShownOnBlur: 2, @@ -142,8 +157,8 @@ const autoNumericIVA = new AutoNumeric('#total-iva-sum', 0, { const autoNumericTotal = new AutoNumeric('#total-sum', 0, { decimalPlaces: 2, - digitGroupSeparator: ',', - decimalCharacter: '.', + digitGroupSeparator: '.', + decimalCharacter: ',', unformatOnSubmit: true, decimalPlacesShownOnFocus: 2, decimalPlacesShownOnBlur: 2, @@ -151,8 +166,8 @@ const autoNumericTotal = new AutoNumeric('#total-sum', 0, { const autoNumericPendientePago = new AutoNumeric('#pendiente-pago', 0, { decimalPlaces: 2, - digitGroupSeparator: ',', - decimalCharacter: '.', + digitGroupSeparator: '.', + decimalCharacter: ',', unformatOnSubmit: true, decimalPlacesShownOnFocus: 2, decimalPlacesShownOnBlur: 2, @@ -448,11 +463,38 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({ const table = this.api(); const totalSubtotal = table.column(8).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0); - const totalIVA = table.column(9).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0); + + const data_table = table.rows().data(); + const totalIVA_4 = data_table.reduce((sum, row) => { + if (parseInt(row['iva']) === 4) { + return sum + parseFloat(row['total_iva']) || 0; + } + return sum; + }, 0); + const totalIVA_21 = data_table.reduce((sum, row) => { + if (parseInt(row['iva']) === 21) { + return sum + parseFloat(row['total_iva']) || 0; + } + return sum; + }, 0); + const totalTotal = table.column(10).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0); autoNumericSubtotal.set(totalSubtotal); - autoNumericIVA.set(totalIVA); + autoNumericIVA_4.set(totalIVA_4); + if(totalIVA_4 == 0){ + $('#total-iva-sum-4').closest('tr').addClass('d-none'); + } + else{ + $('#total-iva-sum-4').closest('tr').removeClass('d-none'); + } + autoNumericIVA_21.set(totalIVA_21); + if(totalIVA_21 == 0){ + $('#total-iva-sum-21').closest('tr').addClass('d-none'); + } + else{ + $('#total-iva-sum-21').closest('tr').removeClass('d-none'); + } autoNumericTotal.set(totalTotal); var total_pagos = autoNumericTotalCobrado.getNumber(); diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoadminForm.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoadminForm.php index 55550d0b..6ef1a1c5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoadminForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoadminForm.php @@ -190,6 +190,11 @@ dataType: 'json', success:function(response){ + if(response.error){ + console.error(response.error); + return; + } + token=response.; yeniden(token); // redirect diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js index c597c3ce..1fe9218c 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js @@ -399,7 +399,9 @@ class PresupuestoAdminEdit { self.tipo_impresion.val(response.data.tipo_impresion); self.POD.val(response.data.POD); - AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(response.data.total_aceptado_revisado); + const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ? + response.data.total_aceptado_revisado : response.data.resumen.total_aceptado; + AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado); $('#aprobado_by_at').html(response.data.aprobado_by_at); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js index f34c49d0..098b33cf 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js @@ -414,6 +414,9 @@ class Resumen { if (total_aceptado_revisado && total_aceptado_revisado != 0) { data.total_aceptado_revisado = total_aceptado_revisado; } + else{ + data.total_aceptado_revisado = data.total_aceptado; + } return data; } From e9827c3557543db2c404e3827c06b65c7daa4b50 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Mon, 14 Apr 2025 08:05:03 +0200 Subject: [PATCH 06/13] fechas pedido and imposiciones --- ci4/app/Config/OrdenTrabajo.php | 7 ++ ci4/app/Config/Routes.php | 2 + .../Controllers/Produccion/Ordentrabajo.php | 37 +++++-- ci4/app/Entities/Pedidos/PedidoEntity.php | 20 ++++ .../Presupuestos/PresupuestoLineaEntity.php | 4 + .../Produccion/OrdenTrabajoEntity.php | 4 +- .../Produccion/OrdenTrabajoTareaEntity.php | 6 +- ci4/app/Language/es/Produccion.php | 4 +- .../Models/OrdenTrabajo/OrdenTrabajoDate.php | 19 +--- ci4/app/Services/ProductionService.php | 93 +++++++++++++++-- .../vuexy/form/produccion/ot/otDates.php | 20 ++-- .../vuexy/form/produccion/ot/otHeader.php | 2 +- .../vuexy/form/produccion/ot/otProgress.php | 16 +-- .../Views/themes/vuexy/pdfs/orden_trabajo.php | 36 +++---- .../assets/js/safekat/pages/pdf/otDownload.js | 20 ++-- .../assets/js/safekat/pages/produccion/ot.js | 95 +++++++++++++----- httpdocs/themes/vuexy/css/pdf.ot.css | 36 +++++-- .../vuexy/img/safekat/presupuestos/cmyk.png | Bin 0 -> 1028 bytes 18 files changed, 315 insertions(+), 106 deletions(-) create mode 100644 httpdocs/themes/vuexy/img/safekat/presupuestos/cmyk.png diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php index 763bad87..1d91e1d2 100644 --- a/ci4/app/Config/OrdenTrabajo.php +++ b/ci4/app/Config/OrdenTrabajo.php @@ -33,6 +33,13 @@ class OrdenTrabajo extends BaseConfig "pre_imposicion_at" => "pre_imposicion_user_id", ]; + public array $DATE_USER_MAPPING_PEDIDO = [ + "inaplazable" => "inaplazable_change_user_id", + "fecha_entrega_real" => "fecha_entrega_real_change_user_id", + "fecha_impresion" => "fecha_impresion_change_user_id", + "fecha_encuadernado" => "fecha_encuadernado_change_user_id", + "fecha_entrega_externo" => "fecha_entrega_externo_change_user_id", + ]; public function __construct() { diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 36133af7..3f308c76 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -735,6 +735,8 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func *========================**/ $routes->post("update/tarea", 'Ordentrabajo::update_orden_trabajo_tarea'); $routes->post("update/date", 'Ordentrabajo::update_orden_trabajo_date'); + $routes->post("update/pedido/date", 'Ordentrabajo::update_orden_trabajo_pedido_date'); + $routes->post("update/pedido", 'Ordentrabajo::update_orden_trabajo_pedido'); $routes->post("update/user", 'Ordentrabajo::update_orden_trabajo_user'); $routes->post("update", 'Ordentrabajo::update_orden_trabajo'); $routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada'); diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 54b9335d..5bbff500 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -118,7 +118,26 @@ class Ordentrabajo extends BaseController return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400); } } - + public function update_orden_trabajo_pedido_date() + { + try { + $bodyData = $this->request->getPost(); + $r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedidoDate($bodyData); + return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r["status"], "user" => $r["user"], "data" => $bodyData]); + } catch (\Throwable $th) { + return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500); + } + } + public function update_orden_trabajo_pedido() + { + try { + $bodyData = $this->request->getPost(); + $r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedido($bodyData); + return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r,"data" => $bodyData]); + } catch (\Throwable $th) { + return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500); + } + } public function edit($orden_trabajo_id) { // Breadcrumbs @@ -132,6 +151,8 @@ class Ordentrabajo extends BaseController $this->viewData["cliente"] = $this->produccionService->getCliente(); $this->viewData["ot"] = $this->produccionService->getOrdenTrabajo(); $this->viewData["user_dates"] = $this->produccionService->userDates(); + $this->viewData["pedido_user_dates"] = $this->produccionService->pedidoUserDates(); + return view(static::$viewPath . $this->editRoute, $this->viewData); } @@ -233,8 +254,7 @@ class Ordentrabajo extends BaseController ->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmm_string($q->tiempo_estimado)) ->edit("tiempo_real", fn($q) => float_seconds_to_hhmm_string($q->tiempo_real)) ->edit("maquina_tarea", fn($q) => ["id" => $q->id, "maquina_id" => $q->maquina_tarea, "maquina_name" => $q->maquina_nombre]) - ->add("imposicion", fn($q) => ["id" => $q->id, "imposicion_id" => $q->imposicion_id, "name" => $q->imposicion_name,"is_presupuesto_linea" => $q->presupuesto_linea_id ? true : false ]) - + ->add("imposicion", fn($q) => ["id" => $q->id, "imposicion_id" => $q->imposicion_id, "name" => $q->imposicion_name, "is_presupuesto_linea" => $q->presupuesto_linea_id ? true : false]) ->toJson(true); } public function get_pdf($orden_trabajo_id) @@ -244,7 +264,6 @@ class Ordentrabajo extends BaseController public function upload_orden_trabajo_portada() { try { - //code... $file = $this->request->getFile("portada_file"); $bodyData = $this->request->getPost(); $id = $bodyData["orden_trabajo_id"]; @@ -252,6 +271,12 @@ class Ordentrabajo extends BaseController $fullpath = null; if ($file->isValid() && !$file->hasMoved()) { $fullpath = $file->store('ordenes_trabajo_portadas'); + $otEntity = $this->otModel->find($id); + if ($otEntity->portada_path) { + if (file_exists($otEntity->full_path)) { + unlink($otEntity->full_path); + } + } $r = $this->otModel->update($id, ["portada_path" => $fullpath]); } return $this->response->setJSON(["message" => "Portada subida", "data" => $r]); @@ -259,7 +284,7 @@ class Ordentrabajo extends BaseController if ($fullpath) { delete_files($fullpath); } - return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode($th->getCode()); + return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode(500); } } public function delete_orden_trabajo_portada($orden_trabajo_id) @@ -283,7 +308,7 @@ class Ordentrabajo extends BaseController try { $ot = $this->otModel->find($orden_trabajo_id); if ($ot->portada_path) { - $filePath = WRITEPATH . 'uploads/' . $ot->portada_path; + $filePath = $ot->full_path; if (file_exists($filePath)) { $mimeType = mime_content_type($filePath); diff --git a/ci4/app/Entities/Pedidos/PedidoEntity.php b/ci4/app/Entities/Pedidos/PedidoEntity.php index 61c40e25..18c55903 100644 --- a/ci4/app/Entities/Pedidos/PedidoEntity.php +++ b/ci4/app/Entities/Pedidos/PedidoEntity.php @@ -6,9 +6,11 @@ use App\Entities\Produccion\OrdenTrabajoEntity; use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Entities\Clientes\ClienteEntity; use App\Entities\Configuracion\UbicacionesEntity; +use App\Entities\Usuarios\UserEntity; use App\Models\Clientes\ClienteModel; use App\Models\Pedidos\PedidoLineaModel; use App\Models\Presupuestos\PresupuestoModel; +use App\Models\Usuarios\UserModel; use CodeIgniter\Entity; class PedidoEntity extends \CodeIgniter\Entity\Entity @@ -40,6 +42,12 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity protected $casts = [ "total_precio" => "float", "total_tirada" => "float", + "inaplazable" => "bool", + "fecha_entrega_real_change_user_id" => "?integer", + "fecha_impresion_change_user_id" => "?integer", + "fecha_encuadernado_change_user_id" => "?integer", + "fecha_entrega_change_externo_user_id" => "?integer", + "inaplazable_change_user_id" => "?integer", ]; /** * Devuelve la entidad `PedidoEntity` con sus relaciones @@ -91,4 +99,16 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity $pre = $pm->find($pedido_linea->presupuesto_id); return $m->find($pre->cliente_id); } + public function userBy(string $key): ?UserEntity + { + $user = null; + if (isset($this->attributes[$key])) { + + if ($this->attributes[$key]) { + $m = model(UserModel::class); + $user = $m->find($this->attributes[$key]); + } + } + return $user; + } } diff --git a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php index 247a12ec..3fa722b7 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php @@ -225,4 +225,8 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity { return in_array($this->attributes['tipo'],['lp_rot_color','lp_rot_bn']); } + public function isColor():bool { + return in_array($this->attributes['tipo'],['lp_color','lp_colorhq','lp_rot_color']); + + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index e60a9671..0728d4b9 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -134,10 +134,10 @@ class OrdenTrabajoEntity extends Entity { return $this->pedidoEsperaBy(); } - public function getPortadaPath(): ?string + public function getFullPath(): ?string { helper('filesystem'); - $path = $this->attributes["portada_path"]; + $path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"]; $portada_path = null; if($path){ if(file_exists($path)){ diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php index 946b3819..883f76ad 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php @@ -110,7 +110,11 @@ class OrdenTrabajoTareaEntity extends Entity public function imposicion() : ?Imposicion { $m = model(ImposicionModel::class); - return $m->find($this->attributes["imposicion_id"]); + $imposicion = null; + if($this->attributes["imposicion_id"]){ + $imposicion = $m->find($this->attributes["imposicion_id"]); + } + return $imposicion; } } diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index d9719aeb..c8cb238b 100644 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -99,7 +99,9 @@ return [ "errors" => [ - "date_not_exist" => "Esta fecha no existe en el modelo." + "date_not_exist" => "Esta fecha no existe en el modelo", + "attr_not_exist" => "El atributo {0,string} no pertenece al modelo Pedido" + ] diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php index 9feb110a..83f62c54 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php @@ -5,6 +5,7 @@ namespace App\Models\OrdenTrabajo; use App\Entities\Produccion\OrdenTrabajoDateEntity; use CodeIgniter\Database\MySQLi\Builder; use CodeIgniter\Model; +use Config\OrdenTrabajo; class OrdenTrabajoDate extends Model { @@ -107,22 +108,8 @@ class OrdenTrabajoDate extends Model return $data; } public function updateUserDateMap($orden_trabajo_id,$data){ - $mapping = [ - "fecha_encuadernado_at" => "encuadernacion_user_id", - // "fecha_externo_at" => "null", - "fecha_impresion_at" => null, - "pendiente_ferro_at" => "pendiente_ferro_user_id", - "ferro_en_cliente_at" => "ferro_en_cliente_user_id", - "ferro_ok_at" => "ferro_ok_user_id", - "interior_bn_at" => "interior_bn_user_id", - "interior_color_at" => "interior_color_user_id", - "preparacion_interiores_at" => "preparacion_interior_user_id", - "cubierta_at" => "cubierta_user_id", - "plastificado_at" => "plastificado_user_id", - "corte_at" => "corte_user_id", - "embalaje_at" => "embalaje_user_id", - "entrada_manipulado_at" => "entrada_manipulado_user_id" - ]; + $ordenTrabajoConfig = new OrdenTrabajo(); + $mapping = $ordenTrabajoConfig->DATE_USER_MAPPING; $otUser = model(OrdenTrabajoUser::class); $auth_user_id = auth()->user()->id; foreach ($data as $key => $value) { diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index eab9ef70..ade89a42 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -19,6 +19,7 @@ use App\Entities\Produccion\OrdenTrabajoTareaEntity; use App\Models\Configuracion\ConfigVariableModel; use App\Models\Configuracion\MaquinaModel; use App\Models\OrdenTrabajo\OrdenTrabajoFileModel; +use App\Models\Pedidos\PedidoModel; use App\Models\Usuarios\UserModel; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\BaseResult; @@ -43,6 +44,7 @@ class ProductionService extends BaseService protected OrdenTrabajoUser $otUser; protected OrdenTrabajoEntity $ot; protected OrdenTrabajoFileModel $otFileModel; + protected PedidoModel $pedidoModel; protected UserModel $userModel; protected string $defaultMaquinaCorteName = 'HT-1000'; protected MaquinaEntity $defaultMaquinaCorte; @@ -70,6 +72,7 @@ class ProductionService extends BaseService $this->otUser = model(OrdenTrabajoUser::class); $this->userModel = model(UserModel::class); $this->otFileModel = model(OrdenTrabajoFileModel::class); + $this->pedidoModel = model(PedidoModel::class); $this->ordenTrabajoConfig = config('OrdenTrabajo'); } public function init(int $orden_trabajo_id): self @@ -627,6 +630,7 @@ class ProductionService extends BaseService "tareas_encuadernacion" => $this->tareas_encuadernacion(), "tareas_preimpresion" => $this->tareas_preimpresion(), "tareas_impresion" => $this->tareas_impresion(), + "tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(), ]; return $summary; } @@ -650,7 +654,9 @@ class ProductionService extends BaseService "linea_cubierta" => $this->presupuesto->presupuestoLineaCubierta(), "peso_unidad" => $logistica_data["peso_unidad"], "peso_pedido" => $logistica_data["peso_pedido"], - "imposicion" => $this->getImposicionTareaImpresion() + "imposicion" => $this->getImposicionTareaImpresion(), + "tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(), + ]; } public function getImposicionTareaImpresion(): ?Imposicion @@ -658,10 +664,10 @@ class ProductionService extends BaseService $imposicion = null; $impresionInteriorBnImposicion = $this->getTareaImpresionInteriorBn()?->imposicion(); $impresionInteriorColorImposicion = $this->getTareaImpresionInteriorColor()?->imposicion(); - if($impresionInteriorBnImposicion){ + if ($impresionInteriorBnImposicion) { $imposicion = $impresionInteriorBnImposicion; } - if($impresionInteriorColorImposicion){ + if ($impresionInteriorColorImposicion) { $imposicion = $impresionInteriorColorImposicion; } return $imposicion; @@ -755,16 +761,45 @@ class ProductionService extends BaseService } else { $result = ["user" => null, "status" => false]; } + $this->updateProgress(); return $result; } + public function updateOrdenTrabajoPedidoDate($data): array + { + $status = false; + $user = auth()->user(); + $row = []; + $pedidoDatesUser = $this->ordenTrabajoConfig->DATE_USER_MAPPING_PEDIDO; + $attrPedido = $data["name"]; + if (isset($pedidoDatesUser[$attrPedido])) { + $row[$attrPedido] = Time::createFromFormat("Y-m-d", $data[$attrPedido])->format('Y-m-d 00:00:00'); + $attrUserPedido = $pedidoDatesUser[$attrPedido]; + $row[$attrUserPedido] = $user->id; + $status = $this->pedidoModel->update($this->pedido->id, $row); + $this->updateProgress(); + } else { + throw new Exception(lang('Produccion.errors.attr_not_exist', [$attrPedido])); + } + return [ + "user" => $user, + "status" => $status + ]; + } public function updateOrdenTrabajo($data): bool { - if(isset($data["is_pedido_espera"])){ + if (isset($data["is_pedido_espera"])) { $data["pedido_espera_by"] = auth()->user()->id; } return $this->otModel->update($this->ot->id, $data); } + public function updateOrdenTrabajoPedido($data) + { + if (isset($data["inaplazable"])) { + $data[$this->ordenTrabajoConfig->DATE_USER_MAPPING_PEDIDO["inaplazable"]] = auth()->user()->id; + } + return $this->pedidoModel->update($this->pedido->id, $data); + } /**======================================================================== * RELATION METHODS *========================================================================**/ @@ -1022,18 +1057,60 @@ class ProductionService extends BaseService } return $status; } - public function userDates() : array + public function userDates(): array { $userDates = []; foreach ($this->ordenTrabajoConfig->DATE_USER_MAPPING as $key => $value) { - $otUserEntity = $this->otUser->where("orden_trabajo_id",$this->ot->id)->first(); + $otUserEntity = $this->otUser->where("orden_trabajo_id", $this->ot->id)->first(); $userEntity = $otUserEntity->userBy($value); - if($userEntity){ + if ($userEntity) { $userDates[$key] = $userEntity->full_name; - }else{ + } else { $userDates[$key] = null; } } return $userDates; } + public function pedidoUserDates(): array + { + $pedidoUserDates = []; + foreach ($this->ordenTrabajoConfig->DATE_USER_MAPPING_PEDIDO as $key => $value) { + $userEntity = $this->pedido->userBy($value); + if ($userEntity) { + $pedidoUserDates[$key] = $userEntity->full_name; + } else { + $pedidoUserDates[$key] = null; + } + } + return $pedidoUserDates; + } + public function getTiempoProcesamientoHHMM(): string + { + $time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas()); + $seconds = array_sum($time_tareas_seconds); + return float_seconds_to_hhmm_string($seconds); + } + public function updateProgress(): bool + { + $userDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING; + $pedidoUserDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING_PEDIDO; + + $fill_dates = 0; + $status = false; + $total = count($userDates) + count($pedidoUserDates); + if ($this->ot->estado != "F") { + foreach ($userDates as $key => $value) { + if ($this->ot->dates()->{$key} != null) $fill_dates++; + } + foreach ($pedidoUserDates as $key => $value) { + if ($this->pedido->{$key} != null) $fill_dates++; + } + + $progreso = (float) $fill_dates / $total * 100; + $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso,2)]); + }else{ + $status = $this->otModel->update($this->ot->id, ["progreso" => 100]); + } + return $status; + } } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otDates.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otDates.php index d569c1ec..c45bb0c8 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otDates.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otDates.php @@ -15,27 +15,33 @@
- +
- + +
+
- + +
+
- + +
+
@@ -43,12 +49,13 @@
- + +
+
tarifa()->nombre ?> solapas ? "SI" : "NO" ?> hasSobrecubierta() ? "SI" : "NO" ?> pliegos_libro?>/pliegos_pedido?> __________ guardas ? "SI" : "NO" ?> retractilado ? "SI" : "NO" ?> marcapaginas ? "SI" : "NO" ?>
I.V.A.:
IVA (4%):
IVA (21%):
@@ -186,8 +186,8 @@ $settings = $session->get('settings');
- - + +
Imposicionfull_name ?>Imposicionfull_name ?? "" ?>
@@ -201,13 +201,13 @@ $settings = $session->get('settings'); - + - + - + - +
?? ancho ?>xalto ?> tirada ?> tirada ?> tipo ?> tipo ?> lomo_cubierta ?> lomo_cubierta,2,',','.') ?>
@@ -294,13 +294,13 @@ $settings = $session->get('settings');
- + - + - - - + + +
Plastificadotarifa()->nombre ?>tarifa()->nombre ?> UVI ?? ?? Máquina $q->nombre, $acabados[0]->maquinas())) ?> Operariousers()?->plastificado_by?->getFullName() ?? null ?> $q->nombre, $acabados[0]->maquinas())) ?> Operariousers()?->plastificado_by?->getFullName() ?? null ?>
@@ -372,7 +372,7 @@ $settings = $session->get('settings');
- © 2024 SAFEKAT. Todos los derechos reservados. + © 2024 SAFEKAT. Todos los derechos reservados.
diff --git a/httpdocs/assets/js/safekat/pages/pdf/otDownload.js b/httpdocs/assets/js/safekat/pages/pdf/otDownload.js index d8eb9caa..65f4aca3 100644 --- a/httpdocs/assets/js/safekat/pages/pdf/otDownload.js +++ b/httpdocs/assets/js/safekat/pages/pdf/otDownload.js @@ -1,12 +1,12 @@ $(() => { - // console.log("PDF") - // var opt = { - // margin: 2, - // filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf", - // image: { type: 'jpeg', quality: 1 }, - // html2canvas: { scale: 3 }, - // jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } - // }; - // let elementToPdf = $('body')[0] - // html2pdf().set(opt).from(elementToPdf).save() + console.log("PDF") + var opt = { + margin: 2, + filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf", + image: { type: 'jpeg', quality: 1 }, + html2canvas: { scale: 4 }, + jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } + }; + let elementToPdf = $('body')[0] + html2pdf().set(opt).from(elementToPdf).save() }) \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/produccion/ot.js b/httpdocs/assets/js/safekat/pages/produccion/ot.js index 335483c9..ac3c5307 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/ot.js +++ b/httpdocs/assets/js/safekat/pages/produccion/ot.js @@ -1,7 +1,7 @@ import Ajax from "../../components/ajax.js" import ClassSelect from "../../components/select2.js"; import DatePicker from "../../components/datepicker.js"; -import { alertConfirmationDelete, alertSuccess } from "../../components/alerts/sweetAlert.js"; +import { alertConfirmAction, alertConfirmationDelete, alertSuccess } from "../../components/alerts/sweetAlert.js"; import Modal from "../../components/modal.js" import FileUploadDropzone from '../../components/forms/fileUploadDropzone.js'; class OrdenTrabajo { @@ -60,13 +60,7 @@ class OrdenTrabajo { dateFormat: "Y-m-d", allowInput: true, } - this.tiempoProcesamiento = new DatePicker(this.otForm.find("#ot-tiempo-procesamiento"), { - dateFormat: "H:i", - enableTime: true, - noCalendar: true, - time_24hr: true, - allowInput: true, - }) + this.tiempoProcesamiento = this.otForm.find("#ot-tiempo-procesamiento") this.fechaImpresion = new DatePicker(this.otForm.find("#ot-fecha-impresion"), option) this.fechaEncuadernado = new DatePicker(this.otForm.find("#ot-fecha-encuadernado"), option) this.fechaEntregaExterno = new DatePicker(this.otForm.find("#ot-fecha-entrega-externo"), option) @@ -78,6 +72,8 @@ class OrdenTrabajo { this.ferroOk = new DatePicker(this.otForm.find("#ot-ferro-ok"), option) this.plakeneTraslucido = new DatePicker(this.otForm.find("#ot-plakene-traslucido"), option) this.impresionColor = new DatePicker(this.otForm.find("#ot-impresion-color"), option) + this.impresionBN = new DatePicker(this.otForm.find("#ot-impresion-bn"), option) + this.portada = new DatePicker(this.otForm.find("#ot-portada"), option) this.plastificadoMate = new DatePicker(this.otForm.find("#ot-plastificado-mate"), option) this.prepGuillotina = new DatePicker(this.otForm.find("#ot-prep-guillotina"), option) @@ -85,6 +81,17 @@ class OrdenTrabajo { this.embalaje = new DatePicker(this.otForm.find("#ot-embalaje"), option) this.envio = new DatePicker(this.otForm.find("#ot-envio"), option) + //REVISION PREIMPRESION + this.preFormatoAt = new DatePicker(this.otForm.find("#ot-preformato-date"), option) + this.preLomoAt = new DatePicker(this.otForm.find("#ot-prelomo-date"), option) + this.preSolapaAt = new DatePicker(this.otForm.find("#ot-presolapa-date"), option) + this.preCodBarrasAt = new DatePicker(this.otForm.find("#ot-precodbarras-date"), option) + this.preImposicionAt = new DatePicker(this.otForm.find("#ot-preimposicion-date"), option) + + + + + } eventTareas() { @@ -119,7 +126,7 @@ class OrdenTrabajo { this.tareasTableItem.on("xhr.dt", this.unbindEventTareas.bind(this)) this.otForm.on("click", "#btn-upload-portada", this.handleUploadPortada.bind(this)) this.otForm.on("click", "#btn-delete-portada", this.handleDeletePortada.bind(this)) - this.otForm.on("click", "#btn-finalizar-orden-pedido", this.handleFinalizarPedido.bind(this)) + this.btnFinalizarPedido.on("click", this.handleFinalizarPedido.bind(this)) this.tareasTableItem.on("click", ".ot-tarea-btn-delete", this.handleTareaDeleteConfirmation.bind(this)) this.item.on("click", "#btn-reset-tareas", this.handleResetTareasDeleteConfirmation.bind(this)) this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this)) @@ -205,7 +212,6 @@ class OrdenTrabajo { } createSelectMaquinaTarea() { try { - console.log("Create selects") this.summaryData.tasks.forEach(element => { let selectItem = this.item.find("#select-maquina-tarea-" + element.id); if (element.presupuesto_linea_id && element.is_corte == false) this.createSelectMaquinaImpresion(selectItem) @@ -326,6 +332,8 @@ class OrdenTrabajo { try { this.summaryData = data this.otForm.off("change", ".ot-date") + this.otForm.off("change", ".ot-pedido") + this.otForm.off("change", ".ot-pedido-check") this.otForm.off("change", ".ot-preview") this.fillOtDetails() this.fillOtDates() @@ -335,6 +343,8 @@ class OrdenTrabajo { } finally { this.otForm.on("change", ".ot-date", this.handleDateChange.bind(this)) + this.otForm.on("change", ".ot-pedido", this.handlePedidoChange.bind(this)) + this.otForm.on("change", ".ot-pedido-check", this.handlePedidoCheckChange.bind(this)) this.otForm.on("change", ".ot-preview", this.handlePreimpresionReviewChange.bind(this)) Notiflix.Block.remove('.section-block'); @@ -354,28 +364,28 @@ class OrdenTrabajo { this.otForm.find("[name=revisar_codigo_barras]").prop("checked", this.summaryData.ot.revisar_codigo_barras) this.otForm.find("[name=realizar_imposicion]").prop("checked", this.summaryData.ot.realizar_imposicion) this.otForm.find("[name=enviar_impresion]").prop("checked", this.summaryData.ot.enviar_impresion) + this.otForm.find("[name=inaplazable]").prop("checked", this.summaryData.pedido.inaplazable) + } fillOtDetails() { const progreso = this.summaryData.ot.progreso - // this.otForm.find("#ot-progress-bar").attr('aria-valuenow', progreso).text(progreso + "%").css("width", progreso + "%") - // this.otForm.find("#ot-paginas").text(this.summaryData.presupuesto.paginas) - // this.otForm.find("#ot-tirada").text(this.summaryData.presupuesto.tirada) - // this.otForm.find("#ot-merma").text(this.summaryData.presupuesto.merma) + this.otForm.find("#ot-progress-bar").attr('aria-valuenow', progreso).text(progreso + "%").css("width", progreso + "%") } fillOtDates() { - this.fechaImpresion.setDate(this.summaryData.dates.fecha_impresion_at) - this.fechaEncuadernado.setDate(this.summaryData.dates.fecha_encuadernado_at) - // this.fechaEntregaExterno.setDate(this.summaryData.dates.fecha_entrega_externo_) - this.fechaEntregaReal.setDate(this.summaryData.dates.fecha_entrega_real_at) - this.fechaEntregaEstimada.setDate(this.summaryData.dates.fecha_entrega_at) + this.fechaImpresion.setDate(this.summaryData.pedido.fecha_impresion) + this.fechaEncuadernado.setDate(this.summaryData.pedido.fecha_encuadernado) + this.fechaEntregaExterno.setDate(this.summaryData.pedido.fecha_entrega_externo) + this.fechaEntregaReal.setDate(this.summaryData.pedido.fecha_entrega_real) + // this.fechaEntregaEstimada.setDate(this.summaryData.pedido.fecha_entrega_at) this.pendienteFerro.setDate(this.summaryData.dates.pendiente_ferro_at) this.ferroCliente.setDate(this.summaryData.dates.ferro_en_cliente_at) this.ferroOk.setDate(this.summaryData.dates.ferro_ok_at) // this.plakeneTraslucido.setDate(this.summaryData.dates.fecha_impresion_at) this.impresionColor.setDate(this.summaryData.dates.interior_color_at) + this.impresionBN.setDate(this.summaryData.dates.interior_bn_at) this.portada.setDate(this.summaryData.dates.cubierta_at) this.plastificadoMate.setDate(this.summaryData.dates.plastificado_at) this.prepGuillotina.setDate(this.summaryData.dates.corte_at) @@ -383,12 +393,19 @@ class OrdenTrabajo { this.embalaje.setDate(this.summaryData.dates.embalaje_at) this.envio.setDate(this.summaryData.dates.envio_at) this.pedidoEnEsperaCheck.prop("checked", this.summaryData.ot.is_pedido_espera); + this.tiempoProcesamiento.val(this.summaryData.tiempo_procesamiento); if (this.summaryData.ot.pedido_espera_by) { this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name, this.summaryData.ot.pedido_espera_by.last_name].join(" ")) } else { this.pedidoEnEsperaBy.text(""); } this.otEstado.val(this.summaryData.ot.estado) + this.preFormatoAt.setDate(this.summaryData.dates.pre_formato_at) + this.preLomoAt.setDate(this.summaryData.dates.pre_lomo_at) + this.preSolapaAt.setDate(this.summaryData.dates.pre_solapa_at) + this.preCodBarrasAt.setDate(this.summaryData.dates.pre_codbarras_at) + this.preImposicionAt.setDate(this.summaryData.dates.pre_imposicion_at) + } @@ -398,7 +415,6 @@ class OrdenTrabajo { const data = {} data[key] = $(event.currentTarget).val() data["orden_trabajo_tarea_id"] = $(event.currentTarget).data("id") - console.log(data); const ajax = new Ajax( "/produccion/ordentrabajo/update/tarea", data, @@ -428,7 +444,6 @@ class OrdenTrabajo { } handleTareaChangeError(error) { } handleOtComment(event) { - console.log($(event.currentTarget).val()) const ajax = new Ajax( "/produccion/ordentrabajo/update", { @@ -454,7 +469,6 @@ class OrdenTrabajo { data[key] = $(event.currentTarget).val() data["orden_trabajo_id"] = this.modelId data["name"] = key; - console.log(data) const ajax = new Ajax( "/produccion/ordentrabajo/update/date", data, @@ -475,6 +489,36 @@ class OrdenTrabajo { } } handleDateChangeError(errors) { } + handlePedidoChange(event) { + const key = $(event.currentTarget).attr("name") + const data = {} + const element = $(event.currentTarget); + data[key] = $(event.currentTarget).val() + data["orden_trabajo_id"] = this.modelId + data["name"] = key; + const ajax = new Ajax( + "/produccion/ordentrabajo/update/pedido/date", + data, + null, + this.handleDateChangeSuccess.bind(this, element), + this.handleDateChangeError.bind(this) + ) + ajax.post(); + } + handlePedidoCheckChange(event) { + const key = $(event.currentTarget).attr("name") + const data = {} + data[key] = $(event.currentTarget).is(":checked") ? 1 : 0 + data["orden_trabajo_id"] = this.modelId + const ajax = new Ajax( + "/produccion/ordentrabajo/update/pedido", + data, + null, + this.handlePreimpresionReviewChangeSuccess.bind(this), + this.handlePreimpresionReviewChangeError.bind(this) + ) + ajax.post(); + } handlePreimpresionReviewChange(event) { const key = $(event.currentTarget).attr("name") const data = {} @@ -583,7 +627,12 @@ class OrdenTrabajo { this.handleEstadoChangeSuccess.bind(this), this.handleEstadoChangeError.bind(this) ); - ajax.post() + alertConfirmAction("Esta acción marcará la orden de trabjao como FINALIZADA") + .then(result => { + if (result.isConfirmed) { + ajax.post() + } + }) } handleEstadoChangeSuccess(response) { popSuccessAlert(response.message) diff --git a/httpdocs/themes/vuexy/css/pdf.ot.css b/httpdocs/themes/vuexy/css/pdf.ot.css index 03236f49..db367ef9 100644 --- a/httpdocs/themes/vuexy/css/pdf.ot.css +++ b/httpdocs/themes/vuexy/css/pdf.ot.css @@ -35,11 +35,12 @@ body{ border: 2px solid; } .square{ - font-size: 14px; align-items: center; align-content : center; justify-content: center; font-weight: bold; + font-size : 20px; + } .esquema{ display: flex; @@ -126,18 +127,24 @@ body{ table { width: 100%; - border-collapse: collapse; margin-bottom: 5px; - font-size: 12px; + font-size: 10px; } -table th, table td { - border: 2px solid #000000; + + table td { text-align: center; } +table,th,td{ + border: 0.1px solid rgb(0, 0, 0); + border-collapse: collapse; +} + table th { background-color: #f4f4f4; font-weight: bold; color : black; + text-align: center; + } table td{ font-weight: bold; @@ -158,6 +165,23 @@ table td{ padding-left: 0.2rem; } .t-row{ - font-size: 10px; + font-size: 8px; width : 100%; +} +.bicolor{ + background: linear-gradient( to right, #00b5fc 0%, #00b5fc 45%, #000000 55%, #000000 100%); + color: white; +} +.cmyk{ + background-image: url('/themes/vuexy/img/safekat/presupuestos/cmyk.png') + background-size: 110px; + text-shadow: 0px 0px 1px black; + stroke:black; +} +.bn{ + background : black; + color: white; +} +.footer{ + font-size : 10px } \ No newline at end of file diff --git a/httpdocs/themes/vuexy/img/safekat/presupuestos/cmyk.png b/httpdocs/themes/vuexy/img/safekat/presupuestos/cmyk.png new file mode 100644 index 0000000000000000000000000000000000000000..436b4867b56ad743bb33cd67e3821600eb4de1e3 GIT binary patch literal 1028 zcmeAS@N?(olHy`uVBq!ia0y~yV4MJC|KMN)l85p)_yZ}<0*}aI1_r*vAk26?e? Date: Mon, 14 Apr 2025 20:41:23 +0200 Subject: [PATCH 07/13] feat colors --- ci4/app/Config/OrdenTrabajo.php | 12 +++ .../Controllers/Produccion/Ordentrabajo.php | 10 +-- .../Produccion/OrdenTrabajoDateEntity.php | 37 ++++++++- ci4/app/Services/ProductionService.php | 79 ++++++++++++++++++- .../vuexy/components/tables/ot_table.php | 2 +- .../components/datatables/otDatatable.js | 30 ++++++- 6 files changed, 154 insertions(+), 16 deletions(-) diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php index 1d91e1d2..bde32b99 100644 --- a/ci4/app/Config/OrdenTrabajo.php +++ b/ci4/app/Config/OrdenTrabajo.php @@ -40,6 +40,18 @@ class OrdenTrabajo extends BaseConfig "fecha_encuadernado" => "fecha_encuadernado_change_user_id", "fecha_entrega_externo" => "fecha_entrega_externo_change_user_id", ]; + public array $OT_COLORS = [ + "sin_imprimir" => "#FF6363", + "impreso_int" => "#AFDDFF", + "impreso_cub" => "#3A59D1", + "plastificado" => "#FFD63A", + "solapas" => "#4F1C51", + "preparado" => "#FF0B55", + "cosido" => "#FF0B55", + "grapado" => "#FEBA17", + "encuadernado" => "#FEBA17", + "corte" => "#67AE6E" + ]; public function __construct() { diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 5bbff500..a7a59257 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -133,7 +133,7 @@ class Ordentrabajo extends BaseController try { $bodyData = $this->request->getPost(); $r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedido($bodyData); - return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r,"data" => $bodyData]); + return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]); } catch (\Throwable $th) { return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500); } @@ -163,7 +163,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F"); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -178,7 +178,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -193,7 +193,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" @@ -208,7 +208,7 @@ class Ordentrabajo extends BaseController $q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) - ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name]) + ->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()]) ->edit( "fecha_encuadernado_at", fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php index 352e3ac8..0142b0bf 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php @@ -43,9 +43,38 @@ class OrdenTrabajoDateEntity extends Entity 'deleted_at', ]; - protected $casts = [ - ]; - - + protected $casts = []; + public function sinImprimirStatus(): bool + { + return !( + $this->attributes['interior_bn_at'] == null + && $this->attributes['interior_color_at'] == null + && $this->attributes['cubierta_at'] == null + ); + } + public function impresionInteriorStatus():bool + { + return $this->attributes['interior_bn_at']|| $this->attributes['interior_color_at']; + } + public function impresionCubiertaStatus():bool + { + return $this->attributes['cubierta_at'] != null; + } + public function plastificadoStatus():bool + { + return $this->attributes['plastificado_at'] != null; + } + public function encuadernadoStatus():bool + { + return $this->attributes['encuadernacion_at'] != null; + } + public function preparacionInterioresStatus():bool + { + return $this->attributes['preparacion_interiores_at'] != null; + } + public function corteStatus():bool + { + return $this->attributes['corte_at'] != null; + } } diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index ade89a42..1392dde4 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -50,6 +50,7 @@ class ProductionService extends BaseService protected MaquinaEntity $defaultMaquinaCorte; protected MaquinaModel $maquinaModel; protected OrdenTrabajo $ordenTrabajoConfig; + public string $statusColor; /** * Pedido Entity @@ -74,6 +75,7 @@ class ProductionService extends BaseService $this->otFileModel = model(OrdenTrabajoFileModel::class); $this->pedidoModel = model(PedidoModel::class); $this->ordenTrabajoConfig = config('OrdenTrabajo'); + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; } public function init(int $orden_trabajo_id): self { @@ -83,6 +85,7 @@ class ProductionService extends BaseService $pedido = $this->ot->pedido(); $this->setPedido($pedido); $this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first(); + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; return $this; } /** @@ -631,6 +634,7 @@ class ProductionService extends BaseService "tareas_preimpresion" => $this->tareas_preimpresion(), "tareas_impresion" => $this->tareas_impresion(), "tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(), + "statusColor" => $this->getOtColorStatus(), ]; return $summary; } @@ -1107,10 +1111,81 @@ class ProductionService extends BaseService } $progreso = (float) $fill_dates / $total * 100; - $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso,2)]); - }else{ + $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]); + } else { $status = $this->otModel->update($this->ot->id, ["progreso" => 100]); } return $status; } + public function getOtColorStatus(): string + { + if($this->ot->dates()){ + $this->updateColor(); + } + return $this->statusColor; + } + protected function otSinImprimirColor() + { + if ($this->ot->dates()->sinImprimirStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; + }; + } + protected function otImpresionIntColor() + { + if ($this->ot->dates()->impresionInteriorStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["impreso_int"]; + }; + } + protected function otImpresionCubiertaColor() + { + if ($this->ot->dates()->impresionCubiertaStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["impreso_cub"]; + }; + } + protected function otPlastificadoColor() + { + if ($this->ot->dates()->plastificadoStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["plastificado"]; + }; + } + protected function otSolapaColor() + { + + } + protected function otEncuadernadoColor() + { + if ($this->ot->dates()->encuadernadoStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["encuadernado"]; + }; + } + protected function otPreparadoColor() + { + if ($this->ot->dates()->preparacionInterioresStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["preparado"]; + }; + } + protected function otCorteColor() + { + if ($this->ot->dates()->corteStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["corte"]; + }; + } + protected function otCosidoColor() + { + } + protected function otGrapadoColor() + { + } + protected function updateColor(){ + $this->otSinImprimirColor(); + $this->otImpresionIntColor(); + $this->otCosidoColor(); + $this->otImpresionCubiertaColor(); + $this->otPlastificadoColor(); + $this->otSolapaColor(); + $this->otPreparadoColor(); + $this->otGrapadoColor(); + $this->otEncuadernadoColor(); + $this->otCorteColor(); + } } diff --git a/ci4/app/Views/themes/vuexy/components/tables/ot_table.php b/ci4/app/Views/themes/vuexy/components/tables/ot_table.php index a611a1c4..21388a84 100644 --- a/ci4/app/Views/themes/vuexy/components/tables/ot_table.php +++ b/ci4/app/Views/themes/vuexy/components/tables/ot_table.php @@ -1,6 +1,6 @@
-
+
diff --git a/httpdocs/assets/js/safekat/components/datatables/otDatatable.js b/httpdocs/assets/js/safekat/components/datatables/otDatatable.js index d3e9dd80..c2052b33 100644 --- a/httpdocs/assets/js/safekat/components/datatables/otDatatable.js +++ b/httpdocs/assets/js/safekat/components/datatables/otDatatable.js @@ -55,6 +55,7 @@ class OrdenTrabajoDatatable { }, columnDefs: [ { className: 'dt-center', targets: '_all' }, + ], serverSide: true, pageLength: 25, @@ -62,7 +63,10 @@ class OrdenTrabajoDatatable { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, columns: this.datatableColumns, - ajax: '/produccion/ordentrabajo/datatable' + ajax: '/produccion/ordentrabajo/datatable', + createdRow: (row,data,dataIndex) => { + $(row).css("background-color",data.logo.color) + } }); } initPendientes() { @@ -76,6 +80,7 @@ class OrdenTrabajoDatatable { }, columnDefs: [ { className: 'dt-center', targets: '_all' }, + ], serverSide: true, pageLength: 25, @@ -83,7 +88,10 @@ class OrdenTrabajoDatatable { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, columns: this.datatableColumns, - ajax: '/produccion/ordentrabajo/datatable_pendientes' + ajax: '/produccion/ordentrabajo/datatable_pendientes', + createdRow: (row,data,dataIndex) => { + $(row).css("background-color",data.logo.color) + } }); } initFerroPendiente() { @@ -97,11 +105,18 @@ class OrdenTrabajoDatatable { }, serverSide: true, pageLength: 25, + columnDefs: [ + { className: 'dt-center', targets: '_all' }, + + ], language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, columns: this.datatableColumns, - ajax: '/produccion/ordentrabajo/datatable_ferro_pendiente' + ajax: '/produccion/ordentrabajo/datatable_ferro_pendiente', + createdRow: (row,data,dataIndex) => { + $(row).css("background-color",data.logo.color) + } }); } initFerroOk() { @@ -114,12 +129,19 @@ class OrdenTrabajoDatatable { bottomEnd: 'paging' }, serverSide: true, + columnDefs: [ + { className: 'dt-center', targets: '_all' }, + + ], pageLength: 25, language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, columns: this.datatableColumns, - ajax: '/produccion/ordentrabajo/datatable_ferro_ok' + ajax: '/produccion/ordentrabajo/datatable_ferro_ok', + createdRow: (row,data,dataIndex) => { + $(row).css("background-color",data.logo.color) + } }); } From 14c5cf493c3e070c27037e25928081fb379481ca Mon Sep 17 00:00:00 2001 From: amazuecos Date: Mon, 14 Apr 2025 23:36:39 +0200 Subject: [PATCH 08/13] add new dates --- ci4/app/Config/OrdenTrabajo.php | 6 +- ...4500_UpdateDateFieldsOrdenTrabajoDates.php | 61 +++++++++++++++++++ .../Produccion/OrdenTrabajoDateEntity.php | 15 +++++ .../Produccion/OrdenTrabajoUserEntity.php | 3 + ci4/app/Language/es/Produccion.php | 5 ++ .../Models/OrdenTrabajo/OrdenTrabajoDate.php | 3 + .../Models/OrdenTrabajo/OrdenTrabajoUser.php | 3 + ci4/app/Services/ProductionService.php | 10 ++- .../vuexy/form/produccion/ot/otProgress.php | 19 +++++- .../components/datatables/otDatatable.js | 13 ++-- .../assets/js/safekat/pages/produccion/ot.js | 8 +++ 11 files changed, 139 insertions(+), 7 deletions(-) create mode 100644 ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php index bde32b99..b3638dba 100644 --- a/ci4/app/Config/OrdenTrabajo.php +++ b/ci4/app/Config/OrdenTrabajo.php @@ -18,6 +18,10 @@ class OrdenTrabajo extends BaseConfig "corte_at" => "corte_user_id", "preparacion_interiores_at" => "preparacion_interior_user_id", "entrada_manipulado_at" => "entrada_manipulado_user_id", + "cosido_at" => "cosido_user_id", + "grapado_at" => "grapado_user_id", + "solapa_at" => "solapa_user_id", + //FERRO "pendiente_ferro_at" => "pendiente_ferro_user_id", "ferro_en_cliente_at" => "ferro_en_cliente_user_id", @@ -45,8 +49,8 @@ class OrdenTrabajo extends BaseConfig "impreso_int" => "#AFDDFF", "impreso_cub" => "#3A59D1", "plastificado" => "#FFD63A", - "solapas" => "#4F1C51", "preparado" => "#FF0B55", + "solapa" => "#4F1C51", "cosido" => "#FF0B55", "grapado" => "#FEBA17", "encuadernado" => "#FEBA17", diff --git a/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php b/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php new file mode 100644 index 00000000..a69258c7 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php @@ -0,0 +1,61 @@ + [ + "type" => "DATE", + "null" => true, + ], + "solapa_at" => [ + "type" => "DATE", + "null" => true, + ], + "grapado_at" => [ + "type" => "DATE", + "null" => true, + ], + ]; + protected array $USERS = [ + "cosido_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "solapa_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "grapado_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + ]; + + public function up() + { + $this->forge->addColumn("orden_trabajo_dates", $this->DATES); + $this->forge->addColumn("orden_trabajo_users", $this->USERS); + foreach ($this->USERS as $key => $value) { + $this->forge->addForeignKey([$key],"users",["id"]); + } + } + + public function down() + { + $this->forge->dropColumn("orden_trabajo_dates", array_keys($this->DATES)); + $this->forge->dropColumn("orden_trabajo_users", array_keys($this->USERS)); + + + } +} diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php index 0142b0bf..43410440 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php @@ -21,6 +21,9 @@ class OrdenTrabajoDateEntity extends Entity "corte_at" => null, "preparacion_interiores_at" => null, "entrada_manipulado_at" => null, + "cosido_at" => null, + "solapa_at" => null, + "cosido_at" => null, //FERRO "pendiente_ferro_at" => null, "ferro_en_cliente_at" => null, @@ -77,4 +80,16 @@ class OrdenTrabajoDateEntity extends Entity { return $this->attributes['corte_at'] != null; } + public function cosidoStatus():bool + { + return $this->attributes['cosido_at'] != null; + } + public function grapadoStatus():bool + { + return $this->attributes['grapado_at'] != null; + } + public function solapaStatus():bool + { + return $this->attributes['solapa_at'] != null; + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php index 4f516ecd..26e78560 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php @@ -25,6 +25,9 @@ class OrdenTrabajoUserEntity extends Entity "corte_user_id" => null, "preparacion_interior_user_id" => null, "entrada_manipulado_user_id" => null, + "cosido_user_id"=> null, + "solapa_user_id"=> null, + "grapado_user_id"=> null, //FERRO "pendiente_ferro_user_id" => null, "ferro_en_cliente_user_id" => null, diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index c8cb238b..4e27fb34 100644 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -87,6 +87,10 @@ return [ "ejemplares" => "Ejemplares", "tipo" => "Tipo", "lomo" => "Lomo", + + "cosido" => "Cosido", + "grapado" => "Grapado", + "solapa" => "Solapas", //IMPRESION "impresion_bn" => "Impresión BN", "cubierta" => "Cubierta/Portada", @@ -96,6 +100,7 @@ return [ "pre_solapa" => "Revisión solapa", "pre_codbarras" => "Revisión código barras", "pre_imposicion" => "Revisión imposición", + "errors" => [ diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php index 83f62c54..0c883788 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php @@ -28,6 +28,9 @@ class OrdenTrabajoDate extends Model "corte_at", "preparacion_interiores_at", "entrada_manipulado_at", + "cosido_at", + "solapa_at", + "cosido_at", //FERRO "pendiente_ferro_at", "ferro_en_cliente_at", diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php index 3bc18711..12c6b0e9 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php @@ -29,6 +29,9 @@ class OrdenTrabajoUser extends Model "corte_user_id", "preparacion_interior_user_id", "entrada_manipulado_user_id", + "cosido_user_id", + "solapa_user_id", + "grapado_user_id", //FERRO "pendiente_ferro_user_id", "ferro_en_cliente_user_id", diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 1392dde4..c073dc38 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -1150,7 +1150,9 @@ class ProductionService extends BaseService } protected function otSolapaColor() { - + if ($this->ot->dates()->solapaStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["solapa"]; + }; } protected function otEncuadernadoColor() { @@ -1172,9 +1174,15 @@ class ProductionService extends BaseService } protected function otCosidoColor() { + if ($this->ot->dates()->cosidoStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["cosido"]; + }; } protected function otGrapadoColor() { + if ($this->ot->dates()->grapadoStatus()) { + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["grapado"]; + }; } protected function updateColor(){ $this->otSinImprimirColor(); diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php index 382cf351..a3b25fe9 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php @@ -97,7 +97,24 @@
- + +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
diff --git a/httpdocs/assets/js/safekat/components/datatables/otDatatable.js b/httpdocs/assets/js/safekat/components/datatables/otDatatable.js index c2052b33..089406a6 100644 --- a/httpdocs/assets/js/safekat/components/datatables/otDatatable.js +++ b/httpdocs/assets/js/safekat/components/datatables/otDatatable.js @@ -65,7 +65,8 @@ class OrdenTrabajoDatatable { columns: this.datatableColumns, ajax: '/produccion/ordentrabajo/datatable', createdRow: (row,data,dataIndex) => { - $(row).css("background-color",data.logo.color) + $(row).css("border-left",`10px solid ${data.logo.color}`) + $(row).css("border-right",`10px solid ${data.logo.color}`) } }); } @@ -90,7 +91,9 @@ class OrdenTrabajoDatatable { columns: this.datatableColumns, ajax: '/produccion/ordentrabajo/datatable_pendientes', createdRow: (row,data,dataIndex) => { - $(row).css("background-color",data.logo.color) + $(row).css("border-left",`20px solid ${data.logo.color}`) + $(row).css("border-right",`20px solid ${data.logo.color}`) + } }); } @@ -115,7 +118,8 @@ class OrdenTrabajoDatatable { columns: this.datatableColumns, ajax: '/produccion/ordentrabajo/datatable_ferro_pendiente', createdRow: (row,data,dataIndex) => { - $(row).css("background-color",data.logo.color) + $(row).css("border-left",`20px solid ${data.logo.color}`) + $(row).css("border-right",`20px solid ${data.logo.color}`) } }); } @@ -140,7 +144,8 @@ class OrdenTrabajoDatatable { columns: this.datatableColumns, ajax: '/produccion/ordentrabajo/datatable_ferro_ok', createdRow: (row,data,dataIndex) => { - $(row).css("background-color",data.logo.color) + $(row).css("border-left",`20px solid ${data.logo.color}`) + $(row).css("border-right",`20px solid ${data.logo.color}`) } }); } diff --git a/httpdocs/assets/js/safekat/pages/produccion/ot.js b/httpdocs/assets/js/safekat/pages/produccion/ot.js index ac3c5307..d0358813 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/ot.js +++ b/httpdocs/assets/js/safekat/pages/produccion/ot.js @@ -77,6 +77,10 @@ class OrdenTrabajo { this.portada = new DatePicker(this.otForm.find("#ot-portada"), option) this.plastificadoMate = new DatePicker(this.otForm.find("#ot-plastificado-mate"), option) this.prepGuillotina = new DatePicker(this.otForm.find("#ot-prep-guillotina"), option) + this.prepCosido = new DatePicker(this.otForm.find("#ot-prep-cosido"), option) + this.prepGrapado = new DatePicker(this.otForm.find("#ot-prep-grapado"), option) + this.prepSolapa = new DatePicker(this.otForm.find("#ot-prep-solapa"), option) + this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option) this.embalaje = new DatePicker(this.otForm.find("#ot-embalaje"), option) this.envio = new DatePicker(this.otForm.find("#ot-envio"), option) @@ -389,6 +393,10 @@ class OrdenTrabajo { this.portada.setDate(this.summaryData.dates.cubierta_at) this.plastificadoMate.setDate(this.summaryData.dates.plastificado_at) this.prepGuillotina.setDate(this.summaryData.dates.corte_at) + this.prepCosido.setDate(this.summaryData.dates.cosido_at) + this.prepSolapa.setDate(this.summaryData.dates.solapa_at) + this.prepGrapado.setDate(this.summaryData.dates.grapado_at) + this.espiral.setDate(this.summaryData.dates.fecha_impresion_at) this.embalaje.setDate(this.summaryData.dates.embalaje_at) this.envio.setDate(this.summaryData.dates.envio_at) From 9f46569b01c54c52764d6b82a1f8c115ed20f229 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Tue, 15 Apr 2025 00:42:24 +0200 Subject: [PATCH 09/13] add messages to ot --- ci4/app/Config/Routes.php | 5 + ci4/app/Controllers/Chat/ChatController.php | 34 ++++ ...11-180001_AddUserIdFechaEntregaPedido.php} | 0 ...235200_AddFkOrdenTrabajoChatDepartment.php | 40 +++++ .../Entities/Chat/ChatDepartmentEntity.php | 7 +- .../Chat/ChatDepartmentUserEntity.php | 2 + ci4/app/Entities/Chat/ChatEntity.php | 14 +- ci4/app/Models/Chat/ChatDeparmentModel.php | 8 + .../Models/Chat/ChatDeparmentUserModel.php | 4 +- ci4/app/Models/Chat/ChatModel.php | 107 ++++++++++++ ci4/app/Services/ChatService.php | 4 + .../chat_internal_orden_trabajo.php | 41 +++++ .../vuexy/components/chat_orden_trabajo.php | 156 ++++++++++++++++++ .../vuexy/form/produccion/ot/otTask.php | 9 +- .../form/produccion/viewOrdenTrabajoEdit.php | 4 + httpdocs/assets/js/safekat/components/chat.js | 12 +- .../js/safekat/pages/chatOrdenTrabajo.js | 12 ++ 17 files changed, 445 insertions(+), 14 deletions(-) rename ci4/app/Database/Migrations/{2025-04-11-180001_AddUserIdFechaEntregaPedido copy.php => 2025-04-11-180001_AddUserIdFechaEntregaPedido.php} (100%) create mode 100644 ci4/app/Database/Migrations/2025-04-14-235200_AddFkOrdenTrabajoChatDepartment.php create mode 100644 ci4/app/Views/themes/vuexy/components/chat_internal_orden_trabajo.php create mode 100644 ci4/app/Views/themes/vuexy/components/chat_orden_trabajo.php create mode 100644 httpdocs/assets/js/safekat/pages/chatOrdenTrabajo.js diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 3f308c76..718e504b 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -647,6 +647,8 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route $routes->get('direct/client/users/select/presupuesto/(:num)', 'ChatController::get_presupuesto_client_users/$1/$2', ['as' => 'getPresupuestoClientUsers']); $routes->get('direct/client/users/select/pedido/(:num)', 'ChatController::get_pedido_client_users/$1/$2', ['as' => 'getPedidoClientUsers']); $routes->get('direct/client/users/select/factura/(:num)', 'ChatController::get_factura_client_users/$1/$2', ['as' => 'getFacturaClientUsers']); + $routes->get('direct/client/users/select/ot/(:num)', 'ChatController::get_orden_trabajo_client_users/$1/$2', ['as' => 'getOrdenTrabajoClientUsers']); + $routes->get('direct/users/(:num)', 'ChatController::get_chat_direct_users', ['as' => 'getChatDirectUsers']); $routes->post('direct/users/(:num)', 'ChatController::store_chat_direct_users/$1', ['as' => 'storeChatDirectUsers']); @@ -663,7 +665,10 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route $routes->get('department/presupuesto/(:num)/(:num)', 'ChatController::get_chat_presupuesto/$1/$2', ['as' => 'getChatPresupuesto']); $routes->get('department/pedido/(:num)/(:num)', 'ChatController::get_chat_pedido/$1/$2', ['as' => 'getChatPedido']); $routes->get('department/factura/(:num)/(:num)', 'ChatController::get_chat_factura/$1/$2', ['as' => 'getChatFactura']); + $routes->get('department/ot/(:num)/(:num)', 'ChatController::get_chat_orden_trabajo/$1/$2', ['as' => 'getChatOrdenTrabajo']); $routes->get('department/users/presupuesto/(:num)/(:num)', 'ChatController::get_chat_department_presupuesto_users/$1/$2', ['as' => 'getPresupuestoChatDepartmentUsers']); + $routes->get('department/users/ot/(:num)/(:num)', 'ChatController::get_chat_department_orden_trabajo_users/$1/$2', ['as' => 'getOrdenTrabajoChatDepartmentUsers']); + $routes->get('department/datatable', 'ChatController::chat_department_datatable', ['as' => 'chatDepartmentDatatable']); $routes->get('department/edit/(:num)', 'ChatController::chat_department_edit/$1', ['as' => 'chatDepartmentEditView']); $routes->get('department/users/datatable/(:num)', 'ChatController::chat_department_user_datatable/$1', ['as' => 'chatDepartmentUsersDatatable']); diff --git a/ci4/app/Controllers/Chat/ChatController.php b/ci4/app/Controllers/Chat/ChatController.php index ba44d28e..71ee0d2d 100644 --- a/ci4/app/Controllers/Chat/ChatController.php +++ b/ci4/app/Controllers/Chat/ChatController.php @@ -11,6 +11,7 @@ use App\Models\ChatNotification; use App\Models\ChatUser; use App\Models\Clientes\ClienteModel; use App\Models\Facturas\FacturaModel; +use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Models\Pedidos\PedidoModel; use App\Models\Presupuestos\PresupuestoModel; use App\Models\Usuarios\UserModel; @@ -132,6 +133,25 @@ class ChatController extends BaseController $data["chat"] = $chat; return $this->response->setJSON($data); } + public function get_chat_orden_trabajo(int $chat_department_id, int $orden_trabajo_id) + { + + $data = [ + "department" => $this->chatDeparmentModel->find($chat_department_id), + "chat" => null, + "messages" => null, + "count" => 0, + ]; + $chat = $this->chatModel->getChatOrdenTrabajo($chat_department_id, $orden_trabajo_id); + if ($chat) { + $data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id); + $this->chatMessageModel->set_chat_department_messages_as_read($chat->id); + $this->chatModel->setAsViewedChatUserNotifications($chat->id, auth()->user()->id); + $data["count"] = count($data["messages"]); + } + $data["chat"] = $chat; + return $this->response->setJSON($data); + } public function get_chat_direct_view($chat_id) { $chat = $this->chatModel->find($chat_id); @@ -295,6 +315,11 @@ class ChatController extends BaseController $data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($factura_id, 'factura'); return $this->response->setJSON($data); } + public function get_chat_department_orden_trabajo_users(int $chat_department_id, $orden_trabajo_id) + { + $data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($orden_trabajo_id, 'ot'); + return $this->response->setJSON($data); + } public function get_chat_users_internal() { $query = $this->userModel->builder()->select( @@ -357,6 +382,15 @@ class ChatController extends BaseController $clienteContactos = $cm->querySelectClienteContacto($f->cliente_id,$this->request->getGet('q')); return $this->response->setJSON($clienteContactos); } + public function get_orden_trabajo_client_users(int $orden_trabajo_id) + { + $otm = model(OrdenTrabajoModel::class); + $ot = $otm->find($orden_trabajo_id); + $cm = model(ClienteModel::class); + $cliente = $ot->pedido()->cliente(); + $clienteContactos = $cm->querySelectClienteContacto($cliente->id,$this->request->getGet('q')); + return $this->response->setJSON($clienteContactos); + } public function store_hebra(string $model) { $auth_user = auth()->user(); diff --git a/ci4/app/Database/Migrations/2025-04-11-180001_AddUserIdFechaEntregaPedido copy.php b/ci4/app/Database/Migrations/2025-04-11-180001_AddUserIdFechaEntregaPedido.php similarity index 100% rename from ci4/app/Database/Migrations/2025-04-11-180001_AddUserIdFechaEntregaPedido copy.php rename to ci4/app/Database/Migrations/2025-04-11-180001_AddUserIdFechaEntregaPedido.php diff --git a/ci4/app/Database/Migrations/2025-04-14-235200_AddFkOrdenTrabajoChatDepartment.php b/ci4/app/Database/Migrations/2025-04-14-235200_AddFkOrdenTrabajoChatDepartment.php new file mode 100644 index 00000000..3c86d242 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-04-14-235200_AddFkOrdenTrabajoChatDepartment.php @@ -0,0 +1,40 @@ + [ + "type" => "INT", + "constraint" => 10, + "unsigned" => true, + "null" => true + ], + ]; + + + public function up() + { + $this->forge->addColumn("chats", $this->COLUMNS); + $this->forge->addColumn("chat_department_users", $this->COLUMNS); + $this->forge->addForeignKey('orden_trabajo_id', 'ordenes_trabajo', 'id'); + $this->forge->processIndexes('chats'); + $this->forge->addForeignKey('orden_trabajo_id', 'ordenes_trabajo', 'id'); + $this->forge->processIndexes('chat_department_users'); + + + + + } + + public function down() + { + $this->forge->dropColumn("chats", ["orden_trabajo_id"]); + $this->forge->dropColumn("chat_department_users", ["orden_trabajo_id"]); + + } +} diff --git a/ci4/app/Entities/Chat/ChatDepartmentEntity.php b/ci4/app/Entities/Chat/ChatDepartmentEntity.php index 5017c310..ba3a1049 100644 --- a/ci4/app/Entities/Chat/ChatDepartmentEntity.php +++ b/ci4/app/Entities/Chat/ChatDepartmentEntity.php @@ -36,7 +36,9 @@ class ChatDepartmentEntity extends Entity $chatDepartmentUsers = $m->where('chat_department_id',$this->attributes['id']) ->where('pedido_id',null) ->where('factura_id',null) - ->where('presupuesto_id',null)->findAll(); + ->where('presupuesto_id',null) + ->where('orden_trabajo_id',null) + ->findAll(); return $chatDepartmentUsers; } /** @@ -62,6 +64,9 @@ class ChatDepartmentEntity extends Entity case 'factura': $m->where('pedido_id',$modelFkId); break; + case 'ot': + $m->where('orden_trabajo_id',$modelFkId); + break; default: break; } diff --git a/ci4/app/Entities/Chat/ChatDepartmentUserEntity.php b/ci4/app/Entities/Chat/ChatDepartmentUserEntity.php index c261f568..047070f4 100644 --- a/ci4/app/Entities/Chat/ChatDepartmentUserEntity.php +++ b/ci4/app/Entities/Chat/ChatDepartmentUserEntity.php @@ -20,6 +20,7 @@ class ChatDepartmentUserEntity extends Entity "pedido_id" => null, "factura_id" => null, "presupuesto_id" => null, + "orden_trabajo_id" => null, ]; @@ -29,6 +30,7 @@ class ChatDepartmentUserEntity extends Entity "pedido_id" => "?integer", "factura_id" => "?integer", "presupuesto_id" => "?integer", + "orden_trabajo_id" => "?integer", ]; public function user() : ?UserEntity diff --git a/ci4/app/Entities/Chat/ChatEntity.php b/ci4/app/Entities/Chat/ChatEntity.php index 1669f3cd..2bae32de 100644 --- a/ci4/app/Entities/Chat/ChatEntity.php +++ b/ci4/app/Entities/Chat/ChatEntity.php @@ -5,11 +5,13 @@ namespace App\Entities\Chat; use App\Entities\Facturas\FacturaEntity; use App\Entities\Pedidos\PedidoEntity; use App\Entities\Presupuestos\PresupuestoEntity; +use App\Entities\Produccion\OrdenTrabajoEntity; use App\Entities\Usuarios\UserEntity; use App\Models\Chat\ChatDeparmentModel; use App\Models\Chat\ChatMessageModel; use App\Models\ChatUser; use App\Models\Facturas\FacturaModel; +use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Models\Pedidos\PedidoModel; use App\Models\Presupuestos\PresupuestoModel; use App\Models\Usuarios\UserModel; @@ -25,6 +27,7 @@ class ChatEntity extends Entity "pedido_id" => null, "presupuesto_id" => null, "factura_id" => null, + "orden_trabajo_id" => null, "title" => null ]; @@ -34,6 +37,7 @@ class ChatEntity extends Entity "pedido_id" => "?integer", "presupuesto_id" => "?integer", "factura_id" => "?integer", + "orden_trabajo_id" => "?integer", "title" => "string" ]; @@ -71,6 +75,11 @@ class ChatEntity extends Entity $m = model(FacturaEntity::class); return $m->find($this->attributes['factura_id']); } + public function orden_trabajo(): ?OrdenTrabajoEntity + { + $m = model(OrdenTrabajoModel::class); + return $m->find($this->attributes['orden_trabajo_id']); + } public function messages(): ?array { $m = model(ChatMessageModel::class); @@ -100,12 +109,14 @@ class ChatEntity extends Entity $models = [ "presupuesto_id" => model(PresupuestoModel::class), "pedido_id" => model(PedidoModel::class), - "factura_id" => model(FacturaModel::class) + "factura_id" => model(FacturaModel::class), + "orden_trabajo_id" => model(OrdenTrabajoModel::class), ]; $fks = [ "presupuesto_id" => $this->attributes["presupuesto_id"], "pedido_id" => $this->attributes["pedido_id"], "factura_id" => $this->attributes["factura_id"], + "orden_trabajo_id" => $this->attributes["orden_trabajo"], ]; foreach ($fks as $key => $fk) { if ($fk) { @@ -123,6 +134,7 @@ class ChatEntity extends Entity "presupuesto" => $this->attributes["presupuesto_id"], "pedido" => $this->attributes["pedido_id"], "factura" => $this->attributes["factura_id"], + "ot" => $this->attributes["orden_trabajo_id"], ]; foreach ($fks as $key => $fk) { if ($fk) { diff --git a/ci4/app/Models/Chat/ChatDeparmentModel.php b/ci4/app/Models/Chat/ChatDeparmentModel.php index c5d81c87..efe215b8 100644 --- a/ci4/app/Models/Chat/ChatDeparmentModel.php +++ b/ci4/app/Models/Chat/ChatDeparmentModel.php @@ -136,6 +136,7 @@ class ChatDeparmentModel extends Model ->where('chat_department_users.presupuesto_id',null) ->where('chat_department_users.pedido_id',null) ->where('chat_department_users.factura_id',null) + ->where('chat_department_users.orden_trabajo_id',null) ->get(); return $result->getResultObject() ?: []; @@ -161,6 +162,13 @@ class ChatDeparmentModel extends Model ->get()->getResultObject(); return $result; } + public function getChatDeparmentOrdenTrabajoUsers(int $chat_deparment_id, int $orden_trabajo_id) + { + $result = $this->getChatDeparmentUserQuery($chat_deparment_id) + ->where('chat_department_users.orden_trabajo_id', $orden_trabajo_id) + ->get()->getResultObject(); + return $result; + } public function getDisplay(int $chat_deparment_id): string { return $this->find($chat_deparment_id)->display; diff --git a/ci4/app/Models/Chat/ChatDeparmentUserModel.php b/ci4/app/Models/Chat/ChatDeparmentUserModel.php index 1afdca85..b311e11e 100644 --- a/ci4/app/Models/Chat/ChatDeparmentUserModel.php +++ b/ci4/app/Models/Chat/ChatDeparmentUserModel.php @@ -19,7 +19,9 @@ class ChatDeparmentUserModel extends Model "user_id", "pedido_id", "factura_id", - "presupuesto_id" + "presupuesto_id", + "orden_trabajo_id", + ]; protected bool $allowEmptyInserts = false; diff --git a/ci4/app/Models/Chat/ChatModel.php b/ci4/app/Models/Chat/ChatModel.php index 88bbad19..5ac10631 100644 --- a/ci4/app/Models/Chat/ChatModel.php +++ b/ci4/app/Models/Chat/ChatModel.php @@ -6,11 +6,13 @@ use App\Entities\Chat\ChatEntity; use App\Models\ChatNotification; use App\Models\ChatUser; use App\Models\Facturas\FacturaModel; +use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Models\Pedidos\PedidoModel; use App\Models\Presupuestos\PresupuestoModel; use App\Models\Usuarios\UserModel; use CodeIgniter\Model; use CodeIgniter\Database\BaseBuilder; +use Config\OrdenTrabajo; class ChatModel extends Model { @@ -25,6 +27,7 @@ class ChatModel extends Model "chat_department_id", "presupuesto_id", "factura_id", + "orden_trabajo_id", "title" ]; @@ -86,6 +89,10 @@ class ChatModel extends Model { return $this->builder()->where("factura_id", $factura_id)->where("chat_department_id", $chat_department_id)->get()->getFirstRow(); } + public function getChatOrdenTrabajo(int $chat_department_id, int $orden_trabajo_id) + { + return $this->builder()->where("orden_trabajo_id", $orden_trabajo_id)->where("chat_department_id", $chat_department_id)->get()->getFirstRow(); + } public function createChatPresupuesto(int $chat_department_id, int $presupuesto_id): int { @@ -123,6 +130,17 @@ class ChatModel extends Model "chat_department_id" => $chat_department_id ]); } + public function createChatOrdenTrabajo(int $chat_department_id, int $orden_trabajo_id): int + { + $model = model(OrdenTrabajoModel::class); + $chatDeparmentModel = model(ChatDeparmentModel::class); + $ot = $model->find($orden_trabajo_id); + return $this->insert([ + "title" => "[OT]".$ot->id . "[" . $chatDeparmentModel->getDisplay($chat_department_id) . "]", + "orden_trabajo_id" => $orden_trabajo_id, + "chat_department_id" => $chat_department_id + ]); + } public function createChatSingle(): int { return $this->insert(["chat_department_id" => null]); @@ -323,6 +341,7 @@ class ChatModel extends Model "chats.pedido_id as pedidoId", "chats.presupuesto_id as presupuestoId", "chats.factura_id as facturaId", + "chats.orden_trabajo_id as ordenTrabajoId", "chats.title as chatDisplay", "COUNT(chat_notifications.id) as unreadMessages" ]) @@ -363,6 +382,13 @@ class ChatModel extends Model $row->title = $row->facturaId; $rows_new[] = $row; } + elseif ($row->ordenTrabajoId) { + // $row->model = $facturaModel->find($row->facturaId); + $row->uri = "/chat/ot/" . $row->ordenTrabajoId . "#accordionChatOrdenTrabajo"; + $row->avatar = "OT"; + $row->title = $row->ordenTrabajoId; + $rows_new[] = $row; + } } return $rows_new; } @@ -374,6 +400,7 @@ class ChatModel extends Model "chats.chat_department_id as chatDepartmentId", "chats.pedido_id as pedidoId", "chats.presupuesto_id as presupuestoId", + "chats.orden_trabajo_id as ordenTrabajoId", "chats.factura_id as facturaId", "chats.title as chatDisplay", "COUNT(chat_messages.id) as unreadMessages" @@ -413,6 +440,13 @@ class ChatModel extends Model $row->title = $row->facturaId; $rows_new[] = $row; } + elseif ($row->ordenTrabajoId) { + $row->uri = "/produccion/ordentrabajo/edit/" . $row->ordenTrabajoId . "#accordionChatOrdenTrabajo"; + $row->avatar = "OT"; + $row->chatDisplay .= "[INTERNAL]"; + $row->title = $row->ordenTrabajoId; + $rows_new[] = $row; + } } return $rows_new; } @@ -433,6 +467,7 @@ class ChatModel extends Model ->where("chats.chat_department_id", null) ->where("chats.pedido_id", null) ->where("chats.factura_id", null) + ->where("chats.orden_trabajo_id", null) ->where("chat_notifications.viewed", false) ->where("chat_notifications.user_id", auth()->user()->id); $rows = $q->get()->getResultObject(); @@ -513,6 +548,27 @@ class ChatModel extends Model $data["users"] = $this->getChatUsers($chat_id); return $data; } + public function getChatInternalHebraOrdenTrabajo($chat_id, $orden_trabajo_id) + { + $data = []; + $query = $this->builder()->select([ + "chats.id as chatId", + "chat_messages.message", + "users.username as senderUserName", + "chat_messages.created_at", + "CONCAT(users.first_name,' ',users.last_name) as senderFullName", + ]) + ->join("chat_messages", "chat_messages.chat_id = chats.id", "left") + ->join("users", "users.id = chat_messages.sender_id", "left") + ->where("chats.id", $chat_id) + ->where("chats.orden_trabajo_id", $orden_trabajo_id); + $data["chatId"] = $chat_id; + $data["messages"] = $query->get()->getResultObject(); + $data["chatTitle"] = "OT" . "[" . $orden_trabajo_id . "] - "; + $data["chatTitle"] .= $this->find($chat_id)->title; + $data["users"] = $this->getChatUsers($chat_id); + return $data; + } public function getChatUsers(int $chat_id) { $query = $this->builder()->select([ @@ -557,6 +613,17 @@ class ChatModel extends Model } return $data; } + public function getOrdenTrabajoHebras($orden_trabajo_id): array + { + $data = []; + $chats = $this->builder()->select("chats.id as chatId") + ->where("chats.chat_department_id", null) + ->where("chats.orden_trabajo_id", $orden_trabajo_id)->get()->getResultObject(); + foreach ($chats as $chat) { + $data[$chat->chatId] = $this->getChatInternalHebraOrdenTrabajo($chat->chatId, $orden_trabajo_id); + } + return $data; + } public function countUnreadMessagePresupuesto(int $presupuesto_id): int|string { return $this->builder()->select() @@ -586,6 +653,15 @@ class ChatModel extends Model ->where("chat_notifications.viewed", false) ->where("chat_notifications.user_id", auth()->user()->id)->countAllResults(); } + public function countUnreadMessageOrdenTrabajo($orden_trabajo_id): int|string + { + return $this->builder()->select() + ->join("chat_messages", "chat_messages.chat_id = chats.id", "left") + ->join("chat_notifications", "chat_notifications.chat_message_id = chat_messages.id", "left") + ->where("chats.orden_trabajo_id", $orden_trabajo_id) + ->where("chat_notifications.viewed", false) + ->where("chat_notifications.user_id", auth()->user()->id)->countAllResults(); + } public function countUnreadMessageDirectos(int $chat_id): int|string { return $this->builder()->select() @@ -606,6 +682,7 @@ class ChatModel extends Model ->where("chats.presupuesto_id", null) ->where("chats.pedido_id", null) ->where("chats.factura_id", null) + ->where("chats.orden_trabajo_id", null) ->where("chats.id", $chat_id) ->where("chat_messages.receiver_id", auth()->user()->id)->get()->getFirstRow(); $userModel = model(UserModel::class); @@ -837,6 +914,36 @@ class ChatModel extends Model } return $query->groupBy('chatMessageId'); } + public function getQueryDatatableMessageOrdenTrabajo(int $user_id): BaseBuilder + { + $query = $this->builder() + ->select([ + "chats.id", + "cm.id as chatMessageId", + "u.id as userId", + "cm.message", + "chats.created_at", + " + ( + SELECT cm2.updated_at + FROM chat_messages cm2 + WHERE cm2.chat_id = chats.id + ORDER BY cm2.updated_at DESC LIMIT 1 + ) as updated_at", + "CONCAT(u.first_name,' ',u.last_name) as creator", + "chats.title", + ]) + ->join("chat_messages cm", "chats.id = cm.chat_id", "left") + ->join("users u", "u.id = cm.sender_id", 'left') + ->join("ordenes_trabajo", "ordenes_trabajo.id = chats.orden_trabajo_id", "left") + ->where("chats.orden_trabajo_id is NOT NULL", NULL, FALSE); + + if (auth()->user()->inGroup("cliente-administrador","cliente")) { + $query->where('facturas.cliente_id', auth()->user()->cliente_id) + ->where("chats.chat_department_id is NOT NULL", NULL, FALSE); + } + return $query->groupBy('chatMessageId'); + } public function createNewDirectChat(string $title, string $message, array $users) { $chatMessageModel = model(ChatMessageModel::class); diff --git a/ci4/app/Services/ChatService.php b/ci4/app/Services/ChatService.php index 9b0a002d..cf651ef6 100644 --- a/ci4/app/Services/ChatService.php +++ b/ci4/app/Services/ChatService.php @@ -40,6 +40,7 @@ class ChatService extends BaseService "presupuesto" => "presupuesto_id", "pedido" => "pedido_id", "factura" => "factura_id", + "ot" => "orden_trabajo_id" ]; protected array $modelClassMap; public function __construct() @@ -122,6 +123,9 @@ class ChatService extends BaseService case 'factura': $r = $this->chatModel->createChatFactura($chatDepartmentId, $modelId); break; + case 'ot': + $r = $this->chatModel->createChatOrdenTrabajo($chatDepartmentId, $modelId); + break; default: break; } diff --git a/ci4/app/Views/themes/vuexy/components/chat_internal_orden_trabajo.php b/ci4/app/Views/themes/vuexy/components/chat_internal_orden_trabajo.php new file mode 100644 index 00000000..5fd73e23 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/components/chat_internal_orden_trabajo.php @@ -0,0 +1,41 @@ +
+
+

+ +

+
+
+ +
+
+
+
\ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/components/chat_orden_trabajo.php b/ci4/app/Views/themes/vuexy/components/chat_orden_trabajo.php new file mode 100644 index 00000000..546e488c --- /dev/null +++ b/ci4/app/Views/themes/vuexy/components/chat_orden_trabajo.php @@ -0,0 +1,156 @@ +
+ +
+
+ +
+ +
+ +
+ + + +
+
+
+
+
+ +
+ P +
+
+
+ +
+ +
+ +
+ user()->inGroup('cliente-administrador','cliente')): ?> + +
+ +
+
+ +
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
    + +
+
+ + +
+
+ + +
+
+
+
+ +section('css') ?> + + +endSection() ?> + + + +section("additionalExternalJs") ?> + + +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php index 40eb9437..94dbbd9f 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php @@ -3,7 +3,7 @@

-

@@ -62,10 +59,6 @@
- - diff --git a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php index 9a262c65..bca506d1 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php @@ -26,6 +26,10 @@
+
+ $modelId, "type" => "orden_trabajo"]) ?> +
+
diff --git a/httpdocs/assets/js/safekat/components/chat.js b/httpdocs/assets/js/safekat/components/chat.js index 043a6fef..ad645069 100644 --- a/httpdocs/assets/js/safekat/components/chat.js +++ b/httpdocs/assets/js/safekat/components/chat.js @@ -68,7 +68,6 @@ class Chat { } if (this.chatHistoryBody[0]) { - //console.log("History body"); this.scrollbarChatHistory = new PerfectScrollbar(this.chatHistoryBody[0], { wheelPropagation: false, suppressScrollX: true, @@ -126,12 +125,10 @@ class Chat { ${state.text} ${state.desc ?? ''} `) - console.log(state) return $state; } this.selectClientUser.init() this.selectItem.on('change', () => { - console.log(this.selectClientUser.getVal(),this.selectClientUser.getText()) if (this.selectClientUser.getVal()) { this.sendBtnMessageDepartment.attr('disabled', null) } else { @@ -181,6 +178,15 @@ class Chat { this.initSelectClient() // setInterval(this._getChatMessage.bind(this), 10000) } + initOrdenTrabajo() { + this.chatType = "ot" + this._handleGetChatList() + this.sendBtnMessageDepartment.on("click", this._sendMessage.bind(this)) + this.sendBtnMessageDepartmentClient.on("click", this._sendMessage.bind(this)) + this.messageInput.on("keypress", this._sendMessagePressKey.bind(this)) + this.initSelectClient() + // setInterval(this._getChatMessage.bind(this), 10000) + } initContacts() { this.chatType = "internal" diff --git a/httpdocs/assets/js/safekat/pages/chatOrdenTrabajo.js b/httpdocs/assets/js/safekat/pages/chatOrdenTrabajo.js new file mode 100644 index 00000000..503da3be --- /dev/null +++ b/httpdocs/assets/js/safekat/pages/chatOrdenTrabajo.js @@ -0,0 +1,12 @@ +import Chat from '../components/chat.js' +import InternalMessages from "../components/internalMessagesSection.js" +$(function () { + let chat = new Chat($("#chat-orden-trabajo")) + chat.init() + chat.initOrdenTrabajo() + if ($("#internal_messages_chat").length > 0) { + let internalMessages = new InternalMessages($("#internal_messages_chat")) + internalMessages.init() + } + +}) \ No newline at end of file From ab99baaa81be183e5b7846a07c3841e90f72fac1 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Tue, 15 Apr 2025 01:30:46 +0200 Subject: [PATCH 10/13] add new dates in form --- ci4/app/Config/OrdenTrabajo.php | 5 +- ...4500_UpdateDateFieldsOrdenTrabajoDates.php | 40 +++++ .../Produccion/OrdenTrabajoDateEntity.php | 4 + .../Produccion/OrdenTrabajoEntity.php | 18 +- .../Produccion/OrdenTrabajoUserEntity.php | 18 +- .../Models/OrdenTrabajo/OrdenTrabajoDate.php | 4 + .../Models/OrdenTrabajo/OrdenTrabajoUser.php | 4 + .../produccion/ot/otPreimpresionReview.php | 6 +- .../vuexy/form/produccion/ot/otProgress.php | 161 ++++++++++-------- .../form/produccion/viewOrdenTrabajoEdit.php | 20 +-- .../assets/js/safekat/pages/produccion/ot.js | 2 +- 11 files changed, 183 insertions(+), 99 deletions(-) diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php index b3638dba..2c9a9474 100644 --- a/ci4/app/Config/OrdenTrabajo.php +++ b/ci4/app/Config/OrdenTrabajo.php @@ -21,7 +21,10 @@ class OrdenTrabajo extends BaseConfig "cosido_at" => "cosido_user_id", "grapado_at" => "grapado_user_id", "solapa_at" => "solapa_user_id", - + "retractilado_at" => "retractilado_user_id", + "retractilado5_at" => "retractilado5_user_id", + "prototipo_at" => "prototipo_user_id", + "marcapaginas_at" => "marcapaginas_user_id", //FERRO "pendiente_ferro_at" => "pendiente_ferro_user_id", "ferro_en_cliente_at" => "ferro_en_cliente_user_id", diff --git a/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php b/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php index a69258c7..b6d5e06f 100644 --- a/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php +++ b/ci4/app/Database/Migrations/2025-04-14-204500_UpdateDateFieldsOrdenTrabajoDates.php @@ -20,6 +20,22 @@ class UpdateDateFieldsOrdenTrabajoDates extends Migration "type" => "DATE", "null" => true, ], + "retractilado_at" => [ + "type" => "DATE", + "null" => true, + ], + "retractilado5_at" => [ + "type" => "DATE", + "null" => true, + ], + "prototipo_at" => [ + "type" => "DATE", + "null" => true, + ], + "marcapaginas_at" => [ + "type" => "DATE", + "null" => true, + ], ]; protected array $USERS = [ "cosido_user_id" => [ @@ -40,6 +56,30 @@ class UpdateDateFieldsOrdenTrabajoDates extends Migration "constraint" => 10, "null" => true, ], + "retractilado_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "retractilado5_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "prototipo_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "marcapaginas_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], ]; public function up() diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php index 43410440..b796e380 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php @@ -24,6 +24,10 @@ class OrdenTrabajoDateEntity extends Entity "cosido_at" => null, "solapa_at" => null, "cosido_at" => null, + "retractilado_at"=> null, + "retractilado5_at"=> null, + "prototipo_at"=> null, + "marcapaginas_at"=> null, //FERRO "pendiente_ferro_at" => null, "ferro_en_cliente_at" => null, diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index 0728d4b9..c14bfa37 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -21,21 +21,21 @@ class OrdenTrabajoEntity extends Entity "pedido_id" => null, "user_created_id" => null, "user_updated_id" => null, - "fecha_entrega_warning" => false, - "fecha_entrega_warning_revised" => false, + "fecha_entrega_warning" => null, + "fecha_entrega_warning_revised" => null, "total_tirada" => null, "total_precio" => null, "tipo_entrada" => "out", "progreso" => 0.00, "estado" => "I", "comentarios" => null, - "revisar_formato" => false, - "revisar_lomo" => false, - "revisar_solapa" => false, - "revisar_isbn" => false, - "revisar_codigo_barras" => false, - "realizar_imposicion" => false, - "enviar_impresion" => false, + "revisar_formato" => null, + "revisar_lomo" => null, + "revisar_solapa" => null, + "revisar_isbn" => null, + "revisar_codigo_barras" => null, + "realizar_imposicion" => null, + "enviar_impresion" => null, "portada_path" => null, "is_pedido_espera" => null, "pedido_espera_by" => null, diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php index 26e78560..57356b8b 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php @@ -25,9 +25,13 @@ class OrdenTrabajoUserEntity extends Entity "corte_user_id" => null, "preparacion_interior_user_id" => null, "entrada_manipulado_user_id" => null, - "cosido_user_id"=> null, - "solapa_user_id"=> null, - "grapado_user_id"=> null, + "cosido_user_id" => null, + "solapa_user_id" => null, + "grapado_user_id" => null, + "retractilado_user_id" => null, + "retractilado5_user_id" => null, + "prototipo_user_id" => null, + "marcapaginas_user_id" => null, //FERRO "pendiente_ferro_user_id" => null, "ferro_en_cliente_user_id" => null, @@ -42,9 +46,9 @@ class OrdenTrabajoUserEntity extends Entity "pre_codbarras_user_id" => null, "pre_imposicion_user_id" => null, //UNUSED - "inaplazable_revised_change_user_id" => null,//!DELETE - "ferro_disponible_hecho_user_id" => null,//!DELETE - "ferro_entregado_user_id" => null,//!DELETE + "inaplazable_revised_change_user_id" => null, //!DELETE + "ferro_disponible_hecho_user_id" => null, //!DELETE + "ferro_entregado_user_id" => null, //!DELETE "pre_imprimir_user_id" => null, //!DELETE "ferro_disponible_ok_user_id" => null, //!DELETE ]; @@ -88,7 +92,7 @@ class OrdenTrabajoUserEntity extends Entity } return $user; } - public function getPlastificadoBy() : ?UserEntity + public function getPlastificadoBy(): ?UserEntity { return $this->userBy('plastificado_user_id'); } diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php index 0c883788..1d82ec12 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php @@ -31,6 +31,10 @@ class OrdenTrabajoDate extends Model "cosido_at", "solapa_at", "cosido_at", + "retractilado_at", + "retractilado5_at", + "prototipo_at", + "marcapaginas_at", //FERRO "pendiente_ferro_at", "ferro_en_cliente_at", diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php index 12c6b0e9..df4d0541 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php @@ -32,6 +32,10 @@ class OrdenTrabajoUser extends Model "cosido_user_id", "solapa_user_id", "grapado_user_id", + "retractilado_user_id", + "retractilado5_user_id", + "prototipo_user_id", + "marcapaginas_user_id", //FERRO "pendiente_ferro_user_id", "ferro_en_cliente_user_id", diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php index bc0093b6..01d0782b 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php @@ -2,7 +2,7 @@
Revisión
-
+
-
- - -
-
+
"> + + +
+
-
- - -
+
"> + + +
-
+
-
- - -
+
"> + + +
-
+
-
- - -
+
"> + + +
-
+
-
- - -
+
"> + + +
-
+
-
+
-
+
-
+
-
+
@@ -91,35 +91,61 @@
-
+
-
- - -
- - -
-
+
+ +
"> + + +
+
-
-
- -
- - -
+
+ +
"> + + +
+
+ +
"> + + +
+
+ + +
"> + + +
+
+ + +
"> + + +
+
+ + +
"> + + +
+
-
+
@@ -130,40 +156,39 @@
-
+
-
- - -
+
"> + + +
-
- -
- - -
+
+ +
"> + + +
+
+ +
"> + + +
-
- -
- - -
- -
+
-
+
-
+
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php index 9a262c65..80d21ab5 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php @@ -9,7 +9,7 @@
- +
@@ -35,19 +35,19 @@
-
-
-
- "> - - - - +
+
+
+ "> + + + + +
-
-
- - -
"> - - -
-
- -
"> - - -
-
- -
"> - - -
- -
- -
"> - - -
- -
- -
"> - - -
- -
-
-
+
@@ -80,13 +44,7 @@
- -
- - -
-
@@ -95,52 +53,52 @@
-
- -
"> - - -
-
+
+ +
"> + + +
+
- -
"> - - -
-
- -
"> - - -
-
- - -
"> - - -
-
- - -
"> - - -
-
+ +
"> + + +
+
+ +
"> + + +
+
-
"> - - -
-
+
"> + + +
+
+ + +
"> + + +
+
+ + +
"> + + +
+
@@ -156,27 +114,27 @@
-
+
-
"> - - -
+
"> + + +
-
- -
"> - - -
-
- -
"> - - -
+
+ +
"> + + +
+
+ +
"> + + +
-
+
@@ -193,7 +151,43 @@
+
+ + +
"> + + +
+
+ +
"> + + +
+
+ +
"> + + +
+ +
+ +
"> + + +
+ +
+ +
"> + + +
+ +
+
From 0fe247047765445b2205c2507f31b236816ce1fe Mon Sep 17 00:00:00 2001 From: amazuecos Date: Tue, 15 Apr 2025 09:53:50 +0200 Subject: [PATCH 12/13] add colors plannings --- ci4/app/Config/Routes.php | 1 + .../Controllers/Produccion/Ordentrabajo.php | 19 ++++++---- .../Produccion/OrdenTrabajoEntity.php | 24 ++++++------- ci4/app/Services/ProductionService.php | 22 +++++++----- .../components/modals/modalOtTaskManual.php | 36 +++++++++++++++++++ .../vuexy/form/produccion/ot/otTask.php | 10 ++++-- .../planning_rotativa/planning_rotativa.js | 19 ++++++++-- 7 files changed, 98 insertions(+), 33 deletions(-) create mode 100644 ci4/app/Views/themes/vuexy/components/modals/modalOtTaskManual.php diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 718e504b..fb3beb7d 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -746,6 +746,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func $routes->post("update", 'Ordentrabajo::update_orden_trabajo'); $routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada'); $routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1'); + $routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1'); /**====================== * FILES diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index a7a59257..8f0610f9 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -328,26 +328,26 @@ class Ordentrabajo extends BaseController } public function planning_rotativa_datatable() { - $q = $this->produccionService->planningRotativaQueryDatatable(); - return DataTable::of($q) + $query = $this->produccionService->planningRotativaQueryDatatable(); + return DataTable::of($query) ->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "") ->add("metros_check", fn($q) => $q->otId) ->add("corte", fn($q) => ["otId" => $q->otId, "tipo_corte" => $this->produccionService->ordenTrabajoTareaCorte($q->otId)]) - ->add("action", fn($q) => $q) + ->add("action", fn($q) => ["data" => $q]) ->toJson(true); } public function planning_plana_datatable() { - $q = $this->produccionService->planningPlanaQueryDatatable(); + $query = $this->produccionService->planningPlanaQueryDatatable(); $padreId = $this->request->getGet('padre_id'); if ($padreId) { - $q->where('lg_maquinas.padre_id', $padreId); + $query->where('lg_maquinas.padre_id', $padreId); } - return DataTable::of($q) + return DataTable::of($query) ->edit("tiempo_real_sum", fn($q) => $q->tiempo_real_sum) ->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "") ->add("pliegos_check", fn($q) => $q->otId) - ->add("action", fn($q) => $q) + ->add("action", fn($q) => ["data" => $q ]) ->toJson(true); } public function select_maquina_planning_rot() @@ -431,4 +431,9 @@ class Ordentrabajo extends BaseController ); } } + public function get_orden_trabajo_color_status(int $orden_trabajo_id) + { + $color = $this->produccionService->init($orden_trabajo_id)->getOtColorStatus(); + return $this->response->setJSON(["color" => $color]); + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index c14bfa37..3ac4e474 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -87,12 +87,12 @@ class OrdenTrabajoEntity extends Entity public function dates(): ?OrdenTrabajoDateEntity { $m = model(OrdenTrabajoDate::class); - return $m->where('orden_trabajo_id',$this->attributes["id"])->first(); + return $m->where('orden_trabajo_id', $this->attributes["id"])->first(); } public function users(): ?OrdenTrabajoUserEntity { $m = model(OrdenTrabajoUser::class); - return $m->where('orden_trabajo_id',$this->attributes["id"])->first(); + return $m->where('orden_trabajo_id', $this->attributes["id"])->first(); } /** @@ -109,24 +109,24 @@ class OrdenTrabajoEntity extends Entity $this->attributes["dates"] = $ot_dates->fill($data); return $this; } - public function getBarCode() : string + public function getBarCode(): string { $barcode = new TypeCode128(); $renderer = new PngRenderer(); $barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id); - return base64_encode($renderer->render($barcodeData,200, 50)); + return base64_encode($renderer->render($barcodeData, 200, 50)); } - public function files() : array + public function files(): array { $m = model(OrdenTrabajoFileModel::class); - return $m->where('orden_trabajo_id',$this->attributes['id'])->findAll() ?? []; + return $m->where('orden_trabajo_id', $this->attributes['id'])->findAll() ?? []; } - public function pedidoEsperaBy() : ?UserEntity + public function pedidoEsperaBy(): ?UserEntity { $m = model(UserModel::class); - if($this->attributes['pedido_espera_by']){ + if ($this->attributes['pedido_espera_by']) { return $m->findById($this->attributes['pedido_espera_by']); - }else{ + } else { return null; } } @@ -139,10 +139,10 @@ class OrdenTrabajoEntity extends Entity helper('filesystem'); $path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"]; $portada_path = null; - if($path){ - if(file_exists($path)){ + if ($path) { + if (file_exists($path)) { $portada_path = $path; - }else{ + } else { $portada_path = null; } } diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index c073dc38..a1361cbf 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -79,14 +79,20 @@ class ProductionService extends BaseService } public function init(int $orden_trabajo_id): self { - $this->maquinaModel = model(MaquinaModel::class); - $this->otModel = model(OrdenTrabajoModel::class); - $this->ot = $this->otModel->find($orden_trabajo_id); - $pedido = $this->ot->pedido(); - $this->setPedido($pedido); - $this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first(); - $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; - return $this; + try { + //code... + $this->maquinaModel = model(MaquinaModel::class); + $this->otModel = model(OrdenTrabajoModel::class); + $this->ot = $this->otModel->find($orden_trabajo_id); + $pedido = $this->ot->pedido(); + $this->setPedido($pedido); + $this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first(); + $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; + return $this; + } catch (\Throwable $th) { + dd($orden_trabajo_id); + throw $th; + } } /** * Establece el pedido sobre el que se va a trabajar diff --git a/ci4/app/Views/themes/vuexy/components/modals/modalOtTaskManual.php b/ci4/app/Views/themes/vuexy/components/modals/modalOtTaskManual.php new file mode 100644 index 00000000..acae2131 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/components/modals/modalOtTaskManual.php @@ -0,0 +1,36 @@ + + \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php index 94dbbd9f..1b0a54d8 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php @@ -41,9 +41,13 @@
-
-
- +
+
+ +
+
+ +
diff --git a/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js b/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js index d14b8623..1704f193 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js +++ b/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js @@ -151,6 +151,9 @@ class PlanningRotativa { language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, + createdRow: (row,data,dataIndex) => { + this.getColorOtStatus(row,data) + }, columns: this.datatableColumns, ajax: '/produccion/ordentrabajo/planning/rotativa/datatable' }); @@ -165,7 +168,9 @@ class PlanningRotativa { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, columns: this.datatablePlanaColumns, - + createdRow: (row,data,dataIndex) => { + this.getColorOtStatus(row,data) + }, ajax: { url : '/produccion/ordentrabajo/planning/plana/datatable', data : d => { @@ -245,7 +250,7 @@ class PlanningRotativa { this.tablePlanningPlana.on('change', ".pliegos-check", this.calcPliegosCheck.bind(this)) } _renderBtnAction(d) { - return `` + return `` } _columnFiltering() { this.api().columns() @@ -362,7 +367,15 @@ class PlanningRotativa { } toggleCorteError(){ } - + getColorOtStatus(row,data){ + let ajax = new Ajax("/produccion/ordentrabajo/color/"+data.otId,null,null, + (response) => { + $(row).css("border-left",`10px solid ${response.color}`) + $(row).css("border-right",`10px solid ${response.color}`) + },null + ) + ajax.get() + } } From c6db00005796ebd5738ad317e386d7eceb53fb2e Mon Sep 17 00:00:00 2001 From: amazuecos Date: Tue, 15 Apr 2025 19:39:07 +0200 Subject: [PATCH 13/13] fix update pedido espera update --- .../Controllers/Produccion/Ordentrabajo.php | 2 ++ .../Produccion/OrdenTrabajoDateEntity.php | 2 +- .../Models/OrdenTrabajo/OrdenTrabajoDate.php | 2 +- ci4/app/Services/ProductionService.php | 27 +++++++++++++++---- .../assets/js/safekat/pages/produccion/ot.js | 18 +++++++++++-- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 8f0610f9..41bd2391 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -147,6 +147,8 @@ class Ordentrabajo extends BaseController ]; $this->viewData["modelId"] = $orden_trabajo_id; $this->produccionService->init($orden_trabajo_id); + $this->produccionService->reInsertOrdenTrabajoDates(); + $this->produccionService->reInsertOrdenTrabajoUsers(); $this->viewData["presupuesto"] = $this->produccionService->getPresupuesto(); $this->viewData["cliente"] = $this->produccionService->getCliente(); $this->viewData["ot"] = $this->produccionService->getOrdenTrabajo(); diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php index b796e380..e106c57c 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php @@ -23,7 +23,7 @@ class OrdenTrabajoDateEntity extends Entity "entrada_manipulado_at" => null, "cosido_at" => null, "solapa_at" => null, - "cosido_at" => null, + "grapado_at" => null, "retractilado_at"=> null, "retractilado5_at"=> null, "prototipo_at"=> null, diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php index 1d82ec12..555f6415 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php @@ -30,7 +30,7 @@ class OrdenTrabajoDate extends Model "entrada_manipulado_at", "cosido_at", "solapa_at", - "cosido_at", + "grapado_at", "retractilado_at", "retractilado5_at", "prototipo_at", diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index a1361cbf..74d96614 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -90,7 +90,6 @@ class ProductionService extends BaseService $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; return $this; } catch (\Throwable $th) { - dd($orden_trabajo_id); throw $th; } } @@ -141,10 +140,10 @@ class ProductionService extends BaseService ]; $id = $this->otModel->insert($data); $this->init($id); - $this->updatePedidoEspera(); $this->storeOrdenTrabajoUsers(); $this->storeOrdenTrabajoDates(); $this->storeAllTareas(); + $this->updatePedidoEspera(); return $this->ot; } @@ -177,6 +176,24 @@ class ProductionService extends BaseService "orden_trabajo_id" => $this->ot->id, ]); } + public function reInsertOrdenTrabajoUsers(): int|bool|string + { + $status = false; + if($this->otUser->where('orden_trabajo_id',$this->ot->id)->countAllResults() == 0) + { + $status = $this->storeOrdenTrabajoUsers(); + } + return $status; + } + public function reInsertOrdenTrabajoDates(): int|bool|string + { + $status = false; + if($this->otDate->where('orden_trabajo_id',$this->ot->id)->countAllResults() == 0) + { + $status = $this->storeOrdenTrabajoDates(); + } + return $status; + } protected function storeAllTareas() { $this->storeOrdenTrabajoTareas(); @@ -757,8 +774,8 @@ class ProductionService extends BaseService { $result = []; $otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id) - ->set([$data['name'] => $data[$data['name']]]) - ->update($data); + ->set($data['name'],$data[$data['name']]) + ->update(); $this->otDate->updateUserDateMap($this->ot->id, $data); $ot_users = $this->ot->users(); if (isset($this->ordenTrabajoConfig->DATE_USER_MAPPING[$data["name"]])) { @@ -1063,7 +1080,7 @@ class ProductionService extends BaseService $status = false; $presupuestoFiles = $this->presupuesto->files(); if (count($presupuestoFiles) == 0) { - $status = $this->otModel->update($this->ot->id, ['pedido_espera' => true]); + $status = $this->otModel->update($this->ot->id, ['is_pedido_espera' => true]); } return $status; } diff --git a/httpdocs/assets/js/safekat/pages/produccion/ot.js b/httpdocs/assets/js/safekat/pages/produccion/ot.js index 7dd458a0..27090ebd 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/ot.js +++ b/httpdocs/assets/js/safekat/pages/produccion/ot.js @@ -81,6 +81,15 @@ class OrdenTrabajo { this.prepGrapado = new DatePicker(this.otForm.find("#ot-prep-grapado"), option) this.prepSolapa = new DatePicker(this.otForm.find("#ot-prep-solapa"), option) + this.prepPrototipo = new DatePicker(this.otForm.find("#ot-prep-prototipo"), option) + this.prepMarcapaginas = new DatePicker(this.otForm.find("#ot-prep-marcapaginas"), option) + this.prepRetractilado = new DatePicker(this.otForm.find("#ot-prep-retractilado"), option) + this.prepRetractilado5 = new DatePicker(this.otForm.find("#ot-prep-retractilado5"), option) + + + + + this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option) this.embalaje = new DatePicker(this.otForm.find("#ot-embalaje"), option) this.envio = new DatePicker(this.otForm.find("#ot-envio"), option) @@ -225,7 +234,7 @@ class OrdenTrabajo { if (element.presupuesto_preimpresion_id) this.createSelectMaquinaAll(selectItem) if (element.presupuesto_extra_id) this.createSelectMaquinaAll(selectItem) if (this.summaryData.impresion_interior_bn) { - let isTareaImpresionInteriorBN = this.summaryData.impresion_interior_bn?.presupuesto_linea_id == element.presupuesto_linea_id + let isTareaImpresionInteriorBN = this.summaryData.impresion_interior_bn?.presupuesto_linea_id == element.presupuesto_linea_id && element.is_corte == false if (isTareaImpresionInteriorBN) { let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id); this.createSelectImposicion(selectItemImposicion) @@ -235,7 +244,7 @@ class OrdenTrabajo { } } if (this.summaryData.impresion_interior_color) { - let isTareaImpresionInteriorColor = this.summaryData.impresion_interior_color?.presupuesto_linea_id == element.presupuesto_linea_id + let isTareaImpresionInteriorColor = this.summaryData.impresion_interior_color?.presupuesto_linea_id == element.presupuesto_linea_id && element.is_corte == false if (isTareaImpresionInteriorColor) { let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id); this.createSelectImposicion(selectItemImposicion) @@ -397,6 +406,11 @@ class OrdenTrabajo { this.prepSolapa.setDate(this.summaryData.dates.solapa_at) this.prepGrapado.setDate(this.summaryData.dates.grapado_at) + this.prepPrototipo.setDate(this.summaryData.dates.prototipo_at) + this.prepMarcapaginas.setDate(this.summaryData.dates.marcapaginas_at) + this.prepRetractilado.setDate(this.summaryData.dates.retractilado_at) + this.prepRetractilado5.setDate(this.summaryData.dates.retractilado5_at) + this.espiral.setDate(this.summaryData.dates.fecha_impresion_at) this.embalaje.setDate(this.summaryData.dates.embalaje_at) this.envio.setDate(this.summaryData.dates.envio_at)