colores header pdf ot

This commit is contained in:
amazuecos
2025-04-16 09:14:16 +02:00
parent 5dbb40af1d
commit 7ee844fb0c
11 changed files with 326 additions and 77 deletions

View File

@ -59,10 +59,64 @@ class OrdenTrabajo extends BaseConfig
"encuadernado" => "#FEBA17", "encuadernado" => "#FEBA17",
"corte" => "#67AE6E" "corte" => "#67AE6E"
]; ];
public array $OT_WEEK_COLOR_DAY = [
["bg" => "#FFFFFF", "color" => "black"],
["bg" => "yellow", "color" => "black"],
["bg" => "purple", "color" => "white"],
["bg" => "orange", "color" => "white"],
["bg" => "blue", "color" => "black"],
["bg" => "pink", "color" => "black"],
["bg" => "#FFFFFF", "color" => "black"],
];
public array $OT_ENCUADERNACION_COLOR = [
"RF" => ["bg" => "#FF9900", "color" => "white"],
"RFS" => ["bg" => "#FF9900", "color" => "white"],
"RCHV" => ["bg" => "#FF9900", "color" => "blue"],
"RCHVS" => ["bg" => "#FF9900", "color" => "blue"],
"CC2" => ["bg" => "#104861", "color" => "yellow"],
"CC2S" => ["bg" => "#104861", "color" => "yellow"],
"TDF" => ["bg" => "#E49EDD", "color" => "white"],
"TDC" => ["bg" => "#E49EDD", "color" => "blue"],
"default" => ["bg" => "#FFFF00", "color" => "red"],
];
public array $OT_BACKGROUND_COLOR = [
"ferro_digital" => ["bg" => "#BFBFBF","color" => "black"],
"ferro" => ["bg" => "#BFBFBF","color" => "black"],
"prototipo" => ["bg" => "#BFBFBF","color" => "black"],
"pod" => ["bg" => "#47D359","color" => "black"],
"inaplazable" => ["bg" => "red","color" => "white"],
"default" => ["bg" => "#FFFFFF","color" => "black"]
];
public array $OT_PAPEL_COLOR =
[
"blanco" => ["bg" => "#FFFFFF", "color" => "black"],
"ahuesado" => ["bg" => "#FFF2CC", "color" => "black"],
"marfil" => ["bg" => "#FFD966", "color" => "black"],
"volumen_ahuesado" => ["bg" => "#BF8F00", "color" => "black"],
"estucado_mate" => ["bg" => "#BDD7EE", "color" => "black"],
"cartulina" => ["bg" => "#C6E0B4", "color" => "black"],
"default" => ["bg" => "#FFCCFF", "color" => "black"],
];
public array $OT_PLASTIFICADO_COLOR =
[
"BRIL" => ["bg" => "#00B0F0", "color" => "white"],
"MATE" => ["bg" => "#FF0000", "color" => "white"],
"SOFT_TOUCH" => ["bg" => "#00B050", "color" => "white"],
"SANDY" => ["bg" => "#782170", "color" => "white"],
"ANTIRAYADO" => ["bg" => "#E97132", "color" => "white"],
"GOFRADO" => ["bg" => "#FFFF00", "color" => "black"],
"default" => ["bg" => "#FFFFFF", "color" => "black"],
];
public array $OT_IMPRESION_INTERIOR_PPAL_COLOR =
[
"ROTATIVA" => ["bg" => "white", "color" => "red"],
"POD" => ["bg" => "white", "color" => "#47D359"],
"GENERAL" => ["bg" => "white", "color" => "#A02B93"],
"default" => ["bg" => "white", "color" => "black"],
];
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
} }
} }

View File

@ -168,7 +168,7 @@ class Ordentrabajo extends BaseController
->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()]) ->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( ->edit(
"fecha_encuadernado_at", "fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" 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) ->add("action", fn($q) => $q->id)
->toJson(true); ->toJson(true);
@ -183,7 +183,7 @@ class Ordentrabajo extends BaseController
->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()]) ->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( ->edit(
"fecha_encuadernado_at", "fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" 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) ->add("action", fn($q) => $q->id)
->toJson(true); ->toJson(true);
@ -198,7 +198,7 @@ class Ordentrabajo extends BaseController
->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()]) ->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( ->edit(
"fecha_encuadernado_at", "fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" 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) ->add("action", fn($q) => $q->id)
->toJson(true); ->toJson(true);
@ -213,7 +213,7 @@ class Ordentrabajo extends BaseController
->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()]) ->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( ->edit(
"fecha_encuadernado_at", "fecha_encuadernado_at",
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : "" 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) ->add("action", fn($q) => $q->id)
->toJson(true); ->toJson(true);

View File

@ -54,4 +54,5 @@ class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
$m = model(TarifaAcabadoModel::class); $m = model(TarifaAcabadoModel::class);
return $m->find($this->attributes["tarifa_acabado_id"]); return $m->find($this->attributes["tarifa_acabado_id"]);
} }
} }

View File

@ -300,4 +300,5 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
$files = $m->where('presupuesto_id',$this->attributes['id'])->findAll(); $files = $m->where('presupuesto_id',$this->attributes['id'])->findAll();
return $files ?? []; return $files ?? [];
} }
} }

View File

@ -74,6 +74,11 @@ class OrdenTrabajoEntity extends Entity
$m = model(OrdenTrabajoTarea::class); $m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll(); return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll();
} }
public function tareas_impresion() : array
{
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
}
/** /**
* Devuelve el pedido de la orden de trabajo * Devuelve el pedido de la orden de trabajo
* *

View File

@ -45,4 +45,9 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
$ta_maquinas = $m->where('tarifa_acabado_id',$this->attributes['id'])->findAll(); $ta_maquinas = $m->where('tarifa_acabado_id',$this->attributes['id'])->findAll();
return array_map(fn(TarifaAcabadoMaquinaEntity $ta_maquina) => $ta_maquina->maquina(),$ta_maquinas); return array_map(fn(TarifaAcabadoMaquinaEntity $ta_maquina) => $ta_maquina->maquina(),$ta_maquinas);
} }
public function isUVI(): bool
{
return in_array($this->attributes["code"],["R3D","R2D"]);
}
} }

View File

@ -73,7 +73,7 @@ class OrdenTrabajoModel extends Model
->select([ ->select([
"ordenes_trabajo.id", "ordenes_trabajo.id",
"ordenes_trabajo.pedido_id", "ordenes_trabajo.pedido_id",
"orden_trabajo_dates.fecha_encuadernado_at", "pedidos.fecha_encuadernado as fecha_encuadernado_at",
"clientes.nombre as cliente_nombre", "clientes.nombre as cliente_nombre",
"presupuestos.titulo as presupuesto_titulo", "presupuestos.titulo as presupuesto_titulo",
"ordenes_trabajo.estado", "ordenes_trabajo.estado",

View File

@ -16,6 +16,7 @@ use CodeIgniter\Config\BaseService;
use App\Entities\Configuracion\Maquina as MaquinaEntity; use App\Entities\Configuracion\Maquina as MaquinaEntity;
use App\Entities\Produccion\OrdenTrabajoFileEntity; use App\Entities\Produccion\OrdenTrabajoFileEntity;
use App\Entities\Produccion\OrdenTrabajoTareaEntity; use App\Entities\Produccion\OrdenTrabajoTareaEntity;
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
use App\Models\Configuracion\ConfigVariableModel; use App\Models\Configuracion\ConfigVariableModel;
use App\Models\Configuracion\MaquinaModel; use App\Models\Configuracion\MaquinaModel;
use App\Models\OrdenTrabajo\OrdenTrabajoFileModel; use App\Models\OrdenTrabajo\OrdenTrabajoFileModel;
@ -46,7 +47,10 @@ class ProductionService extends BaseService
protected OrdenTrabajoFileModel $otFileModel; protected OrdenTrabajoFileModel $otFileModel;
protected PedidoModel $pedidoModel; protected PedidoModel $pedidoModel;
protected UserModel $userModel; protected UserModel $userModel;
protected ConfigVariableModel $configVariableModel;
protected string $defaultMaquinaCorteName = 'HT-1000'; protected string $defaultMaquinaCorteName = 'HT-1000';
protected int $podValue = 0;
protected bool $isPOD = false;
protected MaquinaEntity $defaultMaquinaCorte; protected MaquinaEntity $defaultMaquinaCorte;
protected MaquinaModel $maquinaModel; protected MaquinaModel $maquinaModel;
protected OrdenTrabajo $ordenTrabajoConfig; protected OrdenTrabajo $ordenTrabajoConfig;
@ -76,6 +80,8 @@ class ProductionService extends BaseService
$this->pedidoModel = model(PedidoModel::class); $this->pedidoModel = model(PedidoModel::class);
$this->ordenTrabajoConfig = config('OrdenTrabajo'); $this->ordenTrabajoConfig = config('OrdenTrabajo');
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
$this->configVariableModel = model(ConfigVariableModel::class);
$this->podValue = $this->configVariableModel->getVariable('POD')->value;
} }
public function init(int $orden_trabajo_id): self public function init(int $orden_trabajo_id): self
{ {
@ -106,6 +112,7 @@ class ProductionService extends BaseService
$this->otModel = model(OrdenTrabajoModel::class); $this->otModel = model(OrdenTrabajoModel::class);
$this->otDate = model(OrdenTrabajoDate::class); $this->otDate = model(OrdenTrabajoDate::class);
$this->otTarea = model(OrdenTrabajoTarea::class); $this->otTarea = model(OrdenTrabajoTarea::class);
$this->isPOD = $this->presupuesto->tirada <= $this->podValue;
return $this; return $this;
} }
/** /**
@ -179,8 +186,7 @@ class ProductionService extends BaseService
public function reInsertOrdenTrabajoUsers(): int|bool|string public function reInsertOrdenTrabajoUsers(): int|bool|string
{ {
$status = false; $status = false;
if($this->otUser->where('orden_trabajo_id',$this->ot->id)->countAllResults() == 0) if ($this->otUser->where('orden_trabajo_id', $this->ot->id)->countAllResults() == 0) {
{
$status = $this->storeOrdenTrabajoUsers(); $status = $this->storeOrdenTrabajoUsers();
} }
return $status; return $status;
@ -188,8 +194,7 @@ class ProductionService extends BaseService
public function reInsertOrdenTrabajoDates(): int|bool|string public function reInsertOrdenTrabajoDates(): int|bool|string
{ {
$status = false; $status = false;
if($this->otDate->where('orden_trabajo_id',$this->ot->id)->countAllResults() == 0) if ($this->otDate->where('orden_trabajo_id', $this->ot->id)->countAllResults() == 0) {
{
$status = $this->storeOrdenTrabajoDates(); $status = $this->storeOrdenTrabajoDates();
} }
return $status; return $status;
@ -683,6 +688,10 @@ class ProductionService extends BaseService
"peso_pedido" => $logistica_data["peso_pedido"], "peso_pedido" => $logistica_data["peso_pedido"],
"imposicion" => $this->getImposicionTareaImpresion(), "imposicion" => $this->getImposicionTareaImpresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(), "tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_impresion" => $this->getTiempoTareasImpresionHHMM(),
"colors" => $this->getPdfColors(),
"isPOD" => $this->isPOD,
"uvi" => $this->getUVI()
]; ];
} }
@ -774,7 +783,7 @@ class ProductionService extends BaseService
{ {
$result = []; $result = [];
$otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id) $otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id)
->set($data['name'],$data[$data['name']]) ->set($data['name'], $data[$data['name']])
->update(); ->update();
$this->otDate->updateUserDateMap($this->ot->id, $data); $this->otDate->updateUserDateMap($this->ot->id, $data);
$ot_users = $this->ot->users(); $ot_users = $this->ot->users();
@ -1117,6 +1126,24 @@ class ProductionService extends BaseService
$seconds = array_sum($time_tareas_seconds); $seconds = array_sum($time_tareas_seconds);
return float_seconds_to_hhmm_string($seconds); return float_seconds_to_hhmm_string($seconds);
} }
public function getTiempoTareasImpresionHHMM():string {
$tareas_impresion = $this->ot->tareas_impresion();
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $tareas_impresion);
$seconds = array_sum($time_tareas_seconds);
return float_seconds_to_hhmm_string($seconds);
}
public function getUVI() : ?TarifaAcabadoEntity
{
$uvi = null;
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
if($acabado->tarifa()->isUVI()){
$uvi = $acabado->tarifa();
}
}
return $uvi;
}
public function updateProgress(): bool public function updateProgress(): bool
{ {
$userDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING; $userDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING;
@ -1142,7 +1169,7 @@ class ProductionService extends BaseService
} }
public function getOtColorStatus(): string public function getOtColorStatus(): string
{ {
if($this->ot->dates()){ if ($this->ot->dates()) {
$this->updateColor(); $this->updateColor();
} }
return $this->statusColor; return $this->statusColor;
@ -1207,7 +1234,8 @@ class ProductionService extends BaseService
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["grapado"]; $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["grapado"];
}; };
} }
protected function updateColor(){ protected function updateColor()
{
$this->otSinImprimirColor(); $this->otSinImprimirColor();
$this->otImpresionIntColor(); $this->otImpresionIntColor();
$this->otCosidoColor(); $this->otCosidoColor();
@ -1219,4 +1247,141 @@ class ProductionService extends BaseService
$this->otEncuadernadoColor(); $this->otEncuadernadoColor();
$this->otCorteColor(); $this->otCorteColor();
} }
public function getEncuadernacionCode(): ?string
{
$code = "";
$encuadernaciones = $this->presupuesto->encuadernaciones();
if (isset($encuadernaciones[0])) {
$code = $encuadernaciones[0]->tarifa()->code;
}
return $code;
}
public function getEncuadernacionColor(): array
{
$color = $this->ordenTrabajoConfig->OT_ENCUADERNACION_COLOR["default"];
$encuadernacion_code = $this->getEncuadernacionCode();
if ($encuadernacion_code) {
if (isset($this->ordenTrabajoConfig->OT_ENCUADERNACION_COLOR[$encuadernacion_code])) {
$color = $this->ordenTrabajoConfig->OT_ENCUADERNACION_COLOR[$encuadernacion_code];
}
}
return $color;
}
public function getWeekDayColor(): array
{
$color = $this->ordenTrabajoConfig->OT_WEEK_COLOR_DAY[0];
if ($this->ot->pedido()->fecha_encuadernado) {
$week_day = Time::createFromFormat("Y-m-d H:i:s", $this->ot->pedido()->fecha_encuadernado)->getDayOfWeek();
$color = $this->ordenTrabajoConfig->OT_WEEK_COLOR_DAY[$week_day];
}
return $color;
}
public function getGeneralBackgroundColor()
{
$color = $this->ordenTrabajoConfig->OT_BACKGROUND_COLOR['default'];
$is_ferro_or_prototipo = ($this->presupuesto->ferro || $this->presupuesto->ferro_digital || $this->presupuesto->prototipo);
$color = $is_ferro_or_prototipo ? $this->ordenTrabajoConfig->OT_BACKGROUND_COLOR['ferro'] : $color;
$color = $this->isPOD ? $this->ordenTrabajoConfig->OT_BACKGROUND_COLOR['pod'] : $color;
$color = $this->pedido->inaplazable ? $this->ordenTrabajoConfig->OT_BACKGROUND_COLOR['inaplazable'] : $color;
return $color;
}
public function getPapelImpresionBackgroundColor()
{
$papel = $this->presupuesto->presupuestoLineaImpresion()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
return $color;
}
public function getPapelImpresionCubiertaBackgroundColor()
{
$papel = $this->presupuesto->presupuestoLineaCubierta()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
return $color;
}
public function getPlastificadoColor()
{
$acabados = $this->presupuesto->acabados();
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['default'];
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->code) {
$plastificado_code = $tarifa_acabado->code;
if ($plastificado_code == "BRIL") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['BRIL'];
}
if ($plastificado_code == "MATE") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['MATE'];
}
if ($plastificado_code == "ANTI") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['ANTIRAYADO'];
}
if ($plastificado_code == "SAND") {
$color = $this->ordenTrabajoConfig->OT_PLASTIFICADO_COLOR['SANDY'];
}
}
}
return $color;
}
public function getImpresionInteriorPPALColor()
{
$isRotativa = $this->presupuesto->presupuestoLineaImpresion()->isRotativa();
$color = $isRotativa ? $this->ordenTrabajoConfig->OT_IMPRESION_INTERIOR_PPAL_COLOR['ROTATIVA'] : $this->ordenTrabajoConfig->OT_IMPRESION_INTERIOR_PPAL_COLOR['GENERAL'] ;
$color = $this->isPOD ? $this->ordenTrabajoConfig->OT_IMPRESION_INTERIOR_PPAL_COLOR['POD'] : $color;
return $color;
}
public function getPdfColors(): array
{
return [
"general" => $this->getGeneralBackgroundColor(),
"week_day" => $this->getWeekDayColor(),
"ot" => $this->getEncuadernacionColor(),
"papel_interior" => $this->getPapelImpresionBackgroundColor(),
"papel_cubierta" => $this->getPapelImpresionCubiertaBackgroundColor(),
"plastificado" => $this->getPlastificadoColor(),
"impresion_interior_ppal" => $this->getImpresionInteriorPPALColor()
];
}
} }

View File

@ -36,7 +36,7 @@ $settings = $session->get('settings');
<div class="col-md-12" data-id=<?= $ot->id ?>> <div class="col-md-12" data-id=<?= $ot->id ?>>
<div class="row"> <div class="row">
<div class="col-12 d-flex justify-content-between align-items-center"> <div class="col-12 d-flex justify-content-between align-items-center">
<h4><?= $presupuesto->titulo ?></h4> <h5><?= $presupuesto->titulo ?></h5>
<span class="fs-medium"><strong><?= Time::now()->format("d/m/Y H:i:s") ?></strong></span> <span class="fs-medium"><strong><?= Time::now()->format("d/m/Y H:i:s") ?></strong></span>
</div> </div>
</div> </div>
@ -46,79 +46,98 @@ $settings = $session->get('settings');
<div class="col-2"> <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>
<div class="col-10 <?= $ot->fecha_entrega_warning ? "bg-danger" : "bg-secondary" ?> py-2 rounded border-1 border-secondary"> <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="row">
<div class="col-8"> <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"> <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(), true) : "" ?></strong></span> <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> <span><strong>Comercial:</strong> <?= $cliente->first_name . " " . $cliente->comercial()->last_name ?> </span>
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="px-2 d-flex flex justify-content-center align-items-center mb-2 border boder-1 border-dark bg-success rounded-pill"> <div class="px-2 d-flex flex justify-content-center align-items-center w-100">
<span class="text-white"><strong><?= $presupuesto->presupuestoLineaImpresion()->isRotativa() ? "Rotativa" : "Plana" ?></strong></span> <span class="w-100 text-center" style="background-color: <?= $colors["impresion_interior_ppal"]["bg"] ?>;color:<?= $colors["impresion_interior_ppal"]["color"] ?>;">
<?php if ($isPOD): ?>
<strong>ROTATIVA</strong>
<?php elseif ($presupuesto->presupuestoLineaImpresion()->isRotativa()): ?>
<strong>ROTATIVA</strong>
<?php else: ?>
<strong>GENERAL</strong>
<?php endif; ?>
</span>
</div> </div>
</div> </div>
</div> </div>
<div class="row p-2"> <div class="row p-2">
<div class="col-4 h-100"> <div class="col-3 h-100">
<div class="row px-2 d-flex flex justify-content-between align-items-center"> <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-white" ?> "> <div class="col-6 w-100 text-center">
<span class="<?= $ot->fecha_entrega_warning ? "text-white" : "text-black" ?>" id="fecha_encuadernado_at"><strong><?= $pedido->fecha_encuadernado ? Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->format('d/m/Y') : "" ?></strong></span> <span id="fecha_encuadernado_at" style="color:<?= $colors["general"]["color"] ?>;"><strong><?= $pedido->fecha_encuadernado ? Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->format('d/m/Y') : "??" ?></strong></span>
</div>
<div 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> </div>
<div class="row px-2 mt-2 h-100"> <div class="row px-2 mt-2 h-100">
<table class="h-100"> <table class="h-100">
<tr class="t-row"> <tr>
<th class="t-header">IN</th> <th>IN</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td> <td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr> </tr>
<tr class="t-row"> <tr>
<th class="t-header">PO</th> <th>PORT.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td> <td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr> </tr>
<tr class="t-row"> <tr>
<th class="t-header">PL</th> <th>ACABAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td> <td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr> </tr>
<tr class="t-row"> <tr>
<th class="t-header">EN</th> <th>ENCUAD.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td> <td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr> </tr>
<tr class="t-row"> <tr>
<th class="t-header">MA</th> <th>MANIPUL.</th>
<td class="t-cell bg-white"><?= $ubicacion ?></td> <td class="t-cell bg-white"><?= $ubicacion ?></td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-5">
<div class="row h-100"> <div class="row">
<div class="col-6 h-50 square text-center text-dark bg-white border border-right border-dark"> <div class="col-12 w-50 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;">
<strong><?= isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "?" : "?" ?></strong>
</div>
</div>
<div class="row h-75">
<div class="col-6 square text-center" style="background-color: <?= $colors["papel_interior"]["bg"] ?>;color:<?= $colors["papel_interior"]["color"] ?>;">
<?= $linea_impresion->papel_impresion()->papel_code_ot ?> <?= $linea_impresion->papel_impresion()->papel_code_ot ?>
</div> </div>
<div class="col-6 h-50 square text-center <?=$linea_impresion->isColor() ? "cmyk" : "bn" ?> border border-right border-dark"> <div class="col-6 square text-center <?= $linea_impresion->isColor() ? "cmyk" : "bn" ?>">
<?= $tiempo_procesamiento ?> <?= $tiempo_impresion ?>
</div> </div>
<div class="col-6 h-50 square bg-primary text-center text-white border border-right border-dark"> <div class="col-6 square text-center" style="background-color: <?= $colors["papel_cubierta"]["bg"] ?>;color:<?= $colors["papel_cubierta"]["color"] ?>;">
<?= $linea_cubierta->papel_impresion()->papel_code_ot ?> <?= $linea_cubierta->papel_impresion()->papel_code_ot ?>
</div> </div>
<div class="col-6 h-50 square bg-blue text-center text-dark bg-secondary border border-right border-dark"> <div class="col-6 square text-center" style="background-color: <?= $colors["plastificado"]["bg"] ?>;color:<?= $colors["plastificado"]["color"] ?>;">
<?= isset($acabados[0]) ? $acabados[0]->tarifa()->code : "" ?> <?= isset($acabados[0]) ? $acabados[0]->tarifa()->code : "" ?>
</div> </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> </div>
<div class="col-4 bg-warning border border-dark"> <div class="col-4" style="background-color: <?= $colors["ot"]["bg"] ?>">
<div class="row h-100"> <div class="row h-100">
<div class="col-12 h-25 d-flex flex align-items-center justify-content-center"> <div class="col-12 h-50 d-flex flex align-items-center justify-content-center">
<span class="fs-large text-white"><strong><?= $ot->id ?></strong></span> <span class="fs-large" style="color:<?= $colors["ot"]["color"] ?>;"><strong><?= $ot->id ?></strong></span>
</div> </div>
<div class="col-12 h-75 d-flex flex align-items-center justify-content-center bg-white"> <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" /> <img class="img-fluid" src="data:image/png;base64,<?= $ot->bar_code ?>" alt="barcode" />
</div> </div>
@ -132,25 +151,25 @@ $settings = $session->get('settings');
<div class="col-8"> <div class="col-8">
<table class="h-50"> <table class="h-50">
<tr> <tr>
<th >Cliente</th> <th>CLIENTE</th>
<td class="t-cell"> <td class="t-cell">
<?= $cliente->nombre ?> <?= $cliente->alias ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<th >Titulo</th> <th>TITULO</th>
<td class="t-cell"> <td class="t-cell">
<?= $presupuesto->titulo ?> <?= $presupuesto->titulo ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<th >ISBN</th> <th>ISBN</th>
<td class="t-cell"><?= $presupuesto->isbn ?></td> <td class="t-cell"><?= $presupuesto->isbn ?></td>
</tr> </tr>
<tr> <tr>
<th >CIF</th> <th>PEDIDO CLIENTE</th>
<td class="t-cell"><?= $cliente->cif ?></td> <td class="t-cell"><?= $pedido->id ?></td>
</tr> </tr>
</table> </table>
</div> </div>
@ -200,14 +219,14 @@ $settings = $session->get('settings');
<div> <div>
<table> <table>
<tr> <tr>
<th class="t-header" style="width: 10%;"><?=lang('Produccion.size')?></th> <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> <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> <th class="t-header" style="width: 10%;"><?= lang('Produccion.ejemplares') ?></th>
<td class="t-cell text-center"> <?=$presupuesto->tirada ?> </td> <td class="t-cell text-center"> <?= $presupuesto->tirada ?> </td>
<th class="t-header" style="width: 10%;"><?=lang('Produccion.tipo')?></th> <th class="t-header" style="width: 10%;"><?= lang('Produccion.tipo') ?></th>
<td class="t-cell text-center"> <?=$linea_impresion->tipo ?> </td> <td class="t-cell text-center"> <?= $linea_impresion->tipo ?> </td>
<th class="t-header" style="width: 10%;"><?=lang('Produccion.lomo')?></th> <th class="t-header" style="width: 10%;"><?= lang('Produccion.lomo') ?></th>
<td class="t-cell text-center"> <?=number_format($presupuesto->lomo_cubierta,2,',','.') ?> </td> <td class="t-cell text-center"> <?= number_format($presupuesto->lomo_cubierta, 2, ',', '.') ?> </td>
</tr> </tr>
</table> </table>
<table> <table>
@ -296,7 +315,7 @@ $settings = $session->get('settings');
<th class="t-header" style="width: 10%;">Plastificado</th> <th class="t-header" style="width: 10%;">Plastificado</th>
<td class="t-cell text-center"><?= $acabados[0]->tarifa()->nombre ?></td> <td class="t-cell text-center"><?= $acabados[0]->tarifa()->nombre ?></td>
<th class="t-header" style="width: 10%;">UVI</th> <th class="t-header" style="width: 10%;">UVI</th>
<td class="t-cell text-center"> ?? </td> <td class="t-cell text-center"> <?= $uvi ? $uvi->code : "" ?> </td>
<th class="t-header" style="width: 10%;">Máquina</th> <th class="t-header" style="width: 10%;">Máquina</th>
<td class="t-cell text-center"><?= implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> </td> <td class="t-cell text-center"><?= implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> </td>
<th class="t-header " style="width: 10%;">Operario</th> <th class="t-header " style="width: 10%;">Operario</th>
@ -319,7 +338,7 @@ $settings = $session->get('settings');
<td><?= $value->tarifa()->nombre ?></td> <td><?= $value->tarifa()->nombre ?></td>
<td><?= $presupuesto->solapas ? "SI" : "NO" ?></td> <td><?= $presupuesto->solapas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td> <td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
<td>_____<?=" ".lang("Produccion.pliegos_de")." "?>_____</td> <td>_____<?= " " . lang("Produccion.pliegos_de") . " " ?>_____</td>
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td> <td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td> <td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td> <td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>

View File

@ -1,5 +1,4 @@
$(() => { $(() => {
console.log("PDF")
var opt = { var opt = {
margin: 2, margin: 2,
filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf", filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",

View File

@ -39,7 +39,7 @@ body{
align-content : center; align-content : center;
justify-content: center; justify-content: center;
font-weight: bold; font-weight: bold;
font-size : 20px; font-size : 14px;
} }
.esquema{ .esquema{