diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 5814ccb4..dfdda020 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -804,6 +804,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func * PDF *========================**/ $routes->get('pdf/(:num)', 'Ordentrabajo::get_pdf/$1'); + $routes->get('pdf/content/(:num)', 'Ordentrabajo::get_ot_pdf_content/$1'); $routes->get('pdf/ferro/(:num)', 'Ordentrabajo::get_ferro_pdf/$1'); $routes->get('pdf/prototipo/(:num)', 'Ordentrabajo::get_prototipo_pdf/$1'); $routes->get('portada/(:num)', 'Ordentrabajo::get_portada_img/$1'); diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 6bb737f7..804fa8ec 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -243,6 +243,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_pendientes() @@ -258,6 +259,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_ferro_pendiente() @@ -273,6 +275,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_ferro_ok() @@ -288,6 +291,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_news() @@ -302,6 +306,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_prod() @@ -316,6 +321,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_waiting() @@ -330,6 +336,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function datatable_revision_com() @@ -344,6 +351,7 @@ class Ordentrabajo extends BaseController fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : "" ) ->add("action", fn($q) => $q->id) + ->add("pdf_check", fn($q) => $q->id) ->toJson(true); } public function papel_gramaje_datatable() @@ -641,7 +649,7 @@ class Ordentrabajo extends BaseController $this->viewData['ot_tarea'] = $otTareaEntity; $this->viewData['ot'] = $otTareaEntity->orden_trabajo(); $this->viewData['presupuesto'] = $this->viewData['ot']->presupuesto(); - + $this->viewData['impresoras'] = $impresoras; $this->viewData['breadcrumb'] = [ ['title' => lang("Produccion.maquinista.maquinas"), 'route' => route_to("viewProduccionMaquinistaMaquinas"), 'active' => false], @@ -784,8 +792,8 @@ class Ordentrabajo extends BaseController ); $tareaEntity = $this->otTarea->find($tareaId); $tiempo_trabajado = $tareaEntity->tiempo_trabajado(); - $responseData['tiempo_total_estimado']+=$tareaEntity->tiempo_estimado; - $responseData['tiempo_total_real']+=$tiempo_trabajado; + $responseData['tiempo_total_estimado'] += $tareaEntity->tiempo_estimado; + $responseData['tiempo_total_real'] += $tiempo_trabajado; $responseData["estado"] = $validatedData["estado"]; $tareaEntity->tiempo_real = $tiempo_trabajado / count($validatedData['tareas']); $tareaEntity->click_init = $validatedData['click_init'] / count($validatedData['tareas']); @@ -823,7 +831,7 @@ class Ordentrabajo extends BaseController $validatedData = $this->validation->getValidated(); foreach ($validatedData['ordenes_trabajo'] as $key => $orden_trabajo_id) { - $maquinaOtTarea = $this->maquinaOtTareaModel->where('orden_trabajo_id', $orden_trabajo_id)->where('maquina_id', $validatedData['maquina_id'])->where('deleted_at',null)->countAllResults(); + $maquinaOtTarea = $this->maquinaOtTareaModel->where('orden_trabajo_id', $orden_trabajo_id)->where('maquina_id', $validatedData['maquina_id'])->where('deleted_at', null)->countAllResults(); if ($maquinaOtTarea) { continue; } @@ -855,17 +863,15 @@ class Ordentrabajo extends BaseController $tarea->click_init = $bodyData['click_init']; $tarea->click_end = $bodyData['click_end']; $totalTareas[] = $tarea; - } - } foreach ($totalTareas as $key => $tarea) { - $tiempo_trabajado = $tarea->tiempo_trabajado(); - $tarea->tiempo_real = $tiempo_trabajado / count($totalTareas); - $tarea->click_init = $tarea->click_init / count($totalTareas); - $tarea->click_end = $tarea->click_end / count($totalTareas); + $tiempo_trabajado = $tarea->tiempo_trabajado(); + $tarea->tiempo_real = $tiempo_trabajado / count($totalTareas); + $tarea->click_init = $tarea->click_init / count($totalTareas); + $tarea->click_end = $tarea->click_end / count($totalTareas); - $this->otTarea->save($tarea); + $this->otTarea->save($tarea); } if ($estado == "F") { $this->maquinaOtTareaModel->where('maquina_id', $maquina_id)->delete(); @@ -875,7 +881,7 @@ class Ordentrabajo extends BaseController } public function delete_maquina_orden_trabajo_tarea($maquina_orden_trabajo_tarea_id) { - + $status = $this->maquinaOtTareaModel->delete($maquina_orden_trabajo_tarea_id); return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $status]); } @@ -889,7 +895,7 @@ class Ordentrabajo extends BaseController $this->produccionService->deleteOrdenTrabajoTareaProgressDates($tarea->id); } } - $status = $this->maquinaOtTareaModel->where('maquina_id',$maquina_id)->delete(); + $status = $this->maquinaOtTareaModel->where('maquina_id', $maquina_id)->delete(); return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $status]); } @@ -916,23 +922,22 @@ class Ordentrabajo extends BaseController $tareas = $this->produccionService->init($maquina_ot->orden_trabajo_id) ->getTareasWithMaquina($maquina_id, ['P', 'I', 'S', 'D']); foreach ($tareas as $key => $tarea) { - $responseData['tiempo_total_estimado']+= $tarea->tiempo_estimado; - $responseData['tiempo_total_real']+= $tarea->tiempo_real; + $responseData['tiempo_total_estimado'] += $tarea->tiempo_estimado; + $responseData['tiempo_total_real'] += $tarea->tiempo_real; $responseData["estado"] = $tarea->lastState()->estado; - if($tarea->presupuesto_linea_id){ + if ($tarea->presupuesto_linea_id) { $responseData["clicks_total"] += $tarea->presupuesto_linea()->rotativa_clicks_total; $responseData["tirada_total"] += $tarea->orden_trabajo()->presupuesto()->tirada; - } } } $responseData['tiempo_total_estimado'] = float_seconds_to_hhmmss_string($responseData['tiempo_total_estimado']); $responseData['tiempo_total_real'] = float_seconds_to_hhmmss_string($responseData['tiempo_total_real']); return $this->response->setJSON($responseData); - } - public function printPackagingLabels(){ + public function printPackagingLabels() + { $ot_id = $this->request->getPost('ot_id') ?? null; $unidades_caja = $this->request->getPost('unidades_caja') ?? null; @@ -963,4 +968,8 @@ class Ordentrabajo extends BaseController return $this->response->setJSON($result); } + public function get_ot_pdf_content($orden_trabajo_id) + { + return $this->produccionService->init($orden_trabajo_id)->getPdfContent(); + } } diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index c9c7ddce..90aeda9d 100755 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -1,6 +1,7 @@ "Descargar", "navs" => [ 'finalizadas' => 'Finalizadas', 'pendientes' => 'Pendientes', diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 6091fab0..25679b40 100755 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -621,6 +621,10 @@ class ProductionService extends BaseService { return view("themes/vuexy/pdfs/orden_trabajo", $this->getDataPdf()); } + public function getPdfContent() + { + return view("themes/vuexy/pdfs/orden_trabajo_view", $this->getDataPdf()); + } public function getFerroPdf() { return view("themes/vuexy/pdfs/ferro", $this->getDataPdf()); 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 cc43a4f9..ad280f80 100755 --- a/ci4/app/Views/themes/vuexy/components/tables/ot_table.php +++ b/ci4/app/Views/themes/vuexy/components/tables/ot_table.php @@ -3,7 +3,8 @@
| = lang('Produccion.datatable.ot_id') ?> | ++ | = lang('Produccion.datatable.ot_id') ?> | = lang('Produccion.datatable.pedido_id') ?> | = lang('Produccion.datatable.fecha_encuadernacion') ?> | = lang('Produccion.datatable.cliente') ?> | diff --git a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php index d401c3d5..3292a21b 100755 --- a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoList.php @@ -6,41 +6,46 @@ = $this->section('content'); ?> -
|---|
+ = $ot->comment_interior ?> +
+