ordenes trabajo

This commit is contained in:
amazuecos
2025-01-02 10:50:56 +01:00
parent 340ab4ec5f
commit b50ba4f2a3
57 changed files with 3005 additions and 417 deletions

View File

@ -0,0 +1,31 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class LogoImpresion extends BaseConfig
{
public array $TIPO_IMPRESION_MAPPING = [
"lp_bn" => "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";
}
}

View File

@ -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');
});
});
});
/*

View File

@ -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"
],
];
}

View File

@ -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'))])];

View File

@ -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);
}
}

View File

@ -1,29 +1,48 @@
<?php
namespace App\Controllers\Produccion;
use App\Controllers\BaseController;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
use App\Models\Presupuestos\PresupuestoModel;
use App\Models\Usuarios\UserModel;
use App\Services\ProductionService;
use CodeIgniter\Files\File;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time;
use CodeIgniter\Validation\Validation;
use Config\LogoImpresion;
use Hermawan\DataTables\DataTable;
use Psr\Log\LoggerInterface;
class Ordentrabajo extends BaseController
{
{
protected $format = 'json';
protected array $viewData = [];
protected ProductionService $produccionService;
protected OrdenTrabajoModel $otModel;
protected OrdenTrabajoUser $otUserModel;
protected OrdenTrabajoTarea $otTarea;
protected UserModel $userModel;
protected Validation $validation;
protected static $viewPath = 'themes/vuexy/form/produccion/';
protected static $controllerSlug = "orden-trabajo";
protected $indexRoute = 'viewOrdenTrabajoList';
protected $indexRoutePlanning = 'ot/viewPlanningRotativa';
protected $editRoute = 'viewOrdenTrabajoEdit';
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->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);
}
}

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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");

View File

@ -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,
],
];

View File

@ -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()

View File

@ -1,6 +1,8 @@
<?php
namespace App\Entities\Clientes;
use App\Entities\Usuarios\UserEntity;
use App\Models\Usuarios\UserModel;
use CodeIgniter\Entity;
class ClienteEntity extends \CodeIgniter\Entity\Entity
@ -68,4 +70,10 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
"user_created_id" => "int",
"user_update_id" => "int",
];
public function comercial() : UserEntity
{
$m = model(UserModel::class);
return $m->find($this->attributes["comercial_id"]);
}
}

View File

@ -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);

View File

@ -1,6 +1,8 @@
<?php
namespace App\Entities\Pedidos;
use App\Entities\Configuracion\UbicacionesEntity;
use App\Models\Configuracion\UbicacionesModel;
use CodeIgniter\Entity;
class PedidoLineaEntity extends \CodeIgniter\Entity\Entity
@ -22,4 +24,9 @@ class PedidoLineaEntity extends \CodeIgniter\Entity\Entity
"presupuesto_id" => "int",
"ubicacion_id" => "int",
];
public function ubicacion() : UbicacionesEntity
{
$m = model(UbicacionesModel::class);
return $m->find($this->attributes["ubicacion_id"]);
}
}

View File

@ -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
{

View File

@ -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"]);
}
}

View File

@ -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;
}
}

View File

@ -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"
];
}

View File

@ -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

View File

@ -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"]);
}
}

View File

@ -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
];
}

View File

@ -0,0 +1,25 @@
<?php
// app/Helpers/info_helper.php
use CodeIgniter\CodeIgniter;
function float_seconds_to_hhmm_string(?float $time):?string
{
$time_str = null;
if($time){
$time_str = sprintf("%02d:%02d",$time/3600,floor($time/60)%60);
}
return $time_str;
}
function week_day_humanize(int $week_day,bool $upper = false) : string
{
$week_days = ["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];
$week_day_string = "";
if(in_array($week_day,range(0,6))){
$week_day_string = $week_days[$week_day];
}
if($upper){
$week_day_string = strtoupper($week_day_string);
}
return $week_day_string;
}

View File

@ -589,13 +589,13 @@ return [
// v1.2.1
"global_select" => "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",

View File

@ -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"
];

View File

@ -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]);
}
}
}
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace App\Models\OrdenTrabajo;
use App\Entities\Produccion\OrdenTrabajoUserEntity;
use CodeIgniter\Database\MySQLi\Builder;
use CodeIgniter\Model;
class OrdenTrabajoUser extends Model
{
protected $table = 'orden_trabajo_users';
protected $primaryKey = 'orden_trabajo_id';
protected $useAutoIncrement = false;
protected $returnType = OrdenTrabajoUserEntity::class;
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
"orden_trabajo_id",
"user_created_id",
"user_update_id",
"inaplazable_revised_change_user_id",
"ferro_disponible_hecho_user_id",
"ferro_disponible_ok_user_id",
"ferro_entregado_user_id",
"pendiente_ferro_user_id",
"ferro_en_cliente_user_id",
"ferro_ok_user_id",
"interior_bn_user_id",
"interior_color_user_id",
"preparacion_interior_user_id",
"cubierta_user_id",
"plastificado_user_id",
"encuadernacion_user_id",
"corte_user_id",
"embalaje_user_id",
"entrada_manipulado_user_id",
"pre_formato_user_id",
"pre_lomo_user_id",
"pre_solapa_user_id",
"pre_codbarras_user_id",
"pre_imposicion_user_id",
"pre_imprimir_user_id"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [
"orden_trabajo_id" => "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 = [];
}

View File

@ -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
];
}
}

View File

@ -1,17 +1,22 @@
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
<th><?= lang('Produccion.datatable.fecha_encuadernacion') ?></th>
<th><?= lang('Produccion.datatable.cliente') ?></th>
<th><?= lang('Produccion.datatable.titulo') ?></th>
<th><?= lang('Produccion.datatable.ubicacion') ?></th>
<th><?= lang('Produccion.datatable.tirada') ?></th>
<th><?= lang('Produccion.datatable.impresion') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
<div class="table-responsive">
</tbody>
</table>
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
<th><?= lang('Produccion.datatable.fecha_encuadernacion') ?></th>
<th><?= lang('Produccion.datatable.cliente') ?></th>
<th><?= lang('Produccion.datatable.titulo') ?></th>
<th><?= lang('Produccion.datatable.ubicacion') ?></th>
<th><?= lang('Produccion.datatable.tirada') ?></th>
<th><?= lang('Produccion.datatable.impresion') ?></th>
<th><?= lang('Produccion.datatable.logo') ?></th>
<th><?= lang('Produccion.datatable.progreso') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

View File

@ -1,17 +1,20 @@
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Produccion.task.order') ?></th>
<th><?= lang('Produccion.task.task') ?></th>
<th><?= lang('Produccion.task.maquina_presupuesto') ?></th>
<th><?= lang('Produccion.task.maquina_actual') ?></th>
<th><?= lang('Produccion.task.imposicion_id') ?></th>
<th><?= lang('Produccion.task.tiempo_estimado') ?></th>
<th><?= lang('Produccion.task.tiempo') ?></th>
<th><?= lang('Produccion.task.action') ?></th>
<div class="table-responsive">
<table id="<?= $id ?>" class="table table-hover">
<thead>
<tr>
<th><?= lang('Produccion.task.order') ?></th>
<th><?= lang('Produccion.task.task') ?></th>
<th><?= lang('Produccion.task.maquina_presupuesto') ?></th>
<th><?= lang('Produccion.task.maquina_actual') ?></th>
<!-- <th><?= lang('Produccion.task.imposicion_id') ?></th> -->
<th><?= lang('Produccion.task.tiempo_estimado') ?></th>
<th><?= lang('Produccion.task.tiempo') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</tbody>
</table>
</div>

View File

@ -0,0 +1,17 @@
<div class="table-responsive">
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Produccion.datatable.papel') ?></th>
<th><?= lang('Produccion.datatable.gramaje') ?> (gr)</th>
<th><?= lang('Produccion.datatable.tareas') ?></th>
<th><?= lang('Produccion.datatable.tiradas') ?></th>
<th><?= lang('Produccion.datatable.tiempo') ?>(HH:MM)</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

View File

@ -0,0 +1,38 @@
<div class="table-responsive">
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('ID') ?></th>
<th><?= lang('Produccion.datatable.fecha_entrega_at') ?></th>
<th><?= lang('Produccion.datatable.titulo') ?></th>
<th><?= lang('Produccion.datatable.maquina') ?></th>
<th><?= lang('Produccion.datatable.tirada') ?></th>
<th><?= lang('Produccion.datatable.ancho') ?></th>
<th><?= lang('Produccion.datatable.alto') ?></th>
<th><?= lang('Produccion.datatable.papel') ?></th>
<th><?= lang('Produccion.datatable.gramaje') ?></th>
<!-- <th><?= lang('Produccion.datatable.corte') ?></th>
<th><?= lang('Produccion.datatable.metros_sel') ?></th>
<th><?= lang('Produccion.datatable.metros_papel') ?></th> -->
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
<tr>
<th><input type="text" class="form-control planning-filter" name="otId" placeholder="ID"></th>
<th><input type="text" class="form-control planning-filter" name="fecha_entrega_real_at" placeholder="d/m/Y"></th>
<th><input type="text" class="form-control planning-filter" name="presupuesto_titulo" placeholder="Titulo"></th>
<th><select class="select2 form-select select-maquina" id="maquina-select-filter" name="maquina_planning_nombre"></select></th>
<th></th>
<th><input type="text" class="form-control planning-filter" name="maquina_ancho" placeholder="Ancho"></th>
<th><input type="text" class="form-control planning-filter" name="maquina_alto" placeholder="Alto"></th>
<th><select class="form-control" name=""></select></th>
<th><input type="text" class="form-control planning-filter" name=""></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

View File

@ -1,5 +1,6 @@
<div class="cold-md-12 mt-3">
<!-- Comment text area-->
<label for="ot-comment" class="form-label"><h4><?= @lang("ot.comment") ?></h4></label>
<textarea rows=5 cols="10" type="text" class="form-control w-100" id="ot-comment"></textarea>
<label for="ot-comment" class="form-label"><h4><?= @lang("Produccion.comments") ?></h4></label>
<textarea rows=5 cols="10" type="text" class="form-control w-100" name="comentarios" id="ot-comment"></textarea>
</div>

View File

@ -2,43 +2,75 @@
<div class="card accordion-item active">
<h2 class="accordion-header">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionOtDatesTip" aria-expanded="false" aria-controls="accordionOtDatesTip">
<h4> <i class="tf-icon ti-calendar ti-xs ti">Fechas</i> </h4>
</button>
</h2>
<div id="accordionOtDatesTip" class="accordion-collapse collapse show" data-bs-parent="#accordionOtDates">
<div class="accordion-body">
<div class="accordion-body mt-2">
<div class="row">
<!-- Date 1-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.tiempo_procesamiento") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-tiempo-procesamiento" disabled>
<label for="ot-tiempo-procesamiento" class="form-label"><?= @lang("Produccion.tiempo_procesamiento") ?></label>
<input type="text" class="form-control" name="tiempo_procesamiento" placeholder="HH:MM" id="ot-tiempo-procesamiento" data-input disabled>
</div>
<!-- Date 2-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_impresion") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-fecha-impresion">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_impresion_at" id="ot-fecha-impresion" data-input>
</div>
<!-- Date 2-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_encuadernado") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-fecha-encuadernado">
<input type="date" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_encuadernado_at" id="ot-fecha-encuadernado" data-input />
</div>
<!-- Date 4-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_entrega_externo") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-fecha-entrega-externo">
<input type="date" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_entrega_externo" id="ot-fecha-entrega-externo" data-input />
</div>
<!-- Date 5-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_entrega_real") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-fecha-entrega-real">
<div class="row d-flex flex-column">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_entrega_real") ?></label>
<input type="date" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_entrega_real_at" id="ot-fecha-entrega-real" data-input />
<label class="switch switch-danger switch-md mt-1">
<input type="checkbox" class="switch-input ot-preview" name="fecha_entrega_warning" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-alert-triangle"></i>
</span>
<span class="switch-off">
<i class="ti ti-x"></i>
</span>
</span>
<span class="switch-label">Inaplazable</span>
</label>
<label class="switch switch-md mt-1">
<input type="checkbox" class="switch-input ot-preview" name="fecha_entrega_warning_revised" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
</span>
<span class="switch-off">
<i class="ti ti-x"></i>
</span>
</span>
<span class="switch-label">Revisada</span>
</label>
</div>
</div>
<!-- Date 6-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("fecha_entrega_estimada") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-fecha-entrega-estimada">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_entrega_estimada") ?></label>
<input type="date" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_entrega_estimada_at" id="ot-fecha-entrega-estimada" data-input disabled />
</div>
</div>
</div>

View File

@ -13,27 +13,27 @@
<!-- Detail 1-->
<div class="col-xs-12 col-md-4 col-lg-2 mb-2">
<label for="ot-formato" class="form-label"><?= @lang("Produccion.formato") ?></label>
<input type="text" class="form-control" id="ot-formato" disabled>
<input type="text" class="form-control" name="formato" id="ot-formato" disabled>
</div>
<!-- Detail 2-->
<div class="col-xs-12 col-md-4 col-lg-2 mb-2">
<label for="ot-paginas" class="form-label"><?= @lang("Produccion.paginas") ?></label>
<input type="text" class="form-control" id="ot-paginas" disabled>
<input type="text" class="form-control" name="paginas" id="ot-paginas" name="presupuesto.paginas" disabled>
</div>
<!-- Detail 3-->
<div class="col-xs-12 col-md-4 col-lg-2 mb-2">
<label for="ot-solapa" class="form-label"><?= @lang("Produccion.solapa") ?></label>
<input type="text" class="form-control" id="ot-solapa" disabled>
<input type="text" class="form-control" name="solapa" id="ot-solapa" disabled>
</div>
<!-- Detail 4-->
<div class="col-xs-12 col-md-4 col-lg-2 mb-2">
<label for="ot-tirada" class="form-label"><?= @lang("Produccion.tirada") ?></label>
<input type="text" class="form-control" id="ot-tirada" disabled>
<input type="text" class="form-control" name="tirada" id="ot-tirada" name="presupuesto.tirada" disabled>
</div>
<!-- Detail 5-->
<div class="col-xs-12 col-md-4 col-lg-2 mb-2">
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-merma" class="form-label"><?= @lang("Produccion.merma") ?></label>
<input type="text" class="form-control" id="ot-merma" disabled>
<input type="text" class="form-control" name="merma" id="ot-merma" name="presupuesto.merma" disabled>
</div>
</div>
</div>

View File

@ -0,0 +1,22 @@
<div class="accordion accordion-bordered mt-3" id="accordionOtPortada">
<div class="card accordion-item">
<h2 class="accordion-header">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionOtPortadaTip" aria-expanded="false" aria-controls="accordionOtPortadaTip">
<h4> <i class="tf-icon ti-photo ti-xs ti">Portada</i> </h4>
</button>
</h2>
<div id="accordionOtPortadaTip" class="accordion-collapse collapse show" data-bs-parent="#accordionOtPortada">
<div class="accordion-body">
<div class="mb-3">
<label for="formFile" class="form-label">Portada</label>
<input class="form-control" type="file" id="portada-file-input">
</div>
<div class="mb-3">
<button type="button" class="btn btn-primary w-100" id="btn-upload-portada"><i class="ti ti-md ti-upload"></i>Subir portada </button>
</div>
</div>
</div>
</div>
</div>

View File

@ -2,7 +2,7 @@
<div class="text-light small fw-medium mb-4 text-start">Revisión</div>
<div class="d-flex flex-column justify-content-start text-start gap-2">
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="revisar_formato"/>
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
@ -14,7 +14,7 @@
<span class="switch-label">Revisar formato</span>
</label>
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="revisar_lomo" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
@ -26,7 +26,7 @@
<span class="switch-label">Revisar lomo</span>
</label>
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="revisar_solapa" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
@ -45,7 +45,7 @@
<div class="text-light small fw-medium mb-4 text-start">&nbsp;</div>
<div class="d-flex flex-column justify-content-start text-start gap-2">
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="revisar_isbn" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
@ -57,7 +57,7 @@
<span class="switch-label">Revisar ISBN,D.L.</span>
</label>
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="revisar_codigo_barras" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
@ -69,7 +69,7 @@
<span class="switch-label">Revisar código de barras</span>
</label>
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="realizar_imposicion" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>
@ -86,7 +86,7 @@
<div class="text-light small fw-medium mb-4 text-start">&nbsp;</div>
<div class="d-flex flex-column justify-content-start text-start gap-2">
<label class="switch switch-md">
<input type="checkbox" class="switch-input" />
<input type="checkbox" class="switch-input ot-preview" name="enviar_impresion" />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>

View File

@ -13,7 +13,7 @@
<div class="col-md-12 mb-3">
<label class="form-label" for="ot-progress-bar-parent"><?=@lang("App.progress") ?></label>
<div class="progress" id="ot-progress-bar-parent">
<div id="ot-progress-bar" class="progress-bar" role="progressbar" style="width: 75%;" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">75%</div>
<div id="ot-progress-bar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
@ -21,57 +21,57 @@
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-pendiente-ferro" class="form-label"><?= @lang("Produccion.pendiente_ferro") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-pendiente-ferro">
<input type="text" class="form-control ot-date" name="pendiente_ferro_at" placeholder="DD/MM/YYYY" id="ot-pendiente-ferro">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-ferro-cliente" class="form-label"><?= @lang("Produccion.ferro_cliente") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-ferro-cliente">
<input type="text" class="form-control ot-date" name="ferro_en_cliente_at" placeholder="DD/MM/YYYY" id="ot-ferro-cliente">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-ferro-ok" class="form-label"><?= @lang("Produccion.ferro_ok") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-ferro-ok">
<input type="text" class="form-control ot-date" name="ferro_ok_at" placeholder="DD/MM/YYYY" id="ot-ferro-ok">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-plakene-traslucido" class="form-label"><?= @lang("Produccion.plakene_traslucido") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-plakene-traslucido">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="plakene_taslucido_at" id="ot-plakene-traslucido">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-impresion-color" class="form-label"><?= @lang("Produccion.impresion_color") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-impresion-color">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="interior_color_at" id="ot-impresion-color">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-portada" class="form-label"><?= @lang("Produccion.portada") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-portada">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="cubierta_at" id="ot-portada">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-plastificado-mate" class="form-label"><?= @lang("Produccion.plastificado_mate") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-plastificado-mate">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="plastificado_at" id="ot-plastificado-mate">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-prep-guillotina" class="form-label"><?= @lang("Produccion.portada") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-prep-guillotina">
<label for="ot-prep-guillotina" class="form-label"><?= @lang("Produccion.guillotina") ?></label>
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="corte_at" id="ot-prep-guillotina">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-espiral" class="form-label"><?= @lang("Produccion.espiral") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-espiral">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="espiral_at" id="ot-espiral">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-embalaje" class="form-label"><?= @lang("Produccion.embalaje") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-embalaje">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="embalaje_at" id="ot-embalaje">
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-envio" class="form-label"><?= @lang("Produccion.envio") ?></label>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="ot-envio">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="envio_at" id="ot-envio">
</div>
</div>
<div class="row">
@ -85,7 +85,7 @@
<div class="row">
<div class="col-md-12">
<div class="d-grip">
<button type="button" class="btn btn-primary btn-block w-100"><?=@lang("Produccion.finalizar_orden")?></button>
<button type="button" id="btn-finalizar-orden-pedido" class="btn btn-primary btn-block w-100" <?=$ot->estado == "F" ? "disabled" : "" ?>><?=@lang("Produccion.finalizar_orden")?></button>
</div>
</div>
</div>

View File

@ -26,7 +26,6 @@
<button type="button" class="nav-link d-flex flex-column gap-1" role="tab" data-bs-toggle="tab" data-bs-target="#nav-ot-task-messages" aria-controls="nav-ot-task-messages" aria-selected="false">Mensajes</button>
</li>
</ul>
</div>
</div>
@ -35,7 +34,18 @@
<div class="tab-content p-0">
<!-- TAREAS -->
<div class="tab-pane fade show active" id="nav-ot-task-general" role="tabpanel">
<?= view("themes/vuexy/components/tables/ot_task_table",["id" => "ot-task-table"]) ?>
<div class="row text-start">
<div class="col-md-12">
<?= view("themes/vuexy/components/tables/ot_task_table", ["id" => "ot-task-table"]) ?>
</div>
</div>
<div class="row text-end mt-2">
<div class="col-md-12">
<button type="button" class="btn btn-danger btn-md" id="btn-reset-tareas"><i class="ti ti-trash ti-xs"></i> Reiniciar tareas</button>
</div>
</div>
</div>
<!-- PREIMPRESION -->
<div class="tab-pane fade" id="nav-ot-task-preimpresion" role="tabpanel">
@ -45,7 +55,7 @@
</div>
<!-- FERROS Y ENVIOS -->
<div class="tab-pane fade" id="nav-ot-task-ferro-envio" role="tabpanel">
<div class="row text-start">
<div class="row text-start">
<?= view("themes/vuexy/form/produccion/ot/otFerrosEnvios") ?>
</div>
</div>

View File

@ -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'); ?>
<!--Content Body-->
<div class="row" id="planning-rotativa-page">
<div class="col-md-12">
<div class="nav-tabs-shadow nav-align-top">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<button type="button" class="nav-link active" role="tab" id="navs-top-align-prot-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-prot"><?= lang("Produccion.planning_rotativa") ?></button>
</li>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-papel-gramaje-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-papel-gramaje"><?= lang("Produccion.papel_gramajes") ?></button>
</li>
</ul>
<div class="tab-content" id="prot-datatables-container">
<div class="tab-pane fade show active" id="navs-top-align-prot">
<?= view("themes/vuexy/components/tables/planning_rot_table.php", ["id" => "planning-rotativa-datatable"]) ?>
</div>
<div class="tab-pane fade show" id="navs-top-align-papel-gramaje">
<?= view("themes/vuexy/components/tables/planning_papel_gramaje_table.php", ["id" => "planning-papel-datatable"]) ?>
</div>
</div>
<!--//.card -->
</div>
</div>
<!--//.col -->
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<script type="module" src="<?= site_url("assets/js/safekat/pages/produccion/planning_rotativa/index.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -6,8 +6,20 @@
<?= $this->section('content'); ?>
<div id="ot-edit" data-id="<?= $modelId ?>">
<div class="row">
<div class="col-md-12">
<div class="alert alert-primary" role="alert">
<div class="col-md-2 d-flex align-items-center justify-content-center">
<div class="sk-wave sk-primary portada-loader">
<div class="sk-wave-rect"></div>
<div class="sk-wave-rect"></div>
<div class="sk-wave-rect"></div>
<div class="sk-wave-rect"></div>
<div class="sk-wave-rect"></div>
</div>
<img class="rounded" id="portada-orden-trabajo" src="" width="100%" height="100%" hidden>
</div>
<div class="col-md-10">
<div class="alert alert-info h-100" role="alert" id="alert-orden-trabajo">
<div class="row">
<div class="col-md-10">
<div class="d-flex flex-row bd-highlight gap-2">
@ -39,7 +51,7 @@
</div>
<div class="col-md-2">
<div class="d-flex flex-row bd-highlight justify-content-end">
<button class="btn btn-sm btn-primary w-100">Presupuesto</button>
<button class="btn btn-sm btn-warning w-100">Presupuesto</button>
</div>
</div>
</div>
@ -57,16 +69,20 @@
</div>
<div class="col-md-2 ">
<div class="d-flex flex-row bd-highlight justify-content-end">
<button class="btn btn-sm btn-primary w-100">Pedido</button>
<button class="btn btn-sm btn-warning w-100">Pedido</button>
</div>
</div>
</div>
</div>
</div><!--//.col -->
</div><!--//.row -->
<div class="row">
<form id="ot-edit-form">
<div class="col-md-12">
<?= view("themes/vuexy/form/produccion/ot/otPortada") ?>
</div>
<div class="col-md-12">
<?= view("themes/vuexy/form/produccion/ot/otDates") ?>
</div>
@ -88,6 +104,7 @@
</form>
<div class="col-md-12 mt-3">
<div class="d-grip gap-2">
<a type="button" class="btn btn-primary btn-block w-100 mb-1" target="__blank" href="<?= "/produccion/ordentrabajo/pdf/" . $modelId ?>"><?= @lang("Produccion.preview_pdf") ?></a>
<button type="button" class="btn btn-primary btn-block w-100 mb-1"><?= @lang("Produccion.imprimir_ferro") ?></button>
<button type="button" class="btn btn-secondary btn-block w-100 mb-1"><?= @lang("Produccion.imprimir_codigo_safekat") ?></button>
@ -95,18 +112,45 @@
</div>
</div>
</div>
<?= $this->endSection() ?>
<!-- Modal -->
<div class="modal fade" id="modalCommentTarea" tabindex="-1" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel1"><?= lang('Produccion.tarea') ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<label for="comment-tarea" class="form-label d-flex text-start w-100">Comentario &nbsp;<p id="comment-type"></p></label>
<textarea name="comment" class="form-control" id="comment-tarea" rows="5" cols="5"></textarea>
</div>
<div class="modal-footer">
<button type="button" id="btn-update-tarea-comment" class="btn btn-primary"><?= lang('Chat.modal.btn_send') ?></button>
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal"><?= lang('App.global_come_back') ?></button>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/bs-stepper/bs-stepper.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.css") ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<script type="module" src="<?= site_url('assets/js/safekat/pages/produccion/edit.js') ?>"></script>
<?= $this->endSection() ?>
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/bs-stepper/bs-stepper.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script type="module" src="<?= site_url('assets/js/safekat/pages/produccion/edit.js') ?>"></script>
<?= $this->endSection() ?>

View File

@ -17,12 +17,30 @@
<div class="nav-tabs-shadow nav-align-top">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<button type="button" class="nav-link active" role="tab" id="navs-top-align-directos-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ots"><?= lang("Produccion.ots") ?></button>
<button type="button" class="nav-link active" role="tab" id="navs-top-align-finalizados-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-finalizados"><?= lang("Produccion.finalizadas") ?></button>
</li>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-pendientes-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-pendientes"><?= lang("Produccion.pendientes") ?></button>
</li>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-ferro-pendiente-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ferro-pendiente"><?= lang("Produccion.pendiente_ferro") ?></button>
</li>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-ferro-ok-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ferro-ok"><?= lang("Produccion.ferro_ok") ?></button>
</li>
</ul>
<div class="tab-content" id="ots-datatables-container">
<div class="tab-pane fade show active" id="navs-top-align-directos">
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable"]) ?>
<div class="tab-pane fade show active" id="navs-top-align-finalizados">
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-finalizados"]) ?>
</div>
<div class="tab-pane fade show" id="navs-top-align-pendientes">
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-pendientes"]) ?>
</div>
<div class="tab-pane fade show" id="navs-top-align-ferro-pendiente">
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-ferro-pendiente"]) ?>
</div>
<div class="tab-pane fade show" id="navs-top-align-ferro-ok">
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-ferro-ok"]) ?>
</div>
</div>
<!--//.card -->

View File

@ -69,6 +69,7 @@ $picture = "/assets/img/default-user.png";
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.css') ?>"/>
@ -80,6 +81,7 @@ $picture = "/assets/img/default-user.png";
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>" />
<!-- Helpers -->
<script src="<?= site_url('themes/vuexy/vendor/js/helpers.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/js/config.js') ?>"></script>
@ -343,6 +345,7 @@ $picture = "/assets/img/default-user.png";
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/bootstrap.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/hammer/hammer.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/menu.js') ?>"></script>

View File

@ -16,7 +16,7 @@ if (auth()->user()->inGroup('beta')) {
<?= lang("App.menu_orden_trabajo") ?>
</a>
</li>
<li class="menu-item">
<!-- <li class="menu-item">
<a href="<?= site_url("produccion/ordentrabajo/cien") ?>" class="menu-link">
<?= lang("App.menu_orden_trabajo_100") ?>
</a>
@ -30,6 +30,11 @@ if (auth()->user()->inGroup('beta')) {
<a href="<?= site_url("produccion/ordentrabajo/pendiente") ?>" class="menu-link">
<?= lang("App.menu_orden_trabajo_pendientes") ?>
</a>
</li> -->
<li class="menu-item">
<a href="<?= site_url("produccion/ordentrabajo/planning/rotativa") ?>" class="menu-link">
<?= lang("App.menu_planning_rotativa") ?>
</a>
</li>
</ul>
</li>

View File

@ -0,0 +1,322 @@
<?php
use CodeIgniter\I18n\Time;
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/pdf.ot.css') ?>">
<title>Rotativa</title>
</head>
<body>
<div>
<div class="header">
<div class="title"><?= $presupuesto->titulo ?></div>
<div><?= Time::now()->format("d/m/Y H:i:s") ?></div>
</div>
<div class="section">
<div class="cover">
<div class="portada">
<img class="portada-img" src="<?= "data:image/png;base64," . base64_encode(file_get_contents(WRITEPATH . "uploads/" . $ot->portada_path)) ?>">
</div>
<div class="portada-info">
<div class="portada-row">
<p class="portada-text pl-2"><strong><?= $dates->fecha_encuadernado_at ? week_day_humanize(Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)->getDayOfWeek(),true) : "" ?></strong></p>
<div class="portada-text pr-2"><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </div>
</div>
<div class="portada-row-2">
<div style="display: flex;flex-direction:column;height:100%;width:25%">
<p class="portada-text date" id="fecha_encuadernado_at"><?= $dates->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)?->format("d/m/Y") : "" ?></p>
<!-- <div style="width: 100%;height: 100%;background-color:white;margin-left:0.5rem;margin-bottom:0.5rem">
</div> -->
<div class="pl-2">
<table id="table-portada-ubicacion">
<tr class="t-row">
<th class="t-header">IN</th>
<td class="t-cell"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">PO</th>
<td class="t-cell"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">PL</th>
<td class="t-cell"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">EN</th>
<td class="t-cell"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">MA</th>
<td class="t-cell"><?= $ubicacion ?></td>
</tr>
</table>
</div>
</div>
<div style="display: flex;flex-direction:column;height:100%;width:10%" class="pt-2">
<div class="pl-2 pt-2">
<table id="table-portada-ubicacion">
<tr class="t-row">
<th class="t-header" style="font-size: large;">RF</th>
</tr>
</table>
</div>
</div>
<div class="square-wrapper">
<div class="square bg-white">
BCLF 100
</div>
<div class="square bg-white">
0:3
</div>
<div class="square bg-gray">
EM 300
</div>
<div class="square bg-blue">
BRILLO
</div>
</div>
<div class="cod">
<div class="code-code">
<p style="line-height: 0px;font-size:20px"><?= $ot->id ?></p>
</div>
<div class="cod-barras"></div>
</div>
</div>
</div>
</div>
</div>
<div class="section">
<div class="flex-row">
<div class="flex-col" id="presupuesto-section">
<table>
<tr>
<th>Cliente</th>
<td class="t-cell ">
<p class="cliente-title"><?= $cliente->nombre ?></p>
</td>
</tr>
<tr>
<th>Titulo</th>
<td class="t-cell ">
<p class="presupuesto-title"><?= $presupuesto->titulo ?></p>
</td>
</tr>
<tr>
<th>ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr>
<tr>
<th>CIF</th>
<td class="t-cell"><?= $cliente->cif ?></td>
</tr>
</table>
</div>
<div class="esquema-imposicion-wrapper">
<div class="esquema">
<div class="pagina-imposicion-outer-start">
<div class="pagina-imposicion-inner">
A
</div>
</div>
<div class="pagina-imposicion-outer">
<div class="pagina-imposicion-inner">
A
</div>
</div>
<div class="pagina-imposicion-outer">
<div class="pagina-imposicion-inner">
A
</div>
</div>
<div class="pagina-imposicion-outer-end">
<div class="pagina-imposicion-inner">
A
</div>
</div>
</div>
<div class="imposicion">
<table style="width: 400%;">
<tr>
<th>Imposicion</th>
<td>400x400</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="section">
<div class="section-title impresion">IMP. INTERIOR</div>
<table>
<tr>
<td rowspan="3" class="row-logo-impresion"><img src="<?= site_url($linea_impresion->get_impresion_logo()) ?>" width="35px" height="35px"></td>
<th>Páginas</th>
<th>Ejemplares</th>
<th>Tintas</th>
<th>Formas</th>
<th>Máquina</th>
<th>Clics</th>
<th>Tiempo</th>
</tr>
<tr>
<td><?= $presupuesto->paginas ?></td>
<td><?= $presupuesto->tirada ?></td>
<td>??</td>
<td><?= json_decode($linea_impresion->formas)->formas ?></td>
<td><strong><?= $linea_impresion->maquina()->nombre ?></strong></td>
<td><?= $linea_impresion->rotativa_clicks_total ?></td>
<td><?= float_seconds_to_hhmm_string($linea_impresion->horas_maquina * 3600) ?></td>
</tr>
<tr>
<td colspan="4"><?= $linea_impresion->papel_impresion ?></td>
<td><?= $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?></td>
<td colspan="2">_________ metros</td>
</tr>
</table>
<div class="comments">
<div class="flex-row impresion">Comentarios impresión interior</div>
<div class="comment-content">
<p>
</p>
<br />
<p>
</p>
</div>
</div>
</div>
<div class="section">
<div class="section-title cubierta">IMP. CUBIERTA</div>
<table>
<tr>
<td rowspan="3" class="row-logo-impresion"><img src="<?= site_url($linea_cubierta->get_impresion_logo()) ?>" width="35px" height="35px"></td>
<th>Tintas</th>
<th>Ejemplares</th>
<th>Maquina</th>
<th>Marcapaginas</th>
<th>Tiempo</th>
</tr>
<tr>
<td>??</td>
<td><?= $presupuesto->tirada ?></td>
<td><strong><?= $linea_cubierta->maquina()->nombre ?></strong></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
<td><?= float_seconds_to_hhmm_string($linea_cubierta->horas_maquina * 3600) ?></td>
</tr>
<tr>
<td colspan="1"><?= json_decode($linea_cubierta->formas)->maquina_ancho ?>x<?= json_decode($linea_cubierta->formas)->maquina_alto ?></td>
<td colspan="1"><?= $papel_formato->ancho ?>x<?= $papel_formato->alto ?></td>
<td colspan="2"><?= $linea_cubierta->papel_impresion ?></td>
<td colspan="2"><?= $linea_cubierta->papel_impresion()->gramaje . " " . "gr" ?></td>
</tr>
</table>
<div class="comments">
<div class="flex-row cubierta">Comentarios cubierta</div>
<div class="comment-content">
<p>
</p>
</div>
</div>
</div>
<div class="section">
<div class="section-title encuadernacion">ENCUADERNACIÓN</div>
<table>
<tr>
<th class="t-header">Plastificado</th>
<td class="t-cell"><?= $acabados[0]->tarifa()->nombre ?></td>
<th class="t-header" style="width: 10%;">UVI</th>
<td class="t-cell"> ?? </td>
</tr>
</table>
<table>
<tr>
<th class="t-header">MAQUINA</th>
<td class="t-cell"> ?? </td>
</tr>
</table>
<table>
<tr>
<th class="t-header">OPERARIO</th>
<td class="t-cell"> ?? </td>
</tr>
</table>
<?php if (count($encuadernaciones) > 0): ?>
<table>
<tr>
<th>Encuadernacion</th>
<th>Solapas</th>
<th>Sobrecubierta</th>
<th>Plegado</th>
<th>Guardas</th>
<th>Retractilado</th>
<th>Marcapáginas</th>
</tr>
<?php foreach ($encuadernaciones as $key => $value): ?>
<tr>
<td><?= $value->tarifa()->nombre ?></td>
<td><?= $presupuesto->solapas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
<td> ______ pliegos de ______ </td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php endforeach; ?>
</table>
<div class="comments">
<div class="flex-row encuadernacion">Comentarios encuadernacion:</div>
<div class="comment-content">
<p>
</p>
</div>
</div>
<?php endif; ?>
</div>
<div class="section">
<div class="section-title">LOGISTICA</div>
<table>
<tr>
<th>Peso Unidad</th>
<th>Peso Pedido</th>
<th>Cajas</th>
<th>Corte Pie</th>
</tr>
<tr>
<td><?= $peso_unidad ?>gr</td>
<td><?= $peso_pedido ?>gr</td>
<td>-</td>
<td>-</td>
</tr>
</table>
<div class="comments">
<div class="flex-row">Comentarios logistica:</div>
<div class="comment-content">
<p>
</p>
</div>
</div>
</div>
<div class="footer">
&copy; 2024 SAFEKAT. Todos los derechos reservados.
</div>
</div>
</body>
</html>

View File

@ -13,7 +13,7 @@
"php": "^8.2",
"codeigniter4/framework": "^4.0",
"codeigniter4/shield": "^1.0",
"dompdf/dompdf": "^2.0",
"dompdf/dompdf": "^3.0",
"firebase/php-jwt": "^6.10",
"hermawan/codeigniter4-datatables": "^0.7.2",
"nicolab/php-ftp-client": "^2.0",

207
ci4/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c0e2ec73d12ca7372057585d362765f7",
"content-hash": "939889ce4de6a8168b475984ff4401bd",
"packages": [
{
"name": "codeigniter4/framework",
@ -211,32 +211,34 @@
},
{
"name": "dompdf/dompdf",
"version": "v2.0.8",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "c20247574601700e1f7c8dab39310fca1964dc52"
"reference": "2d622faf9aa1f8f7f24dd094e49b5cf6c0c5d4e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/c20247574601700e1f7c8dab39310fca1964dc52",
"reference": "c20247574601700e1f7c8dab39310fca1964dc52",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/2d622faf9aa1f8f7f24dd094e49b5cf6c0c5d4e6",
"reference": "2d622faf9aa1f8f7f24dd094e49b5cf6c0c5d4e6",
"shasum": ""
},
"require": {
"dompdf/php-font-lib": "^1.0.0",
"dompdf/php-svg-lib": "^1.0.0",
"ext-dom": "*",
"ext-mbstring": "*",
"masterminds/html5": "^2.0",
"phenx/php-font-lib": ">=0.5.4 <1.0.0",
"phenx/php-svg-lib": ">=0.5.2 <1.0.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"ext-gd": "*",
"ext-json": "*",
"ext-zip": "*",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5"
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10",
"squizlabs/php_codesniffer": "^3.5",
"symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0"
},
"suggest": {
"ext-gd": "Needed to process images",
@ -267,9 +269,100 @@
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v2.0.8"
"source": "https://github.com/dompdf/dompdf/tree/v3.0.1"
},
"time": "2024-04-29T13:06:17+00:00"
"time": "2024-12-05T14:59:38+00:00"
},
{
"name": "dompdf/php-font-lib",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d",
"reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "The FontLib Community",
"homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/dompdf/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/1.0.1"
},
"time": "2024-12-02T14:37:59+00:00"
},
{
"name": "dompdf/php-svg-lib",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "eb045e518185298eb6ff8d80d0d0c6b17aecd9af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/eb045e518185298eb6ff8d80d0d0c6b17aecd9af",
"reference": "eb045e518185298eb6ff8d80d0d0c6b17aecd9af",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "The SvgLib Community",
"homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/dompdf/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/1.0.0"
},
"time": "2024-04-29T13:26:35+00:00"
},
{
"name": "firebase/php-jwt",
@ -734,96 +827,6 @@
},
"time": "2020-10-15T08:29:30+00:00"
},
{
"name": "phenx/php-font-lib",
"version": "0.5.6",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "a1681e9793040740a405ac5b189275059e2a9863"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a1681e9793040740a405ac5b189275059e2a9863",
"reference": "a1681e9793040740a405ac5b189275059e2a9863",
"shasum": ""
},
"require": {
"ext-mbstring": "*"
},
"require-dev": {
"symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/PhenX/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/0.5.6"
},
"time": "2024-01-29T14:45:26+00:00"
},
{
"name": "phenx/php-svg-lib",
"version": "0.5.4",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "46b25da81613a9cf43c83b2a8c2c1bdab27df691"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/46b25da81613a9cf43c83b2a8c2c1bdab27df691",
"reference": "46b25da81613a9cf43c83b2a8c2c1bdab27df691",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/PhenX/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/0.5.4"
},
"time": "2024-04-08T12:52:34+00:00"
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.42",
@ -3037,5 +3040,5 @@
"php": "^8.2"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}