19 Commits

Author SHA1 Message Date
5138681718 feat/ot-datatable-news 2025-05-02 07:56:28 +02:00
9283059f9d Merge branch 'fix/entrega_taller_bubok' into 'main'
corregido

See merge request jjimenez/safekat!763
2025-05-01 07:08:36 +00:00
b75278f449 corregido 2025-05-01 09:08:14 +02:00
3fb944ff97 Merge branch 'mod/importador_bubok' into 'main'
añadido ajuste de precio, url en comentarios y crear pedido y ot

See merge request jjimenez/safekat!762
2025-05-01 06:59:59 +00:00
c7250cb8fd añadido ajuste de precio, url en comentarios y crear pedido y ot 2025-05-01 08:59:34 +02:00
7a9b2af8a6 Merge branch 'feat/ot-new-features' into 'main'
Features:

See merge request jjimenez/safekat!761
2025-05-01 04:16:42 +00:00
cf5a42de8d Merge branch 'main' into feat/ot-new-features 2025-05-01 06:15:26 +02:00
a259d76e5e ot new features 2025-05-01 06:02:22 +02:00
f696153d74 Merge branch 'fix/pliegos_presupuesto' into 'main'
terminado

See merge request jjimenez/safekat!760
2025-04-30 18:24:13 +00:00
9181905233 terminado 2025-04-30 20:23:45 +02:00
0ec7dff479 Merge branch 'feat/importador_bubok' into 'main'
Primera version del importador de Bubok

See merge request jjimenez/safekat!759
2025-04-30 13:39:21 +00:00
b0fb0f18fb Primera version del importador de Bubok 2025-04-30 15:36:33 +02:00
cf4c4df80a Features:
- Prototipo PDF
 - Ferro PDF
 - Ferro OK fecha cambiado a Ferro/Prototipo OK
 - Comentarios para orden,impresion,cubierta,encuadernacion y logistica
 - Migración para comentarios
 - Tarifas acabado migraciones con campos para identificar mejor si es plastificado,plakene,retractilado y el tipo de cada uno
2025-04-30 09:23:37 +02:00
4e9dfb51c7 Merge branch 'fix/descuento_con_ajuste' into 'main'
arreglado

See merge request jjimenez/safekat!757
2025-04-29 18:03:58 +00:00
5aab9a33ac arreglado 2025-04-29 20:03:02 +02:00
ea762a09c0 Merge branch 'fix/confirmar_presupuesto_ajustado' into 'main'
corregido

See merge request jjimenez/safekat!756
2025-04-29 17:56:28 +00:00
21014d029f corregido 2025-04-29 19:56:08 +02:00
9c31f2bbc5 Merge branch 'add/configuracion_cliente_cambios_importador_catalogo' into 'main'
terminado

See merge request jjimenez/safekat!755
2025-04-29 17:33:59 +00:00
b288ca498c terminado 2025-04-29 19:30:35 +02:00
65 changed files with 3634 additions and 614 deletions

View File

@ -12,8 +12,14 @@ class OrdenTrabajo extends BaseConfig
"interior_bn_at" => "interior_bn_user_id",
"interior_color_at" => "interior_color_user_id",
"cubierta_at" => "cubierta_user_id",
"sobrecubierta_at" => "sobrecubierta_user_id",
"guarda_at" => "guarda_user_id",
//ACABADO
"plastificado_at" => "plastificado_user_id",
"plakene_at" => "plakene_user_id",
"retractilado_at" => "retractilado_user_id",
"estampado_at" => "estampado_user_id",
"uvi_at" => "uvi_user_id",
"encuadernacion_at" => "encuadernacion_user_id",
"corte_at" => "corte_user_id",
"preparacion_interiores_at" => "preparacion_interior_user_id",
@ -21,7 +27,6 @@ class OrdenTrabajo extends BaseConfig
"cosido_at" => "cosido_user_id",
"grapado_at" => "grapado_user_id",
"solapa_at" => "solapa_user_id",
"retractilado_at" => "retractilado_user_id",
"retractilado5_at" => "retractilado5_user_id",
"prototipo_at" => "prototipo_user_id",
"marcapaginas_at" => "marcapaginas_user_id",
@ -116,7 +121,14 @@ class OrdenTrabajo extends BaseConfig
"default" => ["bg" => "white", "color" => "black"],
];
public array $OT_TAREA_STATUS_COLOR = [
"P" => '#FFD63A',
"F" => '#67AE6E',
"S" => '#EB5B00',
"I" => '#3A59D1',
"E" => '#FF0B55',
"D" => '#FFA725',
];
public function __construct()
{

View File

@ -751,9 +751,14 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
$routes->get('datatable_pendientes', 'Ordentrabajo::datatable_pendientes');
$routes->get('datatable_ferro_pendiente', 'Ordentrabajo::datatable_ferro_pendiente');
$routes->get('datatable_ferro_ok', 'Ordentrabajo::datatable_ferro_ok');
$routes->get('datatable_news', 'Ordentrabajo::datatable_news');
$routes->get('datatable_prod', 'Ordentrabajo::datatable_prod');
$routes->get('datatable_waiting', 'Ordentrabajo::datatable_waiting');
$routes->get('datatable_revision_com', 'Ordentrabajo::datatable_revision_com');
$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/(:num)', 'Ordentrabajo::find_tarea/$1');
$routes->get('tarea/dates/(:num)','Ordentrabajo::get_orden_trabajo_tareas_dates/$1');
/**======================
* UPDATES
*========================**/
@ -771,6 +776,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
$routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1');
$routes->post("update/tarea/progress", "Ordentrabajo::store_orden_trabajo_progress_date");
$routes->post("update/tarea/pliegos", "Ordentrabajo::update_orden_trabajo_pliegos");
$routes->post("update/tarea/proveedor", "Ordentrabajo::update_presupuesto_tarea_proveedor");
$routes->delete("tarea/progress/(:num)", "Ordentrabajo::delete_orden_trabajo_progress_date/$1");
/**======================
@ -783,6 +789,8 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
* PDF
*========================**/
$routes->get('pdf/(:num)', 'Ordentrabajo::get_pdf/$1');
$routes->get('pdf/ferro/(:num)', 'Ordentrabajo::get_ferro_pdf/$1');
$routes->get('pdf/prototipo/(:num)', 'Ordentrabajo::get_prototipo_pdf/$1');
$routes->get('portada/(:num)', 'Ordentrabajo::get_portada_img/$1');
$routes->group('planning', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
$routes->get('select/maquina/rotativa', 'Ordentrabajo::select_maquina_planning_rot');

View File

@ -6,20 +6,33 @@ use CodeIgniter\Router\RouteCollection;
/* Rutas para tarifas */
$routes->group('importador', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
/* Libros */
/* Desde Catalogo */
$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');
});
/* Desde Cliente Bubok */
$routes->group('bubok', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
/**======================
* Tool
*========================**/
$routes->get('', 'ImportadorBubok::index', ['as' => 'importadorBubokTool']);
/**======================
* AJAX
*========================**/
$routes->post('importar-fila', 'ImportadorBubok::importarFila');
});
});

View File

@ -184,4 +184,15 @@ class Validation extends BaseConfig
"label" => "maquina",
],
];
public array $proveedor_tarea =
[
"proveedor_id" => [
"rules" => "required|integer",
"label" => "Proveedor",
],
"orden_trabajo_tarea_id" => [
"rules" => "required|integer",
"label" => "Tarea",
],
];
}

View File

@ -0,0 +1,396 @@
<?php
namespace App\Controllers\Importadores;
use App\Controllers\BaseResourceController;
use App\Controllers\Presupuestos\Presupuestocliente;
use App\Services\PresupuestoService;
class ImportadorBubok extends BaseResourceController
{
protected $format = 'json';
protected static $singularObjectName = 'Importador';
protected static $singularObjectNameCc = 'ImportadorBubok';
protected static $pluralObjectName = 'Importadores';
protected static $pluralObjectNameCc = 'importadores';
protected static $controllerSlug = 'importador';
protected static $viewPath = 'themes/vuexy/form/importador/bubok/';
protected $indexRoute = 'ImportadorBubokTool';
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_bubok"), 'route' => route_to('importadorBubokTool'), 'active' => true]
];
parent::initController($request, $response, $logger);
}
public function index()
{
$viewData = [
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Importador.importadorCatalogoTitle')]),
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewImportadorBubokTool', $viewData);
}
public function importarFila()
{
$json = $this->request->getJSON();
// Validación mínima de datos comunes
$pedido = $json->pedido ?? null;
if (!$pedido || !isset($pedido->orderNumber)) {
return $this->respond([
'status' => 400,
'message' => 'Datos comunes del pedido ausentes o inválidos.'
]);
}
// Validación mínima de existencia del producto en la linea
if (!$json || !isset($json->producto)) {
return $this->respond([
'status' => 400,
'message' => 'Producto no proporcionado o inválido.'
]);
}
$producto = $json->producto;
// 1. Datos básicos:
// Referencia del cliente
$orderNumber = $pedido->orderNumber ?? null;
$productId = $producto->id ?? null;
if (is_null($orderNumber) || is_null($productId)) {
return $this->respond([
'status' => 400,
'message' => 'Número de orden o ID del producto no reconocidos.'
]);
}
$refCliente = "$orderNumber - $productId";
// Titulo
$titulo = $producto->title ?? null;
if (is_null($titulo)) {
return $this->respond([
'status' => 400,
'message' => 'Título del libro no reconocido.'
]);
}
// Validación de páginas y tirada
$paginas = isset($producto->body->pages) ? (int) $producto->body->pages : 0;
$tirada = isset($producto->amount) ? (int) $producto->amount : 0;
if ($paginas <= 0 || $tirada <= 0) {
$errores = [];
if ($paginas <= 0) {
$errores[] = 'Número de páginas inválido.';
}
if ($tirada <= 0) {
$errores[] = 'Tirada inválida.';
}
return $this->respond([
'status' => 400,
'message' => implode(' ', $errores)
]);
}
// Ancho y alto
$ancho = null;
$alto = null;
foreach ($producto->size as $key => $val) {
if ($val == 1) {
// ejemplo: size170x235
$size = str_replace('size', '', $key);
[$ancho, $alto] = explode('x', $size);
$ancho = (int) $ancho;
$alto = (int) $alto;
break;
}
}
if (!$ancho || !$alto) {
return $this->respond([
'status' => 400,
'message' => 'Tamaño del libro no reconocido.'
]);
}
/*$numGuardaPages = 4;
$hasGuarda = !empty($producto->cover->guarda);
if ($hasGuarda)
$paginas += $numGuardaPages;*/
// 2. Interior: color o negro
// Determinar tipo de impresión interior
$interiorTipo = null;
if (isset($producto->body->color->CMYK) && $producto->body->color->CMYK == '1') {
$interiorTipo = 'color';
} elseif (isset($producto->body->color->Monochrome) && $producto->body->color->Monochrome == '1') {
$interiorTipo = 'negro';
} elseif (isset($producto->body->color->Semicolor) && $producto->body->color->Semicolor == '1') {
return $this->respond([
'status' => 400,
'message' => 'Tipo de impresión "Semicolor" no soportado.'
]);
}
if (is_null($interiorTipo)) {
return $this->respond([
'status' => 400,
'message' => 'No se pudo determinar si el interior es en color o blanco y negro.'
]);
}
// Determinar tipo de papel interior
$papelInteriorId = null;
if (isset($producto->body->paperColor->white) && $producto->body->paperColor->white == '1') {
$papelInteriorId = 3; // Offset blanco 'OFF1'
} elseif (isset($producto->body->paperColor->cream) && $producto->body->paperColor->cream == '1') {
$papelInteriorId = 4; // Offset ahuesado 'OFF2'
} else {
return $this->respond([
'status' => 400,
'message' => 'Tipo de papel interior no definido.'
]);
}
// Determinar el gramaje del papel
$gramajePapelInterior = null;
foreach ($producto->body->paperWeight as $key => $val) {
if ($val == 1) {
$gramajePapelInterior = (int) str_replace(['weight', 'gr'], '', $key);
break;
}
}
if (!$gramajePapelInterior) {
return $this->respond([
'status' => 400,
'message' => 'Gramaje del papel no válido.'
]);
}
// 3. Encuadernación
// Tapa dura
$tapaDura = isset($producto->cover->type->tapadura) && $producto->cover->type->tapadura == '1';
// Solapas
$solapas = isset($producto->cover->type->consolapas) && $producto->cover->type->consolapas == '1';
// Doble cara (a veces se activa con tapa dura) una cara => 2; dos caras => 4
$doscara = false;
// Tipo de encuadernado
$encuadernadoId = null;
if (isset($producto->cover->coverType->SoftCover) && $producto->cover->coverType->SoftCover == '1') {
if ($tapaDura) {
$encuadernadoId = 1; // Libro fresado tapa dura
$doscara = true;
} else {
$encuadernadoId = 2; // Libro fresado tapa blanda
}
} elseif (isset($producto->cover->coverType->SaddleStitch) && $producto->cover->coverType->SaddleStitch == '1') {
if ($tapaDura) {
$encuadernadoId = 3; // Libro cosido tapa dura
$doscara = true;
} else {
$encuadernadoId = $solapas ? 20 : 4; // Libro cosido tapa blanda (solapas) : (sin solapas)
}
} elseif (isset($producto->cover->coverType->CoilBinding) && $producto->cover->coverType->CoilBinding == '1') {
if ($tapaDura) {
$encuadernadoId = 5; // Libro espiral tapa dura
$doscara = true;
} else {
$encuadernadoId = 6; // Libro espiral tapa blanda
}
}
if (!$encuadernadoId) {
return $this->respond([
'status' => 400,
'message' => 'Tipo de encuadernación no identificado.'
]);
}
// Determinar el acabado de la cubierta
$acabadoId = null;
if (isset($producto->cover->acabado->brillo) && $producto->cover->acabado->brillo == '1') {
$acabadoId = 1; // Plastificado brillo 1/c
} elseif (isset($producto->cover->acabado->mate) && $producto->cover->acabado->mate == '1') {
$acabadoId = 2; // Plastificado mate 1/c
} else {
return $this->respond([
'status' => 400,
'message' => 'Tipo de acabado de cubierta no definido.'
]);
}
// 4. ENVÍO: recuperamos la primera dirección del cliente BUBOK (ID 40)
$clienteDireccionModel = model('App\Models\Clientes\ClienteDireccionesModel');
$direccionCliente = $clienteDireccionModel
->where('cliente_id', 40)
->orderBy('id', 'asc')
->first();
if (!$direccionCliente) {
return $this->respond([
'status' => 400,
'message' => 'El cliente Bubok no tiene direcciones asociadas.'
]);
}
$direcciones = [
[
'direccion' => [
'id' => (int) $direccionCliente->id,
'cliente_id' => (int) $direccionCliente->cliente_id,
'cliente_nombre' => $direccionCliente->clienteNombre,
'att' => $direccionCliente->persona_contacto ?? '',
'alias' => $direccionCliente->alias ?? '',
'email' => $direccionCliente->email ?? '',
'direccion' => $direccionCliente->direccion,
'pais_id' => (int) $direccionCliente->pais_id,
'pais' => $direccionCliente->paisNombre,
'municipio' => $direccionCliente->municipio,
'provincia' => $direccionCliente->provincia,
'cp' => $direccionCliente->cp,
'telefono' => $direccionCliente->telefono,
],
'unidades' => $tirada,
'entregaPalets' => false
]
];
// Generamos el objeto a importar
$dataToImport = [
'selectedTirada' => $tirada,
'datosCabecera' => [
'titulo' => $titulo,
'autor' => null,
'isbn' => null,
'coleccion' => null,
'referenciaCliente' => $refCliente
],
'tirada' => [$tirada],
'tamanio' => [
'ancho' => $ancho,
'alto' => $alto
],
'tipo' => '',
'tipo_presupuesto_id' => $encuadernadoId,
'clienteId' => 40, // BUBOK ID
'isColor' => ($interiorTipo === 'color') ? 1 : 0,
'isHq' => 0,
'paginas' => $paginas,
'paginasColor' => ($interiorTipo === 'color') ? $paginas : 0,
'paginasCuadernillo' => 32,
'interior' => [
'papelInterior' => $papelInteriorId,
'gramajeInterior' => $gramajePapelInterior
],
'cubierta' => [
'papelCubierta' => 2, // 'EST2'
'carasCubierta' => $doscara ? 2 : 4,
'gramajeCubierta' => in_array($encuadernadoId, [1, 3]) ? 150 : 300, // 150 gramos para "fresado tapa dura" y "cosido tapa dura"
'solapas' => !empty($producto->cover->type->consolapas) ? 80 : 0,
'acabado' => $acabadoId,
'cabezada' => 'WHI',
'lomoRedondo' => 0
],
'guardas' => [],
'sobrecubierta' => [],
'faja' => null,
'entrega_taller' => 1,
//'direcciones' => $direcciones, las direcciones que aparecen no se añaden, ya que la recogida la hacen ellos con su empresa de mensajeria
'ivaReducido' => 1,
];
/*return $this->respond([
'status' => 400,
'message' => $dataToImport
]);*/
// 5. Guardar
try {
$presupuestocliente = new Presupuestocliente();
$response = $presupuestocliente->guardar($dataToImport);
// Guardar la URL de la portada y el cuerpo en los comentarios del presupuesto
$presupuestoModel = model('App\Models\Presupuestos\PresupuestoModel');
$presupuestoModel->update($response['sk_id'], [
'comentarios_safekat' => 'URL COVER: ' . $producto->cover->file . "\nURL BODY: " . $producto->body->file,
]);
// Ajuste del precio
$precio_compra = $json->producto->prices->unitPrice ?? null;
if ($precio_compra != null && $precio_compra > 0) {
$respuesta_ajuste = PresupuestoService::ajustarPresupuesto(
$response['sk_id'],
$precio_compra,
$tirada,
null,
true
);
if ($respuesta_ajuste['warning'] == true) {
$response['price_warning'] = [
'new_precio_unidad' => $respuesta_ajuste['new_precio_unidad'],
'new_total' => $respuesta_ajuste['new_total'],
];
}
}
// confirmar y crear pedido y ot
$presupuestoModel->confirmarPresupuesto($response['sk_id']);
PresupuestoService::crearPedido($response['sk_id']);
if (!isset($response['sk_id'])) {
return $this->respond([
'status' => 400,
'error' => 'Missing sk_id',
'message' => 'No se pudo crear el presupuesto.'
], 400);
}
return $this->respond([
'status' => 200,
'data' => [
'sk_id' => $response['sk_id'],
'sk_url' => $response['sk_url'] ?? null
]
]);
} catch (\Throwable $e) {
return $this->respond([
'status' => 500,
'error' => 'Server error',
'message' => 'Error inesperado',
'debug' => $e->getMessage()
]);
}
}
}

View File

@ -5,6 +5,7 @@ use App\Controllers\BaseResourceController;
use App\Entities\Catalogo\CatalogoLibroEntity;
use App\Models\Catalogo\CatalogoLibroModel;
use App\Controllers\Presupuestos\Presupuestocliente;
use App\Services\PresupuestoService;
class ImportadorCatalogo extends BaseResourceController
{
@ -43,11 +44,8 @@ class ImportadorCatalogo extends BaseResourceController
{
$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
@ -241,9 +239,11 @@ class ImportadorCatalogo extends BaseResourceController
'lomoRedondo' => 0
],
'ivaReducido' => 1,
'guardas' => [],
'sobrecubierta' => $sobrecubierta,
'faja' => [],
//'faja' => null,
'entrega_taller' => 1,
];
@ -281,17 +281,25 @@ class ImportadorCatalogo extends BaseResourceController
]
];
// 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);
// Ajuste del precio a RAMA
$respuesta_ajuste = PresupuestoService::ajustarPresupuesto(
$response['data']['sk_id'],
$precio_compra,
$tirada,
null,
true
);
if ($respuesta_ajuste['warning'] == true) {
$response['price_warning'] = [
'new_precio_unidad' => $respuesta_ajuste['new_precio_unidad'],
'new_total' => $respuesta_ajuste['new_total'],
];
}
// confirmar y crear pedido y ot
model('App\Models\Presupuestos\PresupuestoModel')->confirmarPresupuesto($response['data']['sk_id']);
PresupuestoService::crearPedido($response['data']['sk_id']);
return $this->respond($response);

View File

@ -993,6 +993,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$reqData = $this->request->getPost();
$calcular_merma = $reqData['calcular_merma'] ?? 0;
$type = $reqData['type'] ?? null;
// por defecto, se deja cosido tapa blanda por ahora JJO
$tipo_impresion_id = $reqData['tipo_impresion_id'] ?? 4;
@ -1071,8 +1073,27 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
'a_favor_fibra' => $a_favor_fibra
);
$resourceData = PresupuestoService::obtenerComparadorPlana($input_data);
if($calcular_merma == 1 && count($resourceData) > 0 &&
count($resourceData[0]['fields']) >0 && $resourceData[0]['fields']['num_formas'] > 0) {
usort($resourceData, function ($a, $b) {
return $b['fields']['total_impresion'] <=> $a['fields']['total_impresion'];
});
$num_formas = [];
$formas_linea = $datosPedido->isCosido ? intval($resourceData[0]['fields']['num_formas']['value']) / 2 :
intval($resourceData[0]['fields']['num_formas']['value']);
array_push($num_formas, $formas_linea);
$POD = $this->getPOD();
$datosPedido->merma = PresupuestoService::calcular_merma($datosPedido->tirada,$POD, $num_formas);
$resourceData = PresupuestoService::obtenerComparadorPlana($input_data);
}
} else if ($type == 'interior_rot') {
$paginas = (object) array(
@ -1105,6 +1126,24 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$resourceData = PresupuestoService::obtenerComparadorRotativa($input_data);
if($calcular_merma == 1 && count($resourceData) > 0 &&
count($resourceData[0]['fields']) >0 && $resourceData[0]['fields']['num_formas'] > 0) {
usort($resourceData, function ($a, $b) {
return $b['fields']['total_impresion'] <=> $a['fields']['total_impresion'];
});
$num_formas = [];
$formas_linea = $datosPedido->isCosido ? intval($resourceData[0]['fields']['num_formas']['value']) / 2 :
intval($resourceData[0]['fields']['num_formas']['value']);
array_push($num_formas, $formas_linea);
$POD = $this->getPOD();
$datosPedido->merma = PresupuestoService::calcular_merma($datosPedido->tirada,$POD, $num_formas);
$resourceData = PresupuestoService::obtenerComparadorRotativa($input_data);
}
} else if ($type == 'cubierta' || $type == 'sobrecubierta' || $type == 'faja') {
$datosPedido->solapas = $reqData['solapas'];

View File

@ -323,17 +323,23 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$datosPedido = (object) array(
'paginas' => $paginas,
'tirada' => $tirada[0],
'merma' => $this->calcular_merma($tirada[0], $POD),
'merma' => PresupuestoService::calcular_merma($tirada[0], $POD),
'ancho' => intval($tamanio['ancho']) ?? 100000,
'alto' => intval($tamanio['alto']) ?? 100000,
'isCosido' => $is_cosido,
'a_favor_fibra' => 1,
);
$cliente_model = model(('App\Models\Clientes\ClienteModel'));
$cliente = $cliente_model->find($cliente_id);
// Para POD siempre es HQ
if ($tirada[0] <= $POD) {
if ($tirada[0] <= $POD && !$cliente->forzar_rotativa_pod) {
$isHq = true;
}
$forzarRotativa = false;
if ($tirada[0] <= $POD && $cliente->forzar_rotativa_pod) {
$forzarRotativa = true;
}
$input_data = array(
'uso' => 'interior',
@ -346,7 +352,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
'cliente_id' => $cliente_id,
'paginas_color' => $paginas_color,
'excluirRotativa' => $excluirRotativa,
'papelInteriorDiferente' => $papelInteriorDiferente
'papelInteriorDiferente' => $papelInteriorDiferente,
'forzarRotativa' => $forzarRotativa,
);
$interior = PresupuestoClienteService::obtenerInterior($input_data);
@ -460,6 +467,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$id = $reqData['id'] ?? 0;
$cliente_id = $reqData['clienteId'] ?? -1;
$noEnvioBase = model('App\Models\Clientes\ClienteModel')->find($cliente_id)->no_envio_base ?? false;
$tirada = $reqData['tirada'] ?? 0;
$selectedTirada = $reqData['selectedTirada'] ?? -1;
@ -609,6 +617,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
} else {
$coste = floatval($coste_direccion->coste);
$margen = $coste * (intval($coste_direccion->margen) / 100.0);
if ($noEnvioBase) {
$coste = 0.0;
$margen = 0.0;
}
$return_data['eb'][$i] = round($coste + $margen, 2);
}
}
@ -739,17 +751,23 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$datosPedido = (object) array(
'paginas' => $paginas,
'tirada' => $tirada[0],
'merma' => $tirada[0] > $POD ? $this->calcular_merma($tirada[0], $POD) : 0,
'merma' => $tirada[0] > $POD ? PresupuestoService::calcular_merma($tirada[0], $POD) : 0,
'ancho' => intval($tamanio['ancho']) ?? 100000,
'alto' => intval($tamanio['alto']) ?? 100000,
'isCosido' => $is_cosido,
'a_favor_fibra' => 1,
);
$cliente_model = model(('App\Models\Clientes\ClienteModel'));
$cliente = $cliente_model->find($cliente_id);
// Para POD siempre es HQ
if ($tirada[0] <= $POD) {
if ($tirada[0] <= $POD && !$cliente->forzar_rotativa_pod) {
$isHq = true;
}
$forzarRotativa = false;
if ($tirada[0] <= $POD && $cliente->forzar_rotativa_pod) {
$forzarRotativa = true;
}
$input_data = array(
'uso' => 'interior',
@ -762,7 +780,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
'cliente_id' => $cliente_id,
'paginas_color' => $paginas_color,
'excluirRotativa' => $excluirRotativa,
'papelInteriorDiferente' => $papelInteriorDiferente
'papelInteriorDiferente' => $papelInteriorDiferente,
'forzarRotativa' => $forzarRotativa,
);
$interior = PresupuestoClienteService::obtenerInterior($input_data);
@ -1126,6 +1145,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$peso_libro = $resultado_presupuesto['peso'][array_search($selected_tirada, $tirada)];
// calculo del envio base (tirada_maxima)
$noEnvioBase = model('App\Models\Clientes\ClienteModel')->find($cliente_id)->no_envio_base ?? false;
$resultado_presupuesto['eb'] = [];
$datos_presupuesto['envio_base'] = 0;
for ($i = 0; $i < count($tirada); $i++) {
@ -1139,6 +1159,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
);
if (intval($selected_tirada) == intval($tirada[$i])) {
if ($noEnvioBase) {
$coste_direccion->coste = 0.0;
$coste_direccion->margen = 0.0;
}
$datos_presupuesto['envio_base'] = round($coste_direccion->coste * (1 + $coste_direccion->margen / 100.0), 2);
}
@ -1160,6 +1184,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
];
return $resultado_presupuesto;
} else {
if ($noEnvioBase) {
$coste_direccion->coste = 0.0;
$coste_direccion->margen = 0.0;
}
$resultado_presupuesto['eb'][$i] = round($coste_direccion->coste, 2);
$resultado_presupuesto['eb_margen'][$i] = round($coste_direccion->margen, 2);
}
@ -1176,10 +1204,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
for ($i = 0; $i < count($tirada); $i++) {
$coste_envio = 0.0;
$coste_envio += ($resultado_presupuesto['eb'][$i] / $tirada[$i]);
$resultado_presupuesto['info']['totales'][$i]['envio_base_margen'] =
floatval($resultado_presupuesto['eb'][$i])*(floatval($resultado_presupuesto['eb_margen'][$i])/100.0);
$resultado_presupuesto['info']['totales'][$i]['envio_base_margen'] =
floatval($resultado_presupuesto['eb'][$i]) * (floatval($resultado_presupuesto['eb_margen'][$i]) / 100.0);
$resultado_presupuesto['info']['totales'][$i]['envio_base_coste'] = $resultado_presupuesto['eb'][$i];
$resultado_presupuesto['precio_u'][$i] = round(floatval($resultado_presupuesto['precio_u'][$i]) + $coste_envio, 4);
}
@ -1312,7 +1340,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$datos_presupuesto['entrega_taller'] = $reqData['entrega_taller'] ?? 0;
$resultado_presupuesto['info']['merma'] = $this->calcular_merma($selected_tirada, $POD);
$resultado_presupuesto['info']['merma'] = PresupuestoService::calcular_merma($selected_tirada, $POD);
$datos_presupuesto['faja'] = $faja;
@ -1357,7 +1385,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
foreach ($serviciosAcabado as $service) {
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
$servicio = $model->getPrecioTarifa(
intval($service), intval($selected_tirada)+$resultado_presupuesto['info']['merma'], -1, $POD);
intval($service),
intval($selected_tirada) + $resultado_presupuesto['info']['merma'],
-1,
$POD
);
if (count($servicio) > 0) {
if ($servicio[0]->total > 0) {
@ -1375,8 +1407,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
foreach ($serviciosAcabado as $service) {
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
$servicio = $model->getPrecioTarifa(
intval($service),
intval($selected_tirada) + $resultado_presupuesto['info']['merma'], -1, $POD);
intval($service),
intval($selected_tirada) + $resultado_presupuesto['info']['merma'],
-1,
$POD
);
if (count($servicio) > 0) {
if ($servicio[0]->total > 0) {
@ -1393,8 +1428,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
foreach ($serviciosAcabado as $service) {
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
$servicio = $model->getPrecioTarifa(
intval($service),
intval($selected_tirada) + $resultado_presupuesto['info']['merma'], -1, $POD);
intval($service),
intval($selected_tirada) + $resultado_presupuesto['info']['merma'],
-1,
$POD
);
if (count($servicio) > 0) {
if ($servicio[0]->total > 0) {
@ -1407,7 +1445,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$tarifa_id = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_lomo_redondo')->value;
$serv_lomo = PresupuestoCLienteService::getServiciosManipulado([
'tarifa_id' => intval($tarifa_id),
'tirada' => $selected_tirada+$resultado_presupuesto['info']['merma'],
'tirada' => $selected_tirada + $resultado_presupuesto['info']['merma'],
'POD' => $POD,
])[0];
@ -2029,7 +2067,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$datosPedido = (object) array(
'paginas' => $paginas,
'tirada' => $tirada[$t],
'merma' => $this->calcular_merma($tirada[$t], $POD),
'merma' => PresupuestoService::calcular_merma($tirada[$t], $POD),
'ancho' => intval($tamanio['ancho']) ?? 100000,
'alto' => intval($tamanio['alto']) ?? 100000,
'isCosido' => $is_cosido,
@ -2039,10 +2077,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$info['merma'] = $datosPedido->merma;
}
$cliente_model = model(('App\Models\Clientes\ClienteModel'));
$cliente = $cliente_model->find($cliente_id);
// Para POD siempre es HQ
if ($tirada[$t] <= $POD) {
if ($tirada[$t] <= $POD && !$cliente->forzar_rotativa_pod) {
$isHq = true;
}
$forzarRotativa = false;
if ($tirada[$t] <= $POD && $cliente->forzar_rotativa_pod) {
$forzarRotativa = true;
}
$input_data = array(
'uso' => 'interior',
@ -2055,7 +2099,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
'cliente_id' => $cliente_id,
'paginas_color' => $paginas_color,
'excluirRotativa' => $excluirRotativa,
'papelInteriorDiferente' => $papelInteriorDiferente
'papelInteriorDiferente' => $papelInteriorDiferente,
'forzarRotativa' => $forzarRotativa,
);
$interior = PresupuestoClienteService::obtenerInterior($input_data);
@ -2107,7 +2152,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
array_push($num_formas, $formas_linea);
}
}
$input_data['datosPedido']->merma = $this->calcular_merma($tirada[$t], $POD, $num_formas);
$input_data['datosPedido']->merma = PresupuestoService::calcular_merma($tirada[$t], $POD, $num_formas);
if ($extra_info) {
$info['merma'] = max($info['merma'], $input_data['datosPedido']->merma);
}
@ -3071,7 +3116,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$sumForFactor += round($linea['precio_pedido'], 2)
- round($linea['margen_papel_pedido'], 2);
$margenPapel += round($linea['margen_papel_pedido'], 2);
$totalImpresion += round($linea['precio_click_pedido'], 2);
$totalImpresion -= round($linea['margen_click_pedido'], 2);
$sumForFactor += round($linea['precio_click_pedido'], 2)
@ -3142,31 +3187,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
}
}
protected function calcular_merma($tirada, $POD, $formas_lineas_interior = [])
{
$merma = 0;
if ($tirada > $POD) {
$merma = $tirada * 0.1;
} else {
$merma_lineas = [];
foreach ($formas_lineas_interior as $formas_linea) {
if ($formas_linea > $tirada)
array_push($merma_lineas, $formas_linea - $tirada);
else
array_push($merma_lineas, $tirada % $formas_linea);
}
if (count($merma_lineas) > 0)
$merma = max($merma_lineas);
}
return round($merma, 0);
}
protected function getPapelFormatoListItems($selId = null)
{
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');

View File

@ -3,6 +3,7 @@
namespace App\Controllers\Produccion;
use App\Controllers\BaseController;
use App\Models\Compras\ProveedorModel;
use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
@ -28,6 +29,7 @@ class Ordentrabajo extends BaseController
protected OrdenTrabajoModel $otModel;
protected OrdenTrabajoUser $otUserModel;
protected OrdenTrabajoTarea $otTarea;
protected ProveedorModel $proveedorModel;
protected MaquinaModel $maquinaModel;
protected UserModel $userModel;
protected Validation $validation;
@ -45,6 +47,7 @@ class Ordentrabajo extends BaseController
$this->produccionService = new ProductionService();
$this->otTarea = model(OrdenTrabajoTarea::class);
$this->maquinaModel = model(MaquinaModel::class);
$this->proveedorModel = model(ProveedorModel::class);
$this->validation = service("validation");
helper("time");
parent::initController($request, $response, $logger);
@ -138,6 +141,18 @@ class Ordentrabajo extends BaseController
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
}
}
public function update_presupuesto_tarea_proveedor(){
$bodyData = $this->request->getPost();
$validated = $this->validation->run($bodyData, "proveedor_tarea");
if ($validated) {
$validatedData = $this->validation->getValidated();
$r = $this->produccionService->updateProveedorLinea($validatedData['orden_trabajo_tarea_id'], $validatedData['proveedor_id']);
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r]);
} else {
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
}
}
public function reset_orden_trabajo_date()
{
$bodyData = $this->request->getPost();
@ -268,6 +283,62 @@ class Ordentrabajo extends BaseController
->add("action", fn($q) => $q->id)
->toJson(true);
}
public function datatable_news()
{
$logo = config(LogoImpresion::class);
$q = $this->otModel->getDatatableQuery();
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()])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
)
->add("action", fn($q) => $q->id)
->toJson(true);
}
public function datatable_prod()
{
$logo = config(LogoImpresion::class);
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro',1)->where("ferro_ok_at is NOT NULL", NULL, FALSE);
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()])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
)
->add("action", fn($q) => $q->id)
->toJson(true);
}
public function datatable_waiting()
{
$logo = config(LogoImpresion::class);
$q = $this->otModel->getDatatableQuery()->where('ordenes_trabajo.is_pedido_espera',1);
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()])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
)
->add("action", fn($q) => $q->id)
->toJson(true);
}
public function datatable_revision_com()
{
$logo = config(LogoImpresion::class);
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro',1)->where("ferro_ok_at is NOT NULL", NULL, FALSE);
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()])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
)
->add("action", fn($q) => $q->id)
->toJson(true);
}
public function papel_gramaje_datatable()
{
@ -305,6 +376,7 @@ class Ordentrabajo extends BaseController
->edit("orden", fn($q) => ["id" => $q->id, "orden" => $q->orden])
->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmm_string($q->tiempo_estimado))
->edit("tiempo_real", fn($q) => float_seconds_to_hhmm_string($q->tiempo_real))
->add("proveedor", fn($q) => $this->produccionService->getProveedorTarea($q->id))
->edit("maquina_tarea", fn($q) => ["id" => $q->id, "maquina_id" => $q->maquina_tarea, "maquina_name" => $q->maquina_nombre])
->add("imposicion", fn($q) => ["id" => $q->id, "imposicion_id" => $q->imposicion_id, "name" => $q->imposicion_name, "is_presupuesto_linea" => $q->presupuesto_linea_id ? true : false])
->toJson(true);
@ -313,6 +385,14 @@ class Ordentrabajo extends BaseController
{
return $this->produccionService->init($orden_trabajo_id)->getPdf();
}
public function get_ferro_pdf($orden_trabajo_id)
{
return $this->produccionService->init($orden_trabajo_id)->getFerroPdf();
}
public function get_prototipo_pdf($orden_trabajo_id)
{
return $this->produccionService->init($orden_trabajo_id)->getPrototipoPdf();
}
public function upload_orden_trabajo_portada()
{
try {
@ -561,8 +641,15 @@ class Ordentrabajo extends BaseController
$validated = $this->validation->run($bodyData, "orden_trabajo_tarea_progress_date");
// return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $this->validation->getValidated(),"errors" => $this->validation->getErrors()]);
if ($validated) {
$r = $this->produccionService->storeOrdenTrabajoTareaProgressDate($this->validation->getValidated());
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]);
$validatedData = $this->validation->getValidated();
$r = $this->produccionService->storeOrdenTrabajoTareaProgressDate($validatedData);
$otTareaEntity = $this->otTarea->find($validatedData['ot_tarea_id']);
$data = [
"tiempo_trabajado" => float_seconds_to_hhmm_string($otTareaEntity->tiempo_trabajado()),
"tarea" => $otTareaEntity,
"estado" => $validatedData['estado'],
];
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $data]);
} else {
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
}
@ -572,7 +659,6 @@ class Ordentrabajo extends BaseController
}
public function delete_orden_trabajo_progress_date(int $orden_trabajo_tarea_id)
{
$status = $this->produccionService->deleteOrdenTrabajoTareaProgressDates($orden_trabajo_tarea_id);
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status]);
}
@ -598,4 +684,9 @@ class Ordentrabajo extends BaseController
}
}
public function get_orden_trabajo_tareas_dates($orden_trabajo_id)
{
$data = $this->produccionService->init($orden_trabajo_id)->getOrdenTrabajoTareaDates();
return $this->response->setJSON(["data" => $data ]);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\RawSql;
use CodeIgniter\Database\Migration;
class AddClienteNoBasePODnoHQ extends Migration
{
protected array $COLUMNS = [
"no_envio_base" => [
"type" => "TINYINT",
"default" => 0,
],
"forzar_rotativa_pod" => [
"type" => "TINYINT",
"default" => 0,
],
];
public function up()
{
$this->forge->addColumn('clientes', $this->COLUMNS);
}
public function down()
{
//
$this->forge->dropColumn('clientes', array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AlterOrdenesTrabajoAddCommentColumns extends Migration
{
protected array $COLUMNS = [
'comment_interior' => [
'type' => 'LONGTEXT',
'null' => true
],
'comment_cubierta' => [
'type' => 'LONGTEXT',
'null' => true
],
'comment_encuadernacion' => [
'type' => 'LONGTEXT',
'null' => true
],
'comment_logistica' => [
'type' => 'LONGTEXT',
'null' => true
],
"info_solapa_guillotina" => [
'type' => 'LONGTEXT',
'null' => true
]
];
public function up()
{
$this->forge->addColumn('ordenes_trabajo',$this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('ordenes_trabajo',array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class AddOrdenTrabajoDatesManipuladoImpresion extends Migration
{
protected array $DATES = [
"sobrecubierta_at" => [
"type" => "DATE",
"null" => true,
],
"guarda_at" => [
"type" => "DATE",
"null" => true,
],
"plakene_at" => [
"type" => "DATE",
"null" => true,
],
"estampado_at" => [
"type" => "DATE",
"null" => true,
],
"uvi_at" => [
"type" => "DATE",
"null" => true,
],
];
protected array $USERS = [
"sobrecubierta_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"guarda_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"plakene_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"estampado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"uvi_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
];
public function up()
{
$this->forge->addColumn("orden_trabajo_dates", $this->DATES);
$this->forge->addColumn("orden_trabajo_users", $this->USERS);
foreach ($this->USERS as $key => $value) {
$this->forge->addForeignKey([$key],"users",["id"]);
}
}
public function down()
{
$this->forge->dropColumn("orden_trabajo_dates", array_keys($this->DATES));
$this->forge->dropColumn("orden_trabajo_users", array_keys($this->USERS));
}
}

View File

@ -1,7 +1,9 @@
<?php
namespace App\Entities\Cliente;
namespace App\Entities\Clientes;
use CodeIgniter\Entity;
use App\Models\Clientes\ClienteModel;
use App\Models\Configuracion\PaisModel;
class ClienteDireccionesEntity extends \CodeIgniter\Entity\Entity
{
@ -23,4 +25,29 @@ class ClienteDireccionesEntity extends \CodeIgniter\Entity\Entity
"pais_id" => "int",
"cp" => "int",
];
public function getClienteNombre(): ?string
{
if (!$this->cliente_id) {
return null;
}
$clienteModel = model(ClienteModel::class);
$cliente = $clienteModel->find($this->cliente_id);
return $cliente ? $cliente->nombre : null;
}
public function getPaisNombre(): ?string
{
if (!$this->pais_id) {
return null;
}
$paisModel = model(PaisModel::class);
$pais = $paisModel->find($this->pais_id);
return $pais ? $pais->nombre : null;
}
}

View File

@ -48,6 +48,8 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
"updated_at" => null,
"user_created_id" => 1,
"user_update_id" => 1,
"no_envio_base" => 0,
"forzar_rotativa_pod" => 0,
];
protected $casts = [
"comunidad_autonoma_id" => "?int",
@ -70,6 +72,8 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
"is_deleted" => "int",
"user_created_id" => "int",
"user_update_id" => "int",
"no_envio_base" => "boolean",
"forzar_rotativa_pod" => "boolean",
];
public function comercial() : ?UserEntity

View File

@ -222,6 +222,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
return $nombre;
}
public function isGuarda(): bool
{
return in_array($this->attributes["tipo"], ["lp_guardas"]);

View File

@ -15,8 +15,15 @@ class OrdenTrabajoDateEntity extends Entity
"interior_bn_at" => null,
"interior_color_at" => null,
"cubierta_at" => null,
"sobrecubierta_at" => null, //TODO
"guarda_at" => null, //TODO
//ACABADO
"plastificado_at" => null,
"plakene_at" => null, //TODO
"retractilado_at"=> null,
"estampado_at" => null, //TODO
"uvi_at" => null, //TODO
//MANIPULADO
"encuadernacion_at" => null,
"corte_at" => null,
"preparacion_interiores_at" => null,
@ -24,9 +31,8 @@ class OrdenTrabajoDateEntity extends Entity
"cosido_at" => null,
"solapa_at" => null,
"grapado_at" => null,
"retractilado_at"=> null,
"retractilado5_at"=> null,
"prototipo_at"=> null,
"retractilado5_at"=> null, // !DELETE
"prototipo_at"=> null, // !DELETE
"marcapaginas_at"=> null,
"espiral_at"=> null,
//FERRO

View File

@ -30,6 +30,11 @@ class OrdenTrabajoEntity extends Entity
"progreso" => 0.00,
"estado" => "I",
"comentarios" => null,
"comment_interior" => null,
"comment_cubierta" => null,
"comment_encuadernacion" => null,
"comment_logistica" => null,
"info_solapa_guillotina" => null,
"revisar_formato" => null,
"revisar_lomo" => null,
"revisar_solapa" => null,
@ -52,7 +57,12 @@ class OrdenTrabajoEntity extends Entity
"tipo_entrada" => "string",
"progreso" => "float",
"estado" => "string",
"comentarios" => "string",
"comentarios" => "?string",
"comment_interior" => "?string",
"comment_cubierta" => "?string",
"comment_encuadernacion" => "?string",
"comment_logistica" => "?string",
"info_solapa_guillotina" => "?string",
"revisar_formato" => "bool",
"revisar_lomo" => "bool",
"revisar_solapa" => "bool",
@ -80,7 +90,22 @@ class OrdenTrabajoEntity extends Entity
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
}
/**
public function tareas_acabado(): array
{
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
}
public function tareas_encuadernado(): array
{
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_encuadernado_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
}
public function tareas_manipulado(): array
{
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
}
/**
* Devuelve el presupuesto de la orden de trabajo
*
* @return PresupuestoEntity
@ -183,4 +208,5 @@ class OrdenTrabajoEntity extends Entity
];
return $estados[$this->attributes["estado"]];
}
}

View File

@ -5,6 +5,7 @@ namespace App\Entities\Produccion;
use App\Entities\Configuracion\Imposicion;
use App\Entities\Configuracion\Maquina;
use App\Entities\Presupuestos\PresupuestoAcabadosEntity;
use App\Entities\Presupuestos\PresupuestoEncuadernacionesEntity;
use App\Entities\Presupuestos\PresupuestoLineaEntity;
use App\Entities\Presupuestos\PresupuestoManipuladosEntity;
use App\Models\Configuracion\ImposicionModel;
@ -12,6 +13,7 @@ use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use App\Models\OrdenTrabajo\OrdenTrabajoTareaProgressDate;
use App\Models\Presupuestos\PresupuestoAcabadosModel;
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
use App\Models\Presupuestos\PresupuestoLineaModel;
use App\Models\Presupuestos\PresupuestoManipuladosModel;
use CodeIgniter\Entity\Entity;
@ -23,6 +25,11 @@ class OrdenTrabajoTareaEntity extends Entity
"id" => null,
"orden_trabajo_id" => null,
"presupuesto_linea_id" => null,
"presupuesto_acabado_id" => null,
"presupuesto_preimpresion_id" => null,
"presupuesto_encuadernado_id" => null,
"presupuesto_extra_id" => null,
"presupuesto_manipulado_id" => null,
"nombre" => null,
"orden" => null,
"maquina_id" => null,
@ -96,10 +103,15 @@ class OrdenTrabajoTareaEntity extends Entity
*
* @return PresupuestoLineaEntity
*/
public function presupuesto_linea(): PresupuestoLineaEntity
public function presupuesto_linea(): ?PresupuestoLineaEntity
{
$presupuesto_linea = null;
$m = model(PresupuestoLineaModel::class);
return $m->find($this->attributes["presupuesto_linea_id"]);
if ($this->attributes['presupuesto_linea_id']) {
$presupuesto_linea = $m->find($this->attributes["presupuesto_linea_id"]);
}
return $presupuesto_linea;
}
/**
* Devuelve la maquina original del presupuesto linea
@ -108,17 +120,35 @@ class OrdenTrabajoTareaEntity extends Entity
*/
public function maquina_presupuesto_linea(): Maquina
{
return $this->presupuesto_linea()->maquina();
return $this->presupuesto_linea()?->maquina();
}
/**
* Devuelve el presupuesto acabado origen de esta tarea
*
* @return PresupuestoAcabadosEntity
*/
public function presupuesto_acabado(): PresupuestoAcabadosEntity
public function presupuesto_acabado(): ?PresupuestoAcabadosEntity
{
$presupuesto_acabado = null;
$m = model(PresupuestoAcabadosModel::class);
return $m->find($this->attributes["presupuesto_linea_id"]);
if ($this->attributes["presupuesto_acabado_id"]) {
$presupuesto_acabado = $m->find($this->attributes["presupuesto_acabado_id"]);
}
return $presupuesto_acabado;
}
/**
* Devuelve el presupuesto enducadernacion origen de esta tarea
*
* @return PresupuestoEncuadernacionesEntity
*/
public function presupuesto_encuadernacion(): ?PresupuestoEncuadernacionesEntity
{
$presupuesto_encuadernacion = null;
$m = model(PresupuestoEncuadernacionesModel::class);
if ($this->attributes["presupuesto_encuadernado_id"]) {
$presupuesto_encuadernacion = $m->find($this->attributes["presupuesto_encuadernado_id"]);
}
return $presupuesto_encuadernacion;
}
/**
* Devuelve el presupuesto acabado origen de esta tarea
@ -148,12 +178,18 @@ class OrdenTrabajoTareaEntity extends Entity
$m = model(OrdenTrabajoTareaProgressDate::class);
return $m->where('ot_tarea_id', $this->attributes["id"])->findAll() ?? [];
}
public function lastState() : ?OrdenTrabajoTareaProgressDateEntity
{
$m = model(OrdenTrabajoTareaProgressDate::class);
$progressDates = $m->where('ot_tarea_id', $this->attributes["id"])->orderBy('action_at', 'DESC')->first();
return $progressDates;
}
public function tiempo_trabajado()
{
$dates = $this->progress_dates();
$intervals = [];
$init = [];
$end = [];
$init = null;
$end = null;
foreach ($dates as $key => $date) {
if ($date->estado == "I") {
if ($date->action_at) {
@ -161,7 +197,7 @@ class OrdenTrabajoTareaEntity extends Entity
}
}
if ($date->estado == "S" || $date->estado == "F") {
if ($date->action_at) {
if ($date->action_at && $init) {
$end = Time::createFromFormat('Y-m-d H:i:s', $date->action_at);
$intervals[] = $init->difference($end)->getSeconds();
}
@ -182,4 +218,24 @@ class OrdenTrabajoTareaEntity extends Entity
}
return $isTareaCosido;
}
public function isImpresion() : bool
{
return $this->attributes['presupuesto_linea_id'] != null;
}
public function isAcabado() : bool
{
return $this->attributes['presupuesto_acabado_id'] != null;
}
public function isManipulado() : bool
{
return $this->attributes['presupuesto_manipulado_id'] != null;
}
public function isEncuadernado() : bool
{
return $this->attributes['presupuesto_encuadernado_id'] != null;
}
public function isCorte() : bool
{
return $this->attributes['is_corte'];
}
}

View File

@ -19,8 +19,13 @@ class OrdenTrabajoUserEntity extends Entity
"interior_bn_user_id" => null,
"interior_color_user_id" => null,
"cubierta_user_id" => null,
"sobrecubierta_user_id" => null,
"guarda_user_id" => null,
//ACABADO
"plastificado_user_id" => null,
"plakene_user_id" => null,
"estampado_user_id" => null,
"uvi_user_id" => null,
"encuadernacion_user_id" => null,
"corte_user_id" => null,
"preparacion_interior_user_id" => null,

View File

@ -24,11 +24,11 @@ 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' => null,
'plakene' => null,
'rectractilado' => null,
'estampado' => null,
'uvi' => null,
'plastificado_tipo' => null,
'plakene_tipo' => null,
'rectractilado_tipo' => null,

View File

@ -722,6 +722,7 @@ return [
"menu_importadores" => "Importadores",
"menu_importadores_catalogo" => "Desde catálogo",
"menu_importadores_bubok" => "Bubok",
"menu_catalogo" => "Catálogo",
"menu_catalogo_libros" => "Libros",

View File

@ -46,6 +46,8 @@ return [
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',
'vencimiento' => 'Vencimiento',
'removeEnvioBase' => 'No añadir Envio Base',
'forzarRotativaPod' => 'Forzar rotativa en POD',
'direccionesEnvio' => 'Direcciones de Envío',

View File

@ -3,6 +3,7 @@
return [
'moduleTitle' => 'Importadores',
'importadorCatalogoTitle' => 'Importador RA-MA Ediciones S.L.',
'importadorBubokTitle' => 'Importador BUBOK Publishing S.L.',
'catalogo' => 'catálogo',
'input' => 'ISBN',
'descripcion' => 'Título',
@ -10,7 +11,8 @@ return [
'cnt_pedida' => 'Unidades',
'precio_compra' => 'Precio Compra',
'importar' => 'Importar',
'subirArchivo' => 'Cargar Excel proporcionado por RA-MA',
'subirArchivoRama' => 'Cargar Excel proporcionado por RA-MA',
'subirArchivoBubok' => 'Cargar XML proporcionado por BUBOK',
'libro' => 'libro',
'id' => 'ID',

View File

@ -1,15 +1,25 @@
<?php
return [
"navs" => [
'finalizadas' => 'Finalizadas',
'pendientes' => 'Pendientes',
'pendientes_ferro' => 'Ferro pendiente',
'ferro_ok' => 'Ferro/Prototipo OK',
'news' => 'Nuevas',
'waiting' => 'En espera',
'revision_com' => 'Revisión comercial',
'prod' => 'Producción'
],
"datatable" => [
"pedido_id"=> "Pedido ID",
"fecha_encuadernacion"=> "Fecha encuadernación",
"fecha_impresion"=> "Fecha impresión",
"cliente"=> "Cliente",
"titulo"=> "Título",
"ubicacion"=> "Ubicación",
"tirada"=> "Tirada",
"impresion"=> "Impresión",
"pedido_id" => "Pedido ID",
"fecha_encuadernacion" => "Fecha encuadernación",
"fecha_impresion" => "Fecha impresión",
"cliente" => "Cliente",
"titulo" => "Título",
"ubicacion" => "Ubicación",
"tirada" => "Tirada",
"impresion" => "Impresión",
"fecha_entrega_at" => "Fecha entrega prevista",
"maquina" => "Máquina",
"ancho" => "Ancho",
@ -31,8 +41,6 @@ return [
"pliegos" => "Pliegos",
"pliegos_libro" => "Pliegos",
"fecha" => "fecha"
],
"task" => [
"order" => "Orden",
@ -43,12 +51,13 @@ return [
"maquina_actual" => "Máquina actual",
"tiempo_estimado" => "Tiempo estimado",
"tiempo" => "Tiempo",
"proveedor" => "Proveedor",
"imposicion" => "Imposición"
],
"finalizadas" => "Finalizadas",
"pendiente_ferro" => "Ferro pendiente",
"pendientes" => "Pendientes",
"ferro_ok" => "Ferro ok",
"ferro_ok" => "Ferro/Prototipo ok",
"envio" => "Envío",
"ferro" => "Ferro",
"ot" => "Orden trabajo",
@ -70,6 +79,7 @@ return [
"portada" => "portada",
"plakene_traslucido" => "Plakene traslúcido",
"plastificado_mate" => "Plastificado mate",
"plastificado" => "Plastificado",
"espiral" => "Espiral",
"embalaje" => "Embalaje",
"tiempo_consumido" => "Tiempo consumido",
@ -80,6 +90,7 @@ return [
"preview_pdf" => "Previsualizar PDF",
"imprimir_codigo_safekat" => "Imprimir código SAFEKAT",
"imprimir_ferro" => "Imprimir ferro",
"imprimir_prototipo" => "Prototipo",
"planning_rotativa" => "Planificación rotativa",
"planning_plana" => "Planificación plana",
"solapa" => "Solapa",
@ -97,19 +108,23 @@ return [
"grapado" => "Grapado",
"solapa" => "Solapas",
"retractilado" => "Retractilado",
"manipulado" => "Entrada manipulado",
"retractilado5" => "Retractilado 5",
"prototipo" => "Prototipo",
"marcapaginas" => "Marcapáginas",
//IMPRESION
"impresion_bn" => "Impresión BN",
"cubierta" => "Cubierta/Portada",
"guarda" => "Guarda",
"encuadernacion" => "Encuadernación",
//PREIMPRESION
"pre_formato" => "Revisión formato",
"pre_lomo" => "Revisión lomo",
"pre_solapa" => "Revisión solapa",
"pre_codbarras" => "Revisión código barras",
"pre_imposicion" => "Revisión imposición",
"iniciada" => "Iniciada",
"finalizada" => "Finalizada",
"error" => "Error",
@ -121,7 +136,7 @@ return [
"attr_not_exist" => "El atributo {0,string} no pertenece al modelo Pedido"
],
"progress_ferro" => "Ferro",
"progress_preimpresion" => "Preimpresión",
"progress_logistica" => "Logística",
@ -132,6 +147,7 @@ return [
"maquinas" => "Máquinas",
"tareas_hoy" => "Tareas para HOY",
"tareas_all" => "Todas",
"tareas_delay" => "Aplazadas",
"play_tarea" => "Continuar",
"play_pause" => "Pausar",
"play_stop" => "Aplazar",
@ -139,11 +155,24 @@ return [
"cancel" => "Cancelar",
],
'tarea_estados' => [
'P' => 'Pendiente',
'I' => 'Iniciada',
'F' => 'Finalizada',
'S' => 'Pausada',
'D' => 'Aplazada',
'E' => 'Error'
],
'duplicate_estado_tarea_progress' => "Último estado de la tarea repetido",
'task_already_finished' => "La tarea se ha marcado como finalizada.",
'print_label' => "Imprimir etiqueta",
'click_init' => "Clicks al inicio",
'click_end' => "Clicks al final",
];
"comentarios" => "Comentarios",
"comentariosOt" => "Comentarios orden",
"comentariosImpresionInterior" => "Comentarios interior",
"comentariosCubierta" => "Comentarios cubierta",
"comentariosEncuadernacion" => "Comentarios encuadernación",
"comentariosLogistica" => "Comentarios logística",
"info_solapa_guillotina" => "Datos solapa y preparación guillotina",
];

View File

@ -70,6 +70,7 @@ return [
'catalogoSection' => 'Catálogo',
'importadoresSection' => 'Importadores',
'catalogoPermission' => 'Desde catálogo',
'bubokPermission' => 'Bubok',

View File

@ -61,6 +61,8 @@ class ClienteModel extends \App\Models\BaseModel
"comentarios",
"user_created_id",
"user_update_id",
"no_envio_base",
"forzar_rotativa_pod",
];
protected $returnType = ClienteEntity::class;
protected $useSoftDeletes = true;

View File

@ -214,4 +214,12 @@ class ProveedorModel extends \App\Models\BaseModel
return $builder->get()->getResultObject();
}
public function querySelect(?string $q)
{
$query = $this->builder()->select(['id','nombre as name']);
if($q){
$query->like('nombre',$q);
}
return $query;
}
}

View File

@ -427,6 +427,9 @@ class MaquinaModel extends \App\Models\BaseModel
->where('tarea_progress.deleted_at', null)
->groupBy('lg_maquinas.id')
->orderBy('countTareas','DESC');
if($maquina_tipo == "impresion"){
$query->where('orden_trabajo_tareas.is_corte',0);
}
return $query;
}

View File

@ -22,8 +22,14 @@ class OrdenTrabajoDate extends Model
"interior_bn_at",
"interior_color_at",
"cubierta_at",
"sobrecubierta_at", //TODO
"guarda_at", //TODO
//ACABADO
"plastificado_at",
"plakene_at", //TODO
"retractilado_at",
"estampado_at", //TODO
"uvi_at", //TODO
"encuadernacion_at",
"corte_at",
"preparacion_interiores_at",
@ -31,7 +37,6 @@ class OrdenTrabajoDate extends Model
"cosido_at",
"solapa_at",
"grapado_at",
"retractilado_at",
"retractilado5_at",
"prototipo_at",
"marcapaginas_at",

View File

@ -25,6 +25,11 @@ class OrdenTrabajoModel extends Model
"progreso",
"estado",
"comentarios",
"comment_interior",
"comment_cubierta",
"comment_encuadernacion",
"comment_logistica",
"info_solapa_guillotina",
"revisar_formato",
"revisar_lomo",
"revisar_solapa",

View File

@ -23,11 +23,18 @@ class OrdenTrabajoUser extends Model
"interior_bn_user_id",
"interior_color_user_id",
"cubierta_user_id",
"sobrecubierta_user_id",
"guarda_user_id",
//ACABADO
"plastificado_user_id",
"plakene_user_id",
"retractilado_user_id",
"estampado_user_id",
"uvi_user_id",
//ENCUADERNADO
"encuadernacion_user_id",
"corte_user_id",
"preparacion_interior_user_id",
"corte_user_id",
"entrada_manipulado_user_id",
"cosido_user_id",
"solapa_user_id",

View File

@ -9,7 +9,7 @@ class EmailService
public function send(string $subject, string $body, $recipient): bool
{
$skEnv = env('sk_environment', 'production'); // fallback a producción si no está definido
$skEnv = env('SK_ENVIRONMENT', 'production'); // fallback a producción si no está definido
// Si no estamos en producción, forzar el destinatario a uno fijo
if ($skEnv !== 'production') {

View File

@ -58,7 +58,7 @@ class PresupuestoClienteService extends BaseService
if ($total_plana < 0 && $total_rotativa < 0)
return [];
else {
if ($total_plana > $total_rotativa)
if ($total_plana > $total_rotativa && $data['forzarRotativa'] == 0)
return $plana;
else
return [$rotativa];

View File

@ -1983,4 +1983,95 @@ class PresupuestoService extends BaseService
return $peso;
}
public static function ajustarPresupuesto($id, $precio_unidad = null, $unidades = null, $precio_total = null, $forzar_descuento = false){
$precio_total_asignado = 0;
$precio_unidad_asignado = $precio_unidad;
$warning = false;
$model = model('App\Models\Presupuestos\PresupuestoModel');
if($precio_unidad != null && $unidades != null){
$precio_total_asignado = round(floatval($precio_unidad) * intval($unidades), 2);
}
else{
$precio_total_asignado = floatval($precio_total);
}
$presupuesto = $model->find($id);
$costes = floatval($presupuesto->total_costes);
$envio_base = floatval($presupuesto->envio_base);
$total_descuento = 0;
$total_descuentoPercent = 0;
if($costes + $envio_base > $precio_total_asignado){
if($forzar_descuento){
$total_descuento = $costes + $envio_base - $precio_total_asignado;
$total_descuentoPercent = round($total_descuento / ($costes + $envio_base) * 100, 2);
}
else{
$precio_total_asignado = round($costes + $envio_base, 2);
$precio_unidad_asignado = round($precio_total_asignado / intval($unidades), 4);
}
$warning = true;
}
$total_margenes = $precio_total_asignado - $costes - $envio_base < 0 ?
0 :
$precio_total_asignado - $costes - $envio_base;
$sumForFactor = floatval($presupuesto->total_coste_papel) + floatval($presupuesto->total_coste_impresion);
$sumForFactorPonderado = $sumForFactor + floatval($presupuesto->total_coste_servicios);
$factor = ($precio_total_asignado - floatval($presupuesto->envio_base)
- floatval($presupuesto->total_coste_envios) - floatval($presupuesto->total_margen_envios)) / $sumForFactor;
$factorPonderado = ($precio_total_asignado - floatval($presupuesto->envio_base)
- floatval($presupuesto->total_coste_envios) - floatval($presupuesto->total_margen_envios)) / $sumForFactorPonderado;
if ($presupuesto) {
$presupuesto->total_margenes = $total_margenes;
$presupuesto->total_aceptado = $precio_total_asignado;
$presupuesto->total_aceptado_revisado = $precio_total_asignado;
$presupuesto->total_presupuesto = $precio_total_asignado;
$presupuesto->total_antes_descuento = $precio_total_asignado - $costes - $envio_base < 0 ?
$costes + $envio_base :
$precio_total_asignado;
$presupuesto->total_precio_unidad = $precio_unidad_asignado;
$presupuesto->total_descuento = $total_descuento;
$presupuesto->total_descuentoPercent = $total_descuentoPercent;
$presupuesto->total_factor = round($factor, 2);
$presupuesto->total_factor_ponderado = round($factorPonderado, 2);
$model->update($id, $presupuesto);
}
return [
"success" => true,
"warning" => $warning,
"new_total" => $precio_total_asignado,
"new_precio_unidad" => $precio_unidad_asignado,
];
}
public static function calcular_merma($tirada, $POD, $formas_lineas_interior = [])
{
$merma = 0;
if ($tirada > $POD) {
$merma = $tirada * 0.1;
} else {
$merma_lineas = [];
foreach ($formas_lineas_interior as $formas_linea) {
if ($formas_linea > $tirada)
array_push($merma_lineas, $formas_linea - $tirada);
else
array_push($merma_lineas, $tirada % $formas_linea);
}
if (count($merma_lineas) > 0)
$merma = max($merma_lineas);
}
return round($merma, 0);
}
}

View File

@ -23,6 +23,8 @@ use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoFileModel;
use App\Models\OrdenTrabajo\OrdenTrabajoTareaProgressDate;
use App\Models\Pedidos\PedidoModel;
use App\Models\Presupuestos\PresupuestoAcabadosModel;
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
use App\Models\Usuarios\UserModel;
use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Database\BaseResult;
@ -65,6 +67,8 @@ class ProductionService extends BaseService
protected MaquinaEntity $defaultMaquinaCorte;
protected MaquinaModel $maquinaModel;
protected OrdenTrabajo $ordenTrabajoConfig;
protected PresupuestoAcabadosModel $presupuestoAcabadoModel;
protected PresupuestoEncuadernacionesModel $presupuestoEncuadernacionModel;
/**
@ -106,6 +110,12 @@ class ProductionService extends BaseService
* @var boolean
*/
public bool $isPlastificado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene retractilado
* Se usa para mostrar la fecha correspondiente en la vista
* @var boolean
*/
public bool $isRetractilado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene gofrado
* Se usa para mostrar la fecha correspondiente en la vista
@ -130,7 +140,7 @@ class ProductionService extends BaseService
* TODO Hay que implementar un boolean en `lg_tarifa_manipulado` para identificar
* @var boolean
*/
public bool $isGrapado = true; //TODO
public bool $isGrapado = false; //TODO
/**
* Indica si la orden de trabajo contiene espiral
* Se usa para mostrar la fecha correspondiente en la vista
@ -138,7 +148,7 @@ class ProductionService extends BaseService
* DEFAULT true hasta implementacion
* @var boolean
*/
public bool $isEspiral = true; //TODO
public bool $isEspiral = false; //TODO
/**
* Indica si la orden de trabajo contiene UVI
* Se usa para mostrar la fecha correspondiente en la vista
@ -196,6 +206,8 @@ class ProductionService extends BaseService
$this->otTareaProgressDate = model(OrdenTrabajoTareaProgressDate::class);
$this->festivoModel = model(FestivoModel::class);
$this->ordenTrabajoConfig = config('OrdenTrabajo');
$this->presupuestoAcabadoModel = model(PresupuestoAcabadosModel::class);
$this->presupuestoEncuadernacionModel = model(PresupuestoEncuadernacionesModel::class);
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
$this->configVariableModel = model(ConfigVariableModel::class);
$this->podValue = $this->configVariableModel->getVariable('POD')->value;
@ -267,6 +279,10 @@ class ProductionService extends BaseService
$this->storeOrdenTrabajoUsers();
$this->storeOrdenTrabajoDates();
$this->storeAllTareas();
try {
$this->updatePodDates();
} catch (\Throwable $th) {
}
$this->updatePedidoEspera();
return $this->ot;
}
@ -585,6 +601,14 @@ class ProductionService extends BaseService
{
return view("themes/vuexy/pdfs/orden_trabajo", $this->getDataPdf());
}
public function getFerroPdf()
{
return view("themes/vuexy/pdfs/ferro", $this->getDataPdf());
}
public function getPrototipoPdf()
{
return view("themes/vuexy/pdfs/prototipo", $this->getDataPdf());
}
/**
* Query para mostrar en datatable
*
@ -605,6 +629,10 @@ class ProductionService extends BaseService
"orden_trabajo_tareas.tiempo_real",
"orden_trabajo_tareas.comment",
"orden_trabajo_tareas.presupuesto_linea_id",
"orden_trabajo_tareas.presupuesto_acabado_id",
"orden_trabajo_tareas.presupuesto_manipulado_id",
"orden_trabajo_tareas.presupuesto_preimpresion_id",
"orden_trabajo_tareas.presupuesto_encuadernado_id",
"presupuesto_linea.tipo",
])
@ -826,6 +854,7 @@ class ProductionService extends BaseService
"tareas_preimpresion" => $this->tareas_preimpresion(),
"tareas_impresion" => $this->tareas_impresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_total" => $this->getTiempoTotalTareas(),
"statusColor" => $this->getOtColorStatus(),
"tareaCosido" => $this->getTareaCosido(),
];
@ -971,6 +1000,18 @@ class ProductionService extends BaseService
throw new Exception(lang('Produccion.task_already_finished'));
}
}
if (isset($data['estado'])) {
if ($data['estado'] == 'F') {
$tareaEntity = $this->otTarea->find($data['ot_tarea_id']);
$this->init($tareaEntity->orden_trabajo_id);
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
$dataDate = [
'name' => $dateName,
];
$dataDate[$dateName] = Time::now()->format('Y-m-d');
$this->updateOrdenTrabajoDate($dataDate);
}
}
return $this->otTareaProgressDate->insert($data);
}
public function getTareaLastState($tarea_id)
@ -985,6 +1026,12 @@ class ProductionService extends BaseService
$data["action_at"] = Time::now()->format('Y-m-d H:i:s');
$data["action_user_id"] = auth()->user()->id;
$status = $this->otTareaProgressDate->where('ot_tarea_id', $orden_trabajo_tarea_id)->delete();
if ($status) {
$tareaEntity = $this->otTarea->find($orden_trabajo_tarea_id);
$this->init($tareaEntity->orden_trabajo_id);
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
$this->emptyOrdenTrabajoDate($this->ot->id, $dateName);
}
if ($status) {
$response = $this->storeOrdenTrabajoTareaProgressDate($data);
}
@ -1373,14 +1420,33 @@ class ProductionService extends BaseService
}
public function getTiempoTareasImpresionHHMM(): string
{
$tareas_impresion = $this->ot->tareas_impresion();
$tiempo_seconds = 0;
foreach ($tareas_impresion as $key => $tarea) {
if ($tarea->is_corte == false) {
$tiempo_seconds += $tarea->tiempo_estimado;
try {
$tareas_impresion = $this->ot->tareas_impresion();
$tiempo_seconds = 0;
foreach ($tareas_impresion as $key => $tarea) {
if ($tarea->is_corte == false) {
$tiempo_seconds += $tarea->tiempo_estimado;
}
}
return float_seconds_to_hhmm_string($tiempo_seconds);
} catch (\Throwable $th) {
return '00:00';
}
}
public function getTiempoTotalTareas(): string
{
try {
$tareas = $this->ot->tareas();
$tiempo_seconds = 0;
foreach ($tareas as $key => $tarea) {
if ($tarea->tiempo_real) {
$tiempo_seconds += $tarea->tiempo_real;
}
}
return float_seconds_to_hhmm_string($tiempo_seconds);
} catch (\Throwable $th) {
return '00:00';
}
return float_seconds_to_hhmm_string($tiempo_seconds);
}
public function getUVI(): ?TarifaAcabadoEntity
{
@ -1647,9 +1713,14 @@ class ProductionService extends BaseService
return [
"isGofrado" => $this->gofrado(),
"isEspiral" => $this->isEspiral, //TODO
"isUVI" => $this->uvi(),
"isPlastificado" => $this->plastificado(),
"isPlakene" => $this->plakene(),
"isEstampado" => $this->estampado(),
"isRetractilado" => $this->retractilado(),
"isUVI" => $this->uvi(),
"isCubierta" => $this->cubierta(),
"isSobrecubierta" => $this->sobreCubierta(),
"isGuarda" => $this->guarda(),
"isColor" => $this->isColor,
"isBN" => $this->isBN,
"isCorte" => $this->corte(),
@ -1688,6 +1759,20 @@ class ProductionService extends BaseService
$this->isPlakene = $flag;
return $this->isPlakene;
}
public function retractilado(): bool
{
$flag = false;
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->rectractilado) {
$flag = true;
break;
}
}
$this->isRetractilado = $flag;
return $this->isRetractilado;
}
public function plakene_tipo(): ?string
{
$tipo = "";
@ -1761,6 +1846,24 @@ class ProductionService extends BaseService
}
return $this->isCubierta;
}
public function sobreCubierta(): bool
{
$flag = false;
$lineaCubierta = $this->presupuesto->presupuestoLineaSobreCubierta();
if ($lineaCubierta) {
$flag = true;
}
return $flag;
}
public function guarda(): bool
{
$flag = false;
$lineaCubierta = $this->presupuesto->presupuestoLineaGuarda();
if ($lineaCubierta) {
$flag = true;
}
return $flag;
}
public function color(): bool
{
$linea_impresion = $this->presupuesto->presupuestoLineaImpresion();
@ -1799,10 +1902,7 @@ class ProductionService extends BaseService
"orden_trabajo_tareas.id as ot_tarea_id",
"pedidos.fecha_impresion",
"orden_trabajo_tareas.nombre as tareaName",
"presupuestos.titulo as presupuesto_titulo",
"orden_trabajo_tareas.maquina_id",
"lg_papel_impresion.nombre as papel_impresion",
"presupuesto_linea.gramaje as papel_gramaje",
"tarea_progress.estado as tareaEstado"
])
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
@ -1819,21 +1919,14 @@ class ProductionService extends BaseService
'tarea_progress.ot_tarea_id = orden_trabajo_tareas.id',
'left'
)
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
->join("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right")
->join("pedidos", "pedidos.id = ordenes_trabajo.pedido_id", "right")
->join("lg_papel_formato", "lg_papel_formato.id = presupuestos.papel_formato_id", "left")
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
->join("lg_papel_impresion", "lg_papel_impresion.id = presupuesto_linea.papel_impresion_id", "left")
->groupStart()
->orWhere('orden_trabajo_tareas.maquina_id', $maquina_id) //!TODO
->orWhere('presupuesto_linea.maquina_id', $maquina_id)
->groupEnd()
->where('orden_trabajo_tareas.maquina_id', $maquina_id)
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false)
->where("orden_trabajo_tareas.deleted_at", null)
->where("tarea_progress.estado", 'P')
->orderBy("pedidos.fecha_impresion", "ASC")
->groupBy('orden_trabajo_tareas.nombre');
->groupBy('orden_trabajo_tareas.id');
return $q;
}
@ -1920,4 +2013,176 @@ class ProductionService extends BaseService
$dates = $this->createDatesForPOD();
return $this->pedidoModel->update($this->pedido->id, $dates);
}
public function getProveedorTarea($tarea_id)
{
$proveedor = null;
$tareaEntity = $this->otTarea->find($tarea_id);
if ($tareaEntity) {
$proveedorEncuadernado = $tareaEntity->presupuesto_encuadernacion();
$proveedorAcabado = $tareaEntity->presupuesto_acabado();
if ($proveedorEncuadernado) {
$proveedor = $proveedorEncuadernado->proveedor();
} elseif ($proveedorAcabado) {
$proveedor = $proveedorAcabado->proveedor();
} else {
$proveedor = null;
}
}
return ["tarea" => $tareaEntity, "proveedor" => $proveedor];
}
public function updateProveedorLinea($tarea_id, $proveedor_id)
{
$status = false;
$tareaEntity = $this->otTarea->find($tarea_id);
$presupuestoEncuadernado = $tareaEntity->presupuesto_encuadernacion();
$presupuestoAcabado = $tareaEntity->presupuesto_acabado();
if ($presupuestoEncuadernado) {
$status = $this->presupuestoEncuadernacionModel->update($presupuestoEncuadernado->id, ['proveedor_id' => $proveedor_id]);
} elseif ($presupuestoAcabado) {
$status = $this->presupuestoAcabadoModel->update($presupuestoAcabado->id, ['proveedor_id' => $proveedor_id]);
} else {
$status = null;
}
return $status;
}
public function otTareaImpresionWithDates()
{
$tareasImpresion = $this->ot->tareas_impresion();
$data = [];
foreach ($tareasImpresion as $key => $tareaImpresion) {
if ($tareaImpresion->is_corte) {
$data[$tareaImpresion->id] = 'corte_at';
continue;
}
$presupuestoLineaEntity = $tareaImpresion->presupuesto_linea();
if ($presupuestoLineaEntity) {
if ($presupuestoLineaEntity->isGuarda()) {
$data[$tareaImpresion->id] = 'guarda_at';
} elseif ($presupuestoLineaEntity->isCubierta()) {
$data[$tareaImpresion->id] = 'cubierta_at';
} elseif ($presupuestoLineaEntity->isColor()) {
$data[$tareaImpresion->id] = 'interior_color_at';
} elseif ($presupuestoLineaEntity->isBN()) {
$data[$tareaImpresion->id] = 'interior_bn_at';
} elseif ($presupuestoLineaEntity->isSobreCubierta()) {
$data[$tareaImpresion->id] = 'sobrecubierta_at';
}
}
}
return $data;
}
public function tareaImpresionDate($tarea): string
{
$dateName = "";
$presupuestoLineaEntity = $tarea->presupuesto_linea();
if ($presupuestoLineaEntity) {
if ($presupuestoLineaEntity->isGuarda()) {
$dateName = 'guarda_at';
} elseif ($presupuestoLineaEntity->isCubierta()) {
$dateName = 'cubierta_at';
} elseif ($presupuestoLineaEntity->isColor()) {
$dateName = 'interior_color_at';
} elseif ($presupuestoLineaEntity->isBN()) {
$dateName = 'interior_bn_at';
} elseif ($presupuestoLineaEntity->isSobreCubierta()) {
$dateName = 'sobrecubierta_at';
}
if ($tarea->is_corte) {
$dateName = 'corte_at';
}
}
return $dateName;
}
public function otTareaAcabadoWithDates()
{
$tareasAcabado = $this->ot->tareas_acabado();
$data = [];
foreach ($tareasAcabado as $key => $tareasAcabado) {
$tarifaAcabado = $tareasAcabado->presupuesto_acabado()?->tarifa();
if ($tarifaAcabado) {
if ($tarifaAcabado->plastificado) {
$data[$tareasAcabado->id] = 'plastificado_at';
}
if ($tarifaAcabado->rectractilado) {
$data[$tareasAcabado->id] = 'rectractilado_at';
}
if ($tarifaAcabado->estampado) {
$data[$tareasAcabado->id] = 'estampado_at';
}
if ($tarifaAcabado->uvi) {
$data[$tareasAcabado->id] = 'uvi_at';
}
}
}
return $data;
}
public function tareaAcabadoDate($tarea): string
{
$dateName = "";
$tarifaAcabado = $tarea->presupuesto_acabado()?->tarifa();;
if ($tarifaAcabado) {
if ($tarifaAcabado->plastificado) {
$dateName = 'plastificado_at';
}
if ($tarifaAcabado->rectractilado) {
$dateName = 'rectractilado_at';
}
if ($tarifaAcabado->plakene) {
$dateName = 'plakene_at';
}
if ($tarifaAcabado->estampado) {
$dateName = 'estampado_at';
}
if ($tarifaAcabado->uvi) {
$dateName = 'uvi_at';
}
}
return $dateName;
}
public function otTareaEncuadernadoWithDates()
{
$tareas = $this->ot->tareas_encuadernado();
$data = [];
foreach ($tareas as $key => $tarea) {
$data[$tarea->id] = "encuadernacion_at";
}
return $data;
}
public function otTareaManipuladooWithDates()
{
$tareas = $this->ot->tareas_manipulado();
$data = [];
foreach ($tareas as $key => $tarea) {
$data[$tarea->id] = "entrada_manipulado_at";
}
return $data;
}
public function getOrdenTrabajoTareaDates(): array
{
$dates = [];
foreach ($this->ot->tareas() as $key => $tarea) {
$dates[] = $this->getOrdenTrabajoTareaDate($tarea);
}
return array_unique($dates);
}
public function getOrdenTrabajoTareaDate(OrdenTrabajoTareaEntity $tarea): ?string
{
$dateName = null;
if ($tarea->isImpresion()) {
$dateName = $this->tareaImpresionDate($tarea);
}
if ($tarea->isAcabado()) {
$dateName = $this->tareaAcabadoDate($tarea);
}
if ($tarea->isManipulado()) {
$dateName = "entrada_manipulado_at";
}
if ($tarea->isEncuadernado()) {
$dateName = "encuadernacion_at";
}
return $dateName;
}
}

View File

@ -6,9 +6,6 @@
<th><?= lang('ID') ?></th>
<th><?= lang('Produccion.task.task') ?></th>
<th><?= lang('Produccion.task.estado') ?></th>
<th><?= lang('Produccion.datatable.titulo') ?></th>
<th><?= lang('Produccion.datatable.papel') ?></th>
<th><?= lang('Produccion.datatable.gramaje') ?></th>
<th><?= lang('Produccion.datatable.fecha_impresion') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>

View File

@ -1,6 +1,6 @@
<div class="table-responsive">
<table id="<?= $id ?>" class="table table-hover">
<table id="<?= $id ?>" class="table table-hover table-sm">
<thead>
<tr>
<th><?= lang('Produccion.task.order') ?></th>
@ -8,6 +8,7 @@
<th><?= lang('Produccion.task.maquina_presupuesto') ?></th>
<th><?= lang('Produccion.task.maquina_actual') ?></th>
<th><?= lang('Produccion.task.imposicion') ?></th>
<th><?= lang('Produccion.task.proveedor') ?></th>
<th><?= lang('Produccion.task.tiempo_estimado') ?></th>
<th><?= lang('Produccion.task.tiempo') ?></th>
<th></th>

View File

@ -521,6 +521,28 @@
</label>
</div>
</div>
<div class="col-md-3">
<div class="form-check">
<label for="removeEnvioBase" class="form-check-label">
<input type="checkbox" id="removeEnvioBase"
name="no_envio_base" value="1"
class="form-check-input"<?= $clienteEntity->no_envio_base == true ? 'checked' : ''; ?>>
<?= lang('Clientes.removeEnvioBase') ?>
</label>
</div>
</div>
<div class="col-md-3">
<div class="form-check">
<label for="rotativaPOD" class="form-check-label">
<input type="checkbox" id="rotativaPOD"
name="forzar_rotativa_pod" value="1"
class="form-check-input"<?= $clienteEntity->forzar_rotativa_pod == true ? 'checked' : ''; ?>>
<?= lang('Clientes.forzarRotativaPod') ?>
</label>
</div>
</div>
</div>
<div class="row g-3 mb-3">
<div class="col-md-3">
<div class="form-check">
<label for="tiradaFlexible" class="form-check-label">

View File

@ -0,0 +1,103 @@
<?= $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.importadorBubokTitle') ?></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="xmlFile"
class="form-label"><?= lang('Importador.subirArchivoBubok') ?? 'Subir archivo XML' ?></label>
<input type="file" id="xmlFile" accept=".xml" class="form-control">
</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="xmlTable" class="table">
<thead>
<tr>
<th><input type="checkbox" id="selectAll" /></th>
<th>Referencia</th>
<th>Título</th>
<th>Tamaño</th>
<th>Páginas</th>
<th>Tirada</th>
<th>Interior</th>
<th>Notas</th>
<th>Acciones</th>
</tr>
<tr>
<th></th> <!-- No filtro para checkbox -->
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th> <!-- No filtro para notas -->
<th></th> <!-- No filtro para 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 type="module" src="<?= site_url("assets/js/safekat/pages/importadores/bubok/bubok_tool.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -22,7 +22,7 @@
<div class="col-md-6 mb-3">
<label for="excelFile"
class="form-label"><?= lang('Importador.subirArchivo') ?? 'Subir archivo Excel' ?></label>
class="form-label"><?= lang('Importador.subirArchivoRama') ?? 'Subir archivo Excel' ?></label>
<input type="file" class="form-control" id="excelFile" name="excelFile"
accept=".xlsx, .xls">
</div>

View File

@ -18,6 +18,8 @@ use CodeIgniter\I18n\Time;
<div class="d-flex flex-row justify-content-center align-items-stretch gap-2 h-100">
<button type="button" id="btn-tareas-hoy" class="btn btn-primary h-100 active w-50" aria-pressed="true"><?= lang('Produccion.maquinista.tareas_hoy') ?></button>
<button type="button" id="btn-all-tareas" class="btn btn-primary h-100 w-50"><?= lang('Produccion.maquinista.tareas_all') ?></button>
<button type="button" id="btn-delay-tasks" class="btn btn-warning h-100 w-50"><?= lang('Produccion.maquinista.tareas_delay') ?></button>
</div>
</div>
<div class="col-md-6 col-xs-12 justify-content-end d-flex">

View File

@ -1,6 +1,195 @@
<div class="accordion accordion-bordered mt-3" id="accordionComentarios">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionComentariosTip" aria-expanded="false"
aria-controls="accordionComentariosTip">
<div class="d-flex flex-row justify-content-start align-items-stretch gap-2">
<span><i class="ti-quote ti-md ti"></i></span>
<h4> <?= lang('Produccion.comentarios') ?> </h4>
</div>
</button>
</h2>
<div class="cold-md-12 mt-3">
<!-- Comment text area-->
<label for="ot-comment" class="form-label"><h4><?= @lang("Produccion.comments") ?></h4></label>
<textarea rows=5 cols="10" type="text" class="form-control w-100" name="comentarios" id="ot-comment"></textarea>
</div>
<div id="accordionComentariosTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionComentarios">
<div class="accordion-body">
<div class="nav-align-top mb-4">
<ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item">
<button
type="button"
class="nav-link active"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-ot"
aria-controls="comentarios-ot"
aria-selected="true">
<?= lang("Produccion.comentariosOt") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-interior"
aria-controls="comentarios-interior"
aria-selected="true">
<?= lang("Produccion.comentariosImpresionInterior") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-cubierta"
aria-controls="comentarios-cubierta"
aria-selected="false">
<?= lang("Produccion.comentariosCubierta") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-encuadernacion"
aria-controls="comentarios-encuadernacion"
aria-selected="false">
<?= lang("Produccion.comentariosEncuadernacion") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-logistica"
aria-controls="comentarios-logistica"
aria-selected="false">
<?= lang("Produccion.comentariosLogistica") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#info-solapa-guillotina"
aria-controls="info-solapa-guillotina"
aria-selected="false">
<?= lang("Produccion.info_solapa_guillotina") ?>
</button>
</li>
</ul>
<div class="tab-content border border-container">
<div class="tab-pane fade show active" id="comentarios-ot" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
name="comentarios"
class="ot-comment w-100"
style="height: 10em;"
class="form-control"><?= $ot->comentarios ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-interior" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
name="comment_interior"
class="ot-comment w-100"
style="height: 10em;"
class="form-control"><?= $ot->comment_interior ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-cubierta" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
name="comment_cubierta"
class="ot-comment w-100"
style="height: 10em;"
class="form-control"><?= $ot->comment_cubierta ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-encuadernacion" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
name="comment_encuadernacion"
class="ot-comment w-100"
style="height: 10em;"
class="form-control"><?= $ot->comment_encuadernacion ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-logistica" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
name="comment_logistica"
class="ot-comment w-100"
style="height: 10em;"
class="form-control"><?= $ot->comment_logistica ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="info-solapa-guillotina" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
name="info_solapa_guillotina"
class="ot-comment w-100"
style="height: 10em;"
class="form-control"><?= $ot->info_solapa_guillotina ?></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->

View File

@ -42,9 +42,17 @@
<span class="ti-sm ti ti-truck-delivery me-1"></span>
Pedido
</a>
<a type="button" class="btn btn-danger btn-block mb-1" target="__blank" href="<?= "/produccion/ordentrabajo/pdf/" . $modelId ?>">
<span class="ti-sm ti ti-file me-1"></span>
PDF</a>
<?php if ($presupuesto->ferro == 1): ?>
<?php if ($ot->dates()->ferro_ok_at != null): ?>
<a type="button" class="btn btn-danger btn-block mb-1" target="__blank" href="<?= "/produccion/ordentrabajo/pdf/" . $modelId ?>">
<span class="ti-sm ti ti-file me-1"></span>
PDF</a>
<?php endif; ?>
<?php else: ?>
<a type="button" class="btn btn-danger btn-block mb-1" target="__blank" href="<?= "/produccion/ordentrabajo/pdf/" . $modelId ?>">
<span class="ti-sm ti ti-file me-1"></span>
PDF</a>
<?php endif; ?>
<a type="button" href="<?= route_to('getOrdenTrabajoBarCode', $modelId) ?>" class="btn btn-secondary btn-block mb-1" download><span class="ti-sm ti ti-barcode me-1"></span><?= @lang("Produccion.imprimir_codigo_safekat") ?></a>

View File

@ -21,7 +21,7 @@
</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" ?>">
<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">
@ -136,30 +136,90 @@
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $flags["isCubierta"] ? "" : "d-none" ?>">
<label for="ot-portada" class="form-label"><?= @lang("Produccion.cubierta") ?></label>
<label for="ot-cubierta" class="form-label"><?= @lang("Produccion.cubierta") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="cubierta_at" id="ot-portada" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="cubierta_at" id="ot-cubierta" 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["cubierta_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 <?= $flags["isSobrecubierta"] ? "" : "d-none" ?>">
<label for="ot-sobrecubierta" class="form-label"><?= @lang("Produccion.sobrecubierta") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="sobrecubierta_at" id="ot-sobrecubierta" 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["sobrecubierta_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 <?= $flags["isGuarda"] ? "" : "d-none" ?>">
<label for="ot-guarda" class="form-label"><?= @lang("Produccion.guarda") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="guarda_at" id="ot-guarda" 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["guarda_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">
<h4 class="text-truncate"><?= lang("Produccion.progress_manipulado") ?></h4>
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $flags["isPlastificado"] ? "" : "d-none" ?>">
<label for="ot-plastificado-mate" class="form-label"><?= @lang("Produccion.plastificado_mate") ?></label>
<label for="ot-plastificado" class="form-label"><?= @lang("Produccion.plastificado") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="plastificado_at" id="ot-plastificado-mate" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="plastificado_at" id="ot-plastificado" 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["plastificado_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">
<h4><?= lang("Produccion.progress_manipulado") ?></h4>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $flags["isPlakene"] ? "" : "d-none" ?>">
<label for="ot-plakene" class="form-label"><?= @lang("Produccion.plakene") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="plakene_at" id="ot-plakene" 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["plakene_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 <?= $flags["isRetractilado"] ? "" : "d-none" ?>">
<label for="ot-retractilado" class="form-label"><?= @lang("Produccion.retractilado") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="retractilado_at" id="ot-retractilado" 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["retractilado_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 <?= $flags["isUVI"] ? "" : "d-none" ?>">
<label for="ot-uvi" class="form-label"><?= @lang("Produccion.uvi") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="uvi_at" id="ot-uvi" 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["uvi_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 <?= $flags["isEstampado"] ? "" : "d-none" ?>">
<label for="ot-estampado" class="form-label"><?= @lang("Produccion.estampado") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="estampado_at" id="ot-estampado" 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["estampado_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $presupuesto->cosido ? "" : "d-none" ?>">
<label for="ot-prep-cosido" class="form-label"><?= @lang("Produccion.cosido") ?></label>
@ -187,35 +247,6 @@
</div>
<div class="form-text"><?= $user_dates["solapa_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->retractilado ? "" : "d-none" ?>">
<label for="ot-prep-retractilado" class="form-label"><?= @lang("Produccion.retractilado") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="retractilado_at" id="ot-prep-retractilado" 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["retractilado_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->retractilado5 ? "" : "d-none" ?>">
<label for="ot-prep-retractilado5" class="form-label"><?= @lang("Produccion.retractilado5") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="retractilado5_at" id="ot-prep-retractilado5" 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["retractilado5_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->prototipo ? "" : "d-none" ?>">
<label for="ot-prep-prototipo" class="form-label"><?= @lang("Produccion.prototipo") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="prototipo_at" id="ot-prep-prototipo" 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["prototipo_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->marcapaginas ? "" : "d-none" ?>">
@ -237,13 +268,23 @@
</div>
<!-- Progress -->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= $flags["isEspiral"] ? "" : "d-none" ?>">
<label for="ot-espiral" class="form-label"><?= @lang("Produccion.espiral") ?></label>
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= count($ot->tareas_manipulado()) > 0 ? "" : "d-none" ?>">
<label for="ot-manipulado" class="form-label"><?= @lang("Produccion.manipulado") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="espiral_at" id="ot-espiral" data-input <?= $is_finalizada ? "disabled" : "" ?>>
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="entrada_manipulado_at" id="ot-manipulado" 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["espiral_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
<div class="form-text"> <?= $user_dates["entrada_manipulado_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 <?= count($ot->tareas_encuadernado()) > 0 ? "" : "d-none" ?>">
<label for="ot-encuadernacion" class="form-label"><?= @lang("Produccion.encuadernacion") ?></label>
<div class="input-group">
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="encuadernacion_at" id="ot-encuadernacion" 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["encuadernacion_at"] ?? "<span class='ti-sm ti ti-alert-triangle me-1'></span>" ?></div>
</div>
</div>
@ -279,10 +320,12 @@
</div>
<div class="row">
<div class="row">
<p><?= @lang("Produccion.tiempo_estimado") ?> : <?= $tiempo_estimado ?> (HH:MM)</p>
<span><?= @lang("Produccion.tiempo_estimado") ?>(HH:MM)</span>
<span class="tiempo-estimado"> <?= $tiempo_estimado ?></span>
</div>
<div class="row">
<p><?= @lang("Produccion.tiempo_consumido") ?> :</p>
<span><?= @lang("Produccion.tiempo_consumido") ?>(HH:MM)</span>
<span id="tiempo-total"></span>
</div>
</div>
<div class="row">

View File

@ -45,9 +45,17 @@
href="<?= "/produccion/ordentrabajo/pdf/" . $modelId ?>">
<span class="ti-sm ti ti-eye me-1"></span>
<?= @lang("Produccion.preview_pdf") ?></a>
<?php if ($presupuesto->ferro): ?>
<a type="button" class="btn btn-primary btn-block mb-1" target="__blank"
href="<?= "/produccion/ordentrabajo/pdf/ferro/" . $modelId ?>">
<span class="ti-sm ti ti-download me-1"></span>
<?= @lang("Produccion.imprimir_ferro") ?></a>
<?php endif; ?>
<?php if ($presupuesto->prototipo): ?>
<button type="button"
class="btn btn-primary btn-block mb-1 beta"><?= @lang("Produccion.imprimir_ferro") ?></button>
<a type="button" class="btn btn-primary btn-block mb-1" target="__blank"
href="<?= "/produccion/ordentrabajo/pdf/prototipo/" . $modelId ?>">
<span class="ti-sm ti ti-download me-1"></span>
<?= @lang("Produccion.prototipo") ?></a>
<?php endif; ?>
<a type="button" href="<?= route_to('getOrdenTrabajoBarCode', $modelId) ?>"
class="btn btn-secondary btn-block mb-1"

View File

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

View File

@ -20,7 +20,14 @@ if (auth()->user()->can('importadores.menu')) {
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('importadores.bubok')) { ?>
<li class="menu-item">
<a href="<?= route_to("importadorBubokTool") ?>" class="menu-link">
<?= lang("App.menu_importadores_bubok") ?>
</a>
</li>
<?php } ?>
</ul>
</li>

View File

@ -3,7 +3,7 @@
/**
* MAQUINISTA MENU
*/
if (auth()->user()->inGroup('maquina')) {
if (auth()->user()->inGroup('maquina','admin')) {
?>
<!-- Catalogue -->
<li class="menu-item">

View File

@ -11,7 +11,7 @@
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<td></td>
<td>Plástico</td>
<td></td>
<td><?= $flags['isPlakene'] ? "SI" : "NO" ?></td>
<td><?= $plakene_tipo ?? "" ?></td>

View File

@ -1,7 +1,7 @@
<table>
<tr class="encuadernacion">
<th class="cell-50">Encuadernacion</th>
<th class="cell-50">Color</th>
<th class="cell-50">Tipo</th>
<th class="cell-50">Plakenes</th>
<th class="cell-50">Plakene</th>
<th class="cell-50">Externo</th>
@ -10,7 +10,7 @@
<?php if (count($encuadernaciones) > 0): ?>
<tr style="color: red;">
<td><?= $encuadernacion->tarifa()->nombre ?></td>
<td></td>
<td>Metálico</td>
<td><?= $flags['isPlakene'] ? "SI" : "NO" ?></td>
<td><?= $plakene_tipo ?? "" ?></td>
<td><?= $encuadernacion->proveedor() ? $encuadernacion->proveedor()->nombre : "" ?></td>

View File

@ -0,0 +1,305 @@
<?php
use CodeIgniter\I18n\Time;
$session = session();
$settings = $session->get('settings');
?>
<!DOCTYPE html>
<html
lang="<?= $session->get('lang') ?>"
data-assets-path="<?= site_url('themes/vuexy/') ?>"
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Icons -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/fonts/fontawesome.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/fonts/tabler-icons.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/fonts/flag-icons.css') ?>" />
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.css') ?>" />
<link rel="icon" type="image/x-icon" href="<?= site_url('themes/vuexy/img/favicon/favicon.ico') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/pdf.ot.css') ?>">
<title><?= $presupuesto->titulo ?>[OT:<?= $ot->id ?>]</title>
</head>
<body>
<div class="col-md-12 pdf-wrapper" data-id="<?= $ot->id . "_FERRO_" . "_" . $presupuesto->id . "_" . $presupuesto->titulo ?>">
<div class="row">
<div class="col-12 d-flex justify-content-between align-items-center">
<h5><?= $presupuesto->titulo ?></h5>
<span class="fs-medium"><strong><?= Time::now()->format("d/m/Y H:i:s") ?></strong></span>
</div>
</div>
</div>
<div class="row mb-2 d-flex flex align-items-stretch">
<div class="col-2">
<?php if ($ot->full_path): ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->full_path ? "data:image/png;base64," . base64_encode(file_get_contents($ot->full_path)) : '/assets/img/portada_not_found.png' ?>" />
<?php else: ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="/assets/img/portada_not_found.png" />
<?php endif; ?>
</div>
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
<div class="row">
<div class="col-8">
<div class="px-2 d-flex flex justify-content-between align-items-center" style="background-color: <?= $colors["week_day"]["bg"] ?>;color:<?= $colors["week_day"]["color"] ?>;">
<span><strong><?= $pedido->fecha_encuadernado ? week_day_humanize(Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->getDayOfWeek() - 1, true) : "" ?></strong></span>
<span><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </span>
</div>
</div>
<div class="col-4">
<div class="px-2 d-flex flex justify-content-center align-items-center w-100">
<span class="w-100 text-center" style="background-color: <?= $colors["impresion_interior_ppal"]["bg"] ?>;color:<?= $colors["impresion_interior_ppal"]["color"] ?>;">
<?php if ($isPOD): ?>
<strong>POD</strong>
<?php elseif ($presupuesto->presupuestoLineaImpresion()->isRotativa()): ?>
<strong>ROTATIVA</strong>
<?php else: ?>
<strong>GENERAL</strong>
<?php endif; ?>
</span>
</div>
</div>
</div>
<div class="row p-2">
<div class="col-3 h-100">
<div class="row px-2 mt-2 h-100">
<table class="h-100 bg-white">
<tr>
<th class="bg-white">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>PORT.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ACABAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ENCUAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>MANIPUL.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
</table>
</div>
</div>
<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><?= $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 ?>
</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 ?>
</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 : "" ?>
</div>
<?php foreach ($acabados as $key => $acabado): ?>
<?php if ($acabado->tarifa()->isUVI()): ?>
<div class="col-6 square offset-md-6 text-center" style="background-color:<?= $acabado->tarifa()->code == "R2D" ? "#4D93D9" : "#0070C0" ?>;color:white;">
+ <?= $acabado->tarifa()->code ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="col-4" style="background-color: <?= $colors["ot"]["bg"] ?>">
<div class="row h-100">
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center">
<span class="fs-large" style="color:<?= $colors["ot"]["color"] ?>;"><strong><?= $ot->id ?></strong></span>
</div>
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center bg-white">
<img class="img-fluid" src="data:image/png;base64,<?= $ot->bar_code ?>" alt="barcode" />
</div>
</div>
</div>
</div>
</div>
</div>
<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">
<?= $cliente->alias ?>
</td>
</tr>
<tr>
<th>TITULO</th>
<td class="t-cell">
<?= $presupuesto->titulo ?>
</td>
</tr>
<tr>
<th>ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr>
<tr>
<th>PEDIDO CLIENTE</th>
<td class="t-cell"><?= $pedido->id ?></td>
</tr>
</table>
</div>
<div class="col-4">
<div class="col-12 d-flex justify-content-center" style="width: 100%">
<?php if ($imposicion): ?>
<?php if ($imposicion->imposicion_esquema()): ?>
<?= $imposicion->imposicion_esquema()->svg_schema ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="col-12">
<div class="imposicion">
<table>
<tr>
<th class="w-50">Imposicion</th>
<td><?= $imposicion?->full_name ?? "" ?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="row mb-2">
<div class="section-title impresion">IMP. INTERIOR</div>
<div class="col-12">
<div>
<table>
<tr>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.size') ?></th>
<td class="t-cell text-center"> <?= $papel_formato->ancho ?>x<?= $papel_formato->alto ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.ejemplares') ?></th>
<td class="t-cell text-center"> 1 </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.tipo') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tipo_presupuesto()?->codigo ?? "" ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.lomo') ?></th>
<td class="t-cell text-center"> <?= number_format($presupuesto->lomo_cubierta, 2, ',', '.') ?> </td>
</tr>
</table>
<table>
<tr>
<td rowspan="3" class="row-logo-impresion"><img src="<?= site_url($linea_impresion->get_impresion_logo()) ?>" width="35px" height="35px"></td>
<th>Páginas</th>
<th>Ejemplares</th>
<th>Tintas</th>
<th>Formas</th>
<th>Máquina</th>
<th>Clics</th>
<th>Tiempo</th>
</tr>
<tr>
<td><?= $presupuesto->paginas ?></td> <!-- Páginas libro -->
<td> 1 </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_libro ?></td>
<td><?= float_seconds_to_hhmm_string($linea_impresion->horas_maquina * 3600 / $presupuesto->tirada) ?></td>
</tr>
<tr>
<td colspan="4"><?= $linea_impresion->papel_impresion ?></td>
<td><?= $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?></td>
<td colspan="2">
<?php if ($linea_impresion->isRotativa()): ?>
<?= number_format($linea_impresion->rotativa_metros_libro, 2, ',', '.') ?> metros
<?php endif; ?>
</td>
</tr>
</table>
</div>
<div class="comments <?=$ot->comment_interior ? '' : 'd-none' ?>">
<div class="flex-row impresion">Comentarios impresión interior</div>
<div class="comment-content w-100">
<p>
<?= $ot->comment_interior ?>
</p>
</div>
</div>
</div>
</div>
<div class="row mb-2">
<div class="section-title">LOGISTICA</div>
<div class="col-12">
<table>
<tr>
<th>Peso Unidad</th>
<th>Peso Pedido</th>
<th>Corte Pie</th>
</tr>
<tr>
<td><?= number_format($peso_unidad, 2, ',', '.') ?> gr</td>
<td><?= $peso_unidad > 1000 ? number_format($peso_unidad / 1000, 2, ',', '.') . " kg" : number_format($peso_unidad, 2, ',', '.') . " gr" ?> </td>
<td>-</td>
</tr>
</table>
<div class="comments <?=$ot->comment_logistica ? '' : 'd-none' ?>">
<div class="flex-row">Comentarios logistica:</div>
<div class="comment-content">
<p>
<?= $ot->comment_logistica ?>
</p>
</div>
</div>
</div>
</div>
<div class="col-md-12 d-flex justify-content-center align-items-center">
<span class="footer">&copy; 2024 SAFEKAT. Todos los derechos reservados.</span>
</div>
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/bootstrap.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/hammer/hammer.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/menu.js') ?>"></script>
<script src="<?= site_url('assets/js/safekat/pages/pdf/otDownload.js') ?>"></script>
</body>
</html>

View File

@ -32,378 +32,382 @@ $settings = $session->get('settings');
</head>
<body>
<div class="col-md-12 pdf-wrapper" data-id="<?= $ot->id . "_" . "_" . $presupuesto->id . "_" . $presupuesto->titulo ?>">
<div class="row">
<div class="col-12 d-flex justify-content-between align-items-center">
<h5><?= $presupuesto->titulo ?></h5>
<span class="fs-medium"><strong><?= Time::now()->format("d/m/Y H:i:s") ?></strong></span>
</div>
</div>
</div>
<div class="row mb-2 d-flex flex align-items-stretch">
<div class="col-2">
<?php if ($ot->full_path): ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->full_path ? "data:image/png;base64," . base64_encode(file_get_contents($ot->full_path)) : '/assets/img/portada_not_found.png' ?>" />
<?php else: ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="/assets/img/portada_not_found.png" />
<?php endif; ?>
</div>
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
<div>
<div class="col-md-12 pdf-wrapper" data-id="<?= $ot->id . "_" . "_" . $presupuesto->id . "_" . $presupuesto->titulo ?>">
<div class="row">
<div class="col-8">
<div class="px-2 d-flex flex justify-content-between align-items-center" style="background-color: <?= $colors["week_day"]["bg"] ?>;color:<?= $colors["week_day"]["color"] ?>;">
<span><strong><?= $pedido->fecha_encuadernado ? week_day_humanize(Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->getDayOfWeek() - 1, true) : "" ?></strong></span>
<span><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </span>
</div>
</div>
<div class="col-4">
<div class="px-2 d-flex flex justify-content-center align-items-center w-100">
<span class="w-100 text-center" style="background-color: <?= $colors["impresion_interior_ppal"]["bg"] ?>;color:<?= $colors["impresion_interior_ppal"]["color"] ?>;">
<?php if ($isPOD): ?>
<strong>POD</strong>
<?php elseif ($presupuesto->presupuestoLineaImpresion()->isRotativa()): ?>
<strong>ROTATIVA</strong>
<?php else: ?>
<strong>GENERAL</strong>
<?php endif; ?>
</span>
</div>
</div>
</div>
<div class="row p-2">
<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>
</div>
</div>
<div class="row px-2 mt-2 h-100">
<table class="h-100 bg-white">
<tr>
<th class="bg-white">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>PORT.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ACABAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ENCUAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>MANIPUL.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
</table>
</div>
</div>
<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><?= $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 ?>
</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 ?>
</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 : "" ?>
</div>
<?php foreach ($acabados as $key => $acabado): ?>
<?php if ($acabado->tarifa()->isUVI()): ?>
<div class="col-6 square offset-md-6 text-center" style="background-color:<?= $acabado->tarifa()->code == "R2D" ? "#4D93D9" : "#0070C0" ?>;color:white;">
+ <?= $acabado->tarifa()->code ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="col-4" style="background-color: <?= $colors["ot"]["bg"] ?>">
<div class="row h-100">
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center">
<span class="fs-large" style="color:<?= $colors["ot"]["color"] ?>;"><strong><?= $ot->id ?></strong></span>
</div>
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center bg-white">
<img class="img-fluid" src="data:image/png;base64,<?= $ot->bar_code ?>" alt="barcode" />
</div>
</div>
<div class="col-12 d-flex justify-content-between align-items-center">
<h5><?= $presupuesto->titulo ?></h5>
<span class="fs-medium"><strong><?= Time::now()->format("d/m/Y H:i:s") ?></strong></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<table class="h-50">
<tr>
<th>IDSK</th>
<td class="t-cell">
<div class="row mb-2 d-flex flex align-items-stretch">
<div class="col-2">
<?php if ($ot->full_path): ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->full_path ? "data:image/png;base64," . base64_encode(file_get_contents($ot->full_path)) : '/assets/img/portada_not_found.png' ?>" />
<?php else: ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="/assets/img/portada_not_found.png" />
</td>
</tr>
<tr>
<th>CLIENTE</th>
<td class="t-cell">
<?= $cliente->alias ?>
</td>
</tr>
<tr>
<th>TITULO</th>
<td class="t-cell">
<?= $presupuesto->titulo ?>
</td>
</tr>
<tr>
<th>ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr>
<tr>
<th>PEDIDO CLIENTE</th>
<td class="t-cell"><?= $pedido->id ?></td>
</tr>
</table>
</div>
<div class="col-4">
<div class="col-12 d-flex justify-content-center" style="width: 100%">
<?php if ($imposicion): ?>
<?php if ($imposicion->imposicion_esquema()): ?>
<?= $imposicion->imposicion_esquema()->svg_schema ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="col-12">
<div class="imposicion">
<table>
<tr>
<th class="w-50">Imposicion</th>
<td><?= $imposicion?->full_name ?? "" ?></td>
</tr>
</table>
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
<div class="row">
<div class="col-8">
<div class="px-2 d-flex flex justify-content-between align-items-center" style="background-color: <?= $colors["week_day"]["bg"] ?>;color:<?= $colors["week_day"]["color"] ?>;">
<span><strong><?= $pedido->fecha_encuadernado ? week_day_humanize(Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->getDayOfWeek() - 1, true) : "" ?></strong></span>
<span><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </span>
</div>
</div>
<div class="col-4">
<div class="px-2 d-flex flex justify-content-center align-items-center w-100">
<span class="w-100 text-center" style="background-color: <?= $colors["impresion_interior_ppal"]["bg"] ?>;color:<?= $colors["impresion_interior_ppal"]["color"] ?>;">
<?php if ($isPOD): ?>
<strong>POD</strong>
<?php elseif ($presupuesto->presupuestoLineaImpresion()->isRotativa()): ?>
<strong>ROTATIVA</strong>
<?php else: ?>
<strong>GENERAL</strong>
<?php endif; ?>
</span>
</div>
</div>
</div>
<div class="row p-2">
<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>
</div>
</div>
<div class="row px-2 mt-2 h-100">
<table class="h-100 bg-white">
<tr>
<th class="bg-white">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>PORT.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ACABAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ENCUAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>MANIPUL.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
</table>
</div>
</div>
<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><?= $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 ?>
</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 ?>
</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 : "" ?>
</div>
<?php foreach ($acabados as $key => $acabado): ?>
<?php if ($acabado->tarifa()->isUVI()): ?>
<div class="col-6 square offset-md-6 text-center" style="background-color:<?= $acabado->tarifa()->code == "R2D" ? "#4D93D9" : "#0070C0" ?>;color:white;">
+ <?= $acabado->tarifa()->code ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="col-4" style="background-color: <?= $colors["ot"]["bg"] ?>">
<div class="row h-100">
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center">
<span class="fs-large" style="color:<?= $colors["ot"]["color"] ?>;"><strong><?= $ot->id ?></strong></span>
</div>
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center bg-white">
<img class="img-fluid" src="data:image/png;base64,<?= $ot->bar_code ?>" alt="barcode" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row mb-2">
<div class="section-title impresion">IMP. INTERIOR</div>
<div class="col-12">
<div>
<table>
<div class="row">
<div class="col-8">
<table class="h-50">
<tr>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.size') ?></th>
<td class="t-cell text-center"> <?= $papel_formato->ancho ?>x<?= $papel_formato->alto ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.ejemplares') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tirada ?> + <?= $presupuesto->merma ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.tipo') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tipo_presupuesto()?->codigo ?? "" ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.lomo') ?></th>
<td class="t-cell text-center"> <?= number_format($presupuesto->lomo_cubierta, 2, ',', '.') ?> </td>
</tr>
</table>
<table>
<tr>
<td rowspan="3" class="row-logo-impresion"><img src="<?= site_url($linea_impresion->get_impresion_logo()) ?>" width="35px" height="35px"></td>
<th>Páginas</th>
<th>Ejemplares</th>
<th>Tintas</th>
<th>Formas</th>
<th>Máquina</th>
<th>Clics</th>
<th>Tiempo</th>
<th>IDSK</th>
<td class="t-cell">
</td>
</tr>
<tr>
<td><?= $presupuesto->paginas ?></td> <!-- Páginas libro -->
<td><?= $presupuesto->tirada ?> </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>
<td><?= float_seconds_to_hhmm_string($linea_impresion->horas_maquina * 3600) ?></td>
<th>CLIENTE</th>
<td class="t-cell">
<?= $cliente->alias ?>
</td>
</tr>
<tr>
<td colspan="4"><?= $linea_impresion->papel_impresion ?></td>
<td><?= $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?></td>
<td colspan="2">
<?php if ($linea_impresion->isRotativa()): ?>
<?= number_format($linea_impresion->rotativa_metros_total, 2, ',', '.') ?> metros
<?php endif; ?>
<th>TITULO</th>
<td class="t-cell">
<?= $presupuesto->titulo ?>
</td>
</tr>
<tr>
<th>ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr>
<tr>
<th>PEDIDO CLIENTE</th>
<td class="t-cell"><?= $pedido->id ?></td>
</tr>
</table>
</div>
<div class="comments">
<div class="flex-row impresion">Comentarios impresión interior</div>
<div class="comment-content w-100">
<p>
</p>
<br />
<p>
</p>
<div class="col-4">
<div class="col-12 d-flex justify-content-center" style="width: 100%">
<?php if ($imposicion): ?>
<?php if ($imposicion->imposicion_esquema()): ?>
<?= $imposicion->imposicion_esquema()->svg_schema ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="col-12">
<div class="imposicion">
<table>
<tr>
<th class="w-50">Imposicion</th>
<td><?= $imposicion?->full_name ?? "" ?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<?php if ($linea_cubierta): ?>
<div class="row mb-2">
<div class="section-title cubierta">IMP. CUBIERTA</div>
<div class="section-title impresion">IMP. INTERIOR</div>
<div class="col-12">
<div>
<table>
<tr>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.size') ?></th>
<td class="t-cell text-center"> <?= $papel_formato->ancho ?>x<?= $papel_formato->alto ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.ejemplares') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tirada ?> + <?= $presupuesto->merma ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.tipo') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tipo_presupuesto()?->codigo ?? "" ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.lomo') ?></th>
<td class="t-cell text-center"> <?= number_format($presupuesto->lomo_cubierta, 2, ',', '.') ?> </td>
</tr>
</table>
<table>
<tr>
<td rowspan="3" class="row-logo-impresion"><img src="<?= site_url($linea_impresion->get_impresion_logo()) ?>" width="35px" height="35px"></td>
<th>Páginas</th>
<th>Ejemplares</th>
<th>Tintas</th>
<th>Formas</th>
<th>Máquina</th>
<th>Clics</th>
<th>Tiempo</th>
</tr>
<tr>
<td><?= $presupuesto->paginas ?></td> <!-- Páginas libro -->
<td><?= $presupuesto->tirada ?> </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>
<td><?= float_seconds_to_hhmm_string($linea_impresion->horas_maquina * 3600) ?></td>
</tr>
<tr>
<td colspan="4"><?= $linea_impresion->papel_impresion ?></td>
<td><?= $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?></td>
<td colspan="2">
<?php if ($linea_impresion->isRotativa()): ?>
<?= number_format($linea_impresion->rotativa_metros_total, 2, ',', '.') ?> metros
<?php endif; ?>
</td>
</tr>
</table>
</div>
<div class="comments <?=$ot->comment_interior ? '' : 'd-none' ?>">
<div class="flex-row impresion"><?= lang('Produccion.comentariosImpresionInterior') ?></div>
<div class=" w-100">
<p>
<?= $ot->comment_interior ?>
</p>
</div>
</div>
</div>
</div>
<?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><?= $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 <?=$ot->comment_cubierta ? '' : 'd-none' ?>">
<div class="flex-row cubierta"><?= lang('Produccion.comentariosCubierta') ?></div>
<div class="">
<p>
<?= $ot->comment_cubierta ?>
</p>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="row">
<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>
<?php foreach ($acabados as $key => $acabado): ?>
<tr>
<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>
<tr>
<td class="text-start" colspan="2"><?=$ot->info_solapa_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 <?=$ot->comment_encuadernacion ? '' : 'd-none' ?>" >
<div class="flex-row encuadernacion"><?= lang('Produccion.comentariosEncuadernacion') ?></div>
<div class="">
<p>
<?= $ot->comment_encuadernacion ?>
</p>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="row mb-2">
<div class="section-title">LOGISTICA</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>
<th>Peso Unidad</th>
<th>Peso Pedido</th>
<th>Cajas</th>
<th>Corte Pie</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>
<td><?= number_format($peso_unidad, 2, ',', '.') ?> gr</td>
<td><?= $peso_pedido > 1000 ? number_format($peso_pedido / 1000, 2, ',', '.') . " kg" : number_format($peso_pedido, 2, ',', '.') . " gr" ?> </td>
<td>-</td>
<td>-</td>
</tr>
</table>
<div class="comments">
<div class="flex-row cubierta">Comentarios cubierta</div>
<div class="comment-content">
<div class="comments <?=$ot->comment_logistica ? '' : 'd-none' ?>">
<div class="flex-row logistica"><?= lang('Produccion.comentariosLogistica') ?></div>
<div class="">
<p>
<?= $ot->comment_logistica ?>
</p>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="row mb-2">
<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>
<?php foreach ($acabados as $key => $acabado): ?>
<tr>
<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>
<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">
<div class="flex-row encuadernacion">Comentarios encuadernacion:</div>
<div class="comment-content">
<p>
</p>
</div>
</div>
<?php endif; ?>
<div class="col-md-12 d-flex justify-content-center align-items-center">
<span class="footer">&copy; 2024 SAFEKAT. Todos los derechos reservados.</span>
</div>
</div>
<div class="row mb-2">
<div class="section-title">LOGISTICA</div>
<div class="col-12">
<table>
<tr>
<th>Peso Unidad</th>
<th>Peso Pedido</th>
<th>Cajas</th>
<th>Corte Pie</th>
</tr>
<tr>
<td><?= number_format($peso_unidad, 2, ',', '.') ?> gr</td>
<td><?= $peso_pedido > 1000 ? number_format($peso_pedido / 1000, 2, ',', '.') . " kg" : number_format($peso_pedido, 2, ',', '.') . " gr" ?> </td>
<td>-</td>
<td>-</td>
</tr>
</table>
<div class="comments">
<div class="flex-row">Comentarios logistica:</div>
<div class="comment-content">
<p>
</p>
</div>
</div>
</div>
</div>
<div class="col-md-12 d-flex justify-content-center align-items-center">
<span class="footer">&copy; 2024 SAFEKAT. Todos los derechos reservados.</span>
</div>
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/bootstrap.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/hammer/hammer.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/menu.js') ?>"></script>
<script src="<?= site_url('assets/js/safekat/pages/pdf/otDownload.js') ?>"></script>
</div>
</body>
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/bootstrap.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/hammer/hammer.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/menu.js') ?>"></script>
<script src="<?= site_url('assets/js/safekat/pages/pdf/otDownload.js') ?>"></script>
</html>

View File

@ -0,0 +1,410 @@
<?php
use CodeIgniter\I18n\Time;
$session = session();
$settings = $session->get('settings');
?>
<!DOCTYPE html>
<html
lang="<?= $session->get('lang') ?>"
data-assets-path="<?= site_url('themes/vuexy/') ?>"
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Icons -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/fonts/fontawesome.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/fonts/tabler-icons.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/fonts/flag-icons.css') ?>" />
<!-- Core CSS -->
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/core.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/rtl/theme-semi-dark.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.css') ?>" />
<link rel="icon" type="image/x-icon" href="<?= site_url('themes/vuexy/img/favicon/favicon.ico') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/pdf.ot.css') ?>">
<title><?= $presupuesto->titulo ?>[OT:<?= $ot->id ?>]</title>
</head>
<body>
<div class="col-md-12 pdf-wrapper" data-id="<?= $ot->id . "_PROTOTIPO_" . "_" . $presupuesto->id . "_" . $presupuesto->titulo ?>">
<div class="row">
<div class="col-12 d-flex justify-content-between align-items-center">
<h5><?= $presupuesto->titulo ?></h5>
<span class="fs-medium"><strong><?= Time::now()->format("d/m/Y H:i:s") ?></strong></span>
</div>
</div>
</div>
<div class="row mb-2 d-flex flex align-items-stretch">
<div class="col-2">
<?php if ($ot->full_path): ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->full_path ? "data:image/png;base64," . base64_encode(file_get_contents($ot->full_path)) : '/assets/img/portada_not_found.png' ?>" />
<?php else: ?>
<img class="portada-img border-secondary img-thumbnail img-fluid" src="/assets/img/portada_not_found.png" />
<?php endif; ?>
</div>
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
<div class="row">
<div class="col-8">
<div class="px-2 d-flex flex justify-content-between align-items-center" style="background-color: <?= $colors["week_day"]["bg"] ?>;color:<?= $colors["week_day"]["color"] ?>;">
<span><strong><?= $pedido->fecha_encuadernado ? week_day_humanize(Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->getDayOfWeek() - 1, true) : "" ?></strong></span>
<span><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </span>
</div>
</div>
<div class="col-4">
<div class="px-2 d-flex flex justify-content-center align-items-center w-100">
<span class="w-100 text-center" style="background-color: <?= $colors["impresion_interior_ppal"]["bg"] ?>;color:<?= $colors["impresion_interior_ppal"]["color"] ?>;">
<?php if ($isPOD): ?>
<strong>POD</strong>
<?php elseif ($presupuesto->presupuestoLineaImpresion()->isRotativa()): ?>
<strong>ROTATIVA</strong>
<?php else: ?>
<strong>GENERAL</strong>
<?php endif; ?>
</span>
</div>
</div>
</div>
<div class="row p-2">
<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>
</div>
</div>
<div class="row px-2 mt-2 h-100">
<table class="h-100 bg-white">
<tr>
<th class="bg-white">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>PORT.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ACABAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>ENCUAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr>
<th>MANIPUL.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
</table>
</div>
</div>
<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><?= $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 ?>
</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 ?>
</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 : "" ?>
</div>
<?php foreach ($acabados as $key => $acabado): ?>
<?php if ($acabado->tarifa()->isUVI()): ?>
<div class="col-6 square offset-md-6 text-center" style="background-color:<?= $acabado->tarifa()->code == "R2D" ? "#4D93D9" : "#0070C0" ?>;color:white;">
+ <?= $acabado->tarifa()->code ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="col-4" style="background-color: <?= $colors["ot"]["bg"] ?>">
<div class="row h-100">
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center">
<span class="fs-large" style="color:<?= $colors["ot"]["color"] ?>;"><strong><?= $ot->id ?></strong></span>
</div>
<div class="col-12 h-50 d-flex flex align-items-center justify-content-center bg-white">
<img class="img-fluid" src="data:image/png;base64,<?= $ot->bar_code ?>" alt="barcode" />
</div>
</div>
</div>
</div>
</div>
</div>
<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">
<?= $cliente->alias ?>
</td>
</tr>
<tr>
<th>TITULO</th>
<td class="t-cell">
<?= $presupuesto->titulo ?>
</td>
</tr>
<tr>
<th>ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr>
<tr>
<th>PEDIDO CLIENTE</th>
<td class="t-cell"><?= $pedido->id ?></td>
</tr>
</table>
</div>
<div class="col-4">
<div class="col-12 d-flex justify-content-center" style="width: 100%">
<?php if ($imposicion): ?>
<?php if ($imposicion->imposicion_esquema()): ?>
<?= $imposicion->imposicion_esquema()->svg_schema ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="col-12">
<div class="imposicion">
<table>
<tr>
<th class="w-50">Imposicion</th>
<td><?= $imposicion?->full_name ?? "" ?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="row mb-2">
<div class="section-title impresion">IMP. INTERIOR</div>
<div class="col-12">
<div>
<table>
<tr>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.size') ?></th>
<td class="t-cell text-center"> <?= $papel_formato->ancho ?>x<?= $papel_formato->alto ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.ejemplares') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tirada/$presupuesto->tirada ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.tipo') ?></th>
<td class="t-cell text-center"> <?= $presupuesto->tipo_presupuesto()?->codigo ?? "" ?> </td>
<th class="t-header" style="width: 10%;"><?= lang('Produccion.lomo') ?></th>
<td class="t-cell text-center"> <?= number_format($presupuesto->lomo_cubierta, 2, ',', '.') ?> </td>
</tr>
</table>
<table>
<tr>
<td rowspan="3" class="row-logo-impresion"><img src="<?= site_url($linea_impresion->get_impresion_logo()) ?>" width="35px" height="35px"></td>
<th>Páginas</th>
<th>Ejemplares</th>
<th>Tintas</th>
<th>Formas</th>
<th>Máquina</th>
<th>Clics</th>
<th>Tiempo</th>
</tr>
<tr>
<td><?= $presupuesto->paginas ?></td> <!-- Páginas libro -->
<td><?= $presupuesto->tirada / $presupuesto->tirada ?> </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_libro ?></td>
<td><?= float_seconds_to_hhmm_string($linea_impresion->horas_maquina * 3600 / $presupuesto->tirada) ?></td>
</tr>
<tr>
<td colspan="4"><?= $linea_impresion->papel_impresion ?></td>
<td><?= $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?></td>
<td colspan="2">
<?php if ($linea_impresion->isRotativa()): ?>
<?= number_format($linea_impresion->rotativa_metros_libro, 2, ',', '.') ?> metros
<?php endif; ?>
</td>
</tr>
</table>
</div>
<div class="comments <?=$ot->comment_interior ? '' : 'd-none' ?>">
<div class="flex-row impresion"><?= lang('Produccion.comentariosImpresionInterior') ?></div>
<div class="comment-content w-100">
<p>
<?= $ot->comment_interior ?>
</p>
</div>
</div>
</div>
</div>
<?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><?= $linea_cubierta->tinta() ?></td>
<td><?= $presupuesto->tirada/$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/$presupuesto->tirada) ?></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 <?=$ot->comment_cubierta ? '' : 'd-none' ?>">
<div class="flex-row cubierta"><?= lang('Produccion.comentariosCubierta') ?></div>
<div class="comment-content">
<p>
<?= $ot->comment_cubierta ?>
</p>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="row mb-2">
<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>
<?php foreach ($acabados as $key => $acabado): ?>
<tr>
<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>
<tr>
<td class="text-start" colspan="2"><?=$ot->info_solapa_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 <?=$ot->comment_encuadernacion ? '' : 'd-none' ?>">
<div class="flex-row encuadernacion"><?= lang('Produccion.comentariosEncuadernacion') ?></div>
<div class="comment-content">
<p>
<?= $ot->comment_encuadernacion ?>
</p>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="row mb-2">
<div class="section-title">LOGISTICA</div>
<div class="col-12">
<table>
<tr>
<th>Peso Unidad</th>
<th>Peso Pedido</th>
<th>Corte Pie</th>
</tr>
<tr>
<td><?= number_format($peso_unidad, 2, ',', '.') ?> gr</td>
<td><?= $peso_unidad > 1000 ? number_format($peso_unidad / 1000, 2, ',', '.') . " kg" : number_format($peso_unidad, 2, ',', '.') . " gr" ?> </td>
<td>-</td>
</tr>
</table>
<div class="comments">
<div class="flex-row logistica"><?= lang('Produccion.comentariosLogistica') ?></div>
<div class="comment-content">
<p>
<?= $ot->comment_logistica ?>
</p>
</div>
</div>
</div>
</div>
<div class="col-md-12 d-flex justify-content-center align-items-center">
<span class="footer">&copy; 2024 SAFEKAT. Todos los derechos reservados.</span>
</div>
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/bootstrap.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/flatpickr/flatpickr.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/hammer/hammer.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/js/menu.js') ?>"></script>
<script src="<?= site_url('assets/js/safekat/pages/pdf/otDownload.js') ?>"></script>
</body>
</html>

View File

@ -6,6 +6,12 @@ class OrdenTrabajoDatatable {
this.datatablePendientesItem = this.item.find("#ot-datatable-pendientes")
this.datatableFerroPendienteItem = this.item.find("#ot-datatable-ferro-pendiente")
this.datatableFerroOkItem = this.item.find("#ot-datatable-ferro-ok")
this.datatableNews = this.item.find("#ot-datatable-news")
this.datatableProd = this.item.find("#ot-datatable-prod")
this.datatableWaiting = this.item.find("#ot-datatable-waiting")
this.datatableRevisionComerical = this.item.find("#ot-datatable-revision-com")
this.datatableColumns = [
@ -37,15 +43,15 @@ class OrdenTrabajoDatatable {
render: (d, t) => {
return `<div class="btn-group btn-group-sm">
<a type="button" href="/produccion/ordentrabajo/edit/${d}" class=" btn btn-outline ot-edit"><i class="ti ti-eye ti-sm mx-2"></i></a>
<a type="button" target="_blank" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
</div>`
}
// <a type="button" target="_blank" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
}
]
}
init() {
this.datatable = this.datatableItem.DataTable({
this.datatableItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -71,7 +77,7 @@ class OrdenTrabajoDatatable {
});
}
initPendientes() {
this.datatable = this.datatablePendientesItem.DataTable({
this.datatablePendientesItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -98,7 +104,7 @@ class OrdenTrabajoDatatable {
});
}
initFerroPendiente() {
this.datatable = this.datatableFerroPendienteItem.DataTable({
this.datatableFerroPendienteItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -124,7 +130,7 @@ class OrdenTrabajoDatatable {
});
}
initFerroOk() {
this.datatable = this.datatableFerroOkItem.DataTable({
this.datatableFerroOkItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -149,6 +155,110 @@ class OrdenTrabajoDatatable {
}
});
}
initNews() {
this.datatableNews.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_news',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
initWaiting() {
this.datatableWaiting.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_waiting',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
initProd() {
this.datatableProd.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_prod',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
initRevisionComercial() {
this.datatableRevisionComerical.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_revision_com',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
}

View File

@ -11,9 +11,9 @@ class MaquinistaTareaList {
{ data: 'otId', searchable: false, sortable: false },
{ data: 'tareaName', searchable: false, sortable: false },
{ data: 'tareaEstado', searchable: false, sortable: false,render : this.renderStado.bind(this)},
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
{ data: 'papel_impresion', searchable: false, sortable: false },
{ data: 'papel_gramaje', searchable: false, sortable: false },
// { data: 'presupuesto_titulo', searchable: false, sortable: false },
// { data: 'papel_impresion', searchable: false, sortable: false },
// { data: 'papel_gramaje', searchable: false, sortable: false },
{ data: 'fecha_impresion', searchable: false, sortable: false },
{ data: 'action', searchable: false, sortable: false, width: "20rem" },
]

View File

@ -1,6 +1,6 @@
import Ajax from '../../../components/ajax.js'
import { alertConfirmAction } from '../../../components/alerts/sweetAlert.js'
import { alertConfirmAction, alertError, alertSuccess } from '../../../components/alerts/sweetAlert.js'
class MaquinistaTareaView {
constructor(domItem) {
this.item = domItem
@ -53,6 +53,8 @@ class MaquinistaTareaView {
}
disableButtons() {
this.actionButtons.attr('disabled', 'disabled')
this.btnDelay.attr('disabled','disabled')
this.btnDeleteProgress.attr('disabled','disabled')
}
enableButtons() {
this.actionButtons.removeAttr('disabled')
@ -84,7 +86,7 @@ class MaquinistaTareaView {
handleUpdateClickInputError(error) {
popErrorAlert(error)
}
updateContentClick(clicks){
updateContentClick(clicks) {
this.item.find('#clicks-info').empty().html(clicks)
}
handleDeleteTareaProgress() {
@ -126,9 +128,7 @@ class MaquinistaTareaView {
console.log("Last status :", lastStatus)
this.showBasedOnStatus(lastStatus)
}
if (response.tiempo_trabajado) {
this.item.find('#tiempo-real-info').html(response.tiempo_trabajado)
}
this.item.find('#tiempo-real-info').html(response.tiempo_trabajado ?? "00:00")
this.actionLoader(false)
}
@ -146,20 +146,32 @@ class MaquinistaTareaView {
this.handleUpdateTareaProgressError.bind(this),
)
if (this.tareaId) {
ajax.post();
if(status == "F"){
alertConfirmAction('La tarea se marcará como finalizada')
.then(result => {
if (result.isConfirmed) {
ajax.post();
}
})
}else{
ajax.post();
}
}
}
handleUpdateTareaProgressSuccess(response) {
if (response.data) {
if (response.data.estado == 'D') {
if (response.data.tarea) {
if (response.data.tarea.estado == 'D') {
window.location.href = '/produccion/ordentrabajo/maquinista/maquinas/view'
}
this.showBasedOnStatus(response.data.status)
this.item.find('#tiempo-real-info').html(response.data.tiempo_trabajado ?? "00:00")
this.showBasedOnStatus(response.data.estado)
alertSuccess(response.message, null, { position: 'top' }).fire()
}
this.actionLoader(false)
}
handleUpdateTareaProgressError(error) {
popErrorAlert(error.error)
alertError(error.error, null, { position: 'top' }).fire()
this.actionLoader(false)
}

View File

@ -0,0 +1,344 @@
document.addEventListener('DOMContentLoaded', function () {
let dataTable;
let productosOriginales = [];
let datosComunesPedido = {};
document.getElementById('xmlFile').addEventListener('change', function (e) {
const file = e.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function (event) {
const xmlText = event.target.result;
parseXmlAndLoadTable(xmlText);
};
reader.readAsText(file);
});
function parseXmlAndLoadTable(xmlText) {
let parser = new DOMParser();
let xmlDoc;
try {
xmlDoc = parser.parseFromString(xmlText, 'application/xml');
if (xmlDoc.getElementsByTagName('parsererror').length > 0) throw new Error('XML inválido');
} catch (e) {
Swal.fire('Error', 'No se pudo leer el XML.', 'error');
return;
}
datosComunesPedido = {
orderNumber: xmlDoc.querySelector('orderNumber')?.textContent ?? '',
shipping: {
address: xmlDoc.querySelector('shippingData > address')?.textContent ?? '',
city: xmlDoc.querySelector('shippingData > city')?.textContent ?? '',
country: xmlDoc.querySelector('shippingData > country')?.textContent ?? '',
postalCode: xmlDoc.querySelector('shippingData > postalCode')?.textContent ?? '',
name: xmlDoc.querySelector('shippingData > name')?.textContent ?? '',
phone: xmlDoc.querySelector('shippingData > phone')?.textContent ?? ''
},
labelUrl: xmlDoc.querySelector('urlPdfSeur')?.textContent ?? ''
};
const products = Array.from(xmlDoc.getElementsByTagName('product'));
productosOriginales = products.map((prod, idx) => ({ index: idx, data: prod }));
const rows = products.map((product, index) => {
const id = product.querySelector('id')?.textContent ?? '';
const title = product.querySelector('title')?.textContent ?? '';
const pages = product.querySelector('body > pages')?.textContent ?? '';
const tirada = product.querySelector('amount')?.textContent ?? '';
let interior = 'Desconocido';
const colorNode = product.querySelector('body > color');
if (colorNode) {
const monochrome = colorNode.querySelector('Monochrome')?.textContent ?? '0';
const cmyk = colorNode.querySelector('CMYK')?.textContent ?? '0';
const semicolor = colorNode.querySelector('Semicolor')?.textContent ?? '0';
if (monochrome === '1') interior = 'Negro';
else if (cmyk === '1') interior = 'Color';
else if (semicolor === '1') interior = 'Semicolor';
}
let tamano = 'Desconocido';
const sizeTags = product.querySelectorAll('size > *');
sizeTags.forEach(tag => {
if (tag.textContent === '1') {
tamano = tag.tagName.replace(/^size/, '');
}
});
return [
`<input type="checkbox" class="form-check-input select-row" checked>`,
`${datosComunesPedido.orderNumber} - ${id}`,
title,
tamano,
pages,
tirada,
interior,
'',
`<button type="button" class="btn btn-sm btn-outline-success importRow">Importar</button>
<button type="button" class="btn btn-sm btn-outline-danger deleteRow">Eliminar</button>`
];
});
if (!$.fn.DataTable.isDataTable('#xmlTable')) {
const headerHtml = `
<thead>
<tr>
<th><input type="checkbox" id="selectAll" /></th>
<th>Referencia</th>
<th>Título</th>
<th>Tamaño</th>
<th>Páginas</th>
<th>Tirada</th>
<th>Interior</th>
<th>Notas</th>
<th>Acciones</th>
</tr>
<tr>
<th></th><th></th><th></th><th></th><th></th>
<th></th><th></th><th></th><th></th>
</tr>
</thead>`;
$('#xmlTable').html(headerHtml);
}
dataTable = $('#xmlTable').DataTable({
destroy: true,
data: rows,
orderCellsTop: true,
responsive: true,
scrollX: true,
dom: 'lfrtip',
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
order: [[1, 'asc']]
});
$('#xmlTable thead tr:eq(1) th').each(function (i) {
if (![0, 7, 8].includes(i)) {
$(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();
}
});
}
});
setupEventListeners();
}
function setupEventListeners() {
$('#xmlTable tbody').off('click', '.deleteRow').on('click', '.deleteRow', function () {
dataTable.row($(this).parents('tr')).remove().draw();
});
$('#xmlTable tbody').off('click', '.importRow').on('click', '.importRow', async function () {
const $row = $(this).closest('tr');
const rowIndex = dataTable.row($row).index();
const xmlProduct = productosOriginales.find(p => p.index === rowIndex)?.data;
if (!xmlProduct) return;
try {
const response = await fetch('/importador/bubok/importar-fila', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '<?= csrf_hash() ?>'
},
body: JSON.stringify({
producto: xmlToJson(xmlProduct),
pedido: datosComunesPedido
})
});
const result = await response.json();
const rowData = dataTable.row($row).data();
if (response.ok && result.status === 200) {
const skUrl = result.data?.sk_url?.replace('presupuestocliente', 'presupuestoadmin') ?? null;
const htmlLink = skUrl
? `<a href="${skUrl}" target="_blank" class="btn btn-sm btn-primary">Ver presupuesto</a>`
: 'Importado';
rowData[7] = htmlLink;
dataTable.row($row).data(rowData).draw(false);
Swal.fire({
title: 'Importado correctamente',
html: skUrl
? `Se importó correctamente.<br><a href="${skUrl}" target="_blank" class="btn btn-primary mt-2">Ver presupuesto</a>`
: 'Importación realizada.',
icon: 'success',
confirmButtonText: 'Aceptar',
customClass: { confirmButton: 'btn btn-success' }
});
} else {
rowData[7] = `<span class="badge bg-danger">${result.message ?? 'Error inesperado'}</span>`;
dataTable.row($row).data(rowData).draw(false);
Swal.fire({
title: 'Error',
text: result.message ?? 'Hubo un error al importar esta fila.',
icon: 'error',
confirmButtonText: 'Aceptar',
customClass: { confirmButton: 'btn btn-danger' }
});
}
dataTable.row($row).data(rowData).draw(false);
} catch (err) {
console.error(err);
Swal.fire('Error', 'Error de comunicación con el servidor.', 'error');
}
});
$('#selectAll').off('change').on('change', function () {
const checked = $(this).is(':checked');
$('#xmlTable tbody input.select-row:enabled').prop('checked', checked);
});
}
function xmlToJson(xmlNode) {
// Si es nodo de texto
if (xmlNode.nodeType === 3) {
return xmlNode.nodeValue.trim();
}
let obj = {};
// Procesar atributos si existen
if (xmlNode.attributes && xmlNode.attributes.length > 0) {
for (let attr of xmlNode.attributes) {
obj[`@${attr.name}`] = attr.value;
}
}
// Procesar hijos
if (xmlNode.hasChildNodes()) {
const children = Array.from(xmlNode.childNodes).filter(n => n.nodeType !== 8); // ignorar comentarios
// Si el único hijo es texto, devolver como string
if (children.length === 1 && children[0].nodeType === 3) {
return children[0].nodeValue.trim();
}
// Procesar nodos hijos normalmente
children.forEach(child => {
const name = child.nodeName;
const value = xmlToJson(child);
if (obj[name]) {
if (!Array.isArray(obj[name])) {
obj[name] = [obj[name]];
}
obj[name].push(value);
} else {
obj[name] = value;
}
});
}
return obj;
}
document.getElementById('importBtn').addEventListener('click', async function () {
if (!dataTable || dataTable.rows().count() === 0) {
Swal.fire({
title: 'Atención',
text: 'Primero debes cargar un archivo XML válido.',
icon: 'warning',
confirmButtonText: 'Aceptar',
customClass: { confirmButton: 'btn btn-warning' }
});
return;
}
const filasSeleccionadas = [];
dataTable.rows().every(function () {
const node = this.node();
const checkbox = $(node).find('input.select-row');
if (checkbox.length > 0 && checkbox.is(':checked') && !checkbox.is(':disabled')) {
filasSeleccionadas.push(this.index());
}
});
if (filasSeleccionadas.length === 0) {
Swal.fire({
title: 'Atención',
text: 'No hay filas seleccionadas.',
icon: 'warning',
confirmButtonText: 'Aceptar',
customClass: { confirmButton: 'btn btn-warning' }
});
return;
}
Swal.fire({
title: '¿Importar seleccionados?',
text: `Se van a importar ${filasSeleccionadas.length} filas.`,
icon: 'question',
showCancelButton: true,
confirmButtonText: 'Sí, importar',
cancelButtonText: 'Cancelar',
reverseButtons: true,
customClass: {
confirmButton: 'btn btn-primary',
cancelButton: 'btn btn-secondary'
}
}).then(async (result) => {
if (!result.isConfirmed) return;
for (const i of filasSeleccionadas) {
const productXml = productosOriginales.find(p => p.index === i)?.data;
if (!productXml) continue;
try {
const response = await fetch('/importador/bubok/importar-fila', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '<?= csrf_hash() ?>'
},
body: JSON.stringify({
producto: xmlToJson(productXml),
pedido: datosComunesPedido
})
});
const result = await response.json();
const rowNode = dataTable.row(i).node();
const rowData = dataTable.row(i).data();
if (response.ok && result.status === 200) {
const skUrl = result.data?.sk_url?.replace('presupuestocliente', 'presupuestoadmin') ?? null;
rowData[7] = skUrl
? `<a href="${skUrl}" target="_blank" class="btn btn-sm btn-primary">Ver presupuesto</a>`
: '<span class="badge bg-success">Importado</span>';
} else {
rowData[7] = `<span class="badge bg-danger">${result.message ?? 'Error desconocido'}</span>`;
}
dataTable.row(rowNode).data(rowData).draw(false);
} catch (error) {
console.error('Importación fallida:', error);
}
}
Swal.fire({
title: 'Importación finalizada',
text: 'Se han procesado todas las filas seleccionadas.',
icon: 'success',
confirmButtonText: 'Aceptar',
customClass: { confirmButton: 'btn btn-success' }
});
});
});
});

View File

@ -169,12 +169,21 @@ document.addEventListener('DOMContentLoaded', function () {
dataTable.row($row).data(rowData).draw(false); // Redibujar la fila SIN perder scroll ni filtros
}
let 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.';
let icon = 'success';
if (result.price_warning) {
html = skUrl ? `La fila se importó exitosamente, pero el precio se ha ajustado debajo de costes.<br><br><a href="${skUrl}" target="_blank" class="btn btn-primary mt-2">Ver presupuesto</a>`
: 'La fila se importó exitosamente, pero el precio se ha ajustado debajo de costes.';
icon = 'warning';
}
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',
html: html,
icon: icon,
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-success' }
@ -252,6 +261,9 @@ document.addEventListener('DOMContentLoaded', function () {
}).then(async (result) => {
if (!result.isConfirmed) return;
// array para contener los IDs que no se han podido ajustar
let idsNoAjustados = [];
for (const fila of filasAptas) {
try {
const response = await fetch('/importador/catalogo/importar-fila', {
@ -268,6 +280,10 @@ document.addEventListener('DOMContentLoaded', function () {
if (response.ok && result.status === 200) {
const skUrl = result.data?.sk_url?.replace('presupuestocliente', 'presupuestoadmin') ?? null;
if (result.price_warning) {
idsNoAjustados.push(result.data.sk_id);
}
if (skUrl) {
fila.rowData[6] = `<a href="${skUrl}" target="_blank" class="btn btn-sm btn-primary">Ver presupuesto</a>`;
} else {
@ -286,10 +302,16 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
let text = 'Se han procesado todas las filas seleccionadas.';
let icon = 'success';
if (idsNoAjustados.length > 0) {
text = 'Se han procesado todas las filas seleccionadas, pero se han ajustado los siguientes presupuestos por debajo de costes: ' + idsNoAjustados.join(', ');
icon = 'warning';
}
Swal.fire({
title: 'Importación finalizada',
text: 'Se han procesado todas las filas seleccionadas.',
icon: 'success',
text: text,
icon: icon,
confirmButtonText: 'Aceptar',
buttonsStyling: true,
customClass: { confirmButton: 'btn btn-success' }

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

@ -1540,6 +1540,12 @@ class LineasPresupuesto {
cliente_id: $('#clienteId').find(":selected").val(),
};
if($('#alert-datosLibro').html().includes(window.language.Presupuestos.validation.no_lp_for_merma) &&
(uso == 'interior' || uso == 'interior_rot')){
datos.calcular_merma = 1;
}
if (datos.ancho == 0 || datos.alto == 0 || datos.ancho == '' || datos.alto == '' || isNaN(datos.ancho) || isNaN(datos.alto)) {
return;
}

View File

@ -20,7 +20,12 @@ class Resumen {
});
$('#total_descuentoPercent').on('change', function () {
this.updateTotales({ updateLP: false, updateServicios: false, updateEnvio: false }, false);
let autoTotalAceptado = AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]);
let total_aceptado_revisado = autoTotalAceptado.getNumber();
if(total_aceptado_revisado && total_aceptado_revisado != 0)
this.updateTotales({ updateLP: false, updateServicios: false, updateEnvio: false }, true);
else
this.updateTotales({ updateLP: false, updateServicios: false, updateEnvio: false }, false);
}.bind(this));
$("#totalDespuesDecuento").on('change', this.updateToastSummary.bind(this))
@ -354,7 +359,7 @@ class Resumen {
$('#total_descuentoPercent').val(0)
}
let totalAntesDescuento = totalCostes + totalMargenes + totalEnvios_base;
let totalDescuento = totalAntesDescuento * parseInt($('#total_descuentoPercent').val() || 0) / 100
let totalDescuento = totalAntesDescuento * parseFloat($('#total_descuentoPercent').val() || 0) / 100
let totalPresupuesto = totalAntesDescuento - totalDescuento; // para el calculo del precio_u solo se tiene en cuenta el base
let precioUnidad = totalPresupuesto / parseInt($('#tirada').val())

View File

@ -1,9 +1,13 @@
import OrdenTrabajoDatatable from '../../components/datatables/otDatatable.js'
$(function() {
$(function () {
const otDatatable = new OrdenTrabajoDatatable($("#ots-datatables-container"))
otDatatable.init()
otDatatable.initPendientes()
otDatatable.initFerroPendiente()
otDatatable.initFerroOk()
otDatatable.initNews()
otDatatable.initProd()
otDatatable.initWaiting()
// otDatatable.initRevisionComercial()
})

View File

@ -21,22 +21,43 @@ class OrdenTrabajo {
this.btnErasePedidoDate = this.item.find('.btn-erase-pedido-date');
this.isOtFinalizada = false;
this.tiempoTotal = this.item.find('#tiempo-total')
this.tiempoEstimado = this.item.find('#tiempo-estimado')
this.btnResetTareas = this.item.find("#btn-reset-tareas")
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
this.pedidoEnEsperaBy = this.item.find("#pedido_espera_by");
this.otEstado = this.item.find("#ot-estado");
this.datatableColumns = [
{ data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this), width: "10%" },
{ data: 'nombre', searchable: true, sortable: true, width: "20%" },
{ data: 'maquina_presupuesto_linea', searchable: true, sortable: true, width: "20%" },
{ data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "20%" },
{ data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this) },
{ data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this) },
{ data: 'nombre', searchable: true, sortable: true },
{
data: 'maquina_presupuesto_linea', searchable: true, sortable: true, render: (d) => {
if (d) {
return `
<div class="btn-group dropstart">
<button class="btn btn-primary btn-xs dropdown-toggle" type="button" data-bs-toggle="dropdown">
<i class="ti ti-printer ti-xs"></i>
</button>
<ul class="dropdown-menu">
<li> <a class="dropdown-item" href="javascript:void(0);">${d}</a> </li>
</ul>
</div>
`
} else {
return "";
}
}
},
{ data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "10%" },
{ data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this), width: "10%" },
{ data: 'proveedor', searchable: false, sortable: false, render: this._renderProveedorSelectTable.bind(this), width: "10%" },
{ data: 'tiempo_estimado', searchable: false, sortable: false },
{ data: 'tiempo_real', searchable: false, sortable: false },
{
data: 'action', searchable: false, sortable: false, width: "10%", render: this._renderActionCell.bind(this)
data: 'action', searchable: false, sortable: false, width: "5%", render: this._renderActionCell.bind(this)
},
]
@ -76,27 +97,40 @@ class OrdenTrabajo {
this.pendienteFerro = new DatePicker(this.otForm.find("#ot-pendiente-ferro"), option)
this.ferroCliente = new DatePicker(this.otForm.find("#ot-ferro-cliente"), option)
this.ferroOk = new DatePicker(this.otForm.find("#ot-ferro-ok"), option)
this.plakeneTraslucido = new DatePicker(this.otForm.find("#ot-plakene-traslucido"), option)
// this.plakeneTraslucido = new DatePicker(this.otForm.find("#ot-plakene-traslucido"), option)
this.impresionColor = new DatePicker(this.otForm.find("#ot-impresion-color"), option)
this.impresionBN = new DatePicker(this.otForm.find("#ot-impresion-bn"), option)
this.cubierta = new DatePicker(this.otForm.find("#ot-cubierta"), option)
this.sobrecubierta = new DatePicker(this.otForm.find("#ot-sobrecubierta"), option)
this.guarda = new DatePicker(this.otForm.find("#ot-guarda"), option)
this.portada = new DatePicker(this.otForm.find("#ot-portada"), option)
this.plastificadoMate = new DatePicker(this.otForm.find("#ot-plastificado-mate"), option)
this.plastificado = new DatePicker(this.otForm.find("#ot-plastificado"), option)
this.plakene = new DatePicker(this.otForm.find("#ot-plakene"), option)
this.retractilado = new DatePicker(this.otForm.find("#ot-retractilado"), option)
this.estampado = new DatePicker(this.otForm.find("#ot-estampado"), option)
this.uvi = new DatePicker(this.otForm.find("#ot-uvi"), option)
this.encuadernacion = new DatePicker(this.otForm.find("#ot-encuadernacion"), option)
this.entradaManipulado = new DatePicker(this.otForm.find("#ot-manipulado"), option)
this.prepGuillotina = new DatePicker(this.otForm.find("#ot-prep-guillotina"), option)
this.prepCosido = new DatePicker(this.otForm.find("#ot-prep-cosido"), option)
this.prepGrapado = new DatePicker(this.otForm.find("#ot-prep-grapado"), option)
this.prepSolapa = new DatePicker(this.otForm.find("#ot-prep-solapa"), option)
this.prepPrototipo = new DatePicker(this.otForm.find("#ot-prep-prototipo"), option)
// this.prepPrototipo = new DatePicker(this.otForm.find("#ot-prep-prototipo"), option)
this.prepMarcapaginas = new DatePicker(this.otForm.find("#ot-prep-marcapaginas"), option)
this.prepRetractilado = new DatePicker(this.otForm.find("#ot-prep-retractilado"), option)
this.prepRetractilado5 = new DatePicker(this.otForm.find("#ot-prep-retractilado5"), option)
this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option)
// this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option)
this.embalaje = new DatePicker(this.otForm.find("#ot-embalaje"), option)
this.envio = new DatePicker(this.otForm.find("#ot-envio"), option)
@ -115,6 +149,7 @@ class OrdenTrabajo {
}
eventTareas() {
this.otForm.on("change", ".select-maquina-tarea-datatable", this.handleTareaChange.bind(this))
this.otForm.on("change", ".select-proveedor-tarea-datatable", this.handleUpdateProveedor.bind(this))
this.otForm.on("change", ".orden-tarea", this.handleTareaChange.bind(this))
this.otForm.on("change", ".select-imposicion-tarea-datatable", this.handleTareaChange.bind(this))
this.otForm.on("click", ".increase-order", (event) => {
@ -133,6 +168,7 @@ class OrdenTrabajo {
unbindEventTareas() {
this.otForm.off("change", ".select-maquina-tarea-datatable")
this.otForm.off("change", ".select-imposicion-tarea-datatable")
this.otForm.off("change", ".select-proveedor-tarea-datatable")
this.otForm.off("change", ".orden-tarea")
this.otForm.off("click", ".increase-order")
this.otForm.off("click", ".decrease-order")
@ -153,7 +189,7 @@ class OrdenTrabajo {
this.item.on("click", "#btn-reset-tareas", this.handleResetTareasDeleteConfirmation.bind(this))
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
$("#btn-update-tarea-comment").on("click", this.handleTareaNoteSubmit.bind(this))
this.otForm.on("change", "#ot-comment", this.handleOtComment.bind(this))
this.otForm.on("change", ".ot-comment", this.handleOtComment.bind(this))
$("#btn-update-pliegos").on('click', this.handleUpdatePliegos.bind(this))
this._handleGetData()
@ -208,6 +244,16 @@ class OrdenTrabajo {
return render
}
_renderProveedorSelectTable(d, t) {
if (d.proveedor) {
let render = `<select id="select-proveedor-tarea-${d.tarea.id}" data-proveedor-id="${d.proveedor.id}" data-proveedor-tipo="${d.proveedor.tipo_id}" data-id="${d.tarea.id}" name="proveedor_id" class="select2 form-select select-proveedor-tarea-datatable" ${this.isOtFinalizada ? "disabled" : ""}>
<option value="${d.proveedor.id}" selected="selected">${d.proveedor.nombre ?? ''}</option>
</select>`
return render
} else {
return "";
}
}
_renderActionCell(d, t) {
let cell = `<div class="d-flex justify-content-start align-items-center gap-1">
@ -222,7 +268,7 @@ class OrdenTrabajo {
return `
<div class="d-flex justify-content-between aling-items-center gap-2 orden-tarea-cell">
<input type="text" style="min-width:5rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}" ${this.isOtFinalizada ? "disabled" : ""}>
<input type="text" style="min-width:2rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}" ${this.isOtFinalizada ? "disabled" : ""}>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary btn-outlined btn-xs increase-order"><i class="ti ti-chevron-up ti-xs"></i></button>
<button type="button" class="btn btn-primary btn-xs decrease-order" data-id="${d.id}"><i class="ti ti-chevron-down ti-xs"></i></button>
@ -232,6 +278,9 @@ class OrdenTrabajo {
}
createSelectMaquinaTarea() {
try {
$('.select-proveedor-tarea-datatable').each((index, element) => {
this.createSelectProveedor($(element))
})
this.summaryData.tasks.forEach(async (element) => {
let selectItem = this.item.find("#select-maquina-tarea-" + element.id);
if (element.presupuesto_linea_id && element.is_corte == false) this.createSelectMaquinaImpresion(selectItem)
@ -262,6 +311,7 @@ class OrdenTrabajo {
}
});
} catch (error) {
console.error(error)
} finally {
this.eventTareas()
@ -270,7 +320,7 @@ class OrdenTrabajo {
}
createSelectMaquinaAcabado(selectItem) {
let maquina_id = selectItem.data("maquina-id")
let maquinaSelects = new ClassSelect(selectItem, `/tarifas/maquinas/acabado/select`, "Seleccione una maquina", true);
let maquinaSelects = new ClassSelect(selectItem, `/tarifas/maquinas/acabado/select`, "Seleccione un máquina", true);
maquinaSelects.init();
if (maquina_id) {
maquinaSelects.setVal(maquina_id)
@ -278,6 +328,24 @@ class OrdenTrabajo {
maquinaSelects.reset()
}
}
createSelectProveedor(selectItem) {
try {
let proveedor_id = selectItem.data("proveedor-id")
let tipo = selectItem.data("proveedor-tipo")
let proveedorSelect = new ClassSelect(selectItem, `/compras/proveedores/getProveedores`, "Seleccione una proveedor", true, { tipo_id: tipo }, this.tareasTableItem);
proveedorSelect.init();
if (proveedor_id) {
proveedorSelect.setVal(proveedor_id)
} else {
proveedorSelect.reset()
}
} catch (error) {
console.error(error)
}
}
createSelectMaquinaManipulado(selectItem) {
let maquina_id = selectItem.data("maquina-id")
let maquinaSelects = new ClassSelect(selectItem, `/tarifas/maquinas/manipulado/select`, "Seleccione una maquina", true);
@ -404,6 +472,8 @@ class OrdenTrabajo {
fillOtDetails() {
const progreso = this.summaryData.ot.progreso
this.otForm.find("#ot-progress-bar").attr('aria-valuenow', progreso).text(progreso + "%").css("width", progreso + "%")
this.tiempoEstimado.html(this.summaryData.tiempo_procesamiento)
this.tiempoTotal.html(this.summaryData.tiempo_total)
}
fillOtDates() {
this.fechaImpresion.setDate(this.summaryData.pedido.fecha_impresion)
@ -416,21 +486,33 @@ class OrdenTrabajo {
this.ferroCliente.setDate(this.summaryData.dates.ferro_en_cliente_at)
this.ferroOk.setDate(this.summaryData.dates.ferro_ok_at)
// this.plakeneTraslucido.setDate(this.summaryData.dates.fecha_impresion_at)
this.impresionColor.setDate(this.summaryData.dates.interior_color_at)
/**IMPRESION */
this.impresionBN.setDate(this.summaryData.dates.interior_bn_at)
this.portada.setDate(this.summaryData.dates.cubierta_at)
this.plastificadoMate.setDate(this.summaryData.dates.plastificado_at)
this.impresionColor.setDate(this.summaryData.dates.interior_color_at)
this.cubierta.setDate(this.summaryData.dates.cubierta_at)
this.sobrecubierta.setDate(this.summaryData.dates.sobrecubierta_at)
this.guarda.setDate(this.summaryData.dates.guarda_at)
/**ACABADO */
this.plastificado.setDate(this.summaryData.dates.plastificado_at)
this.plakene.setDate(this.summaryData.dates.plakene_at)
this.retractilado.setDate(this.summaryData.dates.retractilado_at)
this.estampado.setDate(this.summaryData.dates.estampado_at)
this.uvi.setDate(this.summaryData.dates.uvi_at)
/** ENCUADERNACION */
this.encuadernacion.setDate(this.summaryData.dates.encuadernacion_at)
this.prepGuillotina.setDate(this.summaryData.dates.corte_at)
this.prepCosido.setDate(this.summaryData.dates.cosido_at)
this.prepSolapa.setDate(this.summaryData.dates.solapa_at)
this.prepGrapado.setDate(this.summaryData.dates.grapado_at)
this.prepPrototipo.setDate(this.summaryData.dates.prototipo_at)
this.entradaManipulado.setDate(this.summaryData.dates.entrada_manipulado_at)
// this.prepCosido.setDate(this.summaryData.dates.cosido_at)
// this.prepSolapa.setDate(this.summaryData.dates.solapa_at)
// this.prepGrapado.setDate(this.summaryData.dates.grapado_at)
// this.prepPrototipo.setDate(this.summaryData.dates.prototipo_at)
this.prepMarcapaginas.setDate(this.summaryData.dates.marcapaginas_at)
this.prepRetractilado.setDate(this.summaryData.dates.retractilado_at)
this.prepRetractilado5.setDate(this.summaryData.dates.retractilado5_at)
this.espiral.setDate(this.summaryData.dates.fecha_impresion_at)
// this.espiral.setDate(this.summaryData.dates.fecha_impresion_at)
this.embalaje.setDate(this.summaryData.dates.embalaje_at)
this.envio.setDate(this.summaryData.dates.envio_at)
this.pedidoEnEsperaCheck.prop("checked", this.summaryData.ot.is_pedido_espera);
@ -485,17 +567,18 @@ class OrdenTrabajo {
}
handleTareaChangeError(error) { }
handleOtComment(event) {
let name = $(event.currentTarget).attr("name")
let data = {
"orden_trabajo_id": this.modelId,
"name": name,
}
data[name] = $(event.currentTarget).val()
const ajax = new Ajax(
"/produccion/ordentrabajo/update",
{
"orden_trabajo_id": this.modelId,
"name": $(event.currentTarget).attr("name"),
"comentarios": $(event.currentTarget).val()
},
data,
null,
(response) => {
this._handleGetData();
alertSuccess(response.message).fire()
},
null
@ -780,7 +863,6 @@ class OrdenTrabajo {
alertConfirmationDelete()
.then(result => {
if (result.isConfirmed) {
console.log(name)
ajax.post()
}
})
@ -811,7 +893,6 @@ class OrdenTrabajo {
alertConfirmationDelete()
.then(result => {
if (result.isConfirmed) {
console.log(name)
ajax.post()
}
})
@ -864,6 +945,24 @@ class OrdenTrabajo {
ajax.post()
}
handleUpdateProveedor(event) {
let orden_trabajo_tarea_id = $(event.currentTarget).data('id')
let actualValue = $(event.currentTarget).val()
let ajax = new Ajax(`/produccion/ordentrabajo/update/tarea/proveedor`,
{
orden_trabajo_tarea_id: orden_trabajo_tarea_id,
proveedor_id: actualValue
},
null,
(response) => {
alertSuccess(response.message).fire()
},
(error) => {
alertError(error.message).fire()
})
ajax.post()
}
}

View File

@ -5,5 +5,5 @@
font-size : 20px;
}
.table-maquinista td{
height : 10rem;
height : 7rem;
}

View File

@ -18,7 +18,7 @@ html {
width: 210mm;
height: 297mm;
max-width: 210mm;
font-size: 11px;
font-size: 8px;
max-height: 297mm;
background-color: white;
}
@ -91,7 +91,7 @@ body {
}
.section-title {
font-weight: bold;
margin-bottom: 10px;
margin-bottom: 4px;
}
.cubierta {
color: #007bff;
@ -105,31 +105,29 @@ body {
.comments {
color: #555;
font-style: italic;
font-size : 12px;
margin-top: 0.2rem;
}
.comment-content {
line-height: 0;
width: 100%;
height: 50px;
border: solid;
border-width: 1px;
margin-left : 0.2rem;
font-style: normal;
color : black;
font-size: 10px;
}
table {
width: 100%;
margin-bottom: 5px;
margin-bottom: 2px;
font-size: 10px;
}
th, td {
border: 0.01px solid black;
}
table td {
text-align: center;
}
table,
th,
td {
border: 0.1px solid rgb(0, 0, 0);
border-collapse: collapse;
}
table th {
font-weight: bold;
@ -139,11 +137,7 @@ table th {
table td {
font-weight: bold;
}
.comments {
color: #555;
font-style: italic;
margin-top: 0.2rem;
}
.t-header {
color: black;
width: 25%;