diff --git a/ci4/app/Config/LogoImpresion.php b/ci4/app/Config/LogoImpresion.php
new file mode 100644
index 00000000..7de95716
--- /dev/null
+++ b/ci4/app/Config/LogoImpresion.php
@@ -0,0 +1,31 @@
+ "icon_bn",
+ "lp_bnhq" => "icon_bnhq",
+ "lp_color" => "icon_color",
+ "lp_colorhq" => "icon_colorhq",
+ "lp_cubierta" => "icon_cubierta",
+ "lp_sobrecubierta" => "icon_sobrecubierta",
+ "lp_rot_bn" => "icon_rotativa_bn",
+ "lp_rot_color" => "icon_rotativa_color",
+ "lp_guardas" => "icon_cuardas"
+
+ ];
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+ public function get_logo_path(string $tipo): string
+ {
+ return "themes/vuexy/img/safekat/presupuestos/" . $this->TIPO_IMPRESION_MAPPING[$tipo] . ".png";
+ }
+}
diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php
index 145f37ef..2d7d863a 100644
--- a/ci4/app/Config/Routes.php
+++ b/ci4/app/Config/Routes.php
@@ -40,34 +40,30 @@ $routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function (
/* Maquinas */
$routes->group('maquinas', ['namespace' => 'App\Controllers\Tarifas\Maquinas'], function ($routes) {
- $routes->post('acabado','TarifaMaquinas::add_tarifa_acabado_maquina_with_tarea');
- $routes->post('manipulado','TarifaMaquinas::add_tarifa_manipulado_maquina_with_tarea');
- $routes->post('preimpresion','TarifaMaquinas::add_tarifa_preimpresion_maquina_with_tarea');
- $routes->post('encuadernacion','TarifaMaquinas::add_tarifa_encuadernacion_maquina_with_tarea');
- $routes->post('extra','TarifaMaquinas::add_tarifa_extra_maquina_with_tarea');
-
- $routes->delete('acabado/(:num)','TarifaMaquinas::delete_tarifa_acabado_maquina_with_tarea/$1');
- $routes->delete('manipulado/(:num)','TarifaMaquinas::delete_tarifa_manipulado_maquina_with_tarea/$1');
- $routes->delete('preimpresion/(:num)','TarifaMaquinas::delete_tarifa_preimpresion_maquina_with_tarea/$1');
- $routes->delete('encuadernacion/(:num)','TarifaMaquinas::delete_tarifa_encuadernacion_maquina_with_tarea/$1');
- $routes->delete('extra/(:num)','TarifaMaquinas::delete_tarifa_extra_maquina_with_tarea/$1');
-
- $routes->get('acabado/select','TarifaMaquinas::get_select_maquina_acabado');
- $routes->get('manipulado/select','TarifaMaquinas::get_select_maquina_manipulado');
- $routes->get('impresion/select','TarifaMaquinas::get_select_maquina_impresion');
- $routes->get('tareas/select','TarifaMaquinas::get_select_maquina_tareas');
-
-
-
- $routes->get('acabado/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_acabado_maquina/$1');
- $routes->get('manipulado/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_manipulado_maquina/$1');
- $routes->get('preimpresion/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_preimpresion_maquina/$1');
- $routes->get('encuadernacion/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_encuadernacion_maquina/$1');
- $routes->get('extra/datatable/(:num)','TarifaMaquinas::get_datatable_tarifa_extra_maquina/$1');
+ $routes->post('acabado', 'TarifaMaquinas::add_tarifa_acabado_maquina_with_tarea');
+ $routes->post('manipulado', 'TarifaMaquinas::add_tarifa_manipulado_maquina_with_tarea');
+ $routes->post('preimpresion', 'TarifaMaquinas::add_tarifa_preimpresion_maquina_with_tarea');
+ $routes->post('encuadernacion', 'TarifaMaquinas::add_tarifa_encuadernacion_maquina_with_tarea');
+ $routes->post('extra', 'TarifaMaquinas::add_tarifa_extra_maquina_with_tarea');
+ $routes->delete('acabado/(:num)', 'TarifaMaquinas::delete_tarifa_acabado_maquina_with_tarea/$1');
+ $routes->delete('manipulado/(:num)', 'TarifaMaquinas::delete_tarifa_manipulado_maquina_with_tarea/$1');
+ $routes->delete('preimpresion/(:num)', 'TarifaMaquinas::delete_tarifa_preimpresion_maquina_with_tarea/$1');
+ $routes->delete('encuadernacion/(:num)', 'TarifaMaquinas::delete_tarifa_encuadernacion_maquina_with_tarea/$1');
+ $routes->delete('extra/(:num)', 'TarifaMaquinas::delete_tarifa_extra_maquina_with_tarea/$1');
+
+ $routes->get('acabado/select', 'TarifaMaquinas::get_select_maquina_acabado');
+ $routes->get('manipulado/select', 'TarifaMaquinas::get_select_maquina_manipulado');
+ $routes->get('impresion/select', 'TarifaMaquinas::get_select_maquina_impresion');
+ $routes->get('tareas/select', 'TarifaMaquinas::get_select_maquina_tareas');
+ $routes->get('acabado/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_acabado_maquina/$1');
+ $routes->get('manipulado/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_manipulado_maquina/$1');
+ $routes->get('preimpresion/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_preimpresion_maquina/$1');
+ $routes->get('encuadernacion/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_encuadernacion_maquina/$1');
+ $routes->get('extra/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_extra_maquina/$1');
});
/* Cliente */
$routes->group('acabados', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
@@ -304,6 +300,7 @@ $routes->group('maquinas', ['namespace' => 'App\Controllers\Configuracion'], fun
$routes->post('datatable', 'Maquinas::datatable', ['as' => 'dataTableOfMaquinas']);
$routes->post('allmenuitems', 'Maquinas::allItemsSelect', ['as' => 'select2ItemsOfMaquinas']);
$routes->post('menuitems', 'Maquinas::menuItems', ['as' => 'menuItemsOfMaquinas']);
+ $routes->get('select', 'Maquinas::select', ['as' => 'selectMaquinas']);
});
$routes->resource('maquinas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinas', 'except' => 'show,new,create,update']);
@@ -883,10 +880,32 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
$routes->get('', 'Ordentrabajo::index', ['as' => 'viewOrdenTrabajoIndex']);
$routes->get('edit/(:num)', 'Ordentrabajo::edit/$1', ['as' => 'viewOrdenTrabajoEdit']);
$routes->delete('reset/tareas/(:num)', 'Ordentrabajo::reset_tareas/$1');
+ $routes->delete('tareas/(:num)', 'Ordentrabajo::delete_tarea/$1');
$routes->get('summary/(:num)', 'Ordentrabajo::get_orden_trabajo_summary/$1', ['as' => 'getOrdenTrabajoSumary']);
- $routes->get('datatable', 'Ordentrabajo::datatable', ['as' => 'datatableOrdenTrabajo']);
+ $routes->get('datatable', 'Ordentrabajo::datatable');
+ $routes->get('datatable_pendientes', 'Ordentrabajo::datatable_pendientes');
+ $routes->get('datatable_ferro_pendiente', 'Ordentrabajo::datatable_ferro_pendiente');
+ $routes->get('datatable_ferro_ok', 'Ordentrabajo::datatable_ferro_ok');
$routes->get('tareas/datatable/(:num)', 'Ordentrabajo::tareas_datatable/$1', ['as' => 'datatableTareasOrdenTrabajo']);
+ /**======================
+ * UPDATES
+ *========================**/
+ $routes->post("update/tarea", 'Ordentrabajo::update_orden_trabajo_tarea');
+ $routes->post("update/date", 'Ordentrabajo::update_orden_trabajo_date');
+ $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');
+ /**======================
+ * PDF
+ *========================**/
+ $routes->get('pdf/(:num)', 'Ordentrabajo::get_pdf/$1');
+ $routes->get('portada/(:num)', 'Ordentrabajo::get_portada_img/$1');
+ $routes->group('planning', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
+ $routes->get('rotativa', 'Ordentrabajo::index_planning_rotativa');
+ $routes->get('papel/datatable', 'Ordentrabajo::papel_gramaje_datatable');
+ $routes->get('rotativa/datatable', 'Ordentrabajo::planning_rotativa_datatable');
+ });
});
});
/*
diff --git a/ci4/app/Config/Validation.php b/ci4/app/Config/Validation.php
index 012ff779..d07aade1 100755
--- a/ci4/app/Config/Validation.php
+++ b/ci4/app/Config/Validation.php
@@ -46,81 +46,105 @@ class Validation extends BaseConfig
/**========================================================================
* TARIFA MAQUINA ACABADO
*========================================================================**/
- public array $tarifa_maquina_acabado =
+ public array $tarifa_maquina_acabado =
[
"tarifa_acabado_id" => [
- "rules" => "required|integer",
- "label" => "tarifa acabado",
+ "rules" => "required|integer",
+ "label" => "tarifa acabado",
],
"maquina_id" => [
"rules" => "required|integer",
"label" => "maquina",
- ],
+ ],
"maquina_tarea_id" => [
"rules" => "required|integer",
"label" => "tarea",
- ],
+ ],
];
- public array $tarifa_maquina_manipulado =
+ public array $tarifa_maquina_manipulado =
[
"tarifa_manipulado_id" => [
- "rules" => "required|integer",
- "label" => "tarifa acabado",
+ "rules" => "required|integer",
+ "label" => "tarifa acabado",
],
"maquina_id" => [
"rules" => "required|integer",
"label" => "maquina",
- ],
+ ],
"maquina_tarea_id" => [
"rules" => "required|integer",
"label" => "tarea",
- ],
+ ],
];
- public array $tarifa_maquina_preimpresion =
+ public array $tarifa_maquina_preimpresion =
[
"tarifa_preimpresion_id" => [
- "rules" => "required|integer",
- "label" => "tarifa acabado",
+ "rules" => "required|integer",
+ "label" => "tarifa acabado",
],
"maquina_id" => [
"rules" => "required|integer",
"label" => "maquina",
- ],
+ ],
"maquina_tarea_id" => [
"rules" => "required|integer",
"label" => "tarea",
- ],
+ ],
];
- public array $tarifa_maquina_encuadernacion =
+ public array $tarifa_maquina_encuadernacion =
[
"tarifa_encuadernacion_id" => [
- "rules" => "required|integer",
- "label" => "tarifa acabado",
+ "rules" => "required|integer",
+ "label" => "tarifa acabado",
],
"maquina_id" => [
"rules" => "required|integer",
"label" => "maquina",
- ],
+ ],
"maquina_tarea_id" => [
"rules" => "required|integer",
"label" => "tarea",
- ],
+ ],
];
- public array $tarifa_maquina_extra =
+ public array $tarifa_maquina_extra =
[
"tarifa_extra_id" => [
- "rules" => "required|integer",
- "label" => "tarifa acabado",
+ "rules" => "required|integer",
+ "label" => "tarifa acabado",
],
"maquina_id" => [
"rules" => "required|integer",
"label" => "maquina",
- ],
+ ],
"maquina_tarea_id" => [
"rules" => "required|integer",
"label" => "tarea",
- ],
+ ],
];
+ public array $orden_trabajo_tarea = [
+ "orden_trabajo_tarea_id" => [
+ "rules" => "required|integer",
+ "label" => "tarea"
+ ],
+ // "tiempo_real" => [
+ // "rules" => "required|float",
+ // "label" => "tiempo real"
+ // ]
+ ];
+ public array $orden_trabajo_date = [
+ "orden_trabajo_id" => [
+ "rules" => "required|integer",
+ "label" => "tarea"
+ ],
+
+ ];
+ public array $orden_trabajo = [
+ "orden_trabajo_id" => [
+ "rules" => "required|integer",
+ "label" => "Orden trabajo"
+ ],
+
+ ];
}
diff --git a/ci4/app/Controllers/Configuracion/Maquinas.php b/ci4/app/Controllers/Configuracion/Maquinas.php
index 8deac302..406f44f8 100755
--- a/ci4/app/Controllers/Configuracion/Maquinas.php
+++ b/ci4/app/Controllers/Configuracion/Maquinas.php
@@ -356,7 +356,10 @@ class Maquinas extends \App\Controllers\BaseResourceController
}
}
-
+ public function select(){
+ $r = $this->model->getSelectQuery($this->request->getGet("q"));
+ return $this->response->setJSON($r);
+ }
protected function getMaquinaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
diff --git a/ci4/app/Controllers/Pedidos/Pedido.php b/ci4/app/Controllers/Pedidos/Pedido.php
index 4595ab3b..a2fe761f 100755
--- a/ci4/app/Controllers/Pedidos/Pedido.php
+++ b/ci4/app/Controllers/Pedidos/Pedido.php
@@ -395,7 +395,8 @@ class Pedido extends \App\Controllers\BaseResourceController
$serviceProduction = service('production');
$pedido = $this->model->find($pedido_id);
$serviceProduction->setPedido($pedido);
- return $this->respond()->setJSON($serviceProduction->createOrdenTrabajo());
+ $r = $serviceProduction->createOrdenTrabajo();
+ return $this->respond()->setJSON($r);
}
}
diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php
index 9b89ab6a..a6fe5e73 100755
--- a/ci4/app/Controllers/Produccion/Ordentrabajo.php
+++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php
@@ -1,29 +1,48 @@
otModel = model(OrdenTrabajoModel::class);
+ $this->userModel = model(UserModel::class);
$this->produccionService = new ProductionService();
+ $this->otTarea = model(OrdenTrabajoTarea::class);
+ $this->validation = service("validation");
+ helper("time");
parent::initController($request, $response, $logger);
}
@@ -36,27 +55,70 @@ class Ordentrabajo extends BaseController
];
return view(static::$viewPath . $this->indexRoute, $this->viewData);
}
-
- public function delete()
+ public function index_planning_rotativa()
{
-
+ // Breadcrumbs
+ $this->viewData['breadcrumb'] = [
+ ['title' => lang("Produccion.ots"), 'route' => "javascript:void(0);", 'active' => false],
+ ['title' => lang("Produccion.ots"), 'route' => site_url('produccion/ordentrabajo/planning/rotativa'), 'active' => true]
+ ];
+ return view(static::$viewPath . $this->indexRoutePlanning, $this->viewData);
}
- public function get_orden_trabajo_summary($orden_trabajo_id){
+
+ public function get_orden_trabajo_summary($orden_trabajo_id)
+ {
$summary = $this->produccionService->init($orden_trabajo_id)->getSummary();
return $this->response->setJSON($summary);
}
- public function add()
- {
+ public function add() {}
+ /**========================================================================
+ * UPDATES
+ *========================================================================**/
+ public function update_orden_trabajo()
+ {
+ $bodyData = $this->request->getPost();
+ // return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $bodyData]);
+ $validated = $this->validation->run($bodyData, "orden_trabajo");
+ if ($validated) {
+ $r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajo($bodyData);
+ return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]);
+ } else {
+ return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
+ }
+ }
+ public function update_orden_trabajo_tarea()
+ {
+ $bodyData = $this->request->getPost();
+ // return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $bodyData]);
+ $validated = $this->validation->run($bodyData, "orden_trabajo_tarea");
+ if ($validated) {
+ $r = $this->produccionService->updateOrdenTrabajoTarea($bodyData["orden_trabajo_tarea_id"], $bodyData);
+ return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]);
+ } else {
+ return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
+ }
+ }
+ public function update_orden_trabajo_date()
+ {
+ $bodyData = $this->request->getPost();
+ // return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $bodyData]);
+ $validated = $this->validation->run($bodyData, "orden_trabajo_date");
+ if ($validated) {
+ $r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoDate($bodyData);
+ return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r["status"], "user" => $r["user"], "data" => $bodyData]);
+ } else {
+ return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
+ }
}
public function edit($orden_trabajo_id)
{
// Breadcrumbs
$this->viewData['breadcrumb'] = [
- ['title' => lang("Produccion.ot"), 'route' => "javascript:void(0);", 'active' => false],
- ['title' => $this->otModel->find($orden_trabajo_id)->pedido()->presupuesto()->titulo, 'route' => site_url('produccion/ordentrabajo/edit/'.$orden_trabajo_id), 'active' => true]
+ ['title' => lang("Produccion.ot"), 'route' => site_url('produccion/ordentrabajo'), 'active' => false],
+ ['title' => $this->otModel->find($orden_trabajo_id)->pedido()->presupuesto()->titulo, 'route' => site_url('produccion/ordentrabajo/edit/' . $orden_trabajo_id), 'active' => true]
];
$this->viewData["modelId"] = $orden_trabajo_id;
$this->produccionService->init($orden_trabajo_id);
@@ -66,26 +128,141 @@ class Ordentrabajo extends BaseController
return view(static::$viewPath . $this->editRoute, $this->viewData);
}
- public function datatable(){
-
- $q = $this->otModel->getDatatableQuery();
+ public function datatable()
+ {
+ $logo = config(LogoImpresion::class);
+
+ $q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado","F");
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
- ->add("action" ,fn($q) => $q->id)
- ->toJson(true);
+ ->add("logo",fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
+ ->edit(
+ "fecha_encuadernado_at",
+ fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
+ )
+ ->add("action", fn($q) => $q->id)
+ ->toJson(true);
}
- public function reset_tareas(int $orden_trabajo_id)
+ public function datatable_pendientes()
+ {
+ $logo = config(LogoImpresion::class);
+
+ $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)))
+ ->edit(
+ "fecha_encuadernado_at",
+ fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
+ )
+ ->add("action", fn($q) => $q->id)
+ ->toJson(true);
+ }
+ public function datatable_ferro_pendiente()
+ {
+ $logo = config(LogoImpresion::class);
+
+ $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)))
+ ->edit(
+ "fecha_encuadernado_at",
+ fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
+ )
+ ->add("action", fn($q) => $q->id)
+ ->toJson(true);
+ }
+ public function datatable_ferro_ok()
+ {
+ $logo = config(LogoImpresion::class);
+
+ $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)))
+ ->edit(
+ "fecha_encuadernado_at",
+ fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
+ )
+ ->add("action", fn($q) => $q->id)
+ ->toJson(true);
+ }
+ public function papel_gramaje_datatable()
+ {
+
+ $q = $this->produccionService->papelGramajeDatatableQuery();
+ return DataTable::of($q)
+ ->edit("tiempoReal", fn($q) => float_seconds_to_hhmm_string($q->tiempoReal * 3600))
+ ->toJson(true);
+ }
+ public function reset_tareas(int $orden_trabajo_id)
{
$r = $this->produccionService->init($orden_trabajo_id)->resetAllTareas();
- return $this->response->setJSON(["message" => "Tareas reseteadas" ,"status" => $r]);
+ return $this->response->setJSON(["message" => "Tareas reseteadas", "status" => $r]);
}
- public function tareas_datatable(int $orden_trabajo_id){
+ public function delete_tarea(int $orden_trabajo_tarea_id)
+ {
+ $r = $this->otTarea->delete($orden_trabajo_tarea_id);
+ return $this->response->setJSON(["message" => "Tarea eliminada", "states" => $r]);
+ }
+ public function tareas_datatable(int $orden_trabajo_id)
+ {
$q = $this->produccionService->init($orden_trabajo_id)->taskDatatableQuery($orden_trabajo_id);
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
- ->add("action" ,fn($q) => $q->id)
- ->toJson(true);
+ ->add("action", fn($q) => $q)
+ ->edit("orden", fn($q) => ["id" => $q->id, "orden" => $q->orden])
+ ->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])
+ ->toJson(true);
+ }
+ public function get_pdf($orden_trabajo_id)
+ {
+ return $this->produccionService->init($orden_trabajo_id)->getPdf();
+ }
+ public function upload_orden_trabajo_portada()
+ {
+ try {
+ //code...
+ $file = $this->request->getFile("portada_file");
+ $bodyData = $this->request->getPost();
+ $id = $bodyData["orden_trabajo_id"];
+ $r = null;
+ $fullpath = null;
+ if ($file->isValid() && !$file->hasMoved()) {
+ $fullpath = $file->store('ordenes_trabajo_portadas');
+ $r = $this->otModel->update($id, ["portada_path" => $fullpath]);
+ }
+ return $this->response->setJSON(["message" => "Portada subida", "data" => $r]);
+ } catch (\Throwable $th) {
+ if ($fullpath) {
+ delete_files($fullpath);
+ }
+ return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode($th->getCode());
+ }
+ }
+ public function get_portada_img($orden_trabajo_id)
+ {
+ $ot = $this->otModel->find($orden_trabajo_id);
+ if ($ot->portada_path) {
+ $filePath = WRITEPATH . 'uploads/' . $ot->portada_path;
+ $mimeType = mime_content_type($filePath);
+ return $this->response
+ ->setHeader('Content-Type', $mimeType)
+ ->setHeader('Content-Length', filesize($filePath))
+ ->setBody(file_get_contents($filePath));
+ } else {
+ return $this->response->setJSON(["message" => "Portada error", "error" => "No hay portada"])->setStatusCode(400);
+ }
+ }
+ public function planning_rotativa_datatable()
+ {
+ $q = $this->produccionService->planningRotativaQueryDatatable();
+ return DataTable::of($q)
+ ->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("action", fn($q) => $q)
+ ->toJson(true);
}
-
}
-
\ No newline at end of file
diff --git a/ci4/app/Controllers/Tarifas/Maquinas/TarifaMaquinas.php b/ci4/app/Controllers/Tarifas/Maquinas/TarifaMaquinas.php
index c0aab372..7d6cd5c0 100644
--- a/ci4/app/Controllers/Tarifas/Maquinas/TarifaMaquinas.php
+++ b/ci4/app/Controllers/Tarifas/Maquinas/TarifaMaquinas.php
@@ -14,6 +14,7 @@ use App\Models\Tarifas\Maquinas\TarifaExtraMaquinaModel;
use App\Services\TarifaMaquinaService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
+use CodeIgniter\Validation\Validation;
use Hermawan\DataTables\DataTable;
use Psr\Log\LoggerInterface;
@@ -25,7 +26,7 @@ class TarifaMaquinas extends BaseController
protected MaquinaModel $maquinaModel;
protected MaquinaTareaModel $maquinaTareaModel;
protected TarifaMaquinaService $tarifaMaquinaService;
- protected $validation;
+ protected Validation $validation;
protected static $controllerSlug = "tarifa-maquinas";
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
diff --git a/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php b/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php
index fb00386d..144d78ec 100644
--- a/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php
+++ b/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php
@@ -33,6 +33,14 @@ class OrdenTrabajoTable extends Migration
"comment" => "Usuario que ha actualizado la orden de trabajo",
],
+ "fecha_entrega_warning" => [
+ "type" => "BOOLEAN",
+ "default" => false
+ ],
+ "fecha_entrega_warning_revised" => [
+ "type" => "BOOLEAN",
+ "default" => false
+ ],
"total_tirada" => [
"type" => "DOUBLE",
"null" => true
@@ -56,11 +64,60 @@ class OrdenTrabajoTable extends Migration
"estado" => [
"type" => "ENUM",
- "constraint" => ["I","F","P","E"],
+ "constraint" => ["I", "F", "E","PM"],
"default" => "I",
- "comment" => "I => INICIADO, F => FINALIZADO, P => PROGRESO , E => ERROR"
+ "comment" => "I => INICIADO, F => FINALIZADO, P => PENDIENTE , PM=> PENDIENTE_MATERIAL , E => ERROR"
],
+ /**============================================
+ * PREIMPRESION
+ *=============================================**/
+ "revisar_formato" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision del formato"
+ ],
+ "revisar_lomo" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision del lomo"
+ ],
+ "revisar_solapa" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision de la solapa"
+ ],
+ "revisar_isbn" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision del ISBN"
+
+ ],
+ "revisar_codigo_barras" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision del codigo de barras"
+
+ ],
+ "realizar_imposicion" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision imposicion"
+
+ ],
+ "enviar_impresion" => [
+ "type" => "BOOLEAN",
+ "default" => false,
+ "comment" => "Realizar revision impresion"
+
+ ],
+ "portada_path" => [
+ "type" => "TEXT",
+ "default" => null,
+ "null" => true,
+ "comment" => "Path al archivo de portada"
+
+ ],
"comentarios" => [
"type" => "TEXT",
"null" => true,
@@ -90,9 +147,9 @@ class OrdenTrabajoTable extends Migration
],
]);
$this->forge->addPrimaryKey("id");
- $this->forge->addForeignKey("pedido_id","pedidos","id");
- $this->forge->addForeignKey("user_created_id","users","id");
- $this->forge->addForeignKey("user_updated_id","users","id");
+ $this->forge->addForeignKey("pedido_id", "pedidos", "id");
+ $this->forge->addForeignKey("user_created_id", "users", "id");
+ $this->forge->addForeignKey("user_updated_id", "users", "id");
$this->forge->createTable("ordenes_trabajo", true);
}
diff --git a/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php b/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php
index ab5fa878..36ef2a0a 100644
--- a/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php
+++ b/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php
@@ -99,6 +99,11 @@ class OrdenTrabajoTareasTable extends Migration
"default" => 0.00,
"null" => true,
"comment" => "Tiempo ejecución real de la tarea",
+ ],
+ "comment" => [
+ "type" => "TEXT",
+ "null" => true,
+ "comment" => "Comentario sobre la tarea",
]
];
public function up()
@@ -129,7 +134,6 @@ class OrdenTrabajoTareasTable extends Migration
$this->forge->addForeignKey("presupuesto_manipulado_id","presupuesto_manipulados","id");
$this->forge->addForeignKey("presupuesto_preimpresion_id","presupuesto_preimpresiones","id");
$this->forge->addForeignKey("presupuesto_extra_id","presupuesto_serviciosExtra","id");
-
$this->forge->addForeignKey("imposicion_id","lg_imposiciones","id");
$this->forge->addForeignKey("maquina_id","lg_maquinas","id");
$this->forge->createTable("orden_trabajo_tareas");
diff --git a/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php
index 3e542b75..5deeb3ac 100644
--- a/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php
+++ b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php
@@ -13,26 +13,23 @@ class OrdenTrabajoDatesTable extends Migration
"unsigned" => true,
],
"fecha_entrada_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"fecha_entrega_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"fecha_entrega_change_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"fecha_entrega_real_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
- "fecha_entrega_real_warning" => [
- "type" => "BOOLEAN",
- "default" => false,
- ],
+
"fecha_impresion_at" => [
"type" => "DATE",
"null" => true,
@@ -45,105 +42,97 @@ class OrdenTrabajoDatesTable extends Migration
"type" => "DATE",
"null" => true,
],
- "fecha_entrega_warning" => [
- "type" => "BOOLEAN",
- "default" => false
- ],
- "fecha_entrega_warning_revised" => [
- "type" => "BOOLEAN",
- "default" => false
- ],
-
+
"pendiente_ferro_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"ferro_en_cliente_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"ferro_ok_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"interior_bn_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"interior_color_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"preparacion_interiores_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"cubierta_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"plastificado_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"encuadernacion_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"corte_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"embalaje_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"envio_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"entrada_manipulado_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"ferro_disponible_hecho_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"ferro_disponible_ok_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"ferro_entregado_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"pre_formato_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"pre_lomo_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"pre_solapa_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"pre_codbarras_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
"pre_imposicion_at" => [
- "type" => "DATETIME",
+ "type" => "DATE",
"null" => true,
],
];
diff --git a/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php
index c943caf5..807cb6f9 100644
--- a/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php
+++ b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php
@@ -9,21 +9,28 @@ class OrdenTrabajoUsers extends Migration
{
protected array $COLUMNS = [
+ "orden_trabajo_id" => [
+ "type" => "INT",
+ "unsigned" => true,
+ ],
"user_created_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"user_update_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"inaplazable_revised_change_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
@@ -31,33 +38,39 @@ class OrdenTrabajoUsers extends Migration
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"ferro_disponible_ok_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"ferro_entregado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"pendiente_ferro_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"ferro_en_cliente_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"ferro_ok_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
@@ -66,51 +79,61 @@ class OrdenTrabajoUsers extends Migration
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"interior_color_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"preparacion_interior_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
- "cubierda_user_id" => [
+ "cubierta_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"plastificado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"encuadernacion_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"corte_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"embalaje_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"envio_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"entrada_manipulado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
@@ -118,6 +141,7 @@ class OrdenTrabajoUsers extends Migration
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
@@ -125,12 +149,14 @@ class OrdenTrabajoUsers extends Migration
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"pre_solapa_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
@@ -138,22 +164,26 @@ class OrdenTrabajoUsers extends Migration
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"pre_imposicion_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"pre_imprimir_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
"pre_imprimir_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
+ "null" => true,
],
];
public function up()
@@ -180,7 +210,10 @@ class OrdenTrabajoUsers extends Migration
foreach ($this->COLUMNS as $key => $value) {
$this->forge->addForeignKey([$key],"users",["id"]);
}
+ $this->forge->addPrimaryKey("orden_trabajo_id");
+ // $this->forge->addForeignKey(["ordenes_trabajo_id"],"ordenes_trabajo",["id"]);
$this->forge->createTable("orden_trabajo_users", true);
+
}
public function down()
diff --git a/ci4/app/Entities/Clientes/ClienteEntity.php b/ci4/app/Entities/Clientes/ClienteEntity.php
index 417871e4..a82664e0 100755
--- a/ci4/app/Entities/Clientes/ClienteEntity.php
+++ b/ci4/app/Entities/Clientes/ClienteEntity.php
@@ -1,6 +1,8 @@
"int",
"user_update_id" => "int",
];
+
+ public function comercial() : UserEntity
+ {
+ $m = model(UserModel::class);
+ return $m->find($this->attributes["comercial_id"]);
+ }
}
diff --git a/ci4/app/Entities/Pedidos/PedidoEntity.php b/ci4/app/Entities/Pedidos/PedidoEntity.php
index 32a1bf01..57b81396 100644
--- a/ci4/app/Entities/Pedidos/PedidoEntity.php
+++ b/ci4/app/Entities/Pedidos/PedidoEntity.php
@@ -5,6 +5,7 @@ use App\Entities\Presupuestos\PresupuestoEntity;
use App\Entities\Produccion\OrdenTrabajoEntity;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use App\Entities\Clientes\ClienteEntity;
+use App\Entities\Configuracion\UbicacionesEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Pedidos\PedidoLineaModel;
use App\Models\Presupuestos\PresupuestoModel;
@@ -52,6 +53,15 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity
$q->where("pedido_id",$this->attributes["id"]);
return $q->findAll();
}
+ public function ubicacion(): ?UbicacionesEntity
+ {
+ $lineas = $this->lineas();
+ $ubicacion = null;
+ foreach ($lineas as $key => $linea) {
+ $ubicacion = $linea->ubicacion();
+ }
+ return $ubicacion;
+ }
public function presupuesto() : PresupuestoEntity
{
$q = model(PedidoLineaModel::class);
diff --git a/ci4/app/Entities/Pedidos/PedidoLineaEntity.php b/ci4/app/Entities/Pedidos/PedidoLineaEntity.php
index 38efab3f..dc059079 100644
--- a/ci4/app/Entities/Pedidos/PedidoLineaEntity.php
+++ b/ci4/app/Entities/Pedidos/PedidoLineaEntity.php
@@ -1,6 +1,8 @@
"int",
"ubicacion_id" => "int",
];
+ public function ubicacion() : UbicacionesEntity
+ {
+ $m = model(UbicacionesModel::class);
+ return $m->find($this->attributes["ubicacion_id"]);
+ }
}
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoAcabadosEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoAcabadosEntity.php
index 2ee21c34..e43cd5ed 100755
--- a/ci4/app/Entities/Presupuestos/PresupuestoAcabadosEntity.php
+++ b/ci4/app/Entities/Presupuestos/PresupuestoAcabadosEntity.php
@@ -2,6 +2,7 @@
namespace App\Entities\Presupuestos;
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
+use App\Models\Configuracion\MaquinaModel;
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
use App\Models\Tarifas\Maquinas\TarifaAcabadoMaquinaModel;
use CodeIgniter\Entity;
@@ -35,7 +36,13 @@ class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
public function maquinas() : array
{
$m = model(TarifaAcabadoMaquinaModel::class);
- return $m->where("tarifa_acabado_id",$this->attributes["tarifa_acabado_id"])->findAll();
+ $tarifa_maquinas = $m->where("tarifa_acabado_id",$this->attributes["tarifa_acabado_id"])->findAll();
+ $maquinaModel = model(MaquinaModel::class);
+ $maquinas = [];
+ foreach ($tarifa_maquinas as $key => $tarifa_maquina) {
+ $maquinas[] = $maquinaModel->find($tarifa_maquina->maquina_id);
+ }
+ return $maquinas;
}
public function tarifa() : TarifaAcabadoEntity
{
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
index 6fb49024..660beb08 100755
--- a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
+++ b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php
@@ -3,7 +3,9 @@
namespace App\Entities\Presupuestos;
use App\Entities\Clientes\ClienteEntity;
+use App\Entities\Configuracion\PapelFormatoEntity;
use App\Models\Clientes\ClienteModel;
+use App\Models\Configuracion\PapelFormatoModel;
use App\Models\Presupuestos\PresupuestoAcabadosModel;
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
use App\Models\Presupuestos\PresupuestoLineaModel;
@@ -197,6 +199,55 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
$q = $model->where('presupuesto_id', $this->attributes["id"])->findAll();
return $q;
+ }
+ /**
+ * Obtiene las lineas de presupuesto del actual presupuesto
+ *
+ * @return PresupuestoLineaEntity
+ */
+ public function presupuestoLineaImpresion(): PresupuestoLineaEntity
+ {
+ $model = model(PresupuestoLineaModel::class);
+
+ $q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_rot_bn","lp_rot_color","lp_color","lp_colorhq","lp_bn","lp_bnhq"])->first();
+
+ return $q;
+ }
+ /**
+ * Obtiene las lineas de presupuesto del actual presupuesto
+ *
+ * @return PresupuestoLineaEntity
+ */
+ public function presupuestoLineaCubierta(): PresupuestoLineaEntity
+ {
+ $model = model(PresupuestoLineaModel::class);
+
+ $q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_cubierta"])->first();
+
+ return $q;
+ }
+ /**
+ * Obtiene las lineas de presupuesto del actual presupuesto
+ *
+ * @return PresupuestoLineaEntity
+ */
+ public function presupuestoLineaSobreCubierta(): ?PresupuestoLineaEntity
+ {
+ $model = model(PresupuestoLineaModel::class);
+
+ $q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_sobrecubierta"])->first();
+
+ return $q;
+ }
+ public function hasSobrecubierta() : bool
+ {
+ $hasSobrecubierta = false;
+ $model = model(PresupuestoLineaModel::class);
+ $q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_sobrecubierta"])->countAllResults();
+ if($q > 0){
+ $hasSobrecubierta = true;
+ }
+ return $hasSobrecubierta;
}
public function cliente() : ClienteEntity
{
@@ -228,4 +279,9 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
$m = model(PresupuestoServiciosExtraModel::class);
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
}
+ public function papel_formato() : PapelFormatoEntity
+ {
+ $m = model(PapelFormatoModel::class);
+ return $m->find($this->attributes["papel_formato_id"]);
+ }
}
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
index e8580d27..f0705d98 100755
--- a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
+++ b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
@@ -12,6 +12,7 @@ use App\Entities\Tarifas\TarifapreimpresionEntity;
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
use App\Models\Configuracion\PapelGenericoModel;
use App\Models\Configuracion\PapelImpresionModel;
+use Config\LogoImpresion;
class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
{
@@ -192,4 +193,32 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
$m = model(MaquinasTarifasImpresionModel::class);
return $m->find($this->attributes['tarifa_impresion_id']);
}
+
+ public function get_impresion_logo(){
+ $logo = config(LogoImpresion::class);
+ return $logo->get_logo_path($this->attributes["tipo"]);
+ }
+ public function get_nombre_tarea() : ?string
+ {
+ $nombre = null;
+ $impresion_bn = ["lp_bn","lp_bnhq","lp_rot_bn"];
+ $impresion_color = ["lp_color","lp_colorhq","lp_rot_color"];
+ $impresion_cubierta = ["lp_cubierta"];
+ $impresion_guardas = ["lp_guardas"];
+ $impresion_sobrecubierta = ["lp_sobrecubierta"];
+
+ $is_bn = in_array($this->attributes["tipo"],$impresion_bn);
+ $is_color = in_array($this->attributes["tipo"],$impresion_color);
+ $is_impresion_cubierta = in_array($this->attributes["tipo"],$impresion_cubierta);
+ $is_impresion_guarda = in_array($this->attributes["tipo"],$impresion_guardas);
+ $is_impresion_sobrecubierta = in_array($this->attributes["tipo"],$impresion_sobrecubierta);
+
+ if($is_bn) $nombre ="Impresión B/N";
+ if($is_color) $nombre ="Impresión color";
+ if($is_impresion_cubierta) $nombre ="Impresión cubierta";
+ if($is_impresion_guarda) $nombre ="Impresión guarda";
+ if($is_impresion_sobrecubierta) $nombre ="Impresión sobrecubierta";
+
+ return $nombre;
+ }
}
diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php
index 7c743688..bf4d8f5f 100644
--- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php
+++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php
@@ -35,28 +35,28 @@ class OrdenTrabajoDateEntity extends Entity
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [
- "fecha_entrada_at" => "?datetime",
- "fecha_entrega_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"
+ // "fecha_entrada_at" => "?datetime",
+ // "fecha_entrega_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/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
index e1ffa4bb..9ef6a01c 100644
--- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
+++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
@@ -7,6 +7,7 @@ use App\Database\Migrations\OrdenTrabajoDatesTable;
use App\Entities\Pedidos\PedidoEntity;
use App\Models\OrdenTrabajo\OrdenTrabajoDate;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
+use App\Models\OrdenTrabajo\OrdenTrabajoUser;
use App\Models\Pedidos\PedidoModel;
use CodeIgniter\Entity\Entity;
@@ -17,23 +18,41 @@ class OrdenTrabajoEntity extends Entity
"pedido_id" => null,
"user_created_id" => null,
"user_updated_id" => null,
+ "fecha_entrega_warning" => false,
+ "fecha_entrega_warning_revised" => false,
"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,
];
protected $casts = [
"pedido_id" => "integer",
"user_created_id" => "integer",
"user_updated_id" => "?integer",
+ "fecha_entrega_warning" => "bool",
+ "fecha_entrega_warning_revised" => "bool",
"total_tirada" => "float",
"total_precio" => "float",
"tipo_entrada" => "string",
"progreso" => "float",
"estado" => "string",
"comentarios" => "string",
+ "revisar_formato" => "bool",
+ "revisar_lomo" => "bool",
+ "revisar_solapa" => "bool",
+ "revisar_isbn" => "bool",
+ "revisar_codigo_barras" => "bool",
+ "realizar_imposicion" => "bool",
+ "enviar_impresion" => "bool",
];
@@ -64,9 +83,10 @@ class OrdenTrabajoEntity extends Entity
}
public function users(): ?OrdenTrabajoUserEntity
{
- return null;
- // return $m->find($this->attributes["id"])
+ $m = model(OrdenTrabajoUser::class);
+ return $m->find($this->attributes["id"]);
}
+
/**
* Almacena en la tabla `orden_trabajo_dates` las fechas correspondientes del pedido.
* Se almacenan en una tabla externa porque puede haber modificaciones de estas fechas
diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php
index 5cada2ec..c7826985 100644
--- a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php
+++ b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php
@@ -3,10 +3,14 @@
namespace App\Entities\Produccion;
use App\Entities\Configuracion\Maquina;
+use App\Entities\Presupuestos\PresupuestoAcabadosEntity;
use App\Entities\Presupuestos\PresupuestoLineaEntity;
+use App\Entities\Presupuestos\PresupuestoManipuladosEntity;
use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
+use App\Models\Presupuestos\PresupuestoAcabadosModel;
use App\Models\Presupuestos\PresupuestoLineaModel;
+use App\Models\Presupuestos\PresupuestoManipuladosModel;
use CodeIgniter\Entity\Entity;
class OrdenTrabajoTareaEntity extends Entity
@@ -21,6 +25,7 @@ class OrdenTrabajoTareaEntity extends Entity
"imposicion_id" => null,
"tiempo_estimado" => null,
"tiempo_real" => null,
+ "comment" => null,
];
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
@@ -33,7 +38,8 @@ class OrdenTrabajoTareaEntity extends Entity
"maquina_id" => "?integer",
"imposicion_id" => "?integer",
"tiempo_estimado" => "?float",
- "tiempo_real" => "?float"
+ "tiempo_real" => "?float",
+ "comment" => "?string"
];
/**
@@ -85,4 +91,15 @@ class OrdenTrabajoTareaEntity extends Entity
{
return $this->presupuesto_linea()->maquina();
}
+ /**
+ * Devuelve el presupuesto acabado origen de esta tarea
+ *
+ * @return PresupuestoAcabadosEntity
+ */
+ public function presupuesto_acabado() : PresupuestoAcabadosEntity
+ {
+ $m = model(PresupuestoAcabadosModel::class);
+ return $m->find($this->attributes["presupuesto_linea_id"]);
+ }
+
}
diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php
index f82812b8..138c5d56 100644
--- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php
+++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php
@@ -9,4 +9,31 @@ class OrdenTrabajoUserEntity extends Entity
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
+ protected $attributes = [
+ "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,
+ "interior_bn_user_id"=> null,
+ "interior_color_user_id"=> null,
+ "preparacion_interior_user_id"=> null,
+ "cubierta_user_id"=> null,
+ "plastificado_user_id"=> null,
+ "encuadernacion_user_id"=> null,
+ "corte_user_id"=> null,
+ "embalaje_user_id"=> null,
+ "entrada_manipulado_user_id"=> null,
+ "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
+ ];
}
diff --git a/ci4/app/Helpers/time_helper.php b/ci4/app/Helpers/time_helper.php
new file mode 100644
index 00000000..6e1381ce
--- /dev/null
+++ b/ci4/app/Helpers/time_helper.php
@@ -0,0 +1,25 @@
+ "Selecciona un artículo",
-
/**
*
* SAFEKAT
*
- */
-
+ */
+
+ "progress" => "Progreso",
// NOMBRES DE LOS PERMISOS
"permisos_index" => "Listar",
"permisos_view" => "Ver",
@@ -783,6 +783,7 @@ return [
"menu_orden_trabajo_100" => "OTs 100%",
"menu_orden_trabajo_finalizados" => "OTs finalizados",
"menu_orden_trabajo_pendientes" => "OTs pendientes",
+ "menu_planning_rotativa" => "Planning rotativa",
"menu_ordentrabajomaquetacion" => "Orden de trabajo maquetación",
"menu_ordenmaquina" => "Orden máquina",
diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php
index 95c7d31d..eddedcd4 100644
--- a/ci4/app/Language/es/Produccion.php
+++ b/ci4/app/Language/es/Produccion.php
@@ -9,6 +9,21 @@ return [
"ubicacion"=> "Ubicación",
"tirada"=> "Tirada",
"impresion"=> "Impresión",
+ "fecha_entrega_at" => "Fecha entrega prevista",
+ "maquina" => "Máquina",
+ "ancho" => "Ancho",
+ "alto" => "Alto",
+ "papel" => "Papel",
+ "gramaje" => "Gramaje",
+ "corte" => "Corte",
+ "metros_sel" => "Metros_sel",
+ "metros_papel" => "Metros papel",
+ "tareas" => "Tareas",
+ "tiradas" => "Tiradas",
+ "tiempo" => "Tiempo",
+ "progreso" => "Progreso",
+ "logo" => "Logo impresion",
+
],
"task" => [
"order" => "Orden",
@@ -19,6 +34,9 @@ return [
"tiempo_estimado" => "Tiempo estimado",
"tiempo" => "Tiempo"
],
+ "finalizadas" => "Finalizadas",
+ "pendiente_ferro" => "Ferro pendiente",
+ "pendientes" => "Pendientes",
"ferro_ok" => "Ferro ok",
"envio" => "Envío",
"ot" => "Orden trabajo",
@@ -31,6 +49,7 @@ return [
"fecha_entrega_estimada" => "Fecha entrega estimada",
"formato" => "Formato",
"paginas" => "Páginas",
+ "guillotina" => "Guillotina",
"tirada" => "Tirada",
"merma" => "Merma",
"pendiente_ferro" => "Pendiente ferro",
@@ -43,6 +62,13 @@ return [
"embalaje" => "Embalaje",
"tiempo_consumido" => "Tiempo consumido",
"tiempo_estimado" => "Tiempo estimado",
- "finalizar_orden" => "Finalizar orden"
+ "finalizar_orden" => "Finalizar orden",
+ "comments" => "Comentarios orden trabajo",
+ "preview_pdf" => "Previsualizar PDF",
+ "imprimir_codigo_safekat" => "Imprimir código SAFEKAT",
+ "imprimir_ferro" => "Imprimir ferro",
+ "planning_rotativa" => "Planning rotativa",
+ "solapa" => "Solapa",
+ "papel_gramajes" => "Papel y gramajes"
];
\ No newline at end of file
diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php
index e0480afd..0fb1ab3a 100644
--- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php
+++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php
@@ -10,7 +10,7 @@ class OrdenTrabajoDate extends Model
{
protected $table = 'orden_trabajo_dates';
protected $primaryKey = 'orden_trabajo_id';
- protected $useAutoIncrement = true;
+ protected $useAutoIncrement = false;
protected $returnType = OrdenTrabajoDateEntity::class;
protected $useSoftDeletes = true;
protected $protectFields = true;
@@ -18,14 +18,11 @@ class OrdenTrabajoDate extends Model
"orden_trabajo_id",
"fecha_entrada_at",
"fecha_entrega_at",
- "fecha_entrega_change_at",
"fecha_entrega_real_at",
- "fecha_entrega_real_warning",
+ "fecha_entrega_change_at",
"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",
@@ -38,13 +35,14 @@ class OrdenTrabajoDate extends Model
"corte_at",
"embalaje_at",
"envio_at",
- "entrada_manipulado_at"
+ "entrada_manipulado_at"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
- protected array $casts = [];
+ protected array $casts = [
+ ];
protected array $castHandlers = [];
// Dates
@@ -63,8 +61,8 @@ class OrdenTrabajoDate extends Model
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
- protected $afterInsert = [];
- protected $beforeUpdate = [];
+ protected $afterInsert = ["updateOrdenTrabajoUser"];
+ protected $beforeUpdate = ["updateOrdenTrabajoUser"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
@@ -76,22 +74,59 @@ class OrdenTrabajoDate extends Model
*
* @return Builder
*/
- protected function getQueryDatatable() : Builder
+ protected function getQueryDatatable(): Builder
{
$q = $this->builder()
- ->select([
- "orden_trabajo_tareas.orden",
- "mp.nombre as maquina_presupuesto",
- "m.nombre as maquina_tarea",
- "orden_trabajo_tareas.tiempo_estimado",
- "orden_trabajo_tareas.tiempo_real"
- ])
- ->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
- ->join("lg_maquinas m","lg_maquinas.id = orden_trabajo_tareas.maquina_id","left")
- ->join("lg_maquinas mp","lg_maquinas.id = presupuesto_linea.maquina_id","left")
- ->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id" , "left")
- ->where("orden_trabajo_tareas.deleted_at" , NULL);
+ ->select([
+ "orden_trabajo_tareas.orden",
+ "mp.nombre as maquina_presupuesto",
+ "m.nombre as maquina_tarea",
+ "orden_trabajo_tareas.tiempo_estimado",
+ "orden_trabajo_tareas.tiempo_real"
+ ])
+ ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
+ ->join("lg_maquinas m", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
+ ->join("lg_maquinas mp", "lg_maquinas.id = presupuesto_linea.maquina_id", "left")
+ ->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
+ ->where("orden_trabajo_tareas.deleted_at", NULL);
return $q;
}
+
+ protected function updateOrdenTrabajoUser(array $data) : array
+ {
+ if(!isset($data["data"])){
+ return $data;
+ }else{
+ $this->updateUserDateMap($data["data"]);
+ }
+ return $data;
+ }
+ protected function updateUserDateMap($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"
+ ];
+ $otUser = model(OrdenTrabajoUser::class);
+ $auth_user_id = auth()->user()->id;
+ foreach ($data as $key => $value) {
+ if(isset($mapping[$key])){
+ if($value){
+ $otUser->update($data["orden_trabajo_id"],[$mapping[$key] => $auth_user_id]);
+ }
+ }
+ }
+ }
}
diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php
index 50003181..ea1e00af 100644
--- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php
+++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php
@@ -17,18 +17,45 @@ class OrdenTrabajoModel extends Model
"pedido_id",
"user_created_id",
"user_updated_id",
+ "fecha_entrega_warning",
+ "fecha_entrega_warning_revised",
"total_tirada",
"total_precio",
"tipo_entrada",
"progreso",
"estado",
"comentarios",
+ "revisar_formato",
+ "revisar_lomo",
+ "revisar_solapa",
+ "revisar_isbn",
+ "revisar_codigo_barras",
+ "realizar_imposicion",
+ "enviar_impresion",
+ "portada_path",
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
- protected array $casts = [];
+ protected array $casts = [
+ "pedido_id" => "integer",
+ "user_created_id" => "?integer",
+ "user_updated_id" => "?integer",
+ "fecha_entrega_warning" => "bool",
+ "fecha_entrega_warning_revised" => "bool",
+ "total_tirada" => "?integer",
+ "total_precio" => "?integer",
+ "tipo_entrada" => "?integer",
+ "progreso" => "float",
+ "revisar_formato" => "bool",
+ "revisar_lomo" => "bool",
+ "revisar_solapa" => "bool",
+ "revisar_isbn" => "bool",
+ "revisar_codigo_barras" => "bool",
+ "realizar_imposicion" => "bool",
+ "enviar_impresion" => "bool"
+ ];
protected array $castHandlers = [];
// Dates
@@ -64,17 +91,23 @@ class OrdenTrabajoModel extends Model
"orden_trabajo_dates.fecha_encuadernado_at",
"clientes.nombre as cliente_nombre",
"presupuestos.titulo as presupuesto_titulo",
- "ubicaciones.nombre as ubicacion_nombre",
+ "ordenes_trabajo.estado",
+ "ubicaciones.nombre as ubicacion_nombre",
"pedidos.total_tirada",
"tipos_presupuestos.codigo as tipo_presupuesto_impresion",
+ "ordenes_trabajo.progreso",
+ "presupuesto_linea.tipo as presupuesto_linea_tipo",
+ "orden_trabajo_dates.ferro_ok_at"
])
->join("orden_trabajo_dates","orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id","left")
->join("pedidos","pedidos.id = ordenes_trabajo.pedido_id","left")
->join("pedidos_linea","pedidos.id = pedidos_linea.pedido_id","left")
->join("presupuestos","presupuestos.id = pedidos_linea.presupuesto_id","left")
+ ->join("presupuesto_linea","presupuestos.id = presupuesto_linea.presupuesto_id","left")
->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")
+ ->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");
return $q;
diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php
index 8f82da59..3c6d1e84 100644
--- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php
+++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php
@@ -27,7 +27,8 @@ class OrdenTrabajoTarea extends Model
"maquina_id",
"imposicion_id",
"tiempo_estimado",
- "tiempo_real"
+ "tiempo_real",
+ "comment"
];
protected bool $allowEmptyInserts = false;
@@ -83,4 +84,7 @@ class OrdenTrabajoTarea extends Model
return $q;
}
+
+
+
}
diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php
new file mode 100644
index 00000000..2c56c3c6
--- /dev/null
+++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php
@@ -0,0 +1,103 @@
+ "integer",
+ "user_created_id" => "?integer",
+ "user_update_id" => "?integer",
+ "inaplazable_revised_change_user_id" => "?integer",
+ "ferro_disponible_hecho_user_id" => "?integer",
+ "ferro_disponible_ok_user_id" => "?integer",
+ "ferro_entregado_user_id" => "?integer",
+ "pendiente_ferro_user_id" => "?integer",
+ "ferro_en_cliente_user_id" => "?integer",
+ "ferro_ok_user_id" => "?integer",
+ "interior_bn_user_id" => "?integer",
+ "interior_color_user_id" => "?integer",
+ "preparacion_interior_user_id" => "?integer",
+ "cubierta_user_id" => "?integer",
+ "plastificado_user_id" => "?integer",
+ "encuadernacion_user_id" => "?integer",
+ "corte_user_id" => "?integer",
+ "embalaje_user_id" => "?integer",
+ "entrada_manipulado_user_id" => "?integer",
+ "pre_formato_user_id" => "?integer",
+ "pre_lomo_user_id" => "?integer",
+ "pre_solapa_user_id" => "?integer",
+ "pre_codbarras_user_id" => "?integer",
+ "pre_imposicion_user_id" => "?integer",
+ "pre_imprimir_user_id" => "?integer"
+ ];
+ protected array $castHandlers = [];
+
+ // Dates
+ protected $useTimestamps = true;
+ protected $dateFormat = 'datetime';
+ protected $createdField = 'created_at';
+ protected $updatedField = 'updated_at';
+ protected $deletedField = 'deleted_at';
+
+ // Validation
+ protected $validationRules = [];
+ protected $validationMessages = [];
+ protected $skipValidation = false;
+ protected $cleanValidationRules = true;
+
+ // Callbacks
+ protected $allowCallbacks = true;
+ protected $beforeInsert = [];
+ protected $afterInsert = [];
+ protected $beforeUpdate = [];
+ protected $afterUpdate = [];
+ protected $beforeFind = [];
+ protected $afterFind = [];
+ protected $beforeDelete = [];
+ protected $afterDelete = [];
+
+
+
+}
diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php
index c6e7aafe..ff2a28d7 100644
--- a/ci4/app/Services/ProductionService.php
+++ b/ci4/app/Services/ProductionService.php
@@ -10,10 +10,14 @@ use App\Entities\Produccion\OrdenTrabajoEntity;
use App\Models\OrdenTrabajo\OrdenTrabajoDate;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
+use App\Models\OrdenTrabajo\OrdenTrabajoUser;
+use App\Models\Usuarios\UserModel;
use CodeIgniter\Config\BaseService;
use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Database\BaseResult;
use CodeIgniter\Database\Exceptions\DatabaseException;
+use CodeIgniter\I18n\Time;
+use Dompdf\Dompdf;
/**
* Clase con las funcionalidades necesarias trabajar con las ordenes de trabajo.
@@ -23,7 +27,25 @@ class ProductionService extends BaseService
protected OrdenTrabajoModel $otModel;
protected OrdenTrabajoTarea $otTarea;
protected OrdenTrabajoDate $otDate;
+ protected OrdenTrabajoUser $otUser;
protected OrdenTrabajoEntity $ot;
+ protected UserModel $userModel;
+ 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"
+ ];
/**
* Pedido Entity
@@ -38,6 +60,14 @@ class ProductionService extends BaseService
*/
protected PresupuestoEntity $presupuesto;
+ public function __construct() {
+ $this->otModel = model(OrdenTrabajoModel::class);
+ $this->otDate = model(OrdenTrabajoDate::class);
+ $this->otTarea = model(OrdenTrabajoTarea::class);
+ $this->otUser = model(OrdenTrabajoUser::class);
+ $this->userModel = model(UserModel::class);
+
+ }
public function init(int $orden_trabajo_id): self
{
$this->otModel = model(OrdenTrabajoModel::class);
@@ -97,9 +127,10 @@ class ProductionService extends BaseService
$ot_id = $this->otModel->getInsertID();
$ot->id = $ot_id;
$this->init($ot_id);
- $this->storeOrdenTrabajoDates($ot);
+ $this->storeOrdenTrabajoUsers();
+ $this->storeOrdenTrabajoDates();
$this->storeAllTareas();
- return $ot;
+ return $this->ot;
}
/**
@@ -108,16 +139,26 @@ class ProductionService extends BaseService
* @param OrdenTrabajoEntity $ot
* @return integer|boolean|string ID
*/
- protected function storeOrdenTrabajoDates(OrdenTrabajoEntity $ot): bool|int|string
+ protected function storeOrdenTrabajoDates() : int|bool|string
{
+ $fecha_encuadernado = Time::now()->addDays(2)->format("Y-m-d");
+ $fecha_entrega_real = Time::now()->addDays(5)->format("Y-m-d");
+ $fecha_embalaje_at = Time::now()->addDays(4)->format("Y-m-d");
return $this->otDate->insert([
- "orden_trabajo_id" => $ot->id,
- "fecha_encuadernado_at" => $this->pedido->fecha_encuadernado,
- "fecha_entrega_real_at" => $this->pedido->fecha_entrega_real,
- "fecha_impresion_at" => $this->pedido->fecha_impresion,
+ "orden_trabajo_id" => $this->ot->id,
+ "fecha_encuadernado_at" => $fecha_encuadernado,
+ "fecha_entrega_real_at" => $fecha_entrega_real,
+ "fecha_impresion_at" => Time::now()->format("Y-m-d"),
+ "embalaje_at" => $fecha_embalaje_at,
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
]);
}
+ protected function storeOrdenTrabajoUsers() : int|bool|string
+ {
+ return $this->otUser->insert([
+ "orden_trabajo_id" => $this->ot->id,
+ ]);
+ }
protected function storeAllTareas()
{
$this->storeOrdenTrabajoTareas();
@@ -148,12 +189,11 @@ class ProductionService extends BaseService
foreach ($p_lineas as $key => $p_linea) {
$p_linea_maquina = $p_linea->maquina();
+ $nombre = $p_linea->get_nombre_tarea();
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_linea_id"] = $p_linea->id;
- //TODO : Por ahora nombre maquina, asignar nombre tarea en
- //TODO : base a la tarifa asociada a la linea de presupuesto
- $ot_tareas["nombre"] = $p_linea_maquina->nombre;
- $ot_tareas["orden"] = $p_linea_maquina->orden_planning;
+ $ot_tareas["nombre"] = $nombre;
+ $ot_tareas["orden"] = $p_linea_maquina->orden_planning ?? 0;
$ot_tareas["maquina_id"] = $p_linea_maquina->id;
$ot_tareas["imposicion_id"] = null;
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina;
@@ -173,8 +213,8 @@ class ProductionService extends BaseService
foreach ($p_linea_maquinas as $key => $linea) {
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_acabado_id"] = $p_linea->id;
- $ot_tareas["nombre"] = $linea->nombre;
- $ot_tareas["orden"] = $linea->orden_planning;
+ $ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
+ $ot_tareas["orden"] = $linea->orden_planning ?? 0;
$ot_tareas["maquina_id"] = $linea->id;
$ot_tareas["imposicion_id"] = null;
$this->otTarea->insert($ot_tareas);
@@ -199,8 +239,8 @@ class ProductionService extends BaseService
foreach ($p_linea_maquinas as $key => $linea) {
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_manipulado_id"] = $p_linea->id;
- $ot_tareas["nombre"] = $linea->nombre;
- $ot_tareas["orden"] = $linea->orden_planning;
+ $ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
+ $ot_tareas["orden"] = $linea->orden_planning ?? 0;
$ot_tareas["maquina_id"] = $linea->id;
$ot_tareas["imposicion_id"] = null;
$this->otTarea->insert($ot_tareas);
@@ -225,8 +265,8 @@ class ProductionService extends BaseService
foreach ($p_linea_maquinas as $key => $linea) {
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
- $ot_tareas["nombre"] = $linea->nombre;
- $ot_tareas["orden"] = $linea->orden_planning;
+ $ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
+ $ot_tareas["orden"] = $linea->orden_planning ?? 0;
$ot_tareas["maquina_id"] = $linea->id;
$ot_tareas["imposicion_id"] = null;
$this->otTarea->insert($ot_tareas);
@@ -251,8 +291,8 @@ class ProductionService extends BaseService
foreach ($p_linea_maquinas as $key => $linea) {
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
- $ot_tareas["nombre"] = $linea->nombre;
- $ot_tareas["orden"] = $linea->orden_planning;
+ $ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
+ $ot_tareas["orden"] = $linea->orden_planning ?? 0;
$ot_tareas["maquina_id"] = $linea->id;
$ot_tareas["imposicion_id"] = null;
$this->otTarea->insert($ot_tareas);
@@ -277,7 +317,7 @@ class ProductionService extends BaseService
foreach ($p_linea_maquinas as $key => $linea) {
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
- $ot_tareas["nombre"] = $linea->nombre;
+ $ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
$ot_tareas["orden"] = $linea->orden_planning;
$ot_tareas["maquina_id"] = $linea->id;
$ot_tareas["imposicion_id"] = null;
@@ -313,12 +353,90 @@ class ProductionService extends BaseService
return ["tareas" => $tareas];
}
+ public function getPdf()
+ {
+ return view("themes/vuexy/pdfs/orden_trabajo",$this->getDataPdf());
+ }
/**
* Query para mostrar en datatable
*
* @return BaseBuilder
*/
public function taskDatatableQuery(): BaseBuilder
+ {
+ $q = $this->otModel->builder()->select([
+ "orden_trabajo_tareas.id",
+ "orden_trabajo_tareas.orden",
+ "orden_trabajo_tareas.nombre",
+ "lgmp.nombre as maquina_presupuesto_linea",
+ "orden_trabajo_tareas.maquina_id as maquina_tarea",
+ "lg_maquinas.nombre as maquina_nombre",
+ "lg_imposiciones.id as imposicion_id",
+ "orden_trabajo_tareas.tiempo_estimado",
+ "orden_trabajo_tareas.tiempo_real",
+ "orden_trabajo_tareas.comment",
+
+ ])
+ ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
+ ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
+ ->join("presupuesto_acabados", "presupuesto_acabados.id = orden_trabajo_tareas.presupuesto_acabado_id", "left")
+ ->join("presupuesto_manipulados", "presupuesto_manipulados.id = orden_trabajo_tareas.presupuesto_manipulado_id", "left")
+ ->join("presupuesto_preimpresiones", "presupuesto_preimpresiones.id = orden_trabajo_tareas.presupuesto_preimpresion_id", "left")
+ ->join("presupuesto_encuadernaciones", "presupuesto_encuadernaciones.id = orden_trabajo_tareas.presupuesto_encuadernado_id", "left")
+ ->join("presupuesto_serviciosExtra", "presupuesto_serviciosExtra.id = orden_trabajo_tareas.presupuesto_extra_id", "left")
+ ->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
+ ->join("lg_maquinas as lgmp", "lgmp.id = presupuesto_linea.maquina_id", "left")
+ ->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
+ ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
+ ->where("orden_trabajo_tareas.deleted_at", null)
+ ->orderBy("orden_trabajo_tareas.orden", "ASC");
+ return $q;
+ }
+ /**
+ * Query para mostrar en datatable
+ *
+ * @return BaseBuilder
+ */
+ public function planningRotativaQueryDatatable(): BaseBuilder
+ {
+ $q = $this->otModel->builder()->select([
+ "ordenes_trabajo.id as otId",
+ "orden_trabajo_dates.fecha_entrega_real_at",
+ "presupuestos.titulo as presupuesto_titulo",
+ "orden_trabajo_tareas.maquina_id",
+ "lg_maquinas.nombre as maquina_planning_nombre",
+ "ordenes_trabajo.total_tirada as ot_tirada",
+ "lg_papel_formato.ancho as maquina_ancho",
+ "lg_papel_formato.alto as maquina_alto",
+ // "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') as maquina_ancho",
+ // "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') as maquina_alto",
+ "lg_papel_impresion.nombre as papel_impresion",
+ "presupuesto_linea.gramaje as papel_gramaje",
+
+
+
+ ])
+ ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
+ ->join("orden_trabajo_dates", "orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id", "left")
+ ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
+ ->join("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right")
+ ->join("lg_papel_formato", "lg_papel_formato.id = presupuestos.papel_formato_id", "left")
+ ->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
+ ->join("lg_papel_impresion", "lg_papel_impresion.id = presupuesto_linea.papel_impresion_id", "left")
+ ->join("lg_maquinas as lgmp", "lgmp.id = presupuesto_linea.maquina_id", "left")
+ ->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
+ // ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
+ ->whereIn("presupuesto_linea.tipo", ["lp_rot_bn","lp_rot_color"])
+ ->where("orden_trabajo_tareas.deleted_at", null)
+ ->orderBy("orden_trabajo_tareas.orden", "ASC");
+ return $q;
+ }
+ /**
+ * Query para mostrar en datatable
+ *
+ * @return BaseBuilder
+ */
+ public function costDatatableQuery(): BaseBuilder
{
$q = $this->otModel->builder()->select([
"orden_trabajo_tareas.id",
@@ -343,10 +461,28 @@ class ProductionService extends BaseService
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->where("orden_trabajo_tareas.deleted_at", null)
- ->orderBy("orden_trabajo_tareas.orden", "DESC");
+ ->orderBy("orden_trabajo_tareas.orden", "ASC");
return $q;
}
+ public function papelGramajeDatatableQuery() : BaseBuilder
+ {
+ $q = $this->otModel->builder()->select([
+ "lg_papel_impresion.nombre as papelImpresionNombre",
+ "lg_papel_impresion.gramaje as papelImpresionGramaje",
+ "COUNT(orden_trabajo_tareas.id) as tareasCount",
+ "SUM(ordenes_trabajo.total_tirada) as totalTirada",
+ "SUM(orden_trabajo_tareas.tiempo_real) as tiempoReal"
+ ])
+ ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
+ ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
+ ->join("lg_papel_impresion","presupuesto_linea.papel_impresion_id = lg_papel_impresion.id","left")
+ ->where("orden_trabajo_tareas.deleted_at", null)
+ ->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL,FALSE);
+
+
+ return $q;
+ }
/**
* Get a summary from ot with the following structure
*
@@ -364,17 +500,128 @@ class ProductionService extends BaseService
$summary = [
"ot" => $this->ot,
+ "pedido" => $this->pedido,
+ "presupuesto" => $this->presupuesto,
"dates" => $this->ot->dates(),
"tasks" => $this->ot->tareas(),
"acabados" => $this->presupuesto->acabados(),
"preimpresiones" => $this->presupuesto->preimpresiones(),
"manipulados" => $this->presupuesto->manipulados(),
"encuadernaciones" => $this->presupuesto->encuadernaciones(),
-
+ "impresion_interior_bn" => $this->getTareaImpresionInteriorBn(),
+ "impresion_interior_color" => $this->getTareaImpresionInteriorColor(),
+ "tareas_acabado" => $this->tareas_acabado(),
+ "tareas_manipulado" => $this->tareas_manipulado(),
+ "tareas_encuadernacion" => $this->tareas_encuadernacion(),
+ "tareas_preimpresion" => $this->tareas_preimpresion(),
+ "tareas_impresion" => $this->tareas_impresion(),
];
return $summary;
}
+ public function getDataPdf(){
+ $logistica_data = $this->logistica_data();
+ return [
+ "ot" => $this->ot,
+ "pedido" => $this->pedido,
+ "presupuesto" => $this->presupuesto,
+ "cliente" => $this->presupuesto->cliente(),
+ "ubicacion" => $this->pedido->ubicacion()->nombre,
+ "dates" => $this->ot->dates(),
+ "tasks" => $this->ot->tareas(),
+ "papel_formato" => $this->presupuesto->papel_formato(),
+ "acabados" => $this->presupuesto->acabados(),
+ "preimpresiones" => $this->presupuesto->preimpresiones(),
+ "manipulados" => $this->presupuesto->manipulados(),
+ "encuadernaciones" => $this->presupuesto->encuadernaciones(),
+ "linea_impresion" => $this->presupuesto->presupuestoLineaImpresion(),
+ "linea_cubierta" => $this->presupuesto->presupuestoLineaCubierta(),
+ "peso_unidad" => $logistica_data["peso_unidad"],
+ "peso_pedido" => $logistica_data["peso_pedido"]
+ ];
+ }
+ public function getTareaImpresionSobreCubierta() : array
+ {
+ $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();
+ return $q;
+ }
+ public function getTareaImpresionCubierta() : array
+ {
+ $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();
+ return $q;
+ }
+ public function getTareaImpresionInteriorBn() : array
+ {
+ $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();
+ return $q;
+ }
+ public function getTareaImpresionInteriorColor() : array
+ {
+ $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();
+ return $q;
+ }
+ public function getPresupuestoLineaImpresion(){
+ }
+ public function tareas_acabado(): array
+ {
+ $q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL",NULL,FALSE)->findAll();
+ return $q;
+ }
+ public function tareas_impresion(): array
+ {
+ $q = $this->otTarea->where("presupuesto_linea_id IS NOT NULL",NULL,FALSE)->findAll();
+ return $q;
+ }
+ public function tareas_encuadernacion(): array
+ {
+ $q = $this->otTarea->where("presupuesto_encuadernado_id IS NOT NULL",NULL,FALSE)->findAll();
+ return $q;
+ }
+ public function tareas_preimpresion(): array
+ {
+ $q = $this->otTarea->where("presupuesto_preimpresion_id IS NOT NULL",NULL,FALSE)->findAll();
+ return $q;
+ }
+ public function tareas_manipulado(): array
+ {
+ $q = $this->otTarea->where("presupuesto_manipulado_id IS NOT NULL",NULL,FALSE)->findAll();
+ return $q;
+ }
+ /**========================================================================
+ * UPDATES
+ *========================================================================**/
+ public function updateOrdenTrabajoTarea($tarea_id,$data) : bool
+ {
+ return $this->otTarea->update($tarea_id,$data);
+ }
+
+ public function updateOrdenTrabajoDate($data)
+ {
+ // return $this->otDate->find($this->ot->id);
+ $r = $this->otDate->update($this->ot->id,$data);
+ $ot_users = $this->ot->users();
+ $ot_users = $ot_users->toArray();
+ $user_id = $ot_users[$this->MAPPING_DATE_USER[$data["name"]]];
+ $user = $this->userModel->find($user_id);
+ return ["user" => $user,"status" => $r];
+ }
+
+ public function updateOrdenTrabajo($data) : bool
+ {
+ return $this->otModel->update($this->ot->id,$data);
+ }
/**========================================================================
* RELATION METHODS
*========================================================================**/
@@ -431,4 +678,19 @@ class ProductionService extends BaseService
{
return $this->presupuesto->extras();
}
+ protected function logistica_data() : array
+ {
+ $presupuesto_lineas = $this->presupuesto->presupuestoLineas();
+ $peso = 0;
+ foreach ($presupuesto_lineas as $key => $linea) {
+ $peso += $linea->peso;
+ }
+ return [
+ "peso_unidad" => $peso,
+ "peso_pedido" => $peso*$this->ot->total_tirada
+ ];
+
+ }
+
+
}
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 952bfdd8..a611a1c4 100644
--- a/ci4/app/Views/themes/vuexy/components/tables/ot_table.php
+++ b/ci4/app/Views/themes/vuexy/components/tables/ot_table.php
@@ -1,17 +1,22 @@
-
-
-
- = lang('Produccion.datatable.pedido_id') ?>
- = lang('Produccion.datatable.fecha_encuadernacion') ?>
- = lang('Produccion.datatable.cliente') ?>
- = lang('Produccion.datatable.titulo') ?>
- = lang('Produccion.datatable.ubicacion') ?>
- = lang('Produccion.datatable.tirada') ?>
- = lang('Produccion.datatable.impresion') ?>
- = lang('Basic.global.Action') ?>
-
-
-
+
-
-
\ No newline at end of file
+
+
+
+ = lang('Produccion.datatable.pedido_id') ?>
+ = lang('Produccion.datatable.fecha_encuadernacion') ?>
+ = lang('Produccion.datatable.cliente') ?>
+ = lang('Produccion.datatable.titulo') ?>
+ = lang('Produccion.datatable.ubicacion') ?>
+ = lang('Produccion.datatable.tirada') ?>
+ = lang('Produccion.datatable.impresion') ?>
+ = lang('Produccion.datatable.logo') ?>
+ = lang('Produccion.datatable.progreso') ?>
+ = lang('Basic.global.Action') ?>
+
+
+
+
+
+
+
\ No newline at end of file
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 026cc919..cc9e048c 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
@@ -1,17 +1,20 @@
-
-
-
- = lang('Produccion.task.order') ?>
- = lang('Produccion.task.task') ?>
- = lang('Produccion.task.maquina_presupuesto') ?>
- = lang('Produccion.task.maquina_actual') ?>
- = lang('Produccion.task.imposicion_id') ?>
- = lang('Produccion.task.tiempo_estimado') ?>
- = lang('Produccion.task.tiempo') ?>
- = lang('Produccion.task.action') ?>
+
+
+
+
+
+ = lang('Produccion.task.order') ?>
+ = lang('Produccion.task.task') ?>
+ = lang('Produccion.task.maquina_presupuesto') ?>
+ = lang('Produccion.task.maquina_actual') ?>
+
+ = lang('Produccion.task.tiempo_estimado') ?>
+ = lang('Produccion.task.tiempo') ?>
+
-
-
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php b/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php
new file mode 100644
index 00000000..b6f75226
--- /dev/null
+++ b/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+ = lang('Produccion.datatable.papel') ?>
+ = lang('Produccion.datatable.gramaje') ?> (gr)
+ = lang('Produccion.datatable.tareas') ?>
+ = lang('Produccion.datatable.tiradas') ?>
+ = lang('Produccion.datatable.tiempo') ?>(HH:MM)
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php b/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php
new file mode 100644
index 00000000..883d34f6
--- /dev/null
+++ b/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php
@@ -0,0 +1,38 @@
+
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php
index 1337d806..222d64f9 100644
--- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php
+++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php
@@ -1,5 +1,6 @@
+
- = @lang("ot.comment") ?>
-
+ = @lang("Produccion.comments") ?>
+
\ No newline at end of file
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 10e80362..26d44620 100644
--- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otDates.php
+++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otDates.php
@@ -2,43 +2,75 @@
-
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPortada.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPortada.php
new file mode 100644
index 00000000..508202ff
--- /dev/null
+++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPortada.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ Portada
+
+
+
+ Subir portada
+
+
+
+
+
\ No newline at end of file
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 36cd24bc..bc0093b6 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
-
+
@@ -14,7 +14,7 @@
Revisar formato
-
+
@@ -26,7 +26,7 @@
Revisar lomo
-
+
@@ -45,7 +45,7 @@
@@ -85,7 +85,7 @@
- =@lang("Produccion.finalizar_orden")?>
+ estado == "F" ? "disabled" : "" ?>>=@lang("Produccion.finalizar_orden")?>
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 97d7d4a6..113178d8 100644
--- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php
+++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php
@@ -26,7 +26,6 @@
Mensajes
-
@@ -35,7 +34,18 @@
- = view("themes/vuexy/components/tables/ot_task_table",["id" => "ot-task-table"]) ?>
+
+
+
+ = view("themes/vuexy/components/tables/ot_task_table", ["id" => "ot-task-table"]) ?>
+
+
+
+
@@ -45,7 +55,7 @@
-
+
= view("themes/vuexy/form/produccion/ot/otFerrosEnvios") ?>
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php
new file mode 100644
index 00000000..44177691
--- /dev/null
+++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php
@@ -0,0 +1,45 @@
+= $this->include('themes/_commonPartialsBs/select2bs5') ?>
+= $this->include('themes/_commonPartialsBs/datatables') ?>
+= $this->include('themes/_commonPartialsBs/sweetalert') ?>
+= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
+= $this->extend('themes/vuexy/main/defaultlayout') ?>
+
+
+= $this->section('content'); ?>
+
+
+
+
+
+
+ = lang("Produccion.planning_rotativa") ?>
+
+
+ = lang("Produccion.papel_gramajes") ?>
+
+
+
+
+ = view("themes/vuexy/components/tables/planning_rot_table.php", ["id" => "planning-rotativa-datatable"]) ?>
+
+
+ = view("themes/vuexy/components/tables/planning_papel_gramaje_table.php", ["id" => "planning-papel-datatable"]) ?>
+
+
+
+
+
+
+
+= $this->endSection() ?>
+
+= $this->section('css') ?>
+
+= $this->endSection() ?>
+
+= $this->section("additionalExternalJs") ?>
+
+
+
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php
index b7d1f7d0..59191045 100644
--- a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php
+++ b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php
@@ -6,8 +6,20 @@
= $this->section('content'); ?>
-
-
+
+
+
+
+
+
+
+
@@ -39,7 +51,7 @@
- Presupuesto
+ Presupuesto
@@ -57,16 +69,20 @@
+
-= $this->endSection() ?>
+
+
+
++
+
+