61 Commits

Author SHA1 Message Date
36c9227586 fix pdf tables encuadernacion. Add tarifa acabado configuration for ots 2025-04-30 01:25:24 +02:00
96a6845c0c Merge branch 'feat/importador_rama_2' into 'main'
Feat/importador rama 2

See merge request jjimenez/safekat!754
2025-04-29 15:10:55 +00:00
eed5c0994e Importador rama con ajuste del precio 2025-04-29 17:09:19 +02:00
e2ab42cd84 Arreglado bug impresora de tickets (logistica) 2025-04-29 17:01:16 +02:00
7da76af866 Primera version del importador RAMA 2025-04-29 15:42:50 +02:00
bf1e66d746 Corregido bug en API imprimelibros 2025-04-29 12:40:35 +02:00
adccc414be Merge branch 'fix/bugs-ot' into 'main'
Fix/bugs ot

See merge request jjimenez/safekat!752
2025-04-28 06:13:50 +00:00
95fa192cb9 remove ? from orden_trabajo pdf 2025-04-28 08:12:22 +02:00
9310d2dabd delete class text-center from div.card otTask 2025-04-28 08:06:44 +02:00
3abf45ca6e tiempo real tarea empty when created 2025-04-28 08:00:39 +02:00
6ea22066c2 Merge branch 'feat/festivos-calendar' into 'main'
Feat/festivos calendar

See merge request jjimenez/safekat!751
2025-04-28 00:11:16 +00:00
bf21a336b1 Merge branch 'main' into feat/festivos-calendar 2025-04-28 02:10:52 +02:00
d1e5731d1d create POD dates pedido 2025-04-28 02:03:40 +02:00
029757bb40 add calendar festivos 2025-04-28 00:42:15 +02:00
bb4c9690b9 Merge branch 'feat/importador_rama' into 'main'
Feat/importador rama

See merge request jjimenez/safekat!750
2025-04-27 20:01:26 +00:00
6d45a950df Trabajando JS 2025-04-27 22:00:52 +02:00
6f8890a8b1 Merge branch 'main' into 'feat/importador_rama'
Main

See merge request jjimenez/safekat!749
2025-04-27 18:56:08 +00:00
c093c01c00 Merge branch 'main' into feat/festivos-calendar 2025-04-27 19:30:31 +02:00
a4532a7ff6 Merge branch 'fix/filter-datatable-ot' into 'main'
Fix/filter datatable ot

See merge request jjimenez/safekat!748
2025-04-27 17:27:30 +00:00
31a12ff343 try catch getTiempoProcesamientoHHMM 2025-04-27 19:26:02 +02:00
1d6f5fe53e default table encuadernacion 2025-04-27 19:24:11 +02:00
0b767c63e9 fix filter ferro 2025-04-27 19:13:06 +02:00
e464652fe2 festivo entity model 2025-04-27 19:01:23 +02:00
dd20f2a20e Merge branch 'maquinista-change-user' into 'main'
Maquinista change user

See merge request jjimenez/safekat!747
2025-04-27 16:54:35 +00:00
97554bffc9 add maquinista change user session 2025-04-27 18:53:24 +02:00
73e9e941ed Merge branch 'main' into maquinista-change-user 2025-04-27 12:25:09 +02:00
05720cf1ce Merge branch 'fix/migrate' into 'main'
fix migrate class name

See merge request jjimenez/safekat!746
2025-04-27 10:20:33 +00:00
04e9e3ee6f fix migrate class name 2025-04-27 12:18:20 +02:00
9804a6a927 change user session 2025-04-27 12:17:31 +02:00
3402e67fb2 Merge branch 'add/envio_ferros' into 'main'
Add/envio ferros

See merge request jjimenez/safekat!745
2025-04-27 10:14:05 +00:00
b1932e6f85 terminado envio de ferros 2025-04-27 12:12:52 +02:00
13ae70236e Merge branch 'feat/sk-44' into 'main'
Feat/sk 44

See merge request jjimenez/safekat!744
2025-04-27 09:00:23 +00:00
4d8332e625 Merge branch 'main' into feat/sk-44 2025-04-27 10:59:41 +02:00
c75d08b3c3 ot pliegos 2025-04-27 10:58:23 +02:00
a0b5f3b4df trabajando en envio de ferros 2025-04-27 09:51:52 +02:00
0e444295e3 trabajando en el formulario envio de ferros 2025-04-27 09:51:04 +02:00
ae7707057a Cambiando titulo pagina 2025-04-27 09:17:46 +02:00
ff115f4f20 Configurando logica de captacion del Excel 2025-04-27 09:16:15 +02:00
45e41c77e4 tablas encuadernacion ot pdf 2025-04-27 08:20:35 +02:00
ae456c8890 Implementado script principal 2025-04-27 00:00:58 +02:00
e8958dc893 Implementado menu lateral 2025-04-26 23:23:04 +02:00
b0ac132e59 Arreglado bug en archivo de migrate del catalogo 2025-04-26 23:05:15 +02:00
b50e564641 Desplegando arcihvos iniciales 2025-04-26 21:32:22 +02:00
894770d6ce Merge branch 'feat/importador_rama' of https://git.imnavajas.es/jjimenez/safekat into feat/importador_rama 2025-04-26 21:25:18 +02:00
367c7c2ea8 Merge branch 'main' into 'feat/importador_rama'
Main

See merge request jjimenez/safekat!743
2025-04-26 19:24:58 +00:00
9375b9b624 Añadiendo idiomas 2025-04-26 21:22:39 +02:00
9a6a4f89a2 Merge branch 'add/files_albaranes' into 'main'
subidos ficheros

See merge request jjimenez/safekat!742
2025-04-26 16:09:09 +00:00
7f31e65960 subidos ficheros 2025-04-26 18:08:41 +02:00
5aa2a2e6c9 Merge branch 'add/logistica_albaranes' into 'main'
Add/logistica albaranes

See merge request jjimenez/safekat!741
2025-04-26 15:27:46 +00:00
dfbcb13ba5 hecho tema albaranes logistica 2025-04-26 17:27:29 +02:00
033184cfa2 Iniciando herramienta de importacion desde catalogo 2025-04-26 16:52:59 +02:00
25b6d14423 falta boton borrar albaranes! 2025-04-26 14:16:32 +02:00
96bd24ae8b Merge branch 'add/impresion_etiquetas_envios' into 'main'
Add/impresion etiquetas envios

See merge request jjimenez/safekat!740
2025-04-26 08:51:24 +00:00
b5b86b4164 terminado a falta de pruebas 2025-04-26 10:50:59 +02:00
ef173ab0fc Merge branch 'main' into add/impresion_etiquetas_envios 2025-04-26 09:56:47 +02:00
f473caf06c Merge branch 'fix/change_pedido_ot_logistica' into 'main'
terminado

See merge request jjimenez/safekat!739
2025-04-26 07:55:29 +00:00
5e8a7f8bd4 terminado 2025-04-26 09:54:56 +02:00
905112334f Merge branch 'fix/php-syntax' into 'main'
<php syntax

See merge request jjimenez/safekat!738
2025-04-25 17:34:29 +00:00
d0f37cb714 <php syntax 2025-04-25 19:32:26 +02:00
151e4a2d7a cambios 2025-04-25 17:50:30 +02:00
05ebfa06df Merge branch 'feat/view-maquinista' into 'main'
Feat/view maquinista

See merge request jjimenez/safekat!737
2025-04-25 11:22:19 +00:00
317 changed files with 42294 additions and 1557 deletions

View File

@ -65,7 +65,7 @@ class OrdenTrabajo extends BaseConfig
["bg" => "yellow", "color" => "black"],
["bg" => "purple", "color" => "white"],
["bg" => "orange", "color" => "white"],
["bg" => "blue", "color" => "black"],
["bg" => "blue", "color" => "white"],
["bg" => "pink", "color" => "black"],
["bg" => "#FFFFFF", "color" => "black"],
];
@ -100,9 +100,9 @@ class OrdenTrabajo extends BaseConfig
];
public array $OT_PLASTIFICADO_COLOR =
[
"BRIL" => ["bg" => "#00B0F0", "color" => "white"],
"BRILLO" => ["bg" => "#00B0F0", "color" => "white"],
"MATE" => ["bg" => "#FF0000", "color" => "white"],
"SOFT_TOUCH" => ["bg" => "#00B050", "color" => "white"],
"SOFT" => ["bg" => "#00B050", "color" => "white"],
"SANDY" => ["bg" => "#782170", "color" => "white"],
"ANTIRAYADO" => ["bg" => "#E97132", "color" => "white"],
"GOFRADO" => ["bg" => "#FFFF00", "color" => "black"],

Binary file not shown.

View File

@ -40,6 +40,8 @@ foreach (glob(APPPATH . 'Config/Routes/*Routes.php') as $routeFile) {
$routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'Users::index', ['as' => 'userList']);
$routes->get('maquinista/change/user','Users::index_maquinista_change_user',['as' => 'maquinistaUserChangeList']);
$routes->get('maquinista/change/session/(:num)','Users::change_user_session/$1',['as' => 'maquinistaChangeUserSession']);
$routes->get('list', 'Users::index', ['as' => 'userList2']);
$routes->get('add', 'Users::add', ['as' => 'newUser']);
$routes->post('add', 'Users::add', ['as' => 'createUser']);
@ -522,6 +524,9 @@ $routes->group('albaranes', ['namespace' => 'App\Controllers\Albaranes'], functi
$routes->post('updateAlbaranLinea', 'Albaran::updateAlbaranLinea');
$routes->post('addIvaAlbaran', 'Albaran::addLineasIva');
$routes->post('nuevaLineaAlbaran', 'Albaran::addBlankLineaAlbaran');
$routes->get('datatable', 'Albaran::datatable', ['as' => 'dataTableOfAlbaranes']);
$routes->get('getAlbaran', 'Albaran::getAlbaran');
$routes->get('edit/(:num)', 'Albaran::editAlbaran/$1', ['as' => 'editarAlbaran']);
});
$routes->resource('albaranes', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Albaran', 'except' => 'show,new,create,update']);
@ -639,6 +644,7 @@ $routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($r
$routes->get('datatable/presupuesto', 'ChatController::datatable_presupuesto_messages', ['as' => 'getDatatablePresupuestoMessages']);
$routes->get('datatable/pedido', 'ChatController::datatable_pedido_messages', ['as' => 'getDatatablePedidoMessages']);
$routes->get('datatable/factura', 'ChatController::datatable_factura_messages', ['as' => 'getDatatableFacturaMessages']);
$routes->get('datatable/ots', 'ChatController::datatable_ot_messages', ['as' => 'getDatatableOtMessages']);
$routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']);
$routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']);
@ -649,6 +655,8 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
$routes->get('presupuesto/(:num)', 'ChatController::get_chat_presupuesto_view/$1', ['as' => 'getChatPresupuestoView']);
$routes->get('pedido/(:num)', 'ChatController::get_chat_pedido_view/$1', ['as' => 'getChatPedidoView']);
$routes->get('factura/(:num)', 'ChatController::get_chat_factura_view/$1', ['as' => 'getChatFacturaView']);
$routes->get('ot/(:num)', 'ChatController::get_chat_ot_view/$1', ['as' => 'getChatOtView']);
$routes->get('direct/conversation/(:num)', 'ChatController::get_chat_direct/$1', ['as' => 'getChatDirect']);
$routes->get('direct/users/select/(:num)', 'ChatController::get_chat_direct_select_users/$1', ['as' => 'getChatDirectSelectUsers']);
@ -744,8 +752,8 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
$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']);
$routes->get("tarea/progress/(:num)","Ordentrabajo::get_orden_trabajo_progress_date/$1");
$routes->get("tarea/progress/(:num)", "Ordentrabajo::get_orden_trabajo_progress_date/$1");
$routes->get('tarea/(:num)', 'Ordentrabajo::find_tarea/$1');
/**======================
* UPDATES
*========================**/
@ -754,21 +762,23 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
$routes->post("reset/date", 'Ordentrabajo::reset_orden_trabajo_date');
$routes->post("update/pedido/date", 'Ordentrabajo::update_orden_trabajo_pedido_date');
$routes->post("reset/pedido/date", 'Ordentrabajo::reset_orden_trabajo_pedido_date');
$routes->post("update/pod/pedido/date/(:num)",'Ordentrabajo::update_pod_pedido_dates/$1');
$routes->post("update/pedido", 'Ordentrabajo::update_orden_trabajo_pedido');
$routes->post("update/user", 'Ordentrabajo::update_orden_trabajo_user');
$routes->post("update", 'Ordentrabajo::update_orden_trabajo');
$routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada');
$routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1');
$routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1');
$routes->post("update/tarea/progress","Ordentrabajo::store_orden_trabajo_progress_date");
$routes->delete("tarea/progress/(:num)","Ordentrabajo::delete_orden_trabajo_progress_date/$1");
$routes->post("update/tarea/progress", "Ordentrabajo::store_orden_trabajo_progress_date");
$routes->post("update/tarea/pliegos", "Ordentrabajo::update_orden_trabajo_pliegos");
$routes->delete("tarea/progress/(:num)", "Ordentrabajo::delete_orden_trabajo_progress_date/$1");
/**======================
* FILES
*========================**/
$routes->post('get_files', 'Ordentrabajo::get_files');
$routes->post('upload_files', 'Ordentrabajo::upload_files');
$routes->get('barcode/(:num)', 'Ordentrabajo::imprimir_codigo_safekat/$1',['as' => "getOrdenTrabajoBarCode"]);
$routes->get('barcode/(:num)', 'Ordentrabajo::imprimir_codigo_safekat/$1', ['as' => "getOrdenTrabajoBarCode"]);
/**======================
* PDF
*========================**/
@ -803,6 +813,7 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi
$routes->get('print/label/test', 'LogisticaController::print_test_label');
$routes->get('panel', 'LogisticaController::panel', ['as' => 'LogisticaPanel']);
$routes->get('envios', 'LogisticaController::gestionEnvios', ['as' => 'gestionEnvios']);
$routes->get('enviosFerros', 'LogisticaController::gestionEnviosFerros', ['as' => 'gestionEnviosFerros']);
$routes->get('datatableEnvios', 'LogisticaController::datatable_envios');
$routes->get('datatableLineasEnvios/(:num)', 'LogisticaController::datatable_enviosEdit/$1');
$routes->get('envio/(:num)', 'LogisticaController::editEnvio/$1');
@ -817,8 +828,13 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi
$routes->post('updateProveedorEnvio', 'LogisticaController::updateProveedorEnvio');
$routes->post('finalizarEnvio', 'LogisticaController::finalizarEnvio');
$routes->post('generateEnvio', 'LogisticaController::generarEnvio');
$routes->get('selectPedidosForEnvio', 'LogisticaController::findPedidosNewEnvio');
$routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio');
$routes->post('generateEnvioFerro', 'LogisticaController::generarEnvioFerro');
$routes->get('selectForNewEnvio', 'LogisticaController::findForNewEnvio');
$routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio');
$routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas');
$routes->get('listAlbaranes', 'LogisticaController::listAlbaranes', ['as' => 'albaranesList']);
});
/*

View File

@ -53,7 +53,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
$routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
$routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);
});
/* Maquinas */
@ -149,5 +148,15 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->group("messages", ["namespace" => 'App\Controllers\Chat'], function ($routes) {
$routes->get('', 'ChatController::config_view', ['as' => 'configMessagesIndex']);
});
});
/* Festivos */
$routes->group("festivos", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'FestivoController::index', ['as' => 'festivosList']);
$routes->post('', 'FestivoController::store_festivo_date', ['as' => 'storeFestivoDate']);
$routes->delete('(:num)', 'FestivoController::delete_festivo_date/$1', ['as' => 'deleteFestivoDate']);
$routes->get('all', 'FestivoController::find_all', ['as' => 'getFindAllFestivos']);
});
});

View File

@ -0,0 +1,25 @@
<?php
use CodeIgniter\Router\RouteCollection;
/** @var RouteCollection $routes */
/* Rutas para tarifas */
$routes->group('importador', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
/* Libros */
$routes->group('catalogo', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
/**======================
* Tool
*========================**/
$routes->get('', 'ImportadorCatalogo::index', ['as' => 'importadorCatalogoTool']);
/**======================
* AJAX
*========================**/
$routes->post('validar-fila', 'ImportadorCatalogo::validarFila');
$routes->post('importar-fila', 'ImportadorCatalogo::importarFila');
});
});

View File

@ -5,22 +5,13 @@ namespace App\Controllers\API;
use App\Controllers\Presupuestos\Presupuestocliente;
use CodeIgniter\RESTful\ResourceController;
use CodeIgniter\API\ResponseTrait;
use App\Models\API\ItemModel;
class ImprimelibrosApi extends ResourceController
{
use ResponseTrait;
public function index()
{
$model = new ItemModel();
$data = $model->findAll();
return $this->respond($data);
}
public function calcular()
{
helper(['form']);

View File

@ -47,6 +47,18 @@ class Albaran extends \App\Controllers\BaseResourceController
}
}
public function editAlbaran($albaran_id){
$albaran = $this->model->find($albaran_id);
if ($albaran == false) {
return redirect()->to(base_url('albaranesList'));
}
$this->viewData['boxTitle'] = lang('Albaran.editAlbaran') . ' ' . $albaran->numero_albaran;
$this->viewData['albaranId'] = $albaran_id;
return view('themes/vuexy/form/logistica/albaranes/viewAlbaranesEdit', $this->viewData);
}
public function addLinea($albaran_id)
{
@ -305,6 +317,23 @@ class Albaran extends \App\Controllers\BaseResourceController
}
}
public function getAlbaran()
{
if ($this->request->isAJAX()) {
$id = $this->request->getGet('id');
$albaran = $this->model->getAlbaranData($id);
$data = [
'success' => true,
'data' => $albaran,
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function generateAlbaran()
{
@ -324,6 +353,32 @@ class Albaran extends \App\Controllers\BaseResourceController
}
}
public function datatable(){
$pedidosFilter = $this->request->getGet('pedidosFilter');
$q = $this->model->getDatatableQuery();
if($pedidosFilter != null && !empty($pedidosFilter)) {
$q->groupStart();
$q->like('t4.id', $pedidosFilter);
$q->groupEnd();
}
$result = DataTable::of($q)
->add(
"action",
callback: function ($q) {
return '
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="' . $q->id . '"></i></a>
</div>
';
}
);
return $result->toJson(returnAsObject: true);
}
public function datatablesLineasAlbaran()
{

View File

@ -1,2 +0,0 @@
Portada Id Cliente Título Edición Autor Archivo ISBN EAN Páginas Acciones
Lo que hay que listar

View File

@ -222,6 +222,25 @@ class ChatController extends BaseController
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
}
}
public function get_chat_ot_view($chat_id)
{
$chat = $this->chatModel->find($chat_id);
$this->viewData['breadcrumb'] = [
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
];
$this->viewData["modelId"] = $chat->orden_trabajo_id;
$this->viewData["type"] = "ot";
$auth_user = auth()->user();
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
if ($chat->chat_department_id) {
return view(static::$viewPath . 'messageChatFactura', $this->viewData);
} else {
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
}
}
public function get_chat(int $chat_id)
{
@ -502,6 +521,23 @@ class ChatController extends BaseController
->toJson(true);
}
public function datatable_ot_messages()
{
$auth_user_id = auth()->user()->id;
$isAdmin = auth()->user()->inGroup('admin');
$query = $this->chatModel->getQueryDatatableMessageOrdenTrabajo($auth_user_id);
return DataTable::of($query)
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
->add("action", fn($q) => ["type" => "ot", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
"view_chat" => lang('Chat.view_chat'),
"view_by_alt_message" => lang('Chat.view_by_alt_message')
]])
->toJson(true);
}
public function get_notifications_not_viewed_from_message(int $chat_message_id)
{
$unviewedNotifications = $this->chatModel->getUsersNotificationNotViewedFromChat($chat_message_id);

View File

@ -0,0 +1,103 @@
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseController;
use App\Controllers\BaseResourceController;
use App\Entities\Configuracion\FestivoEntity;
use App\Models\Collection;
use App\Entities\Configuracion\Imposicion;
use App\Models\Configuracion\FestivoModel;
use App\Models\Configuracion\ImposicionEsquemaModel;
use App\Models\Configuracion\ImposicionModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Hermawan\DataTables\DataTable;
use Psr\Log\LoggerInterface;
class FestivoController extends BaseController
{
protected $modelName = FestivoModel::class;
protected FestivoModel $model;
protected static $controllerSlug = 'festivos';
protected $format = 'json';
protected string $viewPath = 'themes/vuexy/form/configuracion/festivos/';
protected $indexRoute = 'festivoList';
protected array $viewData = [];
protected Validation $validation;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Festivos.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
$this->model = model($this->modelName);
$this->validation = service("validation");
parent::initController($request, $response, $logger);
}
public function index()
{
return view($this->viewPath . $this->indexRoute);
}
public function store_festivo_date()
{
$bodyData = $this->request->getPost();
$date = $bodyData['date'];
$count = $this->model->where('date',$date)->countAllResults();
if ($count) {
$status = $this->model->where('date', $date)->delete(purge: true);
return $this->response->setJSON([
"message" => lang("App.user_alert_delete"),
"status" => $status,
]);
} else {
$status = $this->model->insert($bodyData);
if ($status) {
$festivoEntity = $this->model->find($status);
return $this->response->setJSON([
"message" => lang("App.global_alert_save_success"),
"status" => $status,
"data" => $festivoEntity
]);
} else {
return $this->response->setJSON([
"message" => lang("App.global_alert_save_error"),
"errors" => $this->model->errors(),
"status" => true
])->setStatusCode(400);
}
}
}
public function delete_festivo_date($id)
{
$status = $this->model->delete($id, true);
if ($status) {
return $this->response->setJSON([
"message" => lang("App.user_alert_delete"),
"status" => $status,
]);
} else {
return $this->response->setJSON([
"message" => lang("App.global_alert_save_error"),
"errors" => $this->model->errors(),
"status" => true
])->setStatusCode(400);
}
}
public function find_all()
{
$festivos = $this->model->findAll();
return $this->response->setJSON([
"message" => lang("App.global_alert_fetch_success"),
"status" => true,
"data" => $festivos
]);
}
}

View File

@ -1,4 +1,6 @@
<?php namespace App\Controllers\Configuracion;
<?php
namespace App\Controllers\Configuracion;
use App\Entities\Usuarios\UserEntity;
use App\Models\Chat\ChatDeparmentModel;
@ -54,7 +56,6 @@ class Users extends \App\Controllers\GoBaseController
];
parent::initController($request, $response, $logger);
}
public function index()
@ -87,7 +88,7 @@ class Users extends \App\Controllers\GoBaseController
// Marcar el username como NULL
$sanitizedData = $this->sanitized($postData, true);
$noException = true;
// Obtener proveedor de usuarios
@ -118,11 +119,10 @@ class Users extends \App\Controllers\GoBaseController
} // Email is not unique!
else {
$this->viewData['errorMessage'] = "El correo '". $sanitizedData['email'] ."' ya está registrado en el sistema";
$this->viewData['errorMessage'] = "El correo '" . $sanitizedData['email'] . "' ya está registrado en el sistema";
$this->session->setFlashdata('formErrors', $this->model->errors());
$successfulResult = false; // Hacked
}
} catch (\Exception $e) {
$noException = false;
$this->viewData['errorMessage'] = $e->getMessage();
@ -234,7 +234,6 @@ class Users extends \App\Controllers\GoBaseController
} else {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
}
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
@ -319,8 +318,6 @@ class Users extends \App\Controllers\GoBaseController
$message = "Usuario eliminado correctamente";
return $this->redirect2listView('successMessage', $message);
} // end function delete(...)
@ -374,9 +371,10 @@ class Users extends \App\Controllers\GoBaseController
}
}
public function datatable(){
public function datatable()
{
if($this->request->isAJAX()){
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -405,7 +403,6 @@ class Users extends \App\Controllers\GoBaseController
$this->model->getResource([])->countAllResults(),
$this->model->getResource($searchValues)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
@ -447,4 +444,27 @@ class Users extends \App\Controllers\GoBaseController
return $data;
}
public function index_maquinista_change_user()
{
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_change_session"), 'route' => route_to('maquinistaUserChangeList'), 'active' => true]
];
$maquinistas = [];
$users = auth()->getProvider()->whereNotIn('id',[auth()->user()->id])->findAll();
foreach ($users as $key => $user) {
if ($user->inGroup('maquina') && !$user->inGroup('admin', 'comercial', 'cliente-editor', 'cliente-admin')) {
$maquinistas[] = $user;
}
}
$this->viewData['maquinistas'] = $maquinistas;
return view('/themes/vuexy/form/produccion/maquinista/viewMaquinistaCambioUserList.php', $this->viewData);
}
public function change_user_session(int $user_id)
{
// Check the credentials
$user = auth()->getProvider()->findById($user_id);
auth()->logout();
auth()->login($user);
return redirect("home");
}
}

View File

@ -0,0 +1,314 @@
<?php
namespace App\Controllers\Importadores;
use App\Controllers\BaseResourceController;
use App\Entities\Catalogo\CatalogoLibroEntity;
use App\Models\Catalogo\CatalogoLibroModel;
use App\Controllers\Presupuestos\Presupuestocliente;
class ImportadorCatalogo extends BaseResourceController
{
protected $modelName = CatalogoLibroModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Importador';
protected static $singularObjectNameCc = 'ImportadorCatalogo';
protected static $pluralObjectName = 'Importadores';
protected static $pluralObjectNameCc = 'importadores';
protected static $controllerSlug = 'importador';
protected static $viewPath = 'themes/vuexy/form/importador/catalogo/';
protected $indexRoute = 'ImportadorCatalogoTool';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Importador.listingPage');
$this->viewData['usingSweetAlert'] = true;
// Breadcrumbs (IMN)
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_importadores"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_importadores_catalogo"), 'route' => route_to('importadorCatalogoTool'), 'active' => true]
];
parent::initController($request, $response, $logger);
}
public function index()
{
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Importador.importadorCatalogoTitle')]),
'catalogoLibrosEntity' => new CatalogoLibroEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewImportadorCatalogoTool', $viewData);
}
public function validarFila()
{
$json = $this->request->getJSON();
if (!$json || !isset($json->fila[0])) {
return $this->response->setJSON([
'apto' => false,
'reason' => 'Datos inválidos'
]);
}
$input = trim($json->fila[0]); // Asumimos que 'input' es el primer campo de la fila
if (empty($input)) {
return $this->response->setJSON([
'apto' => false,
'reason' => 'ISBN no proporiconado'
]);
}
$catalogoModel = new CatalogoLibroModel();
// 1. Buscar por ISBN exacto
$libroPorIsbn = $catalogoModel->where('isbn', $input)->first();
if ($libroPorIsbn) {
return $this->response->setJSON([
'apto' => true
]);
}
// 2. Buscar por EAN sin guiones
$eanLimpio = str_replace('-', '', $input);
$libroPorEan = $catalogoModel->where('REPLACE(ean, "-", "")', $eanLimpio)->first();
if ($libroPorEan) {
return $this->response->setJSON([
'apto' => true
]);
}
// No encontrado
return $this->response->setJSON([
'apto' => false,
'reason' => 'No encontrado en catálogo'
]);
}
public function importarFila()
{
$json = $this->request->getJSON();
if (!$json || !isset($json->fila[0])) {
return $this->response->setJSON([
'success' => false,
'message' => 'Datos inválidos.'
]);
}
// Mapear cada columna a una variable
$isbn = isset($json->fila[0]) ? trim($json->fila[0]) : null;
$refCliente = isset($json->fila[1]) ? trim($json->fila[1]) : null;
//$descripcion = isset($json->fila[2]) ? trim($json->fila[2]) : null;
$tirada = isset($json->fila[3]) ? (float) $json->fila[3] : null;
$precio_compra = isset($json->fila[4]) ? (float) $json->fila[4] : null;
if (empty($isbn)) {
return $this->response->setJSON([
'success' => false,
'message' => 'Input vacío o no proporcionado.'
]);
}
$catalogoModel = new CatalogoLibroModel();
// 1. Buscar por ISBN exacto
$libro = $catalogoModel->where('isbn', $isbn)->first();
// 2. Si no, buscar por EAN sin guiones
if (!$libro) {
$eanLimpio = str_replace('-', '', $isbn);
$libro = $catalogoModel->where('REPLACE(ean, "-", "")', $eanLimpio)->first();
}
if (!$libro) {
return $this->response->setJSON([
'success' => false,
'message' => 'No se encontró el libro en el catálogo.'
]);
}
// Aquí ya tenemos el libro correcto.
// Ahora se prepara la "inserción" o el "registro" a importar
// Variables intermedias
$colorPaginas = (int) ($libro->color_paginas ?? 0);
$negroPaginas = (int) ($libro->negro_paginas ?? 0);
$papelInteriorDiferente = ($colorPaginas > 0 && $negroPaginas > 0) ? 1 : 0;
// --- Interior (lo que cambiamos ahora)
if ($papelInteriorDiferente) {
// Mixto: páginas en negro + color
$interior = [
'papelInterior' => [
'negro' => $libro->negro_papel_id,
'color' => $libro->color_papel_id,
],
'gramajeInterior' => [
'negro' => $libro->negro_gramaje,
'color' => $libro->color_gramaje,
]
];
} else {
// SOLO un tipo: negro O color
$colorPaginas = (int) ($libro->color_paginas ?? 0);
$negroPaginas = (int) ($libro->negro_paginas ?? 0);
if ($colorPaginas > 0 && $negroPaginas == 0) {
// Libro completamente en color
$interior = [
'papelInterior' => $libro->color_papel_id,
'gramajeInterior' => $libro->color_gramaje,
];
} else {
// Libro completamente en blanco y negro
$interior = [
'papelInterior' => $libro->negro_papel_id,
'gramajeInterior' => $libro->negro_gramaje,
];
}
}
// Sobrecubierta
$sobrecubierta = [];
if (!is_null($libro->sobrecubierta_paginas)) {
$sobrecubierta['papel'] = $libro->sobrecubierta_papel_id;
$sobrecubierta['gramaje'] = $libro->sobrecubierta_gramaje;
$sobrecubierta['solapas'] = $libro->sobrecubierta_solapas;
$sobrecubierta['acabado'] = $libro->sobrecubierta_acabado_id;
}
$dataToImport = [
'selectedTirada' => $tirada,
'datosCabecera' => [
'titulo' => $libro->titulo,
'autor' => $libro->autor,
'isbn' => $isbn,
'coleccion' => $libro->coleccion,
'referenciaCliente' => $refCliente
],
'tirada' => array_values(array_filter([
$tirada,
null,
null,
null,
])),
'tamanio' => [
'ancho' => $libro->ancho,
'alto' => $libro->alto
],
'tipo' => "",
'tipo_presupuesto_id' => $libro->encuadernacion_id,
'clienteId' => 251,
'isColor' => (in_array(strtolower($libro->tipo_impresion), ['color', 'colorhq']) ? 1 : 0),
'isHq' => (in_array(strtolower($libro->tipo_impresion), ['negrohq', 'colorhq']) ? 1 : 0),
'paginas' => $libro->paginas,
'paginasColor' => $colorPaginas,
'papelInteriorDiferente' => $papelInteriorDiferente,
'paginasCuadernillo' => 32,
'interior' => $interior,
'cubierta' => [
'papelCubierta' => $libro->cubierta_papel_id,
'gramajeCubierta' => $libro->cubierta_gramaje,
'solapas' => $libro->cubierta_ancho_solapas,
'acabado' => $libro->cubierta_acabado_id,
'cabezada' => 'WHI',
'lomoRedondo' => 0
],
'guardas' => [],
'sobrecubierta' => $sobrecubierta,
'faja' => [],
'entrega_taller' => 1,
];
/*return $this->response->setJSON([
'success' => true,
'message' => 'Libro encontrado y preparado para importar.',
'data' => $dataToImport
]);*/
// Procedemos a intentar guardar el presupuesto
// Instancia de presupuesto cliente
$presupuestocliente = new Presupuestocliente();
try {
$response = $presupuestocliente->guardar($dataToImport);
// DEBUG LINE
//return $this->respond($response);
if (!isset($response['sk_id'])) {
return $this->respond([
'status' => 400,
'error' => 'Missing sk_id',
'message' => 'El identificador sk_id es requerido pero no se recibió.'
], 400);
}
$response = [
'status' => 200,
'error' => null,
'data' => [
'sk_id' => $response['sk_id'],
'sk_url' => $response['sk_url'] ?? null
]
];
// Ajuste del precio a RAMA
$dataToUpdate = [
'total_aceptado' => ($tirada * $precio_compra),
'total_aceptado_revisado' => ($tirada * $precio_compra),
'total_precio_unidad' => $precio_compra
];
$presupuestoModel = model('App\Models\Presupuestos\Presupuestomodel');
$presupuestoModel->update($response['data']['sk_id'], $dataToUpdate);
return $this->respond($response);
} catch (\Exception $e) {
return $this->respond([
'status' => 500,
'error' => 'Server error',
'message' => 'Error inesperado durante el procesado',
'debug' => $e->getMessage()
]);
}
}
}

View File

@ -62,6 +62,7 @@ class LogisticaController extends BaseController
'currentModule' => static::$controllerSlug,
'boxTitle' => lang('Logistica.gestionEnvios'),
'usingServerSideDataTable' => true,
'tipo_envio' => 'estandar',
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
@ -70,11 +71,44 @@ class LogisticaController extends BaseController
}
public function findPedidosNewEnvio()
public function gestionEnviosFerros()
{
$viewData = [
'currentModule' => static::$controllerSlug,
'boxTitle' => lang('Logistica.envioFerros'),
'usingServerSideDataTable' => true,
'tipo_envio' => 'ferro_prototipo',
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewLogisticaSelectEnvios', $viewData);
}
public function listAlbaranes(){
$viewData = [
'currentModule' => static::$controllerSlug,
'boxTitle' => lang('Albaran.albaranes'),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . '/albaranes/viewAlbaranesList', $viewData);
}
public function findForNewEnvio()
{
if ($this->request->isAJAX()) {
$query = LogisticaService::findPedidosNewEnvio();
$tipo_envio = $this->request->getGet('tipo_envio') ?? 'estandar';
if($tipo_envio == 'ferro_prototipo'){
$query = LogisticaService::findForNewEnvioFerro();
} else {
$query = LogisticaService::findForNewEnvio();
}
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("id", $this->request->getGet("q"))
@ -94,12 +128,12 @@ class LogisticaController extends BaseController
public function selectDireccionForEnvio(){
if ($this->request->isAJAX()) {
$pedido_id = $this->request->getGet('pedido_id');
if($pedido_id == null || $pedido_id == 0){
$ot = $this->request->getGet('ot_id');
if($ot == null || $ot == 0){
return [];
}
$searchVal = $this->request->getGet("q") ?? "";
$result = LogisticaService::findDireccionesNewEnvio($pedido_id, $searchVal);
$result = LogisticaService::findDireccionesNewEnvio($ot, $searchVal);
return $this->response->setJSON($result);
} else {
@ -109,34 +143,91 @@ class LogisticaController extends BaseController
public function searchPedidoOrISBN($search = "", $envio_id = null)
{
if (empty($search)) {
$result = [
'status' => false,
'message' => lang('Logistica.errors.noDataToFind'),
];
return $this->response->setJSON($result);
}
$result = LogisticaService::findPedidoOrISBN($search);
return $this->response->setJSON($result);
}
public function generarEnvio()
{
if ($this->request->isAJAX()) {
$pedido_id = $this->request->getPost('pedido_id');
$direccion = $this->request->getPost('direccion');
$result = LogisticaService::generateEnvio($pedido_id, $direccion);
$ot_id = $this->request->getPost('ot_id');
$direccion = $this->request->getPost('direccion') ?? "";
$result = LogisticaService::generateEnvio($ot_id, $direccion);
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function generarEnvioFerro()
{
if ($this->request->isAJAX()) {
$ot_id = $this->request->getPost('ot_id');
$result = LogisticaService::generateEnvioFerro($ot_id);
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function imprimirEtiquetas()
{
if ($this->request->isAJAX()) {
$envio_id = $this->request->getPost('envio_id');
$ids = $this->request->getPost('envio_lineas');
$cajas = $this->request->getPost('cajas');
$printer_id = $this->request->getPost('printer_id');
if($cajas == null || $cajas == 0){
return $this->response->setJSON([
'status' => false,
'message' => 'Cajas no válidas'
]);
}
$model = model('App\Models\Logistica\EnvioModel');
$envio = $model->select('envios.*, clientes.nombre as cliente')
->join('clientes', 'clientes.id = envios.cliente_id', 'left')
->where('envios.id', $envio_id)
->first();
if($envio == null){
return $this->response->setJSON([
'status' => false,
'message' => 'Envio no válido'
]);
}
$model = model('App\Models\Logistica\EnvioLineaModel');
$lineas = $model->select('envios_lineas.*, presupuestos.titulo as titulo, presupuestos.referencia_cliente as referencia_cliente')
->join('presupuestos', 'presupuestos.id = envios_lineas.presupuesto_id', 'left')
->whereIn('envios_lineas.id', $ids)->findAll();
if($lineas == null){
return $this->response->setJSON([
'status' => false,
'message' => 'Lineas no válidas'
]);
}
$modelImpresora = model('App\Models\Configuracion\ImpresoraEtiquetaModel');
$impresora = $modelImpresora->select('id, name, ip, port, user, pass')
->where('deleted_at', null)
->where('id', $printer_id)
->orderBy('name', 'asc')
->first();
if($impresora == null){
return $this->response->setJSON([
'status' => false,
'message' => 'Impresora no válida'
]);
}
$response = LogisticaService::generateEtiquetasTitulos($envio, $lineas, $impresora, $cajas);
return $this->response->setJSON($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function selectAddEnvioLinea()
{
@ -176,8 +267,18 @@ class LogisticaController extends BaseController
public function datatable_envios()
{
$otsFilter = $this->request->getGetPost('otsFilter');
$tipo_envio = $this->request->getGetPost('tipo_envio') ?? 'estandar';
$model = model('App\Models\Logistica\EnvioModel');
$q = $model->getDatatableQuery();
$q = $model->getDatatableQuery($tipo_envio);
if (!empty($otsFilter)) {
$q->groupStart();
$q->like('t5.id', $otsFilter);
$q->groupEnd();
}
$result = DataTable::of($q)
@ -227,6 +328,14 @@ class LogisticaController extends BaseController
$envioEntity->proveedor_nombre = $proveedor->nombre;
}
$modelImpresora = model('App\Models\Configuracion\ImpresoraEtiquetaModel');
$impresoras = $modelImpresora->select('id, name')
->where('deleted_at', null)
->where('tipo', 1)
->orderBy('name', 'asc')
->findAll();
$envioEntity->impresoras = $impresoras;
$viewData = [
'currentModule' => static::$controllerSlug,
'boxTitle' => '<i class="ti ti-truck ti-xl"></i>' . ' ' . lang('Logistica.envio') . ' [' . $envioEntity->id . ']: ' . $envioEntity->direccion,
@ -298,7 +407,7 @@ class LogisticaController extends BaseController
)->edit(
"unidadesEnvio",
function ($row, $meta) {
if($row->finalizado == 1){
if($row->finalizado == 1 || $row->tipo_envio == 'ferro_prototipo'){
return $row->unidadesEnvio;
}
return '<input type="number" class="form-control input-lineas input-unidades text-center"

View File

@ -54,6 +54,7 @@ class Presupuestodirecciones extends \App\Controllers\BaseResourceController
$proveedor = $reqData['proveedor'] ?? "";
$proveedor_id = $reqData['proveedor_id'] ?? "";
$entregaPieCalle = $reqData['entregaPieCalle'] ?? 0;
$is_ferro_prototipo = $reqData['is_ferro_prototipo'] ?? 0;
$data = [
"presupuesto_id" => $presupuesto_id,
@ -73,6 +74,7 @@ class Presupuestodirecciones extends \App\Controllers\BaseResourceController
"proveedor" => $proveedor,
"proveedor_id" => $proveedor_id,
"entregaPieCalle" => $entregaPieCalle,
"is_ferro_prototipo" => $is_ferro_prototipo
];
$response = $this->model->insert($data);

View File

@ -70,6 +70,11 @@ class Ordentrabajo extends BaseController
}
public function find_tarea($orden_trabajo_tarea_id)
{
$t = $this->otTarea->find($orden_trabajo_tarea_id);
return $this->response->setJSON($t);
}
public function get_orden_trabajo_summary($orden_trabajo_id)
{
try {
@ -100,10 +105,22 @@ class Ordentrabajo extends BaseController
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);
$tareaEntity = $this->otTarea->find($bodyData["orden_trabajo_tarea_id"]);
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $tareaEntity]);
} else {
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
}
}
public function update_orden_trabajo_pliegos()
{
$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"])->updateOrdenTrabajoTareaPliegos($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);
@ -128,7 +145,7 @@ class Ordentrabajo extends BaseController
$validated = $this->validation->run($bodyData, "orden_trabajo_date");
if ($validated) {
$validatedData = $bodyData;
$r = $this->produccionService->emptyOrdenTrabajoDate($validatedData['orden_trabajo_id'],$validatedData['name']);
$r = $this->produccionService->emptyOrdenTrabajoDate($validatedData['orden_trabajo_id'], $validatedData['name']);
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "user" => auth()->user(), "data" => $bodyData]);
} else {
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
@ -225,7 +242,7 @@ class Ordentrabajo extends BaseController
{
$logo = config(LogoImpresion::class);
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null);
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro',1)->where("ferro_ok_at", null);
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
@ -240,7 +257,7 @@ class Ordentrabajo extends BaseController
{
$logo = config(LogoImpresion::class);
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE);
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro',1)->where("ferro_ok_at is NOT NULL", NULL, FALSE);
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
@ -524,10 +541,10 @@ class Ordentrabajo extends BaseController
{
return view(static::$viewPath . '/maquinista/viewMaquinistaPlanningList', $this->viewData);
}
public function maquinista_maquina_tareas_datatable(string $content , int $maquina_id)
public function maquinista_maquina_tareas_datatable(string $content, int $maquina_id)
{
$pm = $this->produccionService->getMaquinaImpresionTareasList($maquina_id);
if($content == 'today'){
if ($content == 'today') {
$pm->like('pedidos.fecha_impresion', Time::now()->format('Y-m-d'));
}
return DataTable::of($pm)
@ -568,4 +585,17 @@ class Ordentrabajo extends BaseController
];
return $this->response->setJSON($data);
}
public function update_pod_pedido_dates($orden_trabajo_id)
{
$this->produccionService->init($orden_trabajo_id);
if($this->produccionService->isPOD){
$status = $this->produccionService->updatePodDates();
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status, "data" => $this->produccionService->getPedido()]);
}else{
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => false, "data" => $this->produccionService->getPedido()]);
}
}
}

View File

@ -11,76 +11,85 @@ class CreateCatalogoLibros extends Migration
$this->db->query('SET foreign_key_checks = 0');
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'auto_increment' => true],
'cliente_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'proveedor_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'user_created_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
'user_update_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
'cubierta_archivo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'cubierta_url' => ['type' => 'VARCHAR', 'constraint' => 500, 'null' => true],
'ancho' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
'alto' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
'peso' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'null' => true],
'titulo' => ['type' => 'VARCHAR', 'constraint' => 300],
'autor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'autor_entidad' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'traductor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'ilustrador' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'idioma' => ['type' => 'VARCHAR', 'constraint' => 3, 'default' => 'spa'],
'num_edic' => ['type' => 'INT', 'default' => 1, 'null' => true],
'fecha_disponibilidad' => ['type' => 'DATE', 'null' => true],
'fecha_public' => ['type' => 'DATE', 'null' => true],
'num_fotos' => ['type' => 'INT', 'default' => 0],
'num_ilustr' => ['type' => 'INT', 'default' => 0],
'num_ilustr_color' => ['type' => 'INT', 'default' => 0],
'num_ilustr_bn' => ['type' => 'INT', 'default' => 0],
'coleccion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'isk' => ['type' => 'VARCHAR', 'constraint' => 64, 'null' => true],
'isbn' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'ean' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'editorial' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'resumen' => ['type' => 'TEXT', 'null' => true],
'resumen_breve' => ['type' => 'TEXT', 'null' => true],
'sello' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'paginas' => ['type' => 'INT'],
'tipo_impresion' => ['type' => 'ENUM', 'constraint' => ['negro','negrohq','color','colorhq'], 'null' => true],
'comentarios' => ['type' => 'TEXT', 'null' => true],
'negro_paginas' => ['type' => 'INT', 'null' => true],
'negro_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'negro_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'negro_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'negro_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'color_paginas' => ['type' => 'INT', 'null' => true],
'color_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'color_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'color_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'color_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'cubierta_paginas' => ['type' => 'INT', 'null' => true],
'cubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'cubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
'cubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'sobrecubierta_paginas' => ['type' => 'INT', 'null' => true],
'sobrecubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'auto_increment' => true],
'cliente_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'proveedor_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'user_created_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
'user_update_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
'cubierta_archivo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'cubierta_url' => ['type' => 'VARCHAR', 'constraint' => 500, 'null' => true],
'ancho' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
'alto' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
'peso' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'null' => true],
'titulo' => ['type' => 'VARCHAR', 'constraint' => 300],
'autor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'autor_entidad' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'traductor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'ilustrador' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'idioma' => ['type' => 'VARCHAR', 'constraint' => 3, 'default' => 'spa'],
'num_edic' => ['type' => 'INT', 'default' => 1, 'null' => true],
'fecha_disponibilidad' => ['type' => 'DATE', 'null' => true],
'fecha_public' => ['type' => 'DATE', 'null' => true],
'num_fotos' => ['type' => 'INT', 'default' => 0],
'num_ilustr' => ['type' => 'INT', 'default' => 0],
'num_ilustr_color' => ['type' => 'INT', 'default' => 0],
'num_ilustr_bn' => ['type' => 'INT', 'default' => 0],
'coleccion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'isk' => ['type' => 'VARCHAR', 'constraint' => 64, 'null' => true],
'isbn' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'ean' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'editorial' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'resumen' => ['type' => 'TEXT', 'null' => true],
'resumen_breve' => ['type' => 'TEXT', 'null' => true],
'sello' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'paginas' => ['type' => 'INT'],
'tipo_impresion' => ['type' => 'ENUM', 'constraint' => ['negro', 'negrohq', 'color', 'colorhq'], 'null' => true],
'comentarios' => ['type' => 'TEXT', 'null' => true],
'negro_paginas' => ['type' => 'INT', 'null' => true],
'negro_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'negro_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'negro_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'negro_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'color_paginas' => ['type' => 'INT', 'null' => true],
'color_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'color_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'color_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'color_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'cubierta_paginas' => ['type' => 'INT', 'null' => true],
'cubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'cubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
'cubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'sobrecubierta_paginas' => ['type' => 'INT', 'null' => true],
'sobrecubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'sobrecubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
'sobrecubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'encuadernacion_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'ubicacion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'created_at' => ['type' => 'TIMESTAMP', 'default' => 'CURRENT_TIMESTAMP'],
'updated_at' => ['type' => 'TIMESTAMP', 'null' => true],
'deleted_at' => ['type' => 'TIMESTAMP', 'null' => true],
'sobrecubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'encuadernacion_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'ubicacion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'created_at' => [
'type' => 'TIMESTAMP',
'default' => new \CodeIgniter\Database\RawSql('CURRENT_TIMESTAMP'),
],
'updated_at' => [
'type' => 'TIMESTAMP',
'null' => true,
],
'deleted_at' => [
'type' => 'TIMESTAMP',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addUniqueKey('isk');
$this->forge->addForeignKey('cliente_id', 'clientes', 'id');
$this->forge->createTable('catalogo_libros');
$this->forge->createTable('catalogo_libros',true);
$this->db->query('SET foreign_key_checks = 1');
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Database\Migrations;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
use CodeIgniter\I18n\Time;
class AddFerroProtoPresupuestoDirecciones extends Migration
{
protected array $COLUMNS = [
"is_ferro_prototipo" => [
"type" => "TINYINT",
"unsigned" => true,
"default" => 0,
"comment" => "Indica si es una direccion para el prototipo o ferro",
],
];
public function up()
{
$this->forge->addColumn('presupuesto_direcciones', $this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('presupuesto_direcciones', array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Database\Migrations;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
use CodeIgniter\I18n\Time;
class AddTipoEnvioEnvios extends Migration
{
protected array $COLUMNS = [
"tipo_envio" => [
"type" => "enum",
"constraint" => ['estandar', 'ferro_prototipo'],
"default" => 'estandar',
"comment" => "Indica el tipo de envio",
],
];
public function up()
{
$this->forge->addColumn('envios', $this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('envios', array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddPliegoColumnOrdenTrabajoTarea extends Migration
{
protected array $COLUMNS = [
"pliego_1" => [
"type" => "INT",
"unsigned" => true,
"default" => 0,
],
"pliego_1_total" => [
"type" => "INT",
"unsigned" => true,
"default" => 0,
],
"pliego_2" => [
"type" => "INT",
"unsigned" => true,
"default" => 0,
],
"pliego_2_total" => [
"type" => "INT",
"unsigned" => true,
"default" => 0,
],
];
public function up()
{
$this->forge->addColumn('orden_trabajo_tareas', $this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('orden_trabajo_tareas', array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AlterFkOrdenTrabajoTareaProgressDates extends Migration
{
public function up()
{
$this->forge->dropForeignKey('orden_trabajo_tarea_progress_dates','orden_trabajo_tarea_progress_dates_ot_tarea_id_foreign');
$this->forge->addForeignKey("ot_tarea_id","orden_trabajo_tareas","id",'CASCADE','CASCADE');
$this->forge->processIndexes('orden_trabajo_tarea_progress_dates');
}
public function down()
{
$this->forge->dropForeignKey('orden_trabajo_tarea_progress_dates','orden_trabajo_tarea_progress_dates_ot_tarea_id_foreign');
$this->forge->addForeignKey("ot_tarea_id","orden_trabajo_tareas","id");
$this->forge->processIndexes('orden_trabajo_tarea_progress_dates');
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\RawSql;
use CodeIgniter\Database\Migration;
class CreateTableFestivos extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"date" => [
"type" => "DATE",
"unique" => true,
],
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->addPrimaryKey('id');
$this->forge->createTable("festivos", true);
}
public function down()
{
//
$this->forge->dropTable("festivos", true);
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AlterTarifasAcabadoAddBoleanColumns extends Migration
{
protected array $COLUMNS = [
'plastificado' => [
'type' => 'BOOLEAN',
'default' => false,
],
'plakene' => [
'type' => 'BOOLEAN',
'default' => false,
],
'rectractilado' => [
'type' => 'BOOLEAN',
'default' => false,
],
'estampado' => [
'type' => 'BOOLEAN',
'default' => false,
],
'uvi' => [
'type' => 'BOOLEAN',
'default' => false,
],
'plastificado_tipo' => [
'type' => 'ENUM',
'constraint' => ['BRILLO','MATE','SANDY','GOFRADO','SOFT','ANTIRAYADO'],
'null' => true,
],
'plakene_tipo' => [
'type' => 'ENUM',
'constraint' => ['TRASLUCIDO','MATE','NEGRO'],
'null' => true,
],
'rectractilado_tipo' => [
'type' => 'ENUM',
'constraint' => ['1','3','5'],
'null' => true,
],
'estampado_tipo' => [
'type' => 'ENUM',
'constraint' => ['ORO','PLATA','COBRE','BRONCE'],
'null' => true,
],
'uvi_tipo' => [
'type' => 'ENUM',
'constraint' => ['2D','3D','BRAILLE'],
'null' => true,
]
];
public function up()
{
$this->forge->addColumn('lg_tarifa_acabado',$this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('lg_tarifa_acabado',array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Database\Seeds;
use App\Models\Configuracion\ConfigVariableModel;
use App\Models\Configuracion\MaquinaTareaModel;
use CodeIgniter\Database\Seeder;
class PedidoPodSeeder extends Seeder
{
public function run()
{
$m = model(ConfigVariableModel::class);
$data = [
[
"name" => "pod_impresion_dias_tras_confirmacion",
"value" => 1,
"description" => "Días a los que se establece la fecha de impresion en pedido tras confirmación"
],
[
"name" => "pod_encuadernacion_dias_tras_confirmacion",
"value" => 2,
"description" => "Días a los que se establece la fecha de encuadernación en pedido tras confirmación"
],
[
"name" => "pod_entrega_real_dias_tras_confirmacion",
"value" => 5,
"description" => "Días a los que se establece la fecha entrega real en pedido tras confirmación"
],
[
"name" => "pod_embalaje_dias_tras_confirmacion",
"value" => 4,
"description" => "Días a los que se establece la fecha de encuadernación en pedido tras confirmación"
],
];
foreach ($data as $key => $row) {
if($m->getVariable($row['name']) == null)
{
$m->insert($row);
}
}
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity\Entity;
class FestivoEntity extends Entity
{
protected $attributes = [
"id" => null,
"date" => null,
];
protected $casts = [];
}

View File

@ -31,5 +31,6 @@ class EnvioEntity extends Entity
'created_at' => 'datetime',
'updated_at' => 'datetime',
'cajas' => 'int',
'tipo_envio' => 'string',
];
}

View File

@ -1,7 +1,9 @@
<?php
namespace App\Entities\Presupuestos;
use App\Entities\Compras\ProveedorEntity;
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
use App\Models\Compras\ProveedorModel;
use App\Models\Configuracion\MaquinaModel;
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
use App\Models\Tarifas\Maquinas\TarifaAcabadoMaquinaModel;
@ -54,5 +56,13 @@ class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
$m = model(TarifaAcabadoModel::class);
return $m->find($this->attributes["tarifa_acabado_id"]);
}
public function proveedor(): ?ProveedorEntity
{
$proveedor = null;
$m = model(ProveedorModel::class);
if ($this->attributes["proveedor_id"]) {
$proveedor = $m->find($this->attributes["proveedor_id"]);
}
return $proveedor;
}
}

View File

@ -25,6 +25,7 @@ class PresupuestoDireccionesEntity extends \CodeIgniter\Entity\Entity
"proveedor_id" => null,
"margen" => null,
"entregaPieCalle" => null,
"is_ferro_prototipo" => null,
];
protected $casts = [
"presupuesto_id" => "int",
@ -38,6 +39,7 @@ class PresupuestoDireccionesEntity extends \CodeIgniter\Entity\Entity
"margen" => "float",
"proveedor_id" => "int",
"entregaPieCalle" => "int",
"is_ferro_prototipo" => "int",
];
}

View File

@ -1,7 +1,10 @@
<?php
namespace App\Entities\Presupuestos;
use App\Entities\Compras\ProveedorEntity;
use App\Entities\Tarifas\TarifaEncuadernacionEntity;
use App\Models\Compras\ProveedorModel;
use App\Models\Configuracion\MaquinaModel;
use App\Models\Tarifas\Maquinas\TarifaEncuadernacionMaquinaModel;
use App\Models\Tarifas\TarifaEncuadernacionModel;
@ -32,10 +35,10 @@ class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
"precio_total" => "float",
"margen" => "float",
];
public function maquinas() : array
public function maquinas(): array
{
$m = model(TarifaEncuadernacionMaquinaModel::class);
$tarifa_maquinas = $m->where("tarifa_encuadernacion_id",$this->attributes["tarifa_encuadernado_id"])->findAll();
$tarifa_maquinas = $m->where("tarifa_encuadernacion_id", $this->attributes["tarifa_encuadernado_id"])->findAll();
$maquinaModel = model(MaquinaModel::class);
$maquinas = [];
foreach ($tarifa_maquinas as $key => $tarifa_maquina) {
@ -43,9 +46,18 @@ class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
}
return $maquinas;
}
public function tarifa() : TarifaEncuadernacionEntity
public function tarifa(): TarifaEncuadernacionEntity
{
$m = model(TarifaEncuadernacionModel::class);
return $m->find($this->attributes["tarifa_encuadernado_id"]);
}
public function proveedor(): ?ProveedorEntity
{
$proveedor = null;
$m = model(ProveedorModel::class);
if ($this->attributes["proveedor_id"]) {
$proveedor = $m->find($this->attributes["proveedor_id"]);
}
return $proveedor;
}
}

View File

@ -210,35 +210,35 @@ 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 presupuestoLineaImpresion(): PresupuestoLineaEntity
public function presupuestoLineaCubierta(): ?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();
$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 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
@ -247,70 +247,81 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
{
$model = model(PresupuestoLineaModel::class);
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_sobrecubierta"])->first();
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo", ["lp_sobrecubierta"])->first();
return $q;
}
public function hasSobrecubierta() : bool
public function presupuestoLineaGuarda(): ?PresupuestoLineaEntity
{
$model = model(PresupuestoLineaModel::class);
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo", ["lp_guardas"])->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){
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo", ["lp_sobrecubierta"])->countAllResults();
if ($q > 0) {
$hasSobrecubierta = true;
}
return $hasSobrecubierta;
}
public function cliente() : ClienteEntity
public function cliente(): ?ClienteEntity
{
$m = model(ClienteModel::class);
return $m->find($this->attributes["cliente_id"]);
if ($this->attributes['cliente_id']) {
return $m->find($this->attributes["cliente_id"]);
} else {
return null;
}
}
public function encuadernaciones(): array
{
$m = model(PresupuestoEncuadernacionesModel::class);
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
return $m->where("presupuesto_id", $this->attributes["id"])->findAll();
}
public function acabados(): array
{
$m = model(PresupuestoAcabadosModel::class);
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
return $m->where("presupuesto_id", $this->attributes["id"])->findAll();
}
public function preimpresiones(): array
{
$m = model(PresupuestoPreimpresionesModel::class);
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
return $m->where("presupuesto_id", $this->attributes["id"])->findAll();
}
public function manipulados(): array
{
$m = model(PresupuestoManipuladosModel::class);
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
return $m->where("presupuesto_id", $this->attributes["id"])->findAll();
}
public function extras(): array
{
$m = model(PresupuestoServiciosExtraModel::class);
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
return $m->where("presupuesto_id", $this->attributes["id"])->findAll();
}
public function papel_formato() : PapelFormatoEntity
public function papel_formato(): PapelFormatoEntity
{
$m = model(PapelFormatoModel::class);
return $m->find($this->attributes["papel_formato_id"]);
}
public function files(): array
public function files(): array
{
$m = model(PresupuestoFicheroModel::class);
$files = $m->where('presupuesto_id',$this->attributes['id'])->findAll();
$files = $m->where('presupuesto_id', $this->attributes['id'])->findAll();
return $files ?? [];
}
public function tipo_presupuesto() : ?TipoPresupuestoEntity
public function tipo_presupuesto(): ?TipoPresupuestoEntity
{
$tipo_presupuesto = null;
$m = model(TipoPresupuestoModel::class);
if($this->attributes["tipo_impresion_id"]){
if ($this->attributes["tipo_impresion_id"]) {
$tipo_presupuesto = $m->find($this->attributes['tipo_impresion_id']);
}
return $tipo_presupuesto;
}
}

View File

@ -194,39 +194,75 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
return $m->find($this->attributes['tarifa_impresion_id']);
}
public function get_impresion_logo(){
public function get_impresion_logo()
{
$logo = config(LogoImpresion::class);
return $logo->get_logo_path($this->attributes["tipo"]);
}
public function get_nombre_tarea() : ?string
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_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);
$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";
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;
}
public function isRotativa() : bool
{
return in_array($this->attributes['tipo'],['lp_rot_color','lp_rot_bn']);
public function isGuarda(): bool
{
return in_array($this->attributes["tipo"], ["lp_guardas"]);
}
public function isColor():bool {
return in_array($this->attributes['tipo'],['lp_color','lp_colorhq','lp_rot_color']);
public function isCubierta(): bool
{
return in_array($this->attributes["tipo"], ["lp_cubierta"]);
}
public function isSobreCubierta(): bool
{
return in_array($this->attributes["tipo"], ["lp_sobrecubierta"]);
}
public function isRotativa(): bool
{
return in_array($this->attributes['tipo'], ['lp_rot_color', 'lp_rot_bn']);
}
public function isColor(): bool
{
return in_array($this->attributes['tipo'], ['lp_color', 'lp_colorhq', 'lp_rot_color']);
}
public function isBN(): bool
{
return in_array($this->attributes['tipo'], ["lp_bn", "lp_bnhq", "lp_rot_bn"]);
}
public function tinta(): string
{
$tinta = "";
if ($this->isCubierta()) {
$paginas = $this->attributes['paginas'];
if ($paginas / 2 == 1) {
$tinta = '4/0';
}
if ($paginas / 2 == 2) {
$tinta = '4/4';
}
} elseif ($this->isColor()) {
$tinta = '4/4';
} elseif ($this->isBN()) {
$tinta = '4/0';
}
return $tinta;
}
}

View File

@ -68,7 +68,7 @@ class OrdenTrabajoEntity extends Entity
/**
* Devuelve las tareas de la orden de trabajo.
*
* @return array<OrdenTrabajoTarea>
* @return array<OrdenTrabajoTareaEntity>
*/
public function tareas(): array
{

View File

@ -34,8 +34,11 @@ class OrdenTrabajoTareaEntity extends Entity
"comment" => null,
"click_init" => null,
"click_end" => null,
"pliego_1" => null,
"pliego_1_total" => null,
"pliego_2" => null,
"pliego_2_total" => null,
];
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [
"id" => "integer",
@ -52,6 +55,10 @@ class OrdenTrabajoTareaEntity extends Entity
"comment" => "?string",
"click_init" => "integer",
"click_end" => "integer",
"pliego_1" => "integer",
"pliego_1_total" => "integer",
"pliego_2" => "integer",
"pliego_2_total" => "integer",
];
/**
@ -113,6 +120,20 @@ class OrdenTrabajoTareaEntity extends Entity
$m = model(PresupuestoAcabadosModel::class);
return $m->find($this->attributes["presupuesto_linea_id"]);
}
/**
* Devuelve el presupuesto acabado origen de esta tarea
*
* @return ?PresupuestoManipuladosEntity
*/
public function presupuesto_manipulado(): ?PresupuestoManipuladosEntity
{
$m = model(PresupuestoManipuladosModel::class);
$p = null;
if ($this->attributes['presupuesto_manipulado_id']) {
$p = $m->find($this->attributes["presupuesto_manipulado_id"]);
}
return $p;
}
public function imposicion(): ?Imposicion
{
$m = model(ImposicionModel::class);
@ -152,5 +173,13 @@ class OrdenTrabajoTareaEntity extends Entity
{
return $this->attributes['click_end'] - $this->attributes['click_init'];
}
public function isCosido(): bool
{
$isTareaCosido = false;
$pm = $this->presupuesto_manipulado();
if ($pm) {
$isTareaCosido = $pm->tarifa()->isCosido();
}
return $isTareaCosido;
}
}

View File

@ -24,6 +24,16 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
"deleted_at" => null,
"created_at" => null,
"updated_at" => null,
'plastificado' => false,
'plakene' => false,
'rectractilado' => false,
'estampado' => false,
'uvi' => false,
'plastificado_tipo' => null,
'plakene_tipo' => null,
'rectractilado_tipo' => null,
'estampado_tipo' => null,
'uvi_tipo' => null,
];
protected $casts = [
"precio_min" => "float",
@ -33,6 +43,16 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",
'plastificado' => 'boolean',
'plakene' => 'boolean',
'rectractilado' => 'boolean',
'estampado' => 'boolean',
'uvi' => 'boolean',
'plastificado_tipo' => '?string',
'plakene_tipo' => '?string',
'rectractilado_tipo' => '?string',
'estampado_tipo' => '?string',
'uvi_tipo' => '?string',
];
/**
* Devuelve las maquinas asociadas a esta tarifa de acabado
@ -48,6 +68,7 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
public function isUVI(): bool
{
return in_array($this->attributes["code"],["R3D","R2D"]);
return $this->attributes['uvi'];
}
}

View File

@ -33,4 +33,9 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
"user_updated_id" => "int",
"is_deleted" => "int",
];
public function isCosido(): bool
{
return in_array($this->attributes['id'], [3, 17]);
}
}

View File

@ -676,6 +676,7 @@ return [
"menu_tarifacliente" => "Fees",
"menu_configuration" => "Settings",
"menu_config_holidays" => "Holidays",
"menu_calendario" => "Calendar",
"menu_paises" => "Countries",
"menu_correo" => "Mail",
@ -699,7 +700,7 @@ return [
"menu_digitalizacion" => "Digitalisation",
"menu_importacion" => "Import",
"menu_importadores" => "Import",
"menu_catalogo" => "Catalogue",
"menu_catalogo_libros" => "Books",
@ -761,6 +762,7 @@ return [
"menu_tarifaimpresion" => "Printing",
"menu_users" => "Users",
"menu_change_session" => "Seleccionar turno",
"menu_permission_group" => "Roles and permissions",
"menu_registration" => "Registration",

View File

@ -0,0 +1,7 @@
<?php
return [
'date' => 'Date',
'moduleTitle' => 'Holidays'
];

View File

@ -1,13 +1,19 @@
<?php
return [
'id' => 'ID',
'fechaCreacion' => 'Fecha de creación',
"fechaAlbaran" => 'Fecha de albarán',
'numEnvio' => 'Número de envío',
'cliente' => 'Cliente',
'albaran' => 'Albarán',
'numAlbaran' => 'Número de albarán',
'numPedidos' => 'Número de Pedidos',
'unidadesTotal' => 'Unidades Totales',
'albaranes' => 'Albaranes',
'att' => 'Att',
'direccion' => 'Dirección',
'cajas' => 'Cajas',
'acciones' => 'Acciones',
'unidades' => 'Unidades',
'titulo' => 'Título',
@ -28,4 +34,6 @@ return [
'iva4' => 'IVA 4%',
'iva21' => 'IVA 21%',
'editAlbaran' => 'Editar albarán',
];

View File

@ -690,6 +690,7 @@ return [
"menu_configuration" => "Configuración",
"menu_variables" => "Variables sistema",
"menu_config_messages" => "Mensajería",
"menu_config_holidays" => "Festivos",
"menu_error_presupuesto" => "Errores presupuesto",
"menu_calendario" => "Calendario",
"menu_paises" => "Paises",
@ -719,7 +720,8 @@ return [
"menu_digitalizacion" => "Digitalización",
"menu_importacion" => "Importación",
"menu_importadores" => "Importadores",
"menu_importadores_catalogo" => "Desde catálogo",
"menu_catalogo" => "Catálogo",
"menu_catalogo_libros" => "Libros",

View File

@ -0,0 +1,7 @@
<?php
return [
'date' => 'Fecha',
'moduleTitle' => 'Festivos'
];

View File

@ -0,0 +1,80 @@
<?php
return [
'moduleTitle' => 'Importadores',
'importadorCatalogoTitle' => 'Importador RA-MA Ediciones S.L.',
'catalogo' => 'catálogo',
'input' => 'ISBN',
'descripcion' => 'Título',
'idlinea' => 'Ref. cliente',
'cnt_pedida' => 'Unidades',
'precio_compra' => 'Precio Compra',
'importar' => 'Importar',
'subirArchivo' => 'Cargar Excel proporcionado por RA-MA',
'libro' => 'libro',
'id' => 'ID',
'clienteId' => 'Cliente',
'cliente' => 'Cliente',
'userCreatedId' => 'Usuario Creador',
'userUpdateId' => 'Usuario Actualizador',
'portada' => 'Portada',
'ancho' => 'Ancho',
'alto' => 'Alto',
'peso' => 'Peso',
'titulo' => 'Título',
'autor' => 'Autor',
'autorEntidad' => 'Entidad del Autor',
'traductor' => 'Traductor',
'ilustrador' => 'Ilustrador',
'idioma' => 'Idioma',
'numEdic' => 'Número de Edición',
'edicion' => 'Edición',
'fechaDisponibilidad' => 'Fecha de Disponibilidad',
'fechaPublic' => 'Fecha de Publicación',
'numFotos' => 'Número de Fotos',
'numIlustr' => 'Número de Ilustraciones',
'numIlustrColor' => 'Ilustraciones a Color',
'numIlustrBn' => 'Ilustraciones en Blanco y Negro',
'coleccion' => 'Colección',
'isbn' => 'ISBN',
'ean' => 'EAN',
'editorial' => 'Editorial',
'resumen' => 'Resumen',
'resumenBreve' => 'Resumen Breve',
'sello' => 'Sello',
'paginas' => 'Páginas',
'tipoImpresion' => 'Tipo de Impresión',
'seleccionarTipoImpresion' => 'Seleccionar tipo de impresión',
'solapasAncho' => 'Ancho de Solapas',
'cubiertasAncho' => 'Ancho de Cubiertas',
'comentarios' => 'Comentarios',
'negroPaginas' => 'Páginas Negras',
'negroPapel' => 'Papel Negro',
'negroGramaje' => 'Gramaje Negro',
'colorPaginas' => 'Páginas a Color',
'colorPapel' => 'Papel a Color',
'colorGramaje' => 'Gramaje Color',
'portadaPaginas' => 'Páginas de Portada',
'portadaPapel' => 'Papel de Portada',
'portadaGramaje' => 'Gramaje Portada',
'portadaAcabado' => 'Acabado Portada',
'cubiertaPaginas' => 'Páginas de Cubierta',
'cubiertaPapel' => 'Papel de Cubierta',
'cubiertaGramaje' => 'Gramaje Cubierta',
'cubiertaAcabado' => 'Acabado Cubierta',
'encuardenacion' => 'Encuadernación',
'ubicacion' => 'Ubicación',
'createdAt' => 'Fecha de Creación',
'updatedAt' => 'Fecha de Actualización',
'deletedAt' => 'Fecha de Eliminación',
'catalogoLibro' => 'Libro',
'catalogoLibroList' => 'Lista de Libros',
'datosGenerales' => 'Datos generales del libro',
'otrosDatosLibro' => 'Otros datos del libro',
'configuracionLibro' => 'Configuración del libro',
'ficherosLibro' => 'Ficheros',
'created_by_at' => 'Creado:',
'updated_by_at' => 'Actualizado:',
];

View File

@ -9,12 +9,13 @@ return [
'albaranes' => 'Albaranes',
'envioSimpleMultiple' => 'Envío simple/múltiple',
'nuevoEnvio' => 'Nuevo envío',
'buscadorPedidosTitle' => 'Código Pedido o ISBN',
'buscadorPedidosTitle2' => 'Código Pedido o título',
'buscadorPedidosTitle' => 'Código OT o ISBN',
'buscadorPedidosTitle2' => 'Código OT o título',
'selectDirecciones' => 'Dirección de envio',
'listadoEnvios' => 'Listado de envíos',
'idEnvio' => 'ID Envío',
'numeroPedidos' => 'Nº Pedidos',
'numeroOts' => 'Nº OTs',
'numeroLineas' => 'Nº Líneas',
'att' => 'Att',
'direccion' => 'Dirección',
@ -28,6 +29,8 @@ return [
'backToPanel' => 'Volver al panel',
'no' => 'No',
'si' => 'Sí',
'todos' => 'Todos',
'impresoraEtiquetas' => 'Impresora de etiquetas',
'envio' => 'Envío',
'addLineasEnvio' => 'Añadir líneas al envío',

View File

@ -50,6 +50,7 @@ return [
"pendientes" => "Pendientes",
"ferro_ok" => "Ferro ok",
"envio" => "Envío",
"ferro" => "Ferro",
"ot" => "Orden trabajo",
"ots" => "Órdenes trabajo",
"tiempo_procesamiento" => "Tiempo procesamiento",
@ -121,8 +122,9 @@ return [
],
"progress_ferro" => "Ferro",
"progress_preimpresion" => "Preimpresión",
"progress_logistica" => "Ferro/Logística",
"progress_logistica" => "Logística",
"progress_impresion" => "Impresión",
"progress_manipulado" => "Manipulado/Acabado",

View File

@ -67,6 +67,11 @@ return [
'vencimientosPermission' => 'Vencimientos',
"ticketsSection" => "Tickets",
'produccionSection' => 'Producción',
'catalogoSection' => 'Catálogo',
'importadoresSection' => 'Importadores',
'catalogoPermission' => 'Desde catálogo',
'validation' => [
'id' => [

View File

@ -173,6 +173,37 @@ class AlbaranModel extends \App\Models\BaseModel
return $albaran_data;
}
public function getAlbaranData($albaran_id=null){
if (!$albaran_id) {
return [];
}
$albaran_data = $this->db->table('albaranes t1')
->select("
t1.id,
t1.att_albaran AS att,
t1.direccion_albaran AS direccion,
t1.envio_id,
t1.numero_albaran AS numero_albaran,
DATE_FORMAT(t1.created_at, '%d/%m/%Y') AS fecha_creacion,
DATE_FORMAT(t1.fecha_albaran, '%d/%m/%Y') AS fecha_albaran,
t1.mostrar_precios AS mostrar_precios,
t2.nombre AS cliente,
t1.cajas AS cajas
")
->join('clientes t2', 't1.cliente_id = t2.id', 'left')
->where('t1.id', $albaran_id)
->where('t1.deleted_at IS NULL')
->get()
->getResultObject();
if (count($albaran_data) == 0) {
return [];
}
return $albaran_data[0];
}
/**
* Get resource data for creating PDFs.
*
@ -203,4 +234,25 @@ class AlbaranModel extends \App\Models\BaseModel
return $builder;
}
public function getDatatableQuery()
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id, t1.numero_albaran as numero_albaran, t1.envio_id as envio_id, GROUP_CONCAT(DISTINCT t4.id) AS pedidos,
t5.nombre as cliente, t1.att_albaran as att, t1.direccion_albaran as direccion, SUM(t2.cantidad) as unidades_total,
t1.cajas as cajas"
)
->join("albaranes_lineas t2", "t1.id = t2.albaran_id", "left")
->join("pedidos_linea t3", "t2.pedido_linea_id = t3.id", "left")
->join("pedidos t4", "t3.pedido_id = t4.id", "left")
->join("clientes t5", "t1.cliente_id = t5.id", "left");
$builder->where("t1.deleted_at IS NULL");
$builder->where("t2.deleted_at IS NULL");
$builder->groupBy("t1.id");
return $builder;
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace App\Models\Configuracion;
use App\Entities\Configuracion\FestivoEntity;
use App\Models\BaseModel;
class FestivoModel extends BaseModel
{
protected $table = "festivos";
protected $primaryKey = 'id';
protected $allowedFields = ["date"];
protected $returnType = FestivoEntity::class;
protected $useAutoIncrement = true;
protected $useSoftDeletes = true;
protected $protectFields = true;
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
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 = [];
protected $validationRules = [
"date" => [
"label" => "Festivos.date",
"rules" => "required|valid_date[Y-m-d]",
],
];
protected $validationMessages = [
"date" => [
"valid_date" => "Validation.valid_date",
],
];
public function isFestivo($date)
{
return $this->where('date',$date)->countAllResults() > 0 ? true : false;
}
}

View File

@ -37,7 +37,7 @@ class EnvioLineaModel extends Model
->select(
"t1.id, t1.pedido_id as pedido, t3.id as presupuesto,
t3.titulo as titulo, t1.unidades_envio as unidadesEnvio, t1.unidades_envio as unidadesEnvioRaw,
t1.unidades_total as unidadesTotal,
t1.unidades_total as unidadesTotal, t2.tipo_envio as tipo_envio,
IFNULL((
SELECT SUM(t_sub.unidades_envio)
FROM envios_lineas t_sub

View File

@ -32,23 +32,44 @@ class EnvioModel extends Model
'created_at',
'updated_at',
'cajas',
'tipo_envio',
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
public function getDatatableQuery(): BaseBuilder
public function getDatatableQuery($tipo_envio = "estandar"): BaseBuilder
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id, GROUP_CONCAT(DISTINCT t2.pedido_id) AS pedidos,
"t1.id, GROUP_CONCAT(DISTINCT t5.id) AS ots,
COUNT(t2.id) AS num_lineas,
t1.att, t1.direccion, t1.ciudad, t3.nombre as pais, t1.cp, t1.email, t1.telefono, t1.finalizado"
);
$builder->join("envios_lineas t2", "t2.envio_id = t1.id", "left");
$builder->join("lg_paises t3", "t3.id = t1.pais_id", "left");
$builder->join("pedidos t4", "t4.id = t2.pedido_id", "left");
$builder->join('ordenes_trabajo t5', 't5.pedido_id = t4.id');
$builder->where("t1.tipo_envio", $tipo_envio);
$builder->groupBy("t1.id");
return $builder;
}
public function getDatatableQueryFerroPrototipo(): BaseBuilder
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id, GROUP_CONCAT(DISTINCT t5.id) AS ots,
t1.att, t1.direccion, t1.ciudad, t3.nombre as pais, t1.cp, t1.email, t1.telefono, t1.finalizado"
);
$builder->join("lg_paises t3", "t3.id = t1.pais_id", "left");
$builder->join("pedidos t4", "t4.id = t2.pedido_id", "left");
$builder->join('ordenes_trabajo t5', 't5.pedido_id = t4.id');
$builder->whereIn("t1.tipo_envio", ["estandar"]);
$builder->groupBy("t1.id");
return $builder;

View File

@ -32,7 +32,11 @@ class OrdenTrabajoTarea extends Model
"tipo_corte",
"comment",
"click_init",
"click_end"
"click_end",
"pliego_1",
"pliego_1_total",
"pliego_2",
"pliego_2_total"
];
protected bool $allowEmptyInserts = false;

View File

@ -45,6 +45,7 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel
"proveedor_id",
"proveedor",
"entregaPieCalle",
"is_ferro_prototipo"
];
protected $returnType = "App\Entities\Presupuestos\PresupuestoDireccionesEntity";
@ -69,7 +70,8 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel
t1.email AS email, t1.direccion AS direccion, t1.pais_id AS pais_id, t2.nombre AS pais,
t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono,
t1.peso AS peso, t1.cantidad AS cantidad, t1.precio AS precio, t1.margen AS margen,
t1.proveedor_id AS proveedor_id, t1.proveedor AS proveedor, t1.entregaPieCalle AS entregaPieCalle"
t1.proveedor_id AS proveedor_id, t1.proveedor AS proveedor, t1.entregaPieCalle AS entregaPieCalle,
t1.is_ferro_prototipo AS is_ferro_prototipo"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Tarifas\Acabados;
class TarifaAcabadoModel extends \App\Models\BaseModel
@ -33,6 +34,16 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
"is_deleted",
"user_created_id",
"user_updated_id",
'plastificado',
'plakene',
'rectractilado',
'estampado',
'uvi',
'plastificado_tipo',
'plakene_tipo',
'rectractilado_tipo',
'estampado_tipo',
'uvi_tipo'
];
protected $returnType = 'App\Entities\Tarifas\Acabados\TarifaAcabadoEntity';
@ -96,9 +107,9 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.nombre", $search)
->groupEnd();
->groupStart()
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosAcabadoSelector()

View File

@ -57,7 +57,7 @@ class ImpresoraEtiquetaService extends BaseService
return ["impresora" => $impresora, "content" => $th->getMessage(), "status" => $status];
}
}
protected function createEtiqueta(array $data_label = []): ?string
public function createEtiqueta(array $data_label = []): ?string
{
$xml = new DOMDocument('1.0', 'utf-8');
$labels = $xml->createElement("labels");
@ -76,7 +76,7 @@ class ImpresoraEtiquetaService extends BaseService
$xml->appendChild($labels);
return $xml->saveXML();
}
protected function sendToImpresoraEtiqueta(string $name, string $content, ImpresoraEtiquetaEntity $impresoraEtiqueta): bool
public function sendToImpresoraEtiqueta(string $name, string $content, ImpresoraEtiquetaEntity $impresoraEtiqueta): bool
{
$tmpFile = tmpfile();

View File

@ -7,111 +7,6 @@ use Config\Services;
class LogisticaService
{
public static function findPedidoOrISBN($search)
{
$multienvio = false;
$direcciones = [];
$modelPedido = model('App\Models\Pedidos\PedidoModel');
$search = trim($search);
$searchClean = str_replace('-', '', $search);
$modelPedido = model('App\Models\Pedidos\PedidoModel');
$builder = $modelPedido->builder();
$builder->select([
'pedidos.id as pedido_id',
'pedidos_linea.id as linea_id',
'pedidos_linea.cantidad as cantidad_linea',
'presupuestos.id as presupuesto_id',
]);
$builder->join('pedidos_linea', 'pedidos_linea.pedido_id = pedidos.id', 'left');
$builder->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left');
$builder->join('envios_lineas', 'envios_lineas.pedido_id = pedidos_linea.pedido_id', 'left');
$builder->groupStart()
->where('pedidos.id', $search)
->whereIn('pedidos.estado', ['finalizado', 'produccion'])
->orWhere("REPLACE(presupuestos.isbn, '-', '')", $searchClean)
->groupEnd();
$builder->groupBy('pedidos_linea.id');
$builder->having('IFNULL(SUM(envios_lineas.unidades_envio), 0) < cantidad_linea', null, false);
$result = $builder->get()->getResult();
if (empty($result)) {
$response = [
'status' => false,
'message' => lang('Logistica.errors.notFound'),
];
return $response;
}
$PresupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
$numDirecciones = $PresupuestoDireccionesModel->where('presupuesto_id', $result[0]->presupuesto_id)
->countAllResults();
if ($numDirecciones == 0) {
$response = [
'status' => false,
'message' => lang('Logistica.errors.noAddresses'),
];
return $response;
} else if ($numDirecciones > 1) {
$multienvio = true;
$dirs = $PresupuestoDireccionesModel->select('direccion')->where('presupuesto_id', $result[0]->presupuesto_id)
->findAll();
foreach ($dirs as $key => $direccion) {
$modelEnvioLineasModel = model('App\Models\Logistica\EnvioLineaModel');
$unidades_en_direccion = $modelEnvioLineasModel->select('SUM(envios_lineas.unidades_envio) as unidades_enviadas,
envios_lineas.unidades_total')
->join('envios', 'envios.id = envios_lineas.envio_id')
->where('pedido_id', $result[0]->pedido_id)
->where('envios.direccion', $direccion->direccion)
->where('envios.finalizado', 1)
->groupBy('pedido_id')->get()->getResult();
if (count($unidades_en_direccion) == 0 || $unidades_en_direccion[0]->unidades_enviadas < $unidades_en_direccion[0]->unidades_total) {
array_push($direcciones, $direccion->direccion);
}
}
}
$response = [
'status' => true,
'data' => $result[0],
];
if ($multienvio) {
$response_envio = [
'status' => true,
'multienvio' => true,
'direcciones' => $direcciones,
'pedido_id' => $result[0]->pedido_id,
];
return $response_envio;
}
$direccion = $PresupuestoDireccionesModel->select('direccion')->where('presupuesto_id', $result[0]->presupuesto_id)
->first()->direccion;
$response_envio = LogisticaService::generateEnvio($result[0]->pedido_id, $direccion);
if ($response_envio['status'] == false) {
$response = [
'status' => false,
'message' => $response_envio['message'],
];
return $response;
} else {
$response['data']->id_envio = $response_envio['data']['id_envio'];
$response['data']->multienvio = false;
}
return $response;
}
public static function findLineaEnvioPorEnvio(int $envio_id)
@ -142,8 +37,8 @@ class LogisticaService
// 3. Subconsulta principal
$subBuilder = $db->table('pedidos_linea pl')
->select("
pl.id AS id,
CONCAT('[', p.id, '] - ', pr.titulo) AS name,
ot.id AS id,
CONCAT('[', ot.id, '] - ', pr.titulo) AS name,
(
SELECT IFNULL(SUM(el.unidades_envio), 0)
FROM envios_lineas el
@ -183,15 +78,15 @@ class LogisticaService
return $builder;
}
public static function findPedidosNewEnvio()
public static function findForNewEnvio()
{
$db = \Config\Database::connect();
// 3. Subconsulta principal
$subBuilder = $db->table('pedidos_linea pl')
->select("
pl.id AS id,
CONCAT('[', p.id, '] - ', pr.titulo) AS name,
ot.id AS id,
CONCAT('[', ot.id, '] - ', pr.titulo) AS name,
(
SELECT IFNULL(SUM(el.unidades_envio), 0)
FROM envios_lineas el
@ -199,6 +94,7 @@ class LogisticaService
WHERE el.pedido_id = p.id
AND el.presupuesto_id = pr.id
AND e.finalizado = 1
AND e.tipo_envio = 'estandar'
) AS unidades_enviadas,
pd.cantidad AS cantidad
")
@ -220,7 +116,47 @@ class LogisticaService
return $builder;
}
public static function findDireccionesNewEnvio($pedido_id, $searchVal = "")
public static function findForNewEnvioFerro()
{
$db = \Config\Database::connect();
// 3. Subconsulta principal
$subBuilder = $db->table('pedidos_linea pl')
->select("
ot.id AS id,
CONCAT('[', ot.id, '] - ', pr.titulo) AS name,
p.id as pedido_id,
pr.id as presupuesto_id
")
->join('pedidos p', 'p.id = pl.pedido_id')
->join('presupuestos pr', 'pr.id = pl.presupuesto_id')
->join('presupuesto_direcciones pd', 'pd.presupuesto_id = pr.id')
->join('ordenes_trabajo ot', 'ot.pedido_id = p.id')
->join('orden_trabajo_dates ot_dates', 'ot_dates.orden_trabajo_id = ot.id')
->whereIn('p.estado', ['finalizado', 'produccion'])
->where('ot_dates.pendiente_ferro_at IS NOT NULL')
->where('pd.is_ferro_prototipo', 1)
->groupBy('pl.id');
// 4. Envolver y filtrar por unidades pendientes
$builder = $db->table("({$subBuilder->getCompiledSelect(false)}) AS sub");
$builder->select('id, name');
$builder->orderBy('name', 'ASC');
$builder->where("
NOT EXISTS (
SELECT 1
FROM envios e
INNER JOIN envios_lineas le ON le.envio_id = e.id
WHERE e.tipo_envio = 'ferro_prototipo'
AND (le.pedido_id = sub.pedido_id OR le.presupuesto_id = sub.presupuesto_id)
)
", null, false);
return $builder;
}
public static function findDireccionesNewEnvio($ot_id, $searchVal = "")
{
$direcciones = [];
@ -231,7 +167,9 @@ class LogisticaService
->join('presupuestos pr', 'pr.id=presupuesto_direcciones.presupuesto_id')
->join('pedidos_linea pl', 'pl.presupuesto_id = pr.id')
->join('pedidos p', 'pl.pedido_id=p.id')
->where('p.id', $pedido_id);
->join('ordenes_trabajo ot', 'ot.pedido_id = p.id')
->where('ot.id', $ot_id)
->where("presupuesto_direcciones.is_ferro_prototipo", 0);
if ($searchVal != "") {
$dirs = $dirs->groupStart()
->Like("id", $searchVal)
@ -243,10 +181,13 @@ class LogisticaService
$unidades_en_direccion = $modelEnvioLineasModel->select('SUM(envios_lineas.unidades_envio) as unidades_enviadas,
envios_lineas.unidades_total')
->join('envios', 'envios.id = envios_lineas.envio_id')
->where('pedido_id', $pedido_id)
->join('pedidos_linea', 'pedidos_linea.pedido_id = envios_lineas.pedido_id')
->join('pedidos', 'pedidos.id = pedidos_linea.pedido_id')
->join('ordenes_trabajo', 'ordenes_trabajo.pedido_id = pedidos.id')
->where('ordenes_trabajo.id', $ot_id)
->where('envios.direccion', $direccion->direccion)
->where('envios.finalizado', 1)
->groupBy('pedido_id')->get()->getResult();
->groupBy('ordenes_trabajo.pedido_id')->get()->getResult();
if (count($unidades_en_direccion) == 0 || $unidades_en_direccion[0]->unidades_enviadas < $unidades_en_direccion[0]->unidades_total) {
array_push(
$direcciones,
@ -301,6 +242,7 @@ class LogisticaService
->join('pedidos p', 'p.id = pl.pedido_id')
->join('presupuestos pr', 'pr.id = pl.presupuesto_id')
->join('presupuesto_direcciones pd', 'pd.presupuesto_id = pr.id')
->where('pd.is_ferro_prototipo', 0)
->where('p.id', $pedido_id)
->whereIn('p.estado', ['finalizado', 'produccion'])
->where("TRIM(LOWER(pd.direccion)) = '$direccionNormalizada'", null, false)
@ -347,7 +289,7 @@ class LogisticaService
public static function generateEnvio($pedido_id, $direccion = null)
public static function generateEnvio($ot_id, $direccion = null)
{
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
$direccionNormalizada = strtolower(trim($direccion));
@ -364,6 +306,7 @@ class LogisticaService
presupuesto_direcciones.pais_id,
presupuesto_direcciones.cantidad as cantidad_total,
presupuestos.cliente_id as cliente_id,
ordenes_trabajo.pedido_id as pedido_id,
(
presupuesto_direcciones.cantidad - IFNULL((
@ -380,7 +323,9 @@ class LogisticaService
->join('pedidos_linea', 'pedidos_linea.presupuesto_id = presupuesto_direcciones.presupuesto_id')
->join('pedidos', 'pedidos.id = pedidos_linea.pedido_id')
->join('presupuestos', 'pedidos_linea.presupuesto_id = presupuestos.id')
->where('pedidos.id', $pedido_id)
->join('ordenes_trabajo', 'ordenes_trabajo.pedido_id = pedidos.id')
->where('ordenes_trabajo.id', $ot_id)
->where('presupuesto_direcciones.is_ferro_prototipo', 0)
->like('presupuesto_direcciones.direccion', $direccion)
->groupBy('presupuesto_direcciones.id')
->first();
@ -416,7 +361,7 @@ class LogisticaService
$EnvioLineasModel = model('App\Models\Logistica\EnvioLineaModel');
$EnvioLineasModel->save([
'envio_id' => $idEnvio,
'pedido_id' => $pedido_id,
'pedido_id' => $datosEnvio->pedido_id,
'unidades_envio' => $datosEnvio->cantidad,
'unidades_total' => $datosEnvio->cantidad_total,
'cajas' => 1,
@ -437,6 +382,95 @@ class LogisticaService
}
public static function generateEnvioFerro($ot_id)
{
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
$datosEnvio = $presupuestoDireccionesModel
->select("
presupuestos.id as presupuesto_id,
presupuesto_direcciones.att,
presupuesto_direcciones.direccion,
presupuesto_direcciones.provincia as ciudad,
presupuesto_direcciones.cp,
presupuesto_direcciones.telefono,
presupuesto_direcciones.email,
presupuesto_direcciones.pais_id,
presupuesto_direcciones.cantidad as cantidad_total,
presupuestos.cliente_id as cliente_id,
ordenes_trabajo.pedido_id as pedido_id,
")
->join('pedidos_linea', 'pedidos_linea.presupuesto_id = presupuesto_direcciones.presupuesto_id')
->join('pedidos', 'pedidos.id = pedidos_linea.pedido_id')
->join('presupuestos', 'pedidos_linea.presupuesto_id = presupuestos.id')
->join('ordenes_trabajo', 'ordenes_trabajo.pedido_id = pedidos.id')
->where('ordenes_trabajo.id', $ot_id)
->where('presupuesto_direcciones.is_ferro_prototipo', 1)
->where("
NOT EXISTS (
SELECT 1
FROM envios e
INNER JOIN envios_lineas el ON el.envio_id = e.id
WHERE e.tipo_envio = 'ferro_prototipo'
AND (el.pedido_id = pedidos.id OR el.presupuesto_id = presupuestos.id)
)
", null, false) // <= Esta es la parte nueva, importante
->groupBy('presupuesto_direcciones.id')
->first();
// Validación si no hay datos o no quedan unidades
if (empty($datosEnvio)) {
return [
'status' => false,
'message' => lang('Logistica.errors.noAddresses')
];
}
// Crear envío
$EnvioModel = model('App\Models\Logistica\EnvioModel');
$EnvioModel->set([
'cliente_id' => $datosEnvio->cliente_id,
'att' => $datosEnvio->att,
'direccion' => $datosEnvio->direccion,
'ciudad' => $datosEnvio->ciudad,
'cp' => $datosEnvio->cp,
'telefono' => $datosEnvio->telefono,
'email' => $datosEnvio->email,
'pais_id' => $datosEnvio->pais_id,
'cantidad' => 1,
'cajas' => 1,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
'tipo_envio' => 'ferro_prototipo',
]);
$EnvioModel->insert();
$idEnvio = $EnvioModel->insertID();
// Crear línea de envío
$EnvioLineasModel = model('App\Models\Logistica\EnvioLineaModel');
$EnvioLineasModel->save([
'envio_id' => $idEnvio,
'pedido_id' => $datosEnvio->pedido_id,
'unidades_envio' => 1,
'unidades_total' => 1,
'cajas' => 1,
'unidades_cajas' => 1,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
'created_by' => auth()->user()->id,
'updated_by' => auth()->user()->id,
'presupuesto_id' => (int) $datosEnvio->presupuesto_id
]);
return [
'status' => true,
'data' => [
'id_envio' => $idEnvio,
],
];
}
public static function finalizarEnvio($envio_id, $finalizar_ot = false)
{
@ -489,24 +523,36 @@ class LogisticaService
$cantidad_enviada = $cantidad_enviada[0]->unidades_enviadas;
}
if ($cantidad_enviada + $linea->unidades_envio == $pedido->total_tirada) {
if ($envio->tipo_envio == 'ferro_prototipo') {
$otModel = model('App\Models\OrdenTrabajo\OrdenTrabajoModel');
$ot = $otModel->where('pedido_id', $linea->pedido_id)
->first();
$ps = (new ProductionService())->init($ot->id);
$ps->updateOrdenTrabajoDate([
"name" => "envio_at",
"envio_at" => date('Y-m-d H:i:s')
"name" => "ferro_en_cliente_at",
"ferro_en_cliente_at" => date('Y-m-d H:i:s')
]);
if ($finalizar_ot) {
$ps->updateOrdenTrabajo(
[
"estado" => 'F'
]
);
array_push($ots, $ot->id);
} else {
if ($cantidad_enviada + $linea->unidades_envio == $pedido->total_tirada) {
$otModel = model('App\Models\OrdenTrabajo\OrdenTrabajoModel');
$ot = $otModel->where('pedido_id', $linea->pedido_id)
->first();
$ps = (new ProductionService())->init($ot->id);
$ps->updateOrdenTrabajoDate([
"name" => "envio_at",
"envio_at" => date('Y-m-d H:i:s')
]);
if ($finalizar_ot) {
$ps->updateOrdenTrabajo(
[
"estado" => 'F'
]
);
array_push($ots, $ot->id);
}
}
}
}
$EnvioModel->update($envio_id, ['finalizado' => 1]);
@ -524,4 +570,66 @@ class LogisticaService
}
return $data_return;
}
public static function generateEtiquetasTitulos($envio, $lineas, $printer, $cajas)
{
$data = [
"printer" => $printer->name,
"header" => [
"_FORMAT" => "E:PEDIDO.ZPL",
"_QUANTITY" => 1,
"_PRINBTERNAME" => $printer->name,
"_JOBNAME" => "LBL101"
],
];
foreach ($lineas as $linea) {
$data["labels"][] = [
"cliente" => $envio->cliente,
"titulo" => "[" . $linea->pedido_id . "] - " . $linea->titulo,
"cantidad" => $linea->unidades_envio,
"tirada" => $linea->unidades_total,
"cajas" => $cajas,
"ean" => null,
"nombre" => $envio->att,
"direccion" => $envio->direccion,
"notas" => "",
"refcliente" => $linea->refcliente,
"npedido" => $linea->pedido_id
];
}
$servicioImpresora = new ImpresoraEtiquetaService();
$xml = $servicioImpresora->createEtiqueta($data);
if ($xml == null) {
return [
'status' => false,
'message' => lang('Logistica.errors.noEtiquetas'),
];
}
$sk_environment = getenv('SK_ENVIRONMENT');
if ($sk_environment == 'production') {
$status = $servicioImpresora->sendToImpresoraEtiqueta("ETIQUETA", $xml, $printer);
if ($status) {
return [
'status' => true,
'message' => lang('Logistica.success.imprimirEtiquetas'),
'data' => $xml
];
} else {
return [
'status' => false,
'message' => lang('Logistica.errors.noEtiquetas'),
];
}
} else {
return [
'status' => true,
'message' => lang('Logistica.success.imprimirEtiquetas'),
'data' => $xml
];
}
}
}

View File

@ -18,6 +18,7 @@ use App\Entities\Produccion\OrdenTrabajoFileEntity;
use App\Entities\Produccion\OrdenTrabajoTareaEntity;
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
use App\Models\Configuracion\ConfigVariableModel;
use App\Models\Configuracion\FestivoModel;
use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoFileModel;
use App\Models\OrdenTrabajo\OrdenTrabajoTareaProgressDate;
@ -56,6 +57,7 @@ class ProductionService extends BaseService
protected OrdenTrabajoUser $otUser;
protected OrdenTrabajoEntity $ot;
protected OrdenTrabajoFileModel $otFileModel;
protected FestivoModel $festivoModel;
protected OrdenTrabajoTareaProgressDate $otTareaProgressDate;
protected PedidoModel $pedidoModel;
protected UserModel $userModel;
@ -90,7 +92,7 @@ class ProductionService extends BaseService
* `tirada <= podValue`
* @var boolean
*/
protected bool $isPOD = false;
public bool $isPOD = false;
/**
* Indica si la orden de trabajo contiene gofrado
@ -98,10 +100,34 @@ class ProductionService extends BaseService
* @var boolean
*/
public bool $isGofrado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene plastificado
* Se usa para mostrar la fecha correspondiente en la vista
* @var boolean
*/
public bool $isPlastificado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene gofrado
* Se usa para mostrar la fecha correspondiente en la vista
* TODO Hay que implementar un boolean en `lg_tarifa_acabado` para identificar
* @var boolean
*/
public bool $isPlakene = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene gofrado
* Se usa para mostrar la fecha correspondiente en la vista
* @var boolean
*/
public bool $isEstampado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene cosido
* Se usa para mostrar la fecha correspondiente en la vista y pliegos
* @var boolean
*/
public bool $isCosido = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene gofrado
* Se usa para mostrar la fecha correspondiente en la vista
* TODO Hay que implementar un boolean en `lg_tarifa_manipulado` para identificar
* @var boolean
*/
public bool $isGrapado = true; //TODO
@ -119,14 +145,7 @@ class ProductionService extends BaseService
* @var boolean
*/
public bool $isUVI = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene plastificado
* Se usa para mostrar la fecha correspondiente en la vista
* TODO Hay que implementar un boolean en `lg_tarifa_acabado` para identificar
* DEFAULT true hasta implementacion
* @var boolean
*/
public bool $isPlastificado = true; //TODO
/**
* Indica si la orden de trabajo contiene cubierta
* Se usa para mostrar la fecha correspondiente en la vista
@ -175,6 +194,7 @@ class ProductionService extends BaseService
$this->otFileModel = model(OrdenTrabajoFileModel::class);
$this->pedidoModel = model(PedidoModel::class);
$this->otTareaProgressDate = model(OrdenTrabajoTareaProgressDate::class);
$this->festivoModel = model(FestivoModel::class);
$this->ordenTrabajoConfig = config('OrdenTrabajo');
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
$this->configVariableModel = model(ConfigVariableModel::class);
@ -222,7 +242,6 @@ class ProductionService extends BaseService
{
return $this->ot;
}
/**
* Crea una instancia de la orden de trabajo
*
@ -254,25 +273,19 @@ class ProductionService extends BaseService
/**
* Inserta las fechas del pedido asociado a la orden de trabajo en `orden_trabajo_tareas`
* Si el pedido es POD las fechas se insertan automaticamente usando `createDatesForPOD` y
* en base a las variables :
* - pod_impresion_dias_tras_confirmacion [fecha_impresion_at]
* - pod_encuadernacion_dias_tras_confirmacion [fecha_encuadernacion]
* - pod_entrega_real_dias_tras_confirmacion [fecha_impresion_at]
* - pod_embalaje_dias_tras_confirmacion [fecha_impresion_at]
*
* @param OrdenTrabajoEntity $ot
* @return integer|boolean|string ID
*/
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");
$data = [
"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,
];
$otDateId = $this->otDate->insert($data);
$this->otDate->updateUserDateMap($this->ot->id, $data);
$otDateId = $this->otDate->insert(["orden_trabajo_id" => $this->ot->id]);
return $otDateId;
}
/**
@ -362,7 +375,7 @@ class ProductionService extends BaseService
$ot_tareas["maquina_id"] = $p_linea_maquina->id;
$ot_tareas["imposicion_id"] = null;
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina * 3600;
$ot_tareas["tiempo_real"] = $p_linea->horas_maquina * 3600; //? Tiempo real se inserta manual?
$ot_tareas["tiempo_real"] = 0;
$insert_query_result = $this->otTarea->insert($ot_tareas);
$ot_tareas = [];
$this->storeTareaCorte($p_linea);
@ -386,7 +399,7 @@ class ProductionService extends BaseService
'maquina_id' => $this->defaultMaquinaCorte->id,
'orden' => $this->defaultMaquinaCorte->orden_planning,
'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60,
'tiempo_real' => $pLinea->rotativa_tiempo_corte * 60,
'tiempo_real' => 0,
'is_corte' => true,
'tipo_corte' => "bobina",
]);
@ -814,6 +827,7 @@ class ProductionService extends BaseService
"tareas_impresion" => $this->tareas_impresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"statusColor" => $this->getOtColorStatus(),
"tareaCosido" => $this->getTareaCosido(),
];
return $summary;
}
@ -833,6 +847,7 @@ class ProductionService extends BaseService
"preimpresiones" => $this->presupuesto->preimpresiones(),
"manipulados" => $this->presupuesto->manipulados(),
"encuadernaciones" => $this->presupuesto->encuadernaciones(),
"encuadernacionCode" => $this->getEncuadernacionCode(),
"linea_impresion" => $this->presupuesto->presupuestoLineaImpresion(),
"linea_cubierta" => $this->presupuesto->presupuestoLineaCubierta(),
"peso_unidad" => $logistica_data["peso_unidad"],
@ -842,8 +857,10 @@ class ProductionService extends BaseService
"tiempo_impresion" => $this->getTiempoTareasImpresionHHMM(),
"colors" => $this->getPdfColors(),
"isPOD" => $this->isPOD,
"uvi" => $this->getUVI()
"uvi" => $this->getUVI(),
"flags" => $this->getFlags(),
"tareaCosido" => $this->getTareaCosido(),
"plakene_tipo" => $this->plakene_tipo()
];
}
public function getImposicionTareaImpresion(): ?Imposicion
@ -894,27 +911,27 @@ class ProductionService extends BaseService
public function getPresupuestoLineaImpresion() {}
public function tareas_acabado(): array
{
$q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll();
$q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->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();
$q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->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();
$q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->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();
$q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->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();
$q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll();
return $q;
}
/**========================================================================
@ -929,6 +946,18 @@ class ProductionService extends BaseService
}
return $this->otTarea->update($tarea_id, $data);
}
public function updateOrdenTrabajoTareaPliegos($data_pliegos): bool
{
$flag = false;
$tareas = $this->ot->tareas();
foreach ($tareas as $key => $tarea) {
if ($tarea->isCosido()) {
$flag = $this->otTarea->update($tarea->id, $data_pliegos);
break;
}
}
return $flag;
}
public function storeOrdenTrabajoTareaProgressDate($data): bool
{
$data["action_at"] = Time::now()->format('Y-m-d H:i:s');
@ -1334,9 +1363,13 @@ class ProductionService extends BaseService
}
public function getTiempoProcesamientoHHMM(): ?string
{
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
$seconds = array_sum($time_tareas_seconds);
return float_seconds_to_hhmm_string($seconds);
try {
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
$seconds = array_sum($time_tareas_seconds);
return float_seconds_to_hhmm_string($seconds);
} catch (\Throwable $th) {
return '00:00';
}
}
public function getTiempoTareasImpresionHHMM(): string
{
@ -1354,7 +1387,7 @@ class ProductionService extends BaseService
$uvi = null;
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
if ($acabado->tarifa()->isUVI()) {
if ($acabado->tarifa()->uvi) {
$uvi = $acabado->tarifa();
}
}
@ -1470,8 +1503,11 @@ class ProductionService extends BaseService
{
$code = "";
$encuadernaciones = $this->presupuesto->encuadernaciones();
if (isset($encuadernaciones[0])) {
$code = $encuadernaciones[0]->tarifa()->code;
foreach ($encuadernaciones as $key => $value) {
$code = $value->tarifa()->code;
if ($code) {
break;
}
}
return $code;
}
@ -1506,58 +1542,68 @@ class ProductionService extends BaseService
}
public function getPapelImpresionBackgroundColor()
{
$papel = $this->presupuesto->presupuestoLineaImpresion()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
if ($this->presupuesto->presupuestoLineaImpresion()) {
return $color;
$papel = $this->presupuesto->presupuestoLineaImpresion()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
return $color;
} else {
return $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
}
public function getPapelImpresionCubiertaBackgroundColor()
{
$papel = $this->presupuesto->presupuestoLineaCubierta()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
if ($this->presupuesto->presupuestoLineaCubierta()) {
$papel = $this->presupuesto->presupuestoLineaCubierta()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
return $color;
} else {
return $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
return $color;
}
public function getPlastificadoColor()
{
@ -1566,21 +1612,10 @@ class ProductionService extends BaseService
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->code) {
$plastificado_code = $tarifa_acabado->code;
if ($plastificado_code == "BRIL") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['BRIL'];
}
if ($plastificado_code == "MATE") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['MATE'];
}
if ($plastificado_code == "ANTI") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['ANTIRAYADO'];
}
if ($plastificado_code == "SAND") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['SANDY'];
}
if ($plastificado_code == "GOF") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['GOFRADO'];
if ($tarifa_acabado->plastificado) {
if (isset($this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR[$tarifa_acabado->plastificado_tipo])) {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR[$tarifa_acabado->plastificado_tipo];
}
}
}
}
@ -1611,14 +1646,15 @@ class ProductionService extends BaseService
$this->color();
return [
"isGofrado" => $this->gofrado(),
"isEspiral" => $this->isEspiral,
"isEspiral" => $this->isEspiral, //TODO
"isUVI" => $this->uvi(),
"isPlastificado" => $this->isPlastificado,
"isPlastificado" => $this->plastificado(),
"isCubierta" => $this->cubierta(),
"isColor" => $this->isColor,
"isBN" => $this->isBN,
"isCorte" => $this->corte(),
"isGrapado" => $this->isGrapado
"isGrapado" => $this->isGrapado,
"isCosido" => $this->cosido(),
];
}
public function gofrado(): bool
@ -1638,6 +1674,75 @@ class ProductionService extends BaseService
$this->isGofrado = $flag;
return $this->isGofrado;
}
public function plakene(): bool
{
$flag = false;
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->plakene) {
$flag = true;
break;
}
}
$this->isPlakene = $flag;
return $this->isPlakene;
}
public function plakene_tipo(): ?string
{
$tipo = "";
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->plakene) {
$tipo = $tarifa_acabado->plakene_tipo;
break;
}
}
return $tipo;
}
public function plastificado(): bool
{
$flag = false;
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->plastificado) {
$flag = true;
break;
}
}
$this->isPlastificado = $flag;
return $this->isPlastificado;
}
public function estampado(): bool
{
$flag = false;
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->estampado) {
$flag = true;
break;
}
}
$this->isEstampado = $flag;
return $this->isEstampado;
}
public function cosido(): bool
{
$flag = false;
$manipulados = $this->presupuesto->manipulados();
foreach ($manipulados as $key => $manipulado) {
$tarifa_manipulado = $manipulado->tarifa();
if ($tarifa_manipulado->isCosido()) {
$flag = true;
break;
}
}
$this->isCosido = $flag;
return $this->isCosido;
}
public function uvi(): bool
{
$flag = false;
@ -1721,7 +1826,7 @@ class ProductionService extends BaseService
->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")
->groupStart()
->orWhere('orden_trabajo_tareas.maquina_id', $maquina_id)
->orWhere('orden_trabajo_tareas.maquina_id', $maquina_id) //!TODO
->orWhere('presupuesto_linea.maquina_id', $maquina_id)
->groupEnd()
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false)
@ -1737,4 +1842,82 @@ class ProductionService extends BaseService
$url = route_to("viewProduccionMaquinistaTareaView", $id);
return "<a type='button' href='$url' class='maquina-btn btn btn-primary btn-md'><span class='ti ti-arrow-big-right'></span></a>";
}
public function getTareaCosido(): ?OrdenTrabajoTareaEntity
{
$tareaCosido = null;
$tareas = $this->ot->tareas();
foreach ($tareas as $key => $tarea) {
if ($tarea->isCosido()) {
$tareaCosido = $tarea;
break;
}
}
return $tareaCosido;
}
public function createDatesForPOD(): array
{
$podDates = [
'fecha_encuadernado' => null,
'fecha_entrega_real' => null,
'fecha_embalaje' => null,
'fecha_impresion' => null,
];
try {
$impresionDays = $this->configVariableModel->getVariable('pod_impresion_dias_tras_confirmacion')->value;
$encuadernadoDays = $this->configVariableModel->getVariable('pod_encuadernacion_dias_tras_confirmacion')->value;
$entregaRealDays = $this->configVariableModel->getVariable('pod_entrega_real_dias_tras_confirmacion')->value;
$embalajeDays = $this->configVariableModel->getVariable('pod_embalaje_dias_tras_confirmacion')->value;
$totalDays = array_sum([$impresionDays, $encuadernadoDays, $entregaRealDays, $embalajeDays]);
$dates = $this->generateWorkdaysFromToday($totalDays);
for ($i = 0; $i < count($dates); $i++) {
if ($i == $impresionDays) {
$podDates['fecha_impresion'] = $dates[$i];
}
if ($i == $encuadernadoDays) {
$podDates['fecha_encuadernado'] = $dates[$i];
}
if ($i == $entregaRealDays) {
$podDates['fecha_entrega_real'] = $dates[$i];
}
if ($i == $embalajeDays) {
$podDates['fecha_embalaje'] = $dates[$i];
}
}
return $podDates;
} catch (\Throwable $th) {
return ["error" => $th->getMessage()];
}
}
/**
* Devuelve un array con la longitud `$count` con las fechas que corresponde con días laborales.
* Menos fines de semana y festivos.
*
* @param integer $count
* @return array <str,YYYY-MM-DD>
*/
public function generateWorkdaysFromToday(int $count): array
{
$current = Time::now();
$workdays = [];
while (count($workdays) < $count) {
$dayOfWeek = $current->format('N'); // 1 (Lunes) to 7 (Domingo)
if ($dayOfWeek < 6) { // Lunes a Viernes
$date = $current->format('Y-m-d 00:00:00');
if ($this->festivoModel->isFestivo($date) == false) {
$workdays[] = $date;
}
}
$current = $current->addDays(1);
}
return $workdays;
}
public function updatePodDates(): bool
{
$dates = $this->createDatesForPOD();
return $this->pedidoModel->update($this->pedido->id, $dates);
}
}

View File

@ -12,7 +12,7 @@
</div>
<div class="col-md-6 mb-2">
<p class="mb-0">Clicks</p>
<h4 class="mb-0" id="clicks-info"><?= $ot_tarea->click_tarea ?></h4>
<h4 class="mb-0" id="clicks-info"><?= $ot_tarea->click_end - $ot_tarea->click_init ?></h4>
</div>
</div>

View File

@ -0,0 +1,64 @@
<?= $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'); ?>
<div class="container-fluid h-100">
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= lang('Festivos.moduleTitle') ?></h3>
</div>
<!--//.card-header -->
<div class="card-body m-10 section-block" id="festivoCard">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<div id="calendar"></div>
<!--//.card-footer -->
</div>
<!--//.card -->
</div>
<!--//.col -->
</div>
</div>
</div>
<!--//.row -->
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/notiflix/notiflix.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<script src="<?= site_url("themes/vuexy/vendor/libs/notiflix/notiflix.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/sweetalert2/sweetalert2.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/fullcalendar/dist/index.global.min.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/fullcalendar/packages/core/locales-all.global.min.js') ?>"></script>
<script type="module" src="<?= site_url("/assets/js/safekat/pages/configuracion/festivo/index.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,106 @@
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= lang('Importador.importadorCatalogoTitle') ?></h3>
</div><!--//.card-header -->
<form id="catalogoLibroForm" class="card-body" method="post" action="#">
<?= csrf_field() ?>
<!-- card-body -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<div class="row">
<div class="col-md-6 mb-3">
<label for="excelFile"
class="form-label"><?= lang('Importador.subirArchivo') ?? 'Subir archivo Excel' ?></label>
<input type="file" class="form-control" id="excelFile" name="excelFile"
accept=".xlsx, .xls">
</div>
<div class="col-md-4 mb-3 d-flex align-items-end">
<button type="button" id="importBtn" class="btn btn-success w-100">
<i class="fas fa-file-import me-2"></i> <?= lang('Importador.importar') ?? 'Importar' ?>
</button>
</div>
<div class="col-md-12 mb-3">
<table id="excelTable" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><input type="checkbox" id="selectAll"></th> <!-- Checkbox general -->
<th><?= lang('Importador.input') ?></th>
<th><?= lang('Importador.idlinea') ?></th>
<th><?= lang('Importador.descripcion') ?></th>
<th><?= lang('Importador.cnt_pedida') ?></th>
<th><?= lang('Importador.precio_compra') ?></th>
<th>Notas</th> <!-- Comentarios -->
<th><?= lang('Basic.global.Action') ?></th>
<!-- Acciones (importar/eliminar) -->
</tr>
<tr> <!-- Segunda fila para filtros -->
<th></th> <!-- No filtro en checkbox -->
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th> <!-- No filtro en notas -->
<th></th> <!-- No filtro en acciones -->
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</form>
</div><!--//.card-body -->
<div class="card-footer">
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet"
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/importadores/catalogo/catalogo_tool.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,35 @@
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4><?= $boxTitle ?></h4>
</div>
<div id="albaranContainer" class="card-body">
<input type="hidden" id="id" value="<?= $albaranId ?>">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/albaranes/edit.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,65 @@
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4><?= $boxTitle ?></h4>
</div>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<table id="tableOfAlbaranes" class="table table-striped table-hover w-100">
<thead>
<tr>
<th><?= lang('Albaran.id') ?></th>
<th><?= lang('Albaran.numAlbaran') ?></th>
<th><?= lang('Albaran.numEnvio') ?></th>
<th><?= lang('Albaran.numPedidos') ?></th>
<th><?= lang('Albaran.cliente') ?></th>
<th><?= lang('Albaran.att') ?></th>
<th><?= lang('Albaran.direccion') ?></th>
<th><?= lang('Albaran.unidadesTotal') ?></th>
<th><?= lang('Albaran.cajas') ?></th>
<th><?= lang('Albaran.acciones') ?? 'Acciones' ?></th>
</tr>
<tr>
<th><input type="text" class="form-control albaran-filter" name="id"></th>
<th><input type="text" class="form-control albaran-filter" name="numero_albaran"></th>
<th><input type="text" class="form-control albaran-filter" name="envio_id"></th>
<th><input type="text" class="form-control albaran-filter-pedidos" name="pedidos"></th>
<th><input type="text" class="form-control albaran-filter" name="cliente"></th>
<th><input type="text" class="form-control albaran-filter" name="att"></th>
<th><input type="text" class="form-control albaran-filter" name="direccion"></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/albaranes/list.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -9,14 +9,16 @@
<div class="col-12">
<div class="card">
<div class="card-header">
<h4><?= $boxTitle ?> <?= ($envioEntity->finalizado == 0)?'':'<span class="badge text-bg-success fw-lg">FINALIZADO</span>' ?></h4>
<h4><?= $boxTitle ?>
<?= ($envioEntity->tipo_envio == 'ferro_prototipo') ? '<span class="badge text-bg-warning fw-lg">FERRO</span>':'' ?>
<?= ($envioEntity->finalizado == 0) ? '' : '<span class="badge text-bg-success fw-lg">FINALIZADO</span>' ?>
</h4>
</div>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<input type="hidden" id="id" name="id" value="<?= $envioEntity->id ?>">
<input type="hidden" id="nextCaja" name="next_caja" value="<?= $envioEntity->nextCaja ?>">
<div class="accordion accordion-bordered">
<div class="card accordion-item active mb-5">
@ -112,7 +114,7 @@
</div>
</div>
<?php if ($envioEntity->finalizado == 0): ?>
<?php if ($envioEntity->finalizado == 0 && $envioEntity->tipo_envio=='estandar'): ?>
<div class="accordion accordion-bordered">
<div class="card accordion-item active mb-5">
<h4 class="accordion-header px-4 py-3">
@ -162,7 +164,7 @@
<div class="d-flex flex-row">
<p><?= lang('Logistica.buttonsActions') ?></p>
</div>
<div class="d-flex flex-row mb-3">
<div class="d-flex flex-row mb-3 align-items-end">
<div class="col-sm-2 px-3">
<button id="btnSelectAll" name="btnSelectAll" tabindex="1"
class="btn btn-primary w-100">
@ -170,7 +172,7 @@
<i class="ti ti-select"></i>
</button>
</div>
<?php if ($envioEntity->finalizado == 0): ?>
<?php if ($envioEntity->finalizado == 0 && $envioEntity->tipo_envio=='estandar'): ?>
<div class="col-sm-2 px-3">
<button id="btnEliminarLineas" name="btnEliminarLineas" tabindex="1"
class="btn btn-danger w-100">
@ -194,6 +196,22 @@
</button>
</div>
<div class="col-sm-2 px-3 d-flex flex-column justify-content-end">
<div class="d-flex flex-column justify-content-end h-100">
<label for="impresoraEtiquetas" class="form-label">
<?= lang("Logistica.impresoraEtiquetas") ?>
</label>
<select id="impresoraEtiquetas" name="impresora_etiquetas" tabindex="1"
maxlength="50" class="form-control select2bs2" style="width: 100%;">
<?php foreach ($envioEntity->impresoras as $impresora): ?>
<option value="<?= $impresora->id ?>">
<?= $impresora->name ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="row mb-3">
@ -288,9 +306,8 @@
<?= lang("Logistica.codigoSeguimiento") ?>
</label>
<input type="text" id="codigoSeguimiento" name="codigo_seguimiento" tabindex="1"
maxlength="100" class="form-control"
<?= ($envioEntity->finalizado == 0) ? "" : "readonly" ?>
value="<?= old('codigo_seguimiento', $envioEntity->codigo_seguimiento) ?>">
maxlength="100" class="form-control" <?= ($envioEntity->finalizado == 0) ? '' : 'readonly' ?>
value="<?= esc(old('codigo_seguimiento', $envioEntity->codigo_seguimiento)) ?>">
</div>
<div class="col-sm-3 px-3">
<label for="empresaMensajeria" class="form-label">
@ -319,6 +336,7 @@
<ti class="ti ti-check"></ti>
</button>
</div>
<?php if ($envioEntity->tipo_envio=='estandar'): ?>
<div class="col-sm-3 px-3">
<button id="finalizarEnvioYOTs" name="finalizar_envio_ots" tabindex="1"
class="btn btn-primary mt-4 w-100 btn-finalizar">
@ -326,6 +344,7 @@
<ti class="ti ti-checks"></ti>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>

View File

@ -1,97 +0,0 @@
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4><?= $boxTitle ?></h4>
</div>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<div class="card accordion-item active mb-5">
<h4 class="accordion-header px-4 py-3">
<?= lang("Logistica.nuevoEnvio") ?>
</h4>
<div id="accordionNuevoEnvioTip" class="accordion-collapse collapse show">
<div class="accordion-body px-4 py-3">
<div class="row">
<div class="mb-1 col-sm-4">
<label for="buscadorPedidos" class="form-label">
<?= lang("Logistica.buscadorPedidosTitle") ?>
</label>
<input id="buscadorPedidos" name="buscador_pedidos" tabindex="1" maxlength="50"
class="form-control" value="">
</div>
</div>
</div>
</div>
</div>
<div class="card accordion-item active">
<h4 class="accordion-header px-4 py-3">
<?= lang("Logistica.listadoEnvios") ?>
</h4>
<div id="accordionListadoEnviosTip" class="accordion-collapse collapse show">
<div class="accordion-body px-4 py-3">
<div class="row">
<table id="tableOfEnvios" class="table table-striped table-hover w-100">
<thead>
<tr>
<th><?= lang('Logistica.idEnvio') ?? 'ID Envío' ?></th>
<th><?= lang('Logistica.numeroPedidos') ?? 'Nº Pedidos' ?></th>
<th><?= lang('Logistica.numeroLineas') ?? 'Nº Líneas' ?></th>
<th><?= lang('Logistica.att') ?? 'Att' ?></th>
<th><?= lang('Logistica.direccion') ?? 'Dirección' ?></th>
<th><?= lang('Logistica.ciudad') ?? 'Ciudad' ?></th>
<th><?= lang('Logistica.pais') ?? 'País' ?></th>
<th><?= lang('Logistica.cp') ?? 'CP' ?></th>
<th><?= lang('Logistica.email') ?? 'Email' ?></th>
<th><?= lang('Logistica.telefono') ?? 'Teléfono' ?></th>
<th><?= lang('Logistica.finalizado') ?? 'Finalizado' ?></th>
<th><?= lang('Logistica.acciones') ?? 'Acciones' ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="mt-3">
<button type="button" class="btn btn-secondary" id="btnImprimirEtiquetas"
onclick="window.location.href='<?= route_to('LogisticaPanel') ?>'">
<?= lang('Logistica.backToPanel') ?>
</button>
</div>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/logistica/envio.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -12,6 +12,8 @@
</div>
<div class="card-body">
<input type="hidden" id="tipo_envio" value="<?= $tipo_envio ?>" />
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<div class="card accordion-item active mb-5">
@ -71,7 +73,7 @@
<thead>
<tr>
<th><?= lang('Logistica.idEnvio') ?? 'ID Envío' ?></th>
<th><?= lang('Logistica.numeroPedidos') ?? 'Nº Pedidos' ?></th>
<th><?= lang('Logistica.numeroOts') ?? 'Nº OTs' ?></th>
<th><?= lang('Logistica.numeroLineas') ?? 'Nº Líneas' ?></th>
<th><?= lang('Logistica.att') ?? 'Att' ?></th>
<th><?= lang('Logistica.direccion') ?? 'Dirección' ?></th>
@ -83,6 +85,26 @@
<th><?= lang('Logistica.finalizado') ?? 'Finalizado' ?></th>
<th><?= lang('Logistica.acciones') ?? 'Acciones' ?></th>
</tr>
<tr>
<th><input type="text" class="form-control envio-filter" name="id"></th>
<th><input type="text" class="form-control envio-filter-ots" name="ots"></th>
<th></th>
<th><input type="text" class="form-control envio-filter" name="att"></th>
<th><input type="text" class="form-control envio-filter" name="direccion"></th>
<th><input type="text" class="form-control envio-filter" name="ciudad"></th>
<th><input type="text" class="form-control envio-filter" name="pais"></th>
<th><input type="text" class="form-control envio-filter" name="cp"></th>
<th><input type="text" class="form-control envio-filter" name="email"></th>
<th><input type="text" class="form-control envio-filter" name="telefono"></th>
<th>
<select class="form-control envio-filter-select" name="finalizado">
<option value=""><?= lang('Logistica.todos')?></option>
<option value="0"><?= lang('Basic.global.no') ?></option>
<option value="1"><?= lang('Basic.global.yes') ?></option>
</select>
</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>

View File

@ -17,7 +17,7 @@
<img src="<?= site_url("assets/img/logistica/envios.jpg") ?>" alt="Envíos">
<div><span><?= lang("Logistica.gestionEnvios"); ?></span></div>
</div>
<div class="item">
<div class="item" onclick="location.href='<?= route_to('gestionEnviosFerros') ?>'">
<img src="<?= site_url("assets/img/logistica/envios_ferros.png") ?>" alt="Envío de Ferros/Prototipos">
<div><span><?= lang("Logistica.envioFerros"); ?></span></div>
</div>
@ -25,7 +25,7 @@
<img src="<?= site_url("assets/img/logistica/impresionEtiquetas.jpg") ?>" alt="Etiquetas de títulos">
<div><span><?= lang("Logistica.etiquetasTitulos"); ?></span></div>
</div>
<div class="item">
<div class="item" onclick="location.href='<?= route_to('albaranesList') ?>'">
<img src="<?= site_url("assets/img/logistica/albaranes.png") ?>" alt="Albaranes">
<div><span><?= lang("Logistica.albaranes"); ?></span></div>
</div>

View File

@ -26,6 +26,9 @@ use Config\App;
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-facturas-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-facturas"><?=lang('App.menu_facturas')?></button>
</li>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-ot-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ots"><?=lang('Produccion.ots')?></button>
</li>
</ul>
<div class="tab-content" id="message-datatables-container">
@ -41,7 +44,9 @@ use Config\App;
</div>
<div class="tab-pane fade show" id="navs-top-align-facturas">
<?= view("themes/vuexy/components/tables/messages_table", ["id" => "tableFacturaMessages"]) ?>
</div>
<div class="tab-pane fade show" id="navs-top-align-ots">
<?= view("themes/vuexy/components/tables/messages_table", ["id" => "tableOtMessages"]) ?>
</div>
</div>
<!--//.card -->

View File

@ -39,6 +39,7 @@
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
<th class="lp-header">Pallets?</th>
<th class="lp-header">Ferro o Prototipo?</th>
<th style="min-width:120px !important;" class="lp-header"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -60,6 +61,7 @@
<button id="insertar_direccion" type="button" class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.insertar")?></button>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->

View File

@ -8,6 +8,15 @@
<div class="modal-body">
<div id='error-tarifa'></div>
<div class="mb-3" id="direccionFerroProto">
<label for="dirFerroProto" class="form-label">
Dirección Ferro o Prototipo
</label>
<input type="checkbox" id="dirFerroProto" class="form-check-input">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_clientedAdd" class="form-label">
<?= lang('PresupuestosDirecciones.clientedAdd') ?>*

View File

@ -0,0 +1,63 @@
<?= $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">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table-maquinista table table-hover text-dark" style="width: 100%;">
<thead>
<tr>
<th><?= lang('ID') ?></th>
<th><?= lang('Users.firstName') ?></th>
<th><?= lang('Users.lastName') ?></th>
<th><?= lang('Users.email') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
<?php if (count($maquinistas) > 0): ?>
<?php foreach ($maquinistas as $key => $maquinista): ?>
<tr>
<td><?= $maquinista->id ?></td>
<td><?= $maquinista->first_name ?></td>
<td><?= $maquinista->last_name ?></td>
<td><?= $maquinista->getEmail() ?></td>
<td style="color: white;">
<a type="button" href="<?= route_to("maquinistaChangeUserSession", $maquinista->id) ?>" class="btn btn-lg btn-primary h-100 w-100">Mi turno</a>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr class="text-center">
<td colspan="5">No hay usuarios para cambiar turno</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/maquinista.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<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

@ -23,11 +23,11 @@
<?= $maquina["nombre"] ?>
<?php if ($maquina["countTareas"] > 0): ?>
<span class="badge rounded-pill badge-center h-px-20 w-px-20 bg-secondary ms-1_5"><?= $maquina["countTareas"] ?></span>
<? endif; ?>
<?php endif; ?>
</span>
</a>
</div>
<? endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>
@ -44,11 +44,11 @@
<?= $maquina["nombre"] ?>
<?php if ($maquina["countTareas"] > 0): ?>
<span class="badge rounded-pill badge-center h-px-20 w-px-20 bg-secondary ms-1_5"><?= $maquina["countTareas"] ?></span>
<? endif; ?>
<?php endif; ?>
</span>
</a>
</div>
<? endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>
@ -65,11 +65,11 @@
<?= $maquina["nombre"] ?>
<?php if ($maquina["countTareas"] > 0): ?>
<span class="badge rounded-pill badge-center h-px-20 w-px-20 bg-secondary ms-1_5"><?= $maquina["countTareas"] ?></span>
<? endif; ?>
<?php endif; ?>
</span>
</a>
</div>
<? endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>

View File

@ -21,7 +21,95 @@
</div>
</div>
<div class="row">
<div class="col-md-3 <?= $user_dates["pre_formato_at"]||$user_dates["pre_lomo_at"]||$user_dates["pre_solapa_at"]||$user_dates["pre_codbarras_at"]||$user_dates["pre_imposicion_at"] ? "" : "d-none" ?>">
<!-- PREIMPRESION -->
<!-- Preformato -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100">
<h4><?= lang("Produccion.progress_preimpresion") ?></h4>
</div>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_formato ? "" : "d-none" ?>">
<label for="ot-preformato-btn" class="form-label"><?= @lang("Produccion.pre_formato") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_formato_at" id="ot-preformato-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_formato_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Prelomo -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_lomo ? "" : "d-none" ?>">
<label for="ot-prelomo-btn" class="form-label"><?= @lang("Produccion.pre_lomo") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_lomo_at" id="ot-prelomo-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_lomo_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Presolapa -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_solapa ? "" : "d-none" ?>">
<label for="ot-presolapa-btn" class="form-label"><?= @lang("Produccion.pre_solapa") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_solapa_at" id="ot-presolapa-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_solapa_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Precodbarras -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_codigo_barras ? "" : "d-none" ?>">
<label for="ot-precodbarras-btn" class="form-label"><?= @lang("Produccion.pre_codbarras") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_codbarras_at" id="ot-precodbarras-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_codbarras_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Preimposicion -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->realizar_imposicion ? "" : "d-none" ?>">
<label for="ot-preimposicion-btn" class="form-label"><?= @lang("Produccion.pre_imposicion") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_imposicion_at" id="ot-preimposicion-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_imposicion_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
</div>
<div class="col-md-3 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100">
<h4><?= lang("Produccion.progress_ferro") ?></h4>
</div>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<label for="ot-pendiente-ferro" class="form-label"><?= @lang("Produccion.pendiente_ferro") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" name="pendiente_ferro_at" placeholder="DD/MM/YYYY" id="ot-pendiente-ferro" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pendiente_ferro_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<label for="ot-ferro-cliente" class="form-label"><?= @lang("Produccion.ferro_cliente") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" name="ferro_en_cliente_at" placeholder="DD/MM/YYYY" id="ot-ferro-cliente" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["ferro_en_cliente_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<label for="ot-ferro-ok" class="form-label"><?= @lang("Produccion.ferro_ok") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" name="ferro_ok_at" placeholder="DD/MM/YYYY" id="ot-ferro-ok" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["ferro_ok_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
</div>
<div class="col-md-3">
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100">
@ -164,34 +252,7 @@
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100">
<h4><?= lang("Produccion.progress_logistica") ?></h4>
</div>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<label for="ot-pendiente-ferro" class="form-label"><?= @lang("Produccion.pendiente_ferro") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" name="pendiente_ferro_at" placeholder="DD/MM/YYYY" id="ot-pendiente-ferro" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pendiente_ferro_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<label for="ot-ferro-cliente" class="form-label"><?= @lang("Produccion.ferro_cliente") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" name="ferro_en_cliente_at" placeholder="DD/MM/YYYY" id="ot-ferro-cliente" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["ferro_en_cliente_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->ferro ? "" : "d-none" ?>">
<label for="ot-ferro-ok" class="form-label"><?= @lang("Produccion.ferro_ok") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" name="ferro_ok_at" placeholder="DD/MM/YYYY" id="ot-ferro-ok" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["ferro_ok_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100">
<label for="ot-embalaje" class="form-label"><?= @lang("Produccion.embalaje") ?></label>
@ -214,61 +275,7 @@
</div>
</div>
<div class="col-md-3">
<!-- PREIMPRESION -->
<!-- Preformato -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100">
<h4><?= lang("Produccion.progress_preimpresion") ?></h4>
</div>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_formato ? "" : "d-none" ?>">
<label for="ot-preformato-btn" class="form-label"><?= @lang("Produccion.pre_formato") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_formato_at" id="ot-preformato-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_formato_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Prelomo -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_lomo ? "" : "d-none" ?>">
<label for="ot-prelomo-btn" class="form-label"><?= @lang("Produccion.pre_lomo") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_lomo_at" id="ot-prelomo-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_lomo_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Presolapa -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_solapa ? "" : "d-none" ?>">
<label for="ot-presolapa-btn" class="form-label"><?= @lang("Produccion.pre_solapa") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_solapa_at" id="ot-presolapa-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_solapa_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Precodbarras -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->revisar_codigo_barras ? "" : "d-none" ?>">
<label for="ot-precodbarras-btn" class="form-label"><?= @lang("Produccion.pre_codbarras") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_codbarras_at" id="ot-precodbarras-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_codbarras_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<!-- Preimposicion -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $ot->realizar_imposicion ? "" : "d-none" ?>">
<label for="ot-preimposicion-btn" class="form-label"><?= @lang("Produccion.pre_imposicion") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="pre_imposicion_at" id="ot-preimposicion-date" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<button class="btn btn-outline-danger btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
<div class="form-text"><?= $user_dates["pre_imposicion_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
</div>
</div>
<div class="row">
<div class="row">

View File

@ -12,7 +12,7 @@
<div id="accordionOtTasksTip" class="accordion-collapse collapse show" data-bs-parent="#accordionOtTasks">
<div class="accordion-body">
<div class="card text-center">
<div class="card">
<div class="card-header">
<div class="nav-align-top">
<ul class="nav nav-pills" role="tablist">
@ -34,7 +34,23 @@
<div class="tab-content p-0">
<!-- TAREAS -->
<div class="tab-pane fade show active" id="nav-ot-task-general" role="tabpanel">
<div class="row text-start">
<div class="row justify-content-end">
<div class="col-md-4">
<?php if ($flags["isCosido"] && $tareaCosido): ?>
<div class="form-group text-start">
<label for="">Pliegos</label>
<div class="d-flex flex-row justify-content-start align-items-center gap-2">
<input type="text" id="pliegos-1" class="form-control ot-pliegos" name="pliego_1" value="<?= $tareaCosido->pliego_1 ?>">
<span>de</span>
<input type="text" id="pliegos-1-total" class="form-control ot-pliegos" name="pliego_1_total" value="<?= $tareaCosido->pliego_1_total ?>">
<input type="text" id="pliegos-2" class="form-control ot-pliegos" name="pliego_2" value="<?= $tareaCosido->pliego_2 ?>">
<span>de</span>
<input type="text" id="pliegos-2-total" class="form-control ot-pliegos" name="pliego_2_total" value="<?= $tareaCosido->pliego_2_total ?>">
<button type="button" id="btn-update-pliegos" class="btn btn-primary"><span class="ti ti-device-floppy"></span></button>
</div>
</div>
<?php endif; ?>
</div>
<div class="col-md-12">
<?= view("themes/vuexy/components/tables/ot_task_table", ["id" => "ot-task-table"]) ?>
@ -43,6 +59,7 @@
<div class="row d-flex flex-row justify-content-between align-items-center mt-2 gap-2">
<div class="col-md-3 text-start">
<!-- <button type="button" class="btn btn-primary btn-md align-items-center" id="btn-add-tarea"><span class="ti ti-plus ti-sm me-1"></span> Insertar tarea</button> -->
</div>
<div class="col-md-3 gap-2 text-end">

View File

@ -110,6 +110,17 @@ $picture = "/assets/img/default-user.png";
<i class="ti ti-menu-2 ti-sm"></i>
</a>
</div>
<!-- CAMBIO DE USUARIO PARA MAQUINISTA -->
<?php if (auth()->user()->inGroup('maquina')): ?>
<div class="navbar-nav-left d-flex align-items-center" id="navbar-collapse">
<ul class="navbar-nav flex-row justify-content-start align-items-center ms-auto">
<li class="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
<a type="btn" href="<?= route_to('maquinistaUserChangeList') ?>" class="btn btn-outline-primary btn-sm w-100">Cambiar usuario</a>
</li>
</ul>
</div>
<?php endif; ?>
<div class="navbar-nav-right d-flex align-items-center" id="navbar-collapse">
<ul class="navbar-nav flex-row align-items-center ms-auto">

View File

@ -32,7 +32,7 @@
require "menus/maquinista_menu.php";
require "menus/importacion_menu.php";
require "menus/importadores_menu.php";
require "menus/catalogo_menu.php";

View File

@ -8,7 +8,7 @@ if (auth()->user()->can('catalogo.menu')) {
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-book"></i>
<?= lang("App.menu_catalogo") ?>
<div><?= lang("App.menu_catalogo") ?></div>
</a>
<ul class="menu-sub">
<?php if (auth()->user()->can('catalogo.menu')) { ?>

View File

@ -134,6 +134,13 @@ if (
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin')) { ?>
<li class="menu-item">
<a href="<?= route_to('festivosList') ?>" class="menu-link">
<div> <?= lang("App.menu_config_holidays") ?></div>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>

View File

@ -1,15 +0,0 @@
<?php
/**
* MENU IMPORTACION
*/
if (auth()->user()->inGroup('beta')) {
?>
<!-- Import -->
<li class="menu-item">
<a href="<?= site_url("importacion/importar") ?>" class="menu-link beta">
<i class="menu-icon tf-icons ti ti-file-import"></i>
<div> <?= lang("App.menu_importacion") ?></div>
</a>
</li>
<?php } ?>

View File

@ -0,0 +1,27 @@
<?php
/**
* MENU IMPORTACION
*/
if (auth()->user()->can('importadores.menu')) {
?>
<!-- Importadores -->
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-file-import"></i>
<div><?= lang("App.menu_importadores") ?> </div>
</a>
<ul class="menu-sub">
<?php if (auth()->user()->can('importadores.catalogo')) { ?>
<li class="menu-item">
<a href="<?= route_to("importadorCatalogoTool") ?>" class="menu-link">
<?= lang("App.menu_importadores_catalogo") ?>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>

View File

@ -0,0 +1,32 @@
<table>
<tr class="encuadernacion">
<th >Encuadernacion</th>
<th class="cell-50"><?=$presupuesto->solapas > 0 ? "Solapas" : ""?></th>
<th class="cell-50"></th>
<th class="cell-50"></th>
<th class="cell-50"></th>
<th class="cell-50"></th>
<th class="cell-50">Retractilado</th>
<th class="cell-50">Marcapáginas</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<?php if ($presupuesto->solapas > 0): ?>
<td><?= "SI ($presupuesto->solapas_ancho mm.)" ?></td>
<?php else: ?>
<td></td>
<?php endif; ?>
<td></td>
<td></td>
<td></td>
<td></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,26 @@
<table>
<tr class="encuadernacion">
<th class="cell-50">Encuadernacion</th>
<th class="cell-50">Tipo</th>
<th class="cell-50">Color</th>
<th class="cell-50">Plakenes</th>
<th class="cell-50">Plakene</th>
<th class="cell-50">Externo</th>
<th class="cell-50">Retractilado</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<td></td>
<td></td>
<td><?= $flags['isPlakene'] ? "SI" : "NO" ?></td>
<td><?= $plakene_tipo ?? "" ?></td>
<td><?= $encuadernacion->proveedor() ? $encuadernacion->proveedor()->nombre : "" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,32 @@
<table>
<tr class="encuadernacion">
<th>Encuadernacion</th>
<th class="cell-50">Pliegos</th>
<th class="cell-50">Pliegos</th>
<th class="cell-50"><?=$presupuesto->solapas > 0 ? "Solapas" : ""?></th>
<th class="cell-50">Sobrecubierta</th>
<th class="cell-50">Guardas</th>
<th class="cell-50">Retractilado</th>
<th class="cell-50">Marcapáginas</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<td><?= $tareaCosido->pliego_1 . " de " . $tareaCosido->pliego_1_total ?></td>
<td><?= $tareaCosido->pliego_2 . " de " . $tareaCosido->pliego_2_total ?></td>
<?php if ($presupuesto->solapas > 0): ?>
<td><?= "SI ($presupuesto->solapas_ancho mm.)" ?></td>
<?php else: ?>
<td>NO</td>
<?php endif; ?>
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,32 @@
<table>
<tr class="encuadernacion">
<th >Encuadernacion</th>
<th class="cell-50"><?=$presupuesto->solapas > 0 ? "Solapas" : ""?></th>
<th class="cell-50"></th>
<th class="cell-50"></th>
<th class="cell-50">Sobrecubierta</th>
<th class="cell-50">Guardas</th>
<th class="cell-50">Retractilado</th>
<th class="cell-50">Marcapáginas</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<?php if ($encuadernacion->solapas > 0): ?>
<td><?= "SI ($presupuesto->solapas_ancho mm.)" ?></td>
<?php else: ?>
<td></td>
<?php endif; ?>
<td></td>
<td></td>
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,48 @@
<table>
<tr>
<th class="encuadernacion">Encuadernacion</th>
<th class="cell-50">Pliegos</th>
<th class="cell-50">Pliegos</th>
<th class="cell-50">Guardas</th>
<th class="cell-50">Guardas Impresion</th>
<th class="cell-50">Cabezada</th>
<th class="cell-50">Lomo</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<?php if ($tareaCosido): ?>
<td><?= $tareaCosido->pliego_1 . " de " . $tareaCosido->pliego_1_total ?></td>
<td><?= $tareaCosido->pliego_2 . " de " . $tareaCosido->pliego_2_total ?></td>
<?php else: ?>
<td><?= "___de___" ?></td>
<td><?= "___de___" ?></td>
<?php endif; ?>
<!-- Guardas -->
<?php if ($presupuesto->presupuestoLineaGuarda()): ?>
<td><?= $presupuesto->presupuestoLineaGuarda()->papel_generico()?->code ?></td>
<td><?= $presupuesto->presupuestoLineaGuarda()->paginas_impresion > 0 ? "SI" : "NO" ?></td>
<?php else: ?>
<td>?</td>
<td><?= $presupuesto->presupuestoLineaGuarda()->paginas_impresion > 0 ? "SI" : "NO" ?>></td>
<?php endif; ?>
<!-- Cabezada -->
<td><?= $presupuesto->cabezada ? "COLOR" : "NO" ?></td>
<!-- Lomo -->
<td><?= $presupuesto->lomo_redondo ? "REDONDO" : "RECTO" ?></td>
</tr>
<tr>
<td class="encuadernacion" colspan="1">Sobrecubierta</td>
<td style="color:red" colspan="2"><?= $linea_impresion->isSobreCubierta() ? "SI" : "NO" ?></td>
<td class="encuadernacion">Retractilado</td>
<td style="color:red"><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td class="encuadernacion">Marcapáginas</td>
<td style="color:red"><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,39 @@
<table>
<tr class="encuadernacion">
<th>Encuadernacion</th>
<th class="cell-50">Guardas</th>
<th class="cell-50">Guardas Imp.</th>
<th class="cell-50">Cabezada</th>
<th class="cell-50">Lomo</th>
<th class="cell-50">Sobrecubierta</th>
<th class="cell-50">Retractilado</th>
<th class="cell-50">Marcapáginas</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<!-- Guardas -->
<?php if ($presupuesto->presupuestoLineaGuarda()): ?>
<td><?= $presupuesto->presupuestoLineaGuarda()->papel_generico()?->nombre ?></td>
<td><?= $presupuesto->presupuestoLineaGuarda()->paginas_impresion > 0 ? "SI" : "NO" ?>></td>
<?php else: ?>
<td>?</td>
<td><?= $presupuesto->presupuestoLineaGuarda()->paginas_impresion > 0 ? "SI" : "NO" ?>></td>
<?php endif; ?>
<!-- Cabezada -->
<td><?= $presupuesto->cabezada ? "COLOR" : "NO" ?></td>
<!-- Lomo -->
<td><?= $presupuesto->lomo_redondo ? "REDONDO" : "RECTO" ?></td>
<!-- Sobrecubierta -->
<td><?= $linea_impresion->isSobreCubierta() ? "SI" : "NO" ?></td>
<!-- Retractilado -->
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<!-- Marcapaginas -->
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,24 @@
<table>
<tr class="encuadernacion">
<th class="cell-50">Encuadernacion</th>
<th class="cell-50">Color</th>
<th class="cell-50">Plakenes</th>
<th class="cell-50">Plakene</th>
<th class="cell-50">Externo</th>
<th class="cell-50">Retractilado</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<td></td>
<td><?= $flags['isPlakene'] ? "SI" : "NO" ?></td>
<td><?= $plakene_tipo ?? "" ?></td>
<td><?= $encuadernacion->proveedor() ? $encuadernacion->proveedor()->nombre : "" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,28 @@
<table>
<tr class="encuadernacion">
<th >Encuadernacion</th>
<th class="cell-50"></th>
<th class="cell-50"></th>
<th class="cell-50"></th>
<th class="cell-50">Sobrecubierta</th>
<th class="cell-50">Guardas</th>
<th class="cell-50">Retractilado</th>
<th class="cell-50">Marcapáginas</th>
</tr>
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<td></td>
<td></td>
<td></td>
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php else: ?>
<tr style="color: red;">
<td colspan="7">Sin encuadernación</td>
</tr>
<?php endif; ?>
</table>

View File

@ -81,13 +81,13 @@ $settings = $session->get('settings');
<div class="col-3 h-100">
<div class="row px-2 d-flex flex justify-content-between align-items-center">
<div class="col-6 w-100 text-center">
<span id="fecha_encuadernado_at" style="color:<?= $colors["general"]["color"] ?>;"><strong><?= $pedido->fecha_encuadernado ? Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->format('d/m/Y') : "??" ?></strong></span>
<span id="fecha_encuadernado_at" style="color:<?= $colors["general"]["color"] ?>;"><strong><?= $pedido->fecha_encuadernado ? Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->format('d/m/Y') : "" ?></strong></span>
</div>
</div>
<div class="row px-2 mt-2 h-100">
<table class="h-100">
<table class="h-100 bg-white">
<tr>
<th>IN</th>
<th class="bg-white">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
@ -113,18 +113,18 @@ $settings = $session->get('settings');
<div class="col-5">
<div class="row">
<div class="col-12 w-50 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;">
<strong><?= isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "?" : "?" ?></strong>
<strong><?= $encuadernacionCode ?></strong>
</div>
</div>
<div class="row h-75">
<div class="col-6 square text-center" style="background-color: <?= $colors["papel_interior"]["bg"] ?>;color:<?= $colors["papel_interior"]["color"] ?>;">
<?= $linea_impresion->papel_impresion()->papel_code_ot ?>
<?= $linea_impresion?->papel_impresion()->papel_code_ot ?>
</div>
<div class="col-6 square text-center <?= $linea_impresion->isColor() ? "cmyk" : "bn" ?>">
<?= $tiempo_impresion ?>
</div>
<div class="col-6 square text-center" style="background-color: <?= $colors["papel_cubierta"]["bg"] ?>;color:<?= $colors["papel_cubierta"]["color"] ?>;">
<?= $linea_cubierta->papel_impresion()->papel_code_ot ?>
<?= $linea_cubierta?->papel_impresion()->papel_code_ot ?>
</div>
<div class="col-6 square text-center" style="background-color: <?= $colors["plastificado"]["bg"] ?>;color:<?= $colors["plastificado"]["color"] ?>;">
<?= isset($acabados[0]) ? $acabados[0]->tarifa()->code : "" ?>
@ -156,6 +156,12 @@ $settings = $session->get('settings');
<div class="row">
<div class="col-8">
<table class="h-50">
<tr>
<th>IDSK</th>
<td class="t-cell">
</td>
</tr>
<tr>
<th>CLIENTE</th>
<td class="t-cell">
@ -229,9 +235,9 @@ $settings = $session->get('settings');
<th>Tiempo</th>
</tr>
<tr>
<td><?= $presupuesto->paginas * $presupuesto->tirada ?></td>
<td><?= $presupuesto->paginas ?></td> <!-- Páginas libro -->
<td><?= $presupuesto->tirada ?> </td>
<td>??</td>
<td><?= $linea_impresion->tinta() ?></td>
<td><?= json_decode($linea_impresion->formas)->formas ?></td>
<td><strong><?= $linea_impresion->maquina()->nombre ?></strong></td>
<td><?= $linea_impresion->rotativa_clicks_total ?></td>
@ -261,87 +267,89 @@ $settings = $session->get('settings');
</div>
</div>
</div>
<div class="row mb-2">
<div class="section-title cubierta">IMP. CUBIERTA</div>
<div class="col-12">
<?php if ($linea_cubierta): ?>
<div class="row mb-2">
<div class="section-title cubierta">IMP. CUBIERTA</div>
<div class="col-12">
<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>
<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><?= $linea_cubierta->tinta() ?></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>
</tr>
</table>
<div class="comments">
<div class="flex-row cubierta">Comentarios cubierta</div>
<div class="comment-content">
<p>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="row mb-2">
<div class="section-title encuadernacion">ENCUADERNACIÓN</div>
<div class="section-title encuadernacion">ACABADOS/ENCUADERNACIÓN</div>
<div class="col-12">
<div class="col-1 w-10 mb-2 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;">
<span class="fs-bold"><?= $encuadernacionCode ?></span>
</div>
<table>
<tr>
<th class="t-header" style="width: 10%;">Plastificado</th>
<td class="t-cell text-center"><?= $acabados[0]->tarifa()->nombre ?></td>
<th class="t-header" style="width: 10%;">UVI</th>
<td class="t-cell text-center"> <?= $uvi ? $uvi->code : "" ?> </td>
<th class="t-header" style="width: 10%;">Máquina</th>
<td class="t-cell text-center"><?= implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> </td>
<th class="t-header " style="width: 10%;">Operario</th>
<td class="t-cell text-center"><?= $ot->users()?->plastificado_by?->getFullName() ?? null ?> </td>
</tr>
</table>
<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 if (count($encuadernaciones) > 0): ?>
<?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>_____<?= " " . lang("Produccion.pliegos_de") . " " ?>_____</td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<?php foreach ($acabados as $key => $acabado): ?>
<tr>
<td colspan="7">Sin encuadernación</td>
<td class="w-10 encuadernacion">Plastificado</td>
<td><?= $acabado->tarifa()->nombre ?></td>
<td class="encuadernacion bg-encuadernacion" style="width: 100px;">UVI</td>
<td style="color:red;width:100px" class="bg-encuadernacion"> <?= $uvi ? 'SI' : "NO" ?> </td>
<td class="encuadernacion bg-encuadernacion" style="width: 100px;">EXTERNO:</td>
<td class="bg-encuadernacion" style="width: 100px;"><?= $acabado->proveedor() ? $acabado->proveedor()->nombre : "" ?></td>
</tr>
<?php endif; ?>
<tr>
<td class="text-start" colspan="2">Meter datos de solapas y preparación guillotina</td>
<td></td>
<td></td>
<td class="t-header">CORTE PIE:</td>
<td></td>
</tr>
<?php endforeach; ?>
</table>
<?php
foreach ($encuadernaciones as $key => $encuadernacion) {
$encuadernacion_code = $encuadernacion->tarifa()->code;
try {
if ($encuadernacion_code) {
echo view("/themes/vuexy/pdfs/encuadernados/$encuadernacion_code.php", ["encuadernacion" => $encuadernacion]);
} else {
echo view("/themes/vuexy/pdfs/encuadernados/default.php", ["encuadernacion" => $encuadernacion]);
}
} catch (\Throwable $th) {
$error_message = $th->getMessage();
echo "<span style='color:red'>No se ha podido renderizar la tabla de encuadernación</span>";
// echo "<br><span style='color:red'>$error_message</span>";
}
}
?>
<?php if (count($encuadernaciones) > 0): ?>
<div class="comments">

View File

@ -0,0 +1,120 @@
import Ajax from '../components/ajax.js'
import { alertSuccess, alertError } from '../components/alerts/sweetAlert.js'
// Render calendar
class SafekatCalendar {
constructor(idElement) {
this.locale = $('meta[name=locale]').attr('content') ?? 'es';
this.calendarEl = document.getElementById(idElement);
this.calendar = null;
}
actionLoader(status = true) {
if (status) {
Notiflix.Block.circle('.section-block');
} else {
Notiflix.Block.remove('.section-block');
}
}
init() {
if (this.calendarEl) {
this.calendar = new FullCalendar.Calendar(this.calendarEl, {
locale: this.locale,
initialView: 'multiMonthYear',
multiMonthMaxColumns: 4,
contentHeight: '100vh',
editable: true,
dragScroll: true,
dayMaxEvents: 2,
dateClick: this.clickEvent.bind(this),
eventResizableFromStart: true,
customButtons: {
sidebarToggle: {
text: 'Sidebar'
}
},
});
this.calendar.render();
this.calendar.setOption('aspectRatio', 1.8);
}
}
renderFestivos() {
this.setEventFestivos()
}
async setEventFestivos() {
try {
let response = await this.getFestivos();
this.actionLoader(false)
if (response.data) {
let festivosEvent = response.data.map(this.parseToFullCalendarEvent)
this.addEvents(festivosEvent)
}
} catch (error) {
console.error(error)
} finally {
this.actionLoader(false)
}
}
removeEvents() {
this.calendar.getEvents().forEach(event => event.remove());
}
async clickEvent(info) {
try {
let response = await this.storeFestivo({ date: info.dateStr })
alertSuccess(response.message).fire()
this.renderFestivos()
} catch (error) {
console.error(error)
} finally {
this.actionLoader(false)
}
}
addEvents(events) {
events.forEach(event => {
this.calendar.addEvent(event)
});
}
parseToFullCalendarEvent(festivoEntity) {
let date = festivoEntity.date.split('-').reverse().join('/')
return {
id: festivoEntity.id,
title: '',
start: festivoEntity.date,
display: 'background',
color: 'red',
textColor: 'white'
}
}
getFestivos() {
this.actionLoader(true)
this.removeEvents()
return new Promise((resolve, reject) => {
let ajax = new Ajax('/configuracion/festivos/all', null, null, resolve, reject)
ajax.get()
})
}
storeFestivo(event) {
this.actionLoader(true)
return new Promise((resolve, reject) => {
let ajax = new Ajax('/configuracion/festivos', event, null, resolve, reject)
ajax.post()
})
}
deleteFestivo(id) {
return new Promise((resolve, reject) => {
let ajax = new Ajax('/configuracion/festivos/' + id, null, null, resolve, reject)
ajax.delete()
})
}
}
export default SafekatCalendar

View File

@ -1,14 +1,17 @@
import DatePicker from "./datepicker.js";
class AlbaranComponent {
constructor(item) {
constructor(item, url_after_delete = '') {
this.url_after_delete = url_after_delete;
this.item = item;
this.id = item.id;
this.numero = item.numero_albaran;
this.cliente = item.cliente;
this.att = item.att;
this.direccion = item.direccion;
this.envio_id = item.envio_id;
this.envio_id = item.envio_id != null ? item.envio_id : '';
this.fecha = null;
if(this.item.fecha_albaran != null){
const [dia, mes, anio] = item.fecha_albaran.split('/');
@ -461,6 +464,9 @@ class AlbaranComponent {
if (response.success) {
// quitar del dom el albarán
$(`#accordioAlbaran${albaranId}`).remove();
if(this.url_after_delete != ''){
window.location.href = this.url_after_delete;
}
} else {
Swal.fire({
title: 'Error',

View File

@ -7,6 +7,8 @@ class MessagesDatatable {
this.datatablePresupuestoMessageItem = this.item.find("#tablePresupuestoMessages")
this.datatablePedidoMessageItem = this.item.find("#tablePedidoMessages")
this.datatableFacturaMessageItem = this.item.find("#tableFacturaMessages")
this.datatableOtMessageItem = this.item.find("#tableOtMessages")
this.focusTable = this.datatableItem
this.columnDefs = [
]
@ -131,6 +133,25 @@ class MessagesDatatable {
columns: this.datatableColumns,
ajax: '/messages/datatable/factura'
});
this.datatableOtMessage = this.datatableOtMessageItem.DataTable({
processing: true,
order: [[1, 'desc']],
columnDefs : this.columnDefs,
orderCellsTop : true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
pageLength: 10,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/messages/datatable/ots'
});
this.datatablePresupuestoMessageItem.on("keyup", ".datatable-message-filter", (event) => {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatablePresupuestoMessage.column(columnIndex).search($(event.currentTarget).val()).draw()
@ -143,6 +164,10 @@ class MessagesDatatable {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatableFacturaMessage.column(columnIndex).search($(event.currentTarget).val()).draw()
})
this.datatableOtMessageItem.on("keyup", ".datatable-message-filter", (event) => {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatableFacturaMessage.column(columnIndex).search($(event.currentTarget).val()).draw()
})
}

View File

@ -0,0 +1,43 @@
import Ajax from '../../components/ajax.js';
import AlbaranComponent from '../../components/albaranComponent.js';
$(() => {
const dropdown = document.querySelector(".dropdown-language");
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
let locale = 'es';
if (activeItem) {
locale = activeItem.getAttribute("data-language");
}
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Albaran'] }, {},
function (translations) {
window.language = JSON.parse(translations);
new Ajax(
'/albaranes/getAlbaran',
{
id: $('#id').val()
},
{},
function (data, headers, success, error, type) {
if (success) {
const albaran = new AlbaranComponent(data.data, '/logistica/listAlbaranes');
albaran.mount('#albaranContainer');
$('.accordion-button').trigger('click');
} else {
popErrorAlert(error);
}
},
function (data, headers, success, error, type) {
popErrorAlert(error);
}
).get();
},
function (error) {
console.log("Error getting translations:", error);
}
).post();
});

View File

@ -0,0 +1,160 @@
import Ajax from "../../components/ajax.js";
$(() => {
let pedidosFilter = '';
const dropdown = document.querySelector(".dropdown-language");
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
let locale = 'es';
if (activeItem) {
locale = activeItem.getAttribute("data-language");
}
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Albaran'] }, {},
function (translations) {
window.language = JSON.parse(translations);
},
function (error) {
console.log("Error getting translations:", error);
}
).post();
$('#btnAddEnvio').on('click', () => {
const pedido_id = selectPedidos.getVal();
const direccionSeleccionada = selectDirecciones.getText();
$.post('/albaranes/datatable', {
pedido_id: pedido_id,
direccion: direccionSeleccionada
}, function (response) {
if (response.status) {
window.open(`${window.location.origin}/logistica/envio/${response.data.id_envio}`);
selectDirecciones.empty();
selectPedidos.empty();
$('.select-direcciones').addClass('d-none');
$('.add-envio').addClass('d-none');
} else {
popErrorAlert(response.message);
}
}).fail(function (xhr, status, error) {
popErrorAlert(error);
});
})
const tableAlbaranes = $('#tableOfAlbaranes').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
orderCellsTop: true,
lengthMenu: [5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500],
pageLength: 50,
"dom": 'lBrtip',
"ajax": {
"url": "/albaranes/datatable",
"data": function (d) {
d.pedidosFilter = pedidosFilter;
}
},
"columns": [
{ "data": "id" },
{ "data": "numero_albaran" },
{ "data": "envio_id" },
{ "data": "pedidos" },
{ "data": "cliente" },
{ "data": "att" },
{ "data": "direccion" },
{ "data": "unidades_total" },
{ "data": "cajas" },
{ "data": "action" }
],
"language": {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
"columnDefs": [
{
orderable: false,
searchable: false,
targets: [9]
},
],
"order": [[0, "desc"]],
});
$(document).on('click', '.btn-delete', function (e) {
const data = {
albaranId: $(this).attr('data-id')
};
const url = '/albaranes/borrarAlbaran';
Swal.fire({
title: window.language.Albaran.borrarAlbaran,
text: window.language.Albaran.borrarAlbaranConfirm,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: window.language.Albaran.borrar,
cancelButtonText: window.language.Albaran.cancelar,
customClass: {
confirmButton: 'btn btn-primary me-1',
cancelButton: 'btn btn-outline-secondary'
},
buttonsStyling: false
}).then((result) => {
$.ajax({
url: url,
type: 'POST',
data: data,
success: (response) => {
if (response.success) {
tableAlbaranes.draw();
} else {
Swal.fire({
title: 'Error',
text: 'No se ha podido borrar el albarán',
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
}
},
error: (xhr, status, error) => {
console.error(error);
}
});
});
});
$(document).on('click', '.btn-edit', function (e) {
window.location.href = '/albaranes/edit/' + $(this).attr('data-id');
});
$(document).on("keyup", ".albaran-filter", (event) => {
let columnName = $(event.currentTarget).attr("name");
let columnIndex = $('#tableOfAlbaranes').DataTable().columns().eq(0).filter(function (index) {
return $('#tableOfAlbaranes').DataTable().column(index).dataSrc() === columnName;
})[0];
$('#tableOfAlbaranes').DataTable().column(columnIndex).search($(event.currentTarget).val()).draw()
})
$(document).on("keyup", ".albaran-filter-pedidos", (event) => {
pedidosFilter = $(event.currentTarget).val();
$('#tableOfAlbaranes').DataTable().ajax.reload();
})
});

View File

@ -0,0 +1,7 @@
import SafekatCalendar from "../../../components/SafekatCalendar.js"
$(() => {
let calendarFestivos = new SafekatCalendar('calendar');
calendarFestivos.init();
calendarFestivos.renderFestivos();
})

View File

@ -79,10 +79,14 @@ class MaquinistaTareaView {
}
handleUpdateClickInputSucess(response) {
popSuccessAlert(response.message)
this.updateContentClick(response.data.click_end - response.data.click_init)
}
handleUpdateClickInputError(error) {
popErrorAlert(error)
}
updateContentClick(clicks){
this.item.find('#clicks-info').empty().html(clicks)
}
handleDeleteTareaProgress() {
let ajax = new Ajax('/produccion/ordentrabajo/tarea/progress/' + this.tareaId,
null,
@ -194,6 +198,17 @@ class MaquinistaTareaView {
}
})
}
getTarea(tarea_id) {
return new Promise((resolve, reject) => {
let ajax = new Ajax(`/produccion/ordentrabajo/tarea/${tarea_id}`, null, null, (response) => {
resolve(response)
},
(error) => {
resolve(error)
})
ajax.get()
})
}
}

View File

@ -54,6 +54,10 @@ class MessagePage {
this.messageDatatable.datatableFacturaMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatableFacturaMessageItem
})
$("#navs-top-align-ot-tab").on("click",()=>{
this.messageDatatable.datatableOtMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatableOtMessageItem
})
}
openNewMessageModal() {

View File

@ -0,0 +1,301 @@
import Ajax from '../../../components/ajax.js';
document.addEventListener('DOMContentLoaded', function () {
const TABLE_COLUMNS = ["input", "idlinea", "descripcion", "cnt_pedida", "precio_compra"];
let dataTable;
dataTable = $('#excelTable').DataTable({
orderCellsTop: true,
responsive: true,
scrollX: true,
lengthMenu: [5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500],
pageLength: 25,
lengthChange: true,
dom: 'lfrtip',
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
order: [[1, 'asc']]
});
// Crear filtros por columna en el segundo <tr>
$('#excelTable thead tr:eq(1) th').each(function (i) {
if (![0, 6, 7].includes(i)) { // No poner input en Checkbox, Notas ni Acciones
$(this).html('<input type="text" class="form-control form-control-sm" placeholder="Filtrar..." />');
$('input', this).on('keyup change', function () {
if (dataTable.column(i).search() !== this.value) {
dataTable.column(i).search(this.value).draw();
}
});
}
});
document.getElementById('excelFile').addEventListener('change', function (e) {
const file = e.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function (e) {
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array' });
const firstSheet = workbook.Sheets[workbook.SheetNames[0]];
const jsonData = XLSX.utils.sheet_to_json(firstSheet, { header: 1 });
validateAndLoadDataTable(jsonData);
};
reader.readAsArrayBuffer(file);
});
async function validateAndLoadDataTable(data) {
if (data.length === 0) return;
const headers = data[0].map(h => h.toString().trim());
const headerMap = {};
headers.forEach((name, idx) => {
headerMap[name.toLowerCase()] = idx;
});
const missing = TABLE_COLUMNS.filter(col => !(col in headerMap));
if (missing.length > 0) {
Swal.fire({
title: 'Error',
text: 'Faltan las siguientes columnas: ' + missing.join(', '),
icon: 'error',
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-danger' }
});
dataTable.clear().draw();
return;
}
const rows = [];
for (let i = 1; i < data.length; i++) {
const rowData = TABLE_COLUMNS.map(col => data[i][headerMap[col]] ?? '');
// Llamar backend para validar la fila
const result = await validarFila(rowData);
let checkboxHtml = '';
let actionBtnsHtml = '';
let notaHtml = '';
if (result.apto) {
checkboxHtml = `<input type="checkbox" class="select-row form-check-input" checked>`;
notaHtml = '';
actionBtnsHtml = `
<div class="d-flex flex-column align-items-start">
<button type="button" class="btn btn-outline-success btn-sm mb-1 importRow">
<i class="fas fa-file-import me-1"></i> Importar
</button>
<button type="button" class="btn btn-outline-danger btn-sm deleteRow">
<i class="fas fa-trash-alt me-1"></i> Eliminar
</button>
</div>
`;
} else {
checkboxHtml = `<input type="checkbox" class="select-row form-check-input" disabled>`;
notaHtml = `<span class="badge bg-danger">${result.reason}</span>`;
actionBtnsHtml = `
<div class="d-flex flex-column align-items-start">
<span class="badge rounded-pill bg-danger mb-2">No Apto</span>
<button type="button" class="btn btn-outline-danger btn-sm deleteRow">
<i class="fas fa-trash-alt me-1"></i> Eliminar
</button>
</div>
`;
}
rows.push([checkboxHtml, ...rowData, notaHtml, actionBtnsHtml]);
}
dataTable.clear().rows.add(rows).draw();
setupEventListeners();
}
async function validarFila(rowData) {
try {
const response = await fetch('/importador/catalogo/validar-fila', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '<?= csrf_hash() ?>'
},
body: JSON.stringify({ fila: rowData })
});
return await response.json();
} catch (error) {
console.error('Error validando fila', error);
return { apto: false, reason: 'Error conexión' };
}
}
function setupEventListeners() {
$('#excelTable tbody').off('click', '.deleteRow').on('click', '.deleteRow', function () {
dataTable.row($(this).parents('tr')).remove().draw();
});
$('#excelTable tbody').off('click', '.importRow').on('click', '.importRow', async function () {
const $row = $(this).closest('tr');
const rowData = dataTable.row($row).data();
if (!rowData) return;
const fila = rowData.slice(1, 6); // solo datos de negocio
try {
const response = await fetch('/importador/catalogo/importar-fila', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '<?= csrf_hash() ?>'
},
body: JSON.stringify({ fila: fila })
});
const result = await response.json();
if (response.ok && result.status === 200) {
const skUrl = result.data?.sk_url?.replace('presupuestocliente', 'presupuestoadmin') ?? null;
// Actualizar campo "Notas" con el enlace
if (skUrl) {
const notasHtml = `<a href="${skUrl}" target="_blank" class="btn btn-sm btn-secondary">Ver presupuesto</a>`;
// La columna de notas es la posición 6 (índice 6)
rowData[6] = notasHtml;
dataTable.row($row).data(rowData).draw(false); // Redibujar la fila SIN perder scroll ni filtros
}
Swal.fire({
title: 'Importado correctamente',
html: skUrl
? `La fila se importó exitosamente.<br><br><a href="${skUrl}" target="_blank" class="btn btn-primary mt-2">Ver presupuesto</a>`
: 'La fila se importó exitosamente.',
icon: 'success',
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-success' }
});
} else {
Swal.fire({
title: 'Error',
text: result.message ?? 'Hubo un error al importar esta fila.',
icon: 'error',
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-danger' }
});
}
} catch (error) {
console.error('Error en la llamada a importar-fila:', error);
Swal.fire({
title: 'Error',
text: 'Error de comunicación con el servidor.',
icon: 'error',
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-danger' }
});
}
});
// Select All funcional
$('#selectAll').off('change').on('change', function () {
const checked = $(this).is(':checked');
$('#excelTable tbody input.select-row:enabled').prop('checked', checked);
});
}
/* Importacion */
document.getElementById('importBtn').addEventListener('click', function () {
const filasAptas = [];
dataTable.rows().every(function () {
const rowNode = this.node();
const checkbox = $(rowNode).find('input.select-row');
if (checkbox.length > 0 && checkbox.is(':checked') && !checkbox.is(':disabled')) {
const rowData = this.data();
filasAptas.push({ fila: rowData.slice(1, 6), rowNode: rowNode, rowData: rowData });
}
});
if (filasAptas.length === 0) {
Swal.fire({
title: 'Atención',
text: 'No hay filas aptas seleccionadas para importar.',
icon: 'warning',
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-warning' }
});
return;
}
Swal.fire({
title: '¿Confirmar importación?',
text: `Se van a importar ${filasAptas.length} filas.`,
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sí, importar',
cancelButtonText: 'Cancelar',
reverseButtons: true,
buttonsStyling: true,
customClass: {
confirmButton: 'btn btn-primary',
cancelButton: 'btn btn-secondary'
}
}).then(async (result) => {
if (!result.isConfirmed) return;
for (const fila of filasAptas) {
try {
const response = await fetch('/importador/catalogo/importar-fila', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '<?= csrf_hash() ?>'
},
body: JSON.stringify({ fila: fila.fila })
});
const result = await response.json();
if (response.ok && result.status === 200) {
const skUrl = result.data?.sk_url?.replace('presupuestocliente', 'presupuestoadmin') ?? null;
if (skUrl) {
fila.rowData[6] = `<a href="${skUrl}" target="_blank" class="btn btn-sm btn-primary">Ver presupuesto</a>`;
} else {
fila.rowData[6] = `<span class="badge bg-success">Importado</span>`;
}
} else {
fila.rowData[6] = `<span class="badge bg-danger">${result.message ?? 'Error desconocido'}</span>`;
}
dataTable.row(fila.rowNode).data(fila.rowData).draw(false);
} catch (error) {
console.error('Error importando fila:', error);
fila.rowData[6] = `<span class="badge bg-danger">Error de comunicación</span>`;
dataTable.row(fila.rowNode).data(fila.rowData).draw(false);
}
}
Swal.fire({
title: 'Importación finalizada',
text: 'Se han procesado todas las filas seleccionadas.',
icon: 'success',
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-success' }
});
});
});
});

View File

@ -3,11 +3,15 @@ import ClassSelect from '../../components/select2.js';
$(() => {
let otsFilter = '';
const tipo_envio = $('#tipo_envio').val();
const selectPedidos = new ClassSelect($('#buscadorPedidos'), '/logistica/selectPedidosForEnvio', "");
const selectPedidos = new ClassSelect($('#buscadorPedidos'), '/logistica/selectForNewEnvio', "", true, {
tipo_envio: () => $('#tipo_envio').val()
});
selectPedidos.init();
const selectDirecciones = new ClassSelect($('#selectDirecciones'), '/logistica/selectDireccionForEnvio', "", true, {
pedido_id: () => selectPedidos.getVal()
ot_id: () => selectPedidos.getVal()
});
selectDirecciones.init();
@ -18,7 +22,10 @@ $(() => {
})
selectPedidos.item.on('change', () => {
selectDirecciones.empty();
$('.select-direcciones').removeClass('d-none');
if(tipo_envio == 'ferro_prototipo')
$('.add-envio').removeClass('d-none');
else
$('.select-direcciones').removeClass('d-none');
})
selectDirecciones.item.on('select2:open', () => {
$('.add-envio').addClass('d-none');
@ -30,12 +37,24 @@ $(() => {
$('#btnAddEnvio').on('click', () => {
const pedido_id = selectPedidos.getVal();
const direccionSeleccionada = selectDirecciones.getText();
$.post('/logistica/generateEnvio', {
pedido_id: pedido_id,
direccion: direccionSeleccionada
}, function (response) {
let url = '';
let data = {};
if(tipo_envio == 'ferro_prototipo'){
url = '/logistica/generateEnvioFerro';
data = {
ot_id: selectPedidos.getVal()
};
}
else{
url = '/logistica/generateEnvio';
data = {
ot_id: selectPedidos.getVal(),
direccion: selectDirecciones.getText()
};
}
$.post(
url,
data, function (response) {
if (response.status) {
window.open(`${window.location.origin}/logistica/envio/${response.data.id_envio}`);
selectDirecciones.empty();
@ -50,7 +69,7 @@ $(() => {
});
})
const tableEnvios = $('#tableOfEnvios').DataTable({
processing: true,
serverSide: true,
@ -63,10 +82,14 @@ $(() => {
"dom": 'lBrtip',
"ajax": {
"url": "/logistica/datatableEnvios",
"data": function (d) {
d.otsFilter = otsFilter;
d.tipo_envio = $('#tipo_envio').val();
}
},
"columns": [
{ "data": "id" },
{ "data": "pedidos" },
{ "data": "ots" },
{ "data": "num_lineas" },
{ "data": "att" },
{ "data": "direccion" },
@ -99,6 +122,26 @@ $(() => {
window.location.href = '/logistica/envio/' + $(this).attr('data-id');
});
$(document).on("keyup", ".envio-filter", (event) => {
let columnName = $(event.currentTarget).attr("name");
let columnIndex = $('#tableOfEnvios').DataTable().columns().eq(0).filter(function (index) {
return $('#tableOfEnvios').DataTable().column(index).dataSrc() === columnName;
})[0];
$('#tableOfEnvios').DataTable().column(columnIndex).search($(event.currentTarget).val()).draw()
})
$(document).on("keyup", ".envio-filter-ots", (event) => {
otsFilter = $(event.currentTarget).val();
$('#tableOfEnvios').DataTable().ajax.reload();
})
$(document).on("change", ".envio-filter-select", (event) => {
let columnName = $(event.currentTarget).attr("name");
let columnIndex = $('#tableOfEnvios').DataTable().columns().eq(0).filter(function (index) {
return $('#tableOfEnvios').DataTable().column(index).dataSrc() === columnName;
})[0];
$('#tableOfEnvios').DataTable().column(columnIndex).search($(event.currentTarget).val()).draw();
});
});

View File

@ -32,6 +32,8 @@ class EnvioEdit {
if (!$("#empresaMensajeriaInput").length) {
this.proveedor = new ClassSelect($("#empresaMensajeria"), '/compras/proveedores/getProveedores', "", true, { 'tipo_id': 2 });
}
this.impresoraEtiquetas = $("#impresoraEtiquetas");
}
init() {
@ -92,6 +94,63 @@ class EnvioEdit {
]
});
$('#btnImprimirEtiquetas').on('click', () => {
const table = this.table;
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
const checkbox = $(node).find('.checkbox-linea-envio');
return checkbox.is(':checked');
}
);
const ids = selectedRows.map((node) => {
const rowData = table.row(node).data();
return rowData.id;
}).toArray();
if (ids.length <= 0) {
Swal.fire({
title: 'Atención!',
text: 'Debe seleccionar al menos una línea de envío para imprimir etiquetas.',
icon: 'info',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
return;
}
const idEnvio = $('#id').val();
let num_cajas = this.cajas.val();
if(ids.length != table.rows().count()){
// se preguntará el numero de cajas en un swal con un input para obtener el valor
Swal.fire({
title: 'Atención!',
text: 'No se ha seleccionado todas las líneas de envío. Ingrese el número de cajas a imprimir.',
icon: 'info',
input: 'text',
inputLabel: 'Número de cajas',
inputValue: num_cajas,
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: 'Imprimir etiquetas',
cancelButtonText: 'Cancelar',
customClass: {
confirmButton: 'btn btn-primary me-1',
cancelButton: 'btn btn-secondary'
},
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
num_cajas = result.value;
this._imprimirEtiquetas(idEnvio, ids, num_cajas);
}
});
}
else{
this._imprimirEtiquetas(idEnvio, ids, num_cajas);
}
});
this.cajas.on('change', (e) => {
const value = $(e.currentTarget).val();
if (value < 0) {
@ -429,6 +488,71 @@ class EnvioEdit {
this._getAlbaranes();
}
_imprimirEtiquetas(envio_id, ids, num_cajas) {
$.post('/logistica/imprimirEtiquetas', {
envio_id: envio_id,
envio_lineas: ids,
cajas: num_cajas,
printer_id: this.impresoraEtiquetas.val(),
}, function (response) {
if (response.status) {
Swal.fire({
title: 'Etiquetas generadas',
text: 'Las etiquetas se han generado correctamente.',
icon: 'success',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
}).then(() => {
if(response.data){
// show xml in a new tab
const blob = new Blob([response.data], { type: 'application/xml' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'etiquetas.xml';
a.click();
URL.revokeObjectURL(url);
a.remove();
}
});
}
else {
Swal.fire({
title: 'Error',
text: response.message,
icon: 'error',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
}
}
).fail(() => {
Swal.fire({
title: 'Error',
text: 'No se pudo generar las etiquetas.',
icon: 'error',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
});
}
_checkDatosFinalizar() {
if (this.codigoSeguimiento.val().length <= 0 || this.proveedor.getVal() <= 0) {

View File

@ -1,11 +1,11 @@
$(() => {
var opt = {
margin: 2,
filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",
image: { type: 'jpeg', quality: 1 },
html2canvas: { scale: 4 },
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
};
let elementToPdf = $('body')[0]
html2pdf().set(opt).from(elementToPdf).save()
// var opt = {
// margin: 2,
// filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",
// image: { type: 'jpeg', quality: 1 },
// html2canvas: { scale: 4 },
// jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
// };
// let elementToPdf = $('body')[0]
// html2pdf().set(opt).from(elementToPdf).save()
})

View File

@ -235,9 +235,35 @@ class DatosLibro {
if (this.ferro.prop('checked')) {
$(document).trigger('add-servicio-lineas', 'ferro');
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: false,
update_tiradas_alternativas: false
});
}
else {
$(document).trigger('remove-servicio-lineas', 'ferro');
if(!this.prototipo.prop('checked')){
const table = $('#tableOfDireccionesEnvio').DataTable();
const rows = table.rows().data();
for (let i = 0; i < rows.length; i++) {
const rowData = rows[i];
if (rowData.is_ferro_prototipo == 1) {
table.rows(i).remove();
table.draw();
break;
}
}
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: true,
update_tiradas_alternativas: true
});
}
}
}
@ -261,9 +287,35 @@ class DatosLibro {
if (this.prototipo.prop('checked')) {
$(document).trigger('add-servicio-lineas', 'prototipo');
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: false,
update_tiradas_alternativas: false
});
}
else {
$(document).trigger('remove-servicio-lineas', 'prototipo');
if(!this.ferro.prop('checked')){
const table = $('#tableOfDireccionesEnvio').DataTable();
const rows = table.rows().data();
for (let i = 0; i < rows.length; i++) {
const rowData = rows[i];
if (rowData.is_ferro_prototipo == 1) {
table.rows(i).remove();
table.draw();
break;
}
}
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: true,
update_tiradas_alternativas: true
});
}
}
}

View File

@ -71,6 +71,7 @@ class Envios {
},
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
{ 'data': 'entregaPieCalle' },
{ 'data': 'is_ferro_prototipo' },
{
data: function (row, type, set, meta) {
return `
@ -87,7 +88,7 @@ class Envios {
orderable: false,
searchable: false,
// all columns
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
//targets: [$('#tableOfDireccionesEnvio').find("tr:first th").length - 1]
},
],
@ -97,7 +98,7 @@ class Envios {
drawCallback: function (settings) {
const boolCols = [15];
const boolCols = [15, 16];
for (let coln of boolCols) {
self.table.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
@ -164,6 +165,19 @@ class Envios {
$('#add_telefono').val(data.telefono)
$('#add_cantidad').val(data.cantidad)
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle == 1 ? true : false)
$('#dirFerroProto').prop('checked', data.is_ferro_prototipo == 1 ? true : false)
if (data.is_ferro_prototipo == 1) {
$('#add_cantidad').val(1);
$('#add_cantidad').attr('disabled', true);
$('#dirFerroProto').prop('disabled', true);
$('#direccionFerroProto').removeClass('d-none');
}
else {
$('#add_cantidad').attr('disabled', false);
$('#dirFerroProto').prop('disabled', false);
$('#direccionFerroProto').addClass('d-none');
}
self.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
self.direccionesClienteForm.init();
@ -220,6 +234,7 @@ class Envios {
let newAddDialog = $("#addressForm");
this.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
this.direccionesClienteForm.init();
let maximaCantidad = parseInt($('#tirada').val());
$("#add_cantidad").attr("max", maximaCantidad);;
$("#add_cantidad").val(maximaCantidad);
@ -228,16 +243,39 @@ class Envios {
})
let cantidad_total = 0;
let hasFerroPrototipo = false;
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
let data = this.data();
cantidad_total += parseInt(data.cantidad);
if (data.is_ferro_prototipo == 0)
cantidad_total += parseInt(data.cantidad);
else
hasFerroPrototipo = true;
});
$('#add_cantidad').attr('max-value', parseInt($('#tirada').val()) - cantidad_total);
$('#add_cantidad').val(parseInt($('#tirada').val()) - cantidad_total);
const restante = parseInt($('#tirada').val()) - cantidad_total;
$('#add_cantidad').attr('max-value', restante);
$('#add_cantidad').val(restante > 0 ? restante : 0);
if (hasFerroPrototipo) {
$('#dirFerroProto').prop('checked', false);
$('#direccionFerroProto').addClass('d-none');
$('#add_cantidad').attr('disabled', false);
}
else {
if (restante == 0) {
$('#direccionFerroProto').removeClass('d-none');
$('#dirFerroProto').prop('checked', true);
$('#dirFerroProto').prop('disabled', true);
$('#add_cantidad').attr('disabled', true);
$('#add_cantidad').val(1);
}
}
newAddDialog.modal('show');
}
get_peso_libro() {
var peso_total_libro = 0.0
@ -277,11 +315,12 @@ class Envios {
margen: data.margen,
proveedor: data.proveedor,
proveedor_id: data.proveedor_id,
entregaPieCalle: data.entregaPieCalle
entregaPieCalle: data.entregaPieCalle,
is_ferro_prototipo: data.is_ferro_prototipo,
})
});
})
}
@ -379,11 +418,14 @@ class Envios {
'precio': datos_tarifa.precio.toFixed(2),
'margen': datos_tarifa.margen,
'entregaPieCalle': rowData.entregaPieCalle,
'is_ferro_prototipo': rowData.is_ferro_prototipo,
'actionBtns_direcciones': self.actionBtns_direcciones,
})
.draw();
self.check_unidades_enviadas(null,null);
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
@ -566,6 +608,7 @@ class Envios {
'precio': tarifa_final.precio,
'margen': tarifa_final.margen,
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
'is_ferro_prototipo': $('#dirFerroProto').is(":checked") ? 1 : 0,
'actionBtns_direcciones': `
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-envio mx-2"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
@ -673,8 +716,12 @@ class Envios {
}
let cantidad_total = 0
let hasFerroPrototipo = false
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
cantidad_total += parseInt(this.data().cantidad)
if (this.data().is_ferro_prototipo == 0)
cantidad_total += parseInt(this.data().cantidad);
else
hasFerroPrototipo = true;
});
const tirada = parseInt($('#tirada').val());
@ -695,7 +742,11 @@ class Envios {
this.insertarEnvio.removeClass('d-none');
return false;
}
this.insertarEnvio.addClass('d-none');
if (($('#ferro').is(':checked') || $('#prototipo').is(':checked')) && !hasFerroPrototipo)
this.insertarEnvio.removeClass('d-none');
else
this.insertarEnvio.addClass('d-none');
$('#alert-envios').html(htmlString);
return true;
}

Some files were not shown because too many files have changed in this diff Show More