imposiciones

This commit is contained in:
amazuecos
2025-04-12 23:53:48 +02:00
parent 41159d1588
commit ba9c4dc339
19 changed files with 293 additions and 453 deletions

View File

@ -1,4 +1,6 @@
<?php namespace App\Controllers\Configuracion;
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseResourceController;
@ -56,7 +58,7 @@ class Imposiciones extends \App\Controllers\BaseResourceController
{
if ($this->request->getPost()) :
@ -130,7 +132,7 @@ class Imposiciones extends \App\Controllers\BaseResourceController
return $this->redirect2listView('sweet-error', $message);
endif;
if ($this->request->getPost()) :
@ -279,6 +281,9 @@ class Imposiciones extends \App\Controllers\BaseResourceController
];
return $orientacionOptions;
}
public function selectImposicion()
{
$data = $this->model->querySelect($this->request->getGet('q'));
return $this->response->setJSON($data);
}
}

View File

@ -141,7 +141,7 @@ class Ordentrabajo extends BaseController
$q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F");
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
@ -156,7 +156,7 @@ class Ordentrabajo extends BaseController
$q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]);
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
@ -171,7 +171,7 @@ class Ordentrabajo extends BaseController
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null);
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
@ -186,7 +186,7 @@ class Ordentrabajo extends BaseController
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE);
// return $this->response->setJSON($q->get()->getResultArray());
return DataTable::of($q)
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
->edit(
"fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
@ -232,6 +232,8 @@ class Ordentrabajo extends BaseController
->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmm_string($q->tiempo_estimado))
->edit("tiempo_real", fn($q) => float_seconds_to_hhmm_string($q->tiempo_real))
->edit("maquina_tarea", fn($q) => ["id" => $q->id, "maquina_id" => $q->maquina_tarea, "maquina_name" => $q->maquina_nombre])
->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);
}
public function get_pdf($orden_trabajo_id)
@ -296,7 +298,6 @@ class Ordentrabajo extends BaseController
}
} catch (\Throwable $th) {
return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode(500);
}
}
public function planning_rotativa_datatable()

View File

@ -19,4 +19,13 @@ class Imposicion extends \CodeIgniter\Entity\Entity
"alto" => "int",
"unidades" => "?int",
];
public function getFullName() : string
{
$ancho_x_alto = $this->attributes["ancho"] ."x". $this->attributes["alto"];
$unidades = $this->attributes["unidades"] ?? "";
$orientacion = $this->attributes["orientacion"] ?? "";
return implode("_",[$ancho_x_alto,$unidades,$orientacion]);
}
}

View File

@ -2,9 +2,11 @@
namespace App\Entities\Configuracion;
use App\Models\Configuracion\MaquinasPapelesImpresionModel;
use App\Models\Configuracion\PapelGenericoModel;
use App\Models\Configuracion\PapelImpresionMargenModel;
use App\Models\Configuracion\PapelImpresionTipologiaModel;
use CodeIgniter\Entity;
use CodeIgniter\Model;
class PapelImpresion extends \CodeIgniter\Entity\Entity
{
@ -68,4 +70,15 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
$m = model(PapelImpresionMargenModel::class);
return $m->asArray()->where('papel_impresion_id',$this->attributes["id"])->findAll();
}
public function papel_generico() : ?PapelGenerico
{
$m = model(PapelGenericoModel::class);
return $m->find($this->attributes["papel_generico_id"]);
}
public function getPapelCodeOt() : ?string
{
$code_ot = $this->papel_generico()->code_ot;
$gramaje = $this->attributes["gramaje"];
return implode(" ",[$code_ot,$gramaje]);
}
}

View File

@ -134,4 +134,18 @@ class OrdenTrabajoEntity extends Entity
{
return $this->pedidoEsperaBy();
}
public function getPortadaPath(): ?string
{
helper('filesystem');
$path = $this->attributes["portada_path"];
$portada_path = null;
if($path){
if(file_exists($path)){
$portada_path = $path;
}else{
$portada_path = null;
}
}
return $portada_path;
}
}

View File

@ -2,10 +2,12 @@
namespace App\Entities\Produccion;
use App\Entities\Configuracion\Imposicion;
use App\Entities\Configuracion\Maquina;
use App\Entities\Presupuestos\PresupuestoAcabadosEntity;
use App\Entities\Presupuestos\PresupuestoLineaEntity;
use App\Entities\Presupuestos\PresupuestoManipuladosEntity;
use App\Models\Configuracion\ImposicionModel;
use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use App\Models\Presupuestos\PresupuestoAcabadosModel;
@ -105,5 +107,10 @@ class OrdenTrabajoTareaEntity extends Entity
$m = model(PresupuestoAcabadosModel::class);
return $m->find($this->attributes["presupuesto_linea_id"]);
}
public function imposicion() : ?Imposicion
{
$m = model(ImposicionModel::class);
return $m->find($this->attributes["imposicion_id"]);
}
}

View File

@ -33,6 +33,14 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
"user_updated_id" => "int",
"is_deleted" => "int",
];
public function getNameInitials(): string
{
$words = explode(" ",$this->attributes["nombre"]);
$words_initial = array_map(fn($w) => substr(strtoupper($w),0,1),$words);
return implode("",$words_initial);
}
}

View File

@ -39,7 +39,8 @@ return [
"maquina_presupuesto" => "Máquina presupuesto",
"maquina_actual" => "Máquina actual",
"tiempo_estimado" => "Tiempo estimado",
"tiempo" => "Tiempo"
"tiempo" => "Tiempo",
"imposicion" => "Imposición"
],
"finalizadas" => "Finalizadas",
"pendiente_ferro" => "Ferro pendiente",
@ -79,6 +80,13 @@ return [
"solapa" => "Solapa",
"papel_gramajes" => "Papel y gramajes",
"estado" => "Estado",
"pedido_espera" => "Pedido en espera"
"pedido_espera" => "Pedido en espera",
"imposicion_no_label" => "Sin etiqueta",
"pliegos_de" => "pliegos de",
"size" => "Tamaño",
"ejemplares" => "Ejemplares",
"tipo" => "Tipo",
"lomo" => "Lomo"
];

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Configuracion;
class ImposicionModel extends \App\Models\BaseModel
@ -95,21 +96,37 @@ class ImposicionModel extends \App\Models\BaseModel
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orlike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.unidades", $search)
->orLike("t1.orientacion", $search)
->orLike("t1.maquina", $search)
->orLike("t1.etiqueta", $search)
->orlike("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.unidades", $search)
->orLike("t1.orientacion", $search)
->orLike("t1.maquina", $search)
->orLike("t1.etiqueta", $search)
->groupEnd();
->groupStart()
->like("t1.id", $search)
->orlike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.unidades", $search)
->orLike("t1.orientacion", $search)
->orLike("t1.maquina", $search)
->orLike("t1.etiqueta", $search)
->orlike("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.unidades", $search)
->orLike("t1.orientacion", $search)
->orLike("t1.maquina", $search)
->orLike("t1.etiqueta", $search)
->groupEnd();
}
public function querySelect(?string $q)
{
$query = $this->builder()->select([
"id",
"CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL')) as name",
"COALESCE(lg_imposiciones.etiqueta,'" . lang("Produccion.imposicion_no_label") . "') as description"
]);
if ($q) {
$query->orLike("CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto)", $q);
$query->orLike("lg_imposiciones.etiqueta", $q);
}
return $query
->orderBy('id', 'ASC')
->get()->getResultArray();
}
}

View File

@ -82,7 +82,9 @@ class OrdenTrabajoModel extends Model
"tipos_presupuestos.codigo as tipo_presupuesto_impresion",
"ordenes_trabajo.progreso",
"presupuesto_linea.tipo as presupuesto_linea_tipo",
"orden_trabajo_dates.ferro_ok_at"
"orden_trabajo_dates.ferro_ok_at",
"CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL')) as imposicion_name"
])
->join("orden_trabajo_dates","orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id","left")
->join("pedidos","pedidos.id = ordenes_trabajo.pedido_id","left")
@ -92,6 +94,9 @@ class OrdenTrabajoModel extends Model
->join("clientes","clientes.id = presupuestos.cliente_id","left")
->join("tipos_presupuestos","presupuestos.tipo_impresion_id = tipos_presupuestos.id","left")
->join("ubicaciones","ubicaciones.id = pedidos_linea.ubicacion_id","left")
->join("orden_trabajo_tareas","orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id","left")
->join("lg_imposiciones","lg_imposiciones.id = orden_trabajo_tareas.imposicion_id","left")
->whereIn("presupuesto_linea.tipo",["lp_bn","lp_bnhq","lp_rot_bn","lp_color","lp_colorhq","lp_rot_color"])
->where("ordenes_trabajo.deleted_at",null)
->groupBy("ordenes_trabajo.id");

View File

@ -3,6 +3,7 @@
namespace App\Services;
use App\Entities\Clientes\ClienteEntity;
use App\Entities\Configuracion\Imposicion;
use App\Entities\Pedidos\PedidoEntity;
use App\Entities\Presupuestos\PresupuestoEntity;
use App\Entities\Presupuestos\PresupuestoLineaEntity;
@ -414,9 +415,12 @@ class ProductionService extends BaseService
"orden_trabajo_tareas.maquina_id as maquina_tarea",
"lg_maquinas.nombre as maquina_nombre",
"lg_imposiciones.id as imposicion_id",
"CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL'),'_',COALESCE(lg_imposiciones.etiqueta,'')) as imposicion_name",
"orden_trabajo_tareas.tiempo_estimado",
"orden_trabajo_tareas.tiempo_real",
"orden_trabajo_tareas.comment",
"orden_trabajo_tareas.presupuesto_linea_id",
"presupuesto_linea.tipo",
])
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
@ -657,39 +661,53 @@ class ProductionService extends BaseService
"linea_impresion" => $this->presupuesto->presupuestoLineaImpresion(),
"linea_cubierta" => $this->presupuesto->presupuestoLineaCubierta(),
"peso_unidad" => $logistica_data["peso_unidad"],
"peso_pedido" => $logistica_data["peso_pedido"]
"peso_pedido" => $logistica_data["peso_pedido"],
"imposicion" => $this->getImposicionTareaImpresion()
];
}
public function getTareaImpresionSobreCubierta(): array
public function getImposicionTareaImpresion(): ?Imposicion
{
$imposicion = null;
$impresionInteriorBnImposicion = $this->getTareaImpresionInteriorBn()?->imposicion();
$impresionInteriorColorImposicion = $this->getTareaImpresionInteriorColor()?->imposicion();
if($impresionInteriorBnImposicion){
$imposicion = $impresionInteriorBnImposicion;
}
if($impresionInteriorColorImposicion){
$imposicion = $impresionInteriorColorImposicion;
}
return $imposicion;
}
public function getTareaImpresionSobreCubierta(): ?OrdenTrabajoTareaEntity
{
$q = $this->otTarea->select('orden_trabajo_tareas.*')
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->whereIn("presupuesto_linea.tipo", ["lp_sobrecubierta"])->findAll();
->whereIn("presupuesto_linea.tipo", ["lp_sobrecubierta"])->first();
return $q;
}
public function getTareaImpresionCubierta(): array
public function getTareaImpresionCubierta(): ?OrdenTrabajoTareaEntity
{
$q = $this->otTarea->select('orden_trabajo_tareas.*')
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->whereIn("presupuesto_linea.tipo", ["lp_cubierta"])->findAll();
->whereIn("presupuesto_linea.tipo", ["lp_cubierta"])->first();
return $q;
}
public function getTareaImpresionInteriorBn(): array
public function getTareaImpresionInteriorBn(): ?OrdenTrabajoTareaEntity
{
$q = $this->otTarea->select('orden_trabajo_tareas.*')
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->whereIn("presupuesto_linea.tipo", ["lp_rot_bn", "lp_bn", "lp_bnhq"])->findAll();
->whereIn("presupuesto_linea.tipo", ["lp_rot_bn", "lp_bn", "lp_bnhq"])->first();
return $q;
}
public function getTareaImpresionInteriorColor(): array
public function getTareaImpresionInteriorColor(): ?OrdenTrabajoTareaEntity
{
$q = $this->otTarea->select('orden_trabajo_tareas.*')
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->whereIn("presupuesto_linea.tipo", ["lp_rot_color", "lp_color", "lp_colorhq"])->findAll();
->whereIn("presupuesto_linea.tipo", ["lp_rot_color", "lp_color", "lp_colorhq"])->first();
return $q;
}
public function getPresupuestoLineaImpresion() {}

View File

@ -7,7 +7,7 @@
<th><?= lang('Produccion.task.task') ?></th>
<th><?= lang('Produccion.task.maquina_presupuesto') ?></th>
<th><?= lang('Produccion.task.maquina_actual') ?></th>
<!-- <th><?= lang('Produccion.task.imposicion_id') ?></th> -->
<th><?= lang('Produccion.task.imposicion') ?></th>
<th><?= lang('Produccion.task.tiempo_estimado') ?></th>
<th><?= lang('Produccion.task.tiempo') ?></th>
<th></th>

View File

@ -52,6 +52,8 @@
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/ot.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>

View File

@ -44,13 +44,13 @@ $settings = $session->get('settings');
</div>
<div class="row mb-2 d-flex flex align-items-stretch">
<div class="col-2">
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->portada_path ? "data:image/png;base64,".base64_encode(file_get_contents(WRITEPATH . "uploads/" . $ot->portada_path)): '/assets/img/portada_not_found.png' ?>" />
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->portada_path ? "data:image/png;base64," . base64_encode(file_get_contents(WRITEPATH . "uploads/" . $ot->portada_path)) : '/assets/img/portada_not_found.png' ?>" />
</div>
<div class="col-10 <?= $ot->fecha_entrega_warning ? "bg-danger" : "bg-secondary" ?> py-2 rounded border-1 border-secondary">
<div class="row">
<div class="col-8">
<div class="px-2 d-flex flex justify-content-between align-items-center mb-2 border boder-1 border-dark bg-primary text-white rounded-pill bordered border-secondary">
<span><strong><?= $dates->fecha_encuadernado_at ? week_day_humanize(Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)->getDayOfWeek(), true) : "" ?></strong></span>
<span><strong><?= $dates?->fecha_encuadernado_at ? week_day_humanize(Time::createFromFormat("Y-m-d", $dates?->fecha_encuadernado_at)->getDayOfWeek(), true) : "" ?></strong></span>
<span><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </span>
</div>
</div>
@ -64,52 +64,52 @@ $settings = $session->get('settings');
<div class="row p-2">
<div class="col-4 h-100">
<div class="row px-2 d-flex flex justify-content-between align-items-center">
<div class="col-6 w-75 border border-1 border-dark text-center <?= $ot->fecha_entrega_warning ? "bg-danger" : "bg-secondary" ?> ">
<span class="text-white" id="fecha_encuadernado_at"><strong><?= $dates->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)?->format("d/m/Y") : "" ?></strong></span>
</div>
<div class="col-6 w-25 border border-1 border-dark text-center bg-secondary text-white">
<strong>RF</strong>
</div>
<div class="col-6 w-75 border border-1 border-dark text-center <?= $ot->fecha_entrega_warning ? "bg-danger" : "bg-secondary" ?> ">
<span class="text-white" id="fecha_encuadernado_at"><strong><?= $dates?->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $dates?->fecha_encuadernado_at)?->format("d/m/Y") : "" ?></strong></span>
</div>
<div class="col-6 w-25 border border-1 border-dark text-center bg-secondary text-white">
<strong><?=isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "?" : "?" ?></strong>
</div>
</div>
<div class="row px-2 mt-2 h-100">
<table class="h-100">
<tr class="t-row">
<th class="t-header">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">PO</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">PL</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">EN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">MA</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
</table>
<table class="h-100">
<tr class="t-row">
<th class="t-header">IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">PO</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">PL</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">EN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
<tr class="t-row">
<th class="t-header">MA</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr>
</table>
</div>
</div>
<div class="col-4">
<div class="row h-100">
<div class="col-6 h-50 square text-center text-dark bg-secondary border border-right border-dark">
BCLF 100
<div class="col-6 h-50 square text-center text-dark bg-white border border-right border-dark">
<?= $linea_impresion->papel_impresion()->papel_code_ot ?>
</div>
<div class="col-6 h-50 square text-center text-dark bg-secondary border border-right border-dark">
0:3
</div>
<div class="col-6 h-50 square bg-primary text-center text-white border border-right border-dark">
EM 300
<?= $linea_cubierta->papel_impresion()->papel_code_ot ?>
</div>
<div class="col-6 h-50 square bg-blue text-center text-dark bg-secondary border border-right border-dark">
BRILLO
<?= isset($acabados[0]) ? $acabados[0]->tarifa()->code : "" ?>
</div>
</div>
</div>
@ -130,26 +130,26 @@ $settings = $session->get('settings');
</div>
<div class="row mb-2">
<div class="col-8">
<table class="h-100">
<table class="h-50">
<tr>
<th>Cliente</th>
<td class="t-cell ">
<th >Cliente</th>
<td class="t-cell">
<?= $cliente->nombre ?>
</td>
</tr>
<tr>
<th>Titulo</th>
<td class="t-cell ">
<th >Titulo</th>
<td class="t-cell">
<?= $presupuesto->titulo ?>
</td>
</tr>
<tr>
<th>ISBN</th>
<th >ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr>
<tr>
<th>CIF</th>
<th >CIF</th>
<td class="t-cell"><?= $cliente->cif ?></td>
</tr>
</table>
@ -187,7 +187,7 @@ $settings = $session->get('settings');
<table>
<tr>
<th>Imposicion</th>
<td>??</td>
<td><?= $imposicion->full_name ?></td>
</tr>
</table>
</div>
@ -198,6 +198,18 @@ $settings = $session->get('settings');
<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"> ?? </td>
<th class="t-header" style="width: 10%;"><?=lang('Produccion.ejemplares')?></th>
<td class="t-cell"> <?=$presupuesto->tirada ?> </td>
<th class="t-header" style="width: 10%;"><?=lang('Produccion.tipo')?></th>
<td class="t-cell"> <?=$presupuesto->tipo ?> </td>
<th class="t-header" style="width: 10%;"><?=lang('Produccion.lomo')?></th>
<td class="t-cell"> <?=$presupuesto->lomo_cubierta ?> </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>
@ -288,7 +300,7 @@ $settings = $session->get('settings');
<th class="t-header" style="width: 10%;">Máquina</th>
<td class="t-cell"><?= implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> </td>
<th class="t-header" style="width: 10%;">Operario</th>
<td class="t-cell"><?= $ot->users()->plastificado_by?->getFullName() ?? null ?> </td>
<td class="t-cell"><?= $ot->users()?->plastificado_by?->getFullName() ?? null ?> </td>
</tr>
</table>
<table>
@ -307,7 +319,7 @@ $settings = $session->get('settings');
<td><?= $value->tarifa()->nombre ?></td>
<td><?= $presupuesto->solapas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
<td> <?= $linea_impresion->pliegos_libro?>/<?=$linea_impresion->pliegos_pedido?> </td>
<td>_____<?=" ".lang("Produccion.pliegos_de")." "?>_____</td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>

View File

@ -14,11 +14,14 @@ class OrdenTrabajoDatatable {
{ data: 'cliente_nombre', searchable: false, sortable: false },
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
{ data: 'ubicacion_nombre', searchable: false, sortable: false },
{ data: 'total_tirada', searchable: false, sortable: false ,render : (d) => `<span class="autonumeric">${d}</span>`},
{ data: 'total_tirada', searchable: false, sortable: false, render: (d) => `<span class="autonumeric">${d}</span>` },
{ data: 'tipo_presupuesto_impresion', searchable: false, sortable: false },
{
data: 'logo', searchable: false, sortable: false, render: (d, t) => {
return `<img src="${d}" width="30px" height="30px" alt="logo-impresion" />`
return `<div class="logo-container">
<img class="d-block" src="${d.logo}" width="45px" height="45px" alt="logo-impresion" />
${d.imposicion ? `<span class="imposicion-overlay-image">${d.imposicion ?? ""}</span>` : ''}
</div>`
}
},
{
@ -50,7 +53,7 @@ class OrdenTrabajoDatatable {
bottomStart: 'info',
bottomEnd: 'paging'
},
columnDefs : [
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
serverSide: true,
@ -71,7 +74,7 @@ class OrdenTrabajoDatatable {
bottomStart: 'info',
bottomEnd: 'paging'
},
columnDefs : [
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
serverSide: true,

View File

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

View File

@ -26,7 +26,7 @@ class OrdenTrabajo {
{ 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_id', searchable: false, sortable: false },
{ data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this) },
{ data: 'tiempo_estimado', searchable: false, sortable: false },
{ data: 'tiempo_real', searchable: false, sortable: false },
{
@ -42,13 +42,13 @@ class OrdenTrabajo {
nameId: "orden_trabajo_id",
getUri: '/produccion/ordentrabajo/get_files',
postUri: '/produccion/ordentrabajo/upload_files',
resourcePath : 'orden_trabajo/' + this.modelId
resourcePath: 'orden_trabajo/' + this.modelId
}
if ($(this.configUploadDropzone.domElement).length > 0) {
this.fileUploadDropzone = new FileUploadDropzone(this.configUploadDropzone)
}
}
initDropFiles(){
initDropFiles() {
if ($(this.configUploadDropzone.domElement).length > 0) {
this.fileUploadDropzone.init()
}
@ -90,6 +90,7 @@ class OrdenTrabajo {
eventTareas() {
this.otForm.on("change", ".select-maquina-tarea-datatable", this.handleTareaChange.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) => {
const input_orden_tarea = $(event.currentTarget).parent().parent().find('.orden-tarea')
let actual_value = parseInt(input_orden_tarea.val())
@ -105,6 +106,7 @@ class OrdenTrabajo {
}
unbindEventTareas() {
this.otForm.off("change", ".select-maquina-tarea-datatable")
this.otForm.off("change", ".select-imposicion-tarea-datatable")
this.otForm.off("change", ".orden-tarea")
this.otForm.off("click", ".increase-order")
this.otForm.off("click", ".decrease-order")
@ -172,6 +174,14 @@ class OrdenTrabajo {
<option value="${d.maquina_id}" selected="selected">${d.maquina_name ?? ''}</option>
</select>`
}
_renderImposicionSelectTable(d, t) {
let render = `<select id="select-imposicion-tarea-${d.id}" data-imposicion-id="${d.imposicion_id}" data-id="${d.id}" name="imposicion_id" class="select2 form-select select-imposicion-tarea-datatable ${d.imposicion_id ? '' : 'is-invalid'}">
<option value="${d.imposicion_id}" selected="selected">${d.name ?? ''}</option>
</select>`
return render
}
_renderActionCell(d, t) {
@ -204,6 +214,26 @@ class OrdenTrabajo {
if (element.presupuesto_manipulado_id || element.is_corte) this.createSelectMaquinaManipulado(selectItem)
if (element.presupuesto_preimpresion_id) this.createSelectMaquinaAll(selectItem)
if (element.presupuesto_extra_id) this.createSelectMaquinaAll(selectItem)
if (this.summaryData.impresion_interior_bn) {
let isTareaImpresionInteriorBN = this.summaryData.impresion_interior_bn?.presupuesto_linea_id == element.presupuesto_linea_id
if (isTareaImpresionInteriorBN) {
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
this.createSelectImposicion(selectItemImposicion)
} else {
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
selectItemImposicion.addClass("d-none");
}
}
if (this.summaryData.impresion_interior_color) {
let isTareaImpresionInteriorColor = this.summaryData.impresion_interior_color?.presupuesto_linea_id == element.presupuesto_linea_id
if (isTareaImpresionInteriorColor) {
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
this.createSelectImposicion(selectItemImposicion)
} else {
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
selectItemImposicion.addClass("d-none");
}
}
});
} catch (error) {
} finally {
@ -262,6 +292,25 @@ class OrdenTrabajo {
maquinaSelects.reset()
}
}
createSelectImposicion(selectItem) {
let imposicionId = selectItem.data("imposicion-id")
let imposicionSelect = new ClassSelect(selectItem, `/imposiciones/select`, "Seleccione una imposición", true);
imposicionSelect.config.templateResult = (state) => {
let $state = $(`
<div class="d-flex flex-column justify-content-start align-items-start gap-1">
<span class="item-text">${state.text}</span>
<span class="badge text-bg-secondary">${state.desc ?? ''}</span>
</div>`)
return $state;
}
imposicionSelect.init();
if (imposicionId) {
imposicionSelect.setVal(imposicionId)
} else {
imposicionSelect.reset()
}
}
@ -294,7 +343,7 @@ class OrdenTrabajo {
}
handleSummaryError(error) {
Notiflix.Block.remove('.section-block');
}
}
fillPreimpresionReview() {
this.otForm.find("[name=fecha_entrega_warning]").prop("checked", this.summaryData.ot.fecha_entrega_warning)
this.otForm.find("[name=fecha_entrega_warning_revised]").prop("checked", this.summaryData.ot.fecha_entrega_warning_revised)
@ -333,10 +382,10 @@ class OrdenTrabajo {
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);
if(this.summaryData.ot.pedido_espera_by){
this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name,this.summaryData.ot.pedido_espera_by.last_name].join(" "))
}else{
this.pedidoEnEsperaCheck.prop("checked", this.summaryData.ot.is_pedido_espera);
if (this.summaryData.ot.pedido_espera_by) {
this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name, this.summaryData.ot.pedido_espera_by.last_name].join(" "))
} else {
this.pedidoEnEsperaBy.text("");
}
this.otEstado.val(this.summaryData.ot.estado)

View File

@ -0,0 +1,17 @@
.imposicion-overlay-image
{
position: absolute;
top: 75%;
left: 25%;
transform: translate(-10%, -10%);
background-color:rgb(255, 255, 255);
color: black;
font-size: 11px;
text-align: center;
border : 1px solid;
}
.logo-container{
position: relative;
display: inline-block;
}

View File

@ -1,348 +0,0 @@
@page {
size: A4;
margin: 0;
}
@media print {
body,html {
width: 210mm;
height: 297mm;
max-width: 210mm;
max-height: 297mm;
print-color-adjust: exact;
}
/* ... the rest of the rules ... */
}
html {
font-family: Arial, sans-serif;
width: 210mm;
height: 297mm;
max-width: 210mm;
font-size : 11px;
max-height: 297mm;
background-color: #f9f9f9;
}
body{
border: 0px solid;
padding: 20px;
max-width: 210mm;
max-height: 297mm;
}
.cubierta{
color: #007bff;
}
.encuadernacion{
color: green;
}
.impresion{
color: #ff4000;
}
.container {
width: 100%;
width: 210mm;
height: 297mm;
background: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border: 2px solid;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
}
.cover{
display: flex;
justify-content: start;
align-items: center;
gap: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
.portada-info{
display: flex;
flex-direction: column;
width: 100%;
}
.impresion-tipo-row{
display: flex;
align-items: center;
justify-items: center;
justify-content: end;
width: 100%;
height: 5mm;
margin: 2px;
}
.portada-row{
display: flex;
align-items: center;
justify-items: center;
justify-content: space-between;
background-color: #4ba0fccc;
width: 100%;
height: 5mm;
border: solid 2px;
margin: 2px;
border-color: black;
}
.portada-row-2{
display: flex;
align-items: center;
justify-items: center;
width: 100%;
height: 35mm;
margin: 2px;
border: 2px solid;
border-color: black;
}
.portada{
height: 40mm;
}
.presupuesto-title{
color: #007bff;
font-size: medium;
line-height: 0;
}
.pl-2{
padding-left: 0.5rem;
}
.pr-2{
padding-right: 0.5rem;
}
.pt-2{
padding-top: 0.5rem;
}
.flex-row{
display: flex;
width: 100%;
justify-content: start;
align-items: flex-start;
}
.date{
padding-left: 0.5rem;
padding-top: 0px;
width: 100%;
line-height: 0px;
stroke-width: 5px;
font-size: medium;
}
#presupuesto-section{
width: 100%;
}
.flex-col{
display: flex;
padding: 0;
flex-direction: column;
}
.cliente-title{
color: red;
font-size: medium;
stroke-width: 10px;
line-height: 0px;
}
.header .title {
font-size: 24px;
font-weight: bold;
color: #333;
}
.section {
margin-top: 0.5rem;
border-top: 1px solid #ddd;
padding-top: 0.2rem;
}
.section-title {
font-weight: bold;
margin-bottom: 10px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 5px;
font-size: 12px;
}
table th, table td {
border: 2px solid #000000;
text-align: center;
}
table th {
background-color: #f4f4f4;
font-weight: bold;
}
table td{
font-weight: bold;
}
.comments {
color: #555;
font-style: italic;
margin-top: 0.2rem;
}
.comment-content {
line-height: 0;
width: 100%;
height: 50px;
border: solid;
border-width: 1px;
}
.footer {
text-align: center;
margin-top: 0.5rem;
font-size: 14px;
color: #777;
}
.row-logo-impresion{
text-align: center;
}
.portada-img{
border: black;
border-style: solid;
border-width: 2px;
height: 40mm;
width: 100px;
max-width: 30mm;
border: 2px solid;
border-color: black;
border-radius: 5%;
}
.portada-text{
color: white;
}
.t-header{
color: black;
width: 25%;
}
.t-cell{
background-color: white;
color: black;
text-align: start;
padding-left: 0.2rem;
}
.t-row{
font-size: 10px;
}
.esquema{
display: flex;
justify-content:flex-end;
width: 100%;
justify-items: flex-end;
}
.pagina-imposicion-outer-start{
border-top: 2px solid;
border-left: 2px solid;
border-bottom: 2px solid;
width: 50px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.pagina-imposicion-outer-end{
border-top: 2px solid;
border-right: 2px solid;
border-bottom: 2px solid;
width: 50px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.pagina-imposicion-outer{
border-top: 2px solid;
border-bottom: 2px solid;
width: 50px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.pagina-imposicion-inner{
border: 2px solid;
font-size: 25px;
width: 40px;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
}
.square-wrapper{
display: grid;
grid-template-columns: repeat(2,1fr);
margin-left: 5px;
}
.square{
width: 100px;
height: 50px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.cod{
width: 150px;
height: 100px;
display: flex;
flex-direction: column;
background-color: orange;
margin-left : 20px;
color: white;
align-items: center;
justify-content: space-between;
font-weight: bold;
}
.cod-code{
font-weight: bold;
color: white;
}
.esquema-imposicion-wrapper{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-left: 2rem;
gap: 10px;
}
.imposicion{
display: flex;
align-items: center;
justify-content: center;
width: 200px;
}
.imposicion td{
font-size: large;
}
.cod-barras{
width: 150px;
height: 80px;
text-align : center;
background-color: white;
align-content: center;
}
.cod-barras img {
padding : 1px;
}
.bg-white{
background-color: white;
color: black;
}
.bg-red{
background-color: red;
color: white;
}
.bg-gray{
background-color: gray;
color:white
}
.bg-blue{
background-color: blue;
color: white;
}