mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fix pod and file if not exist
This commit is contained in:
@ -74,7 +74,7 @@ class OrdenTrabajoEntity extends Entity
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll();
|
||||
}
|
||||
public function tareas_impresion() : array
|
||||
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() ?? [];
|
||||
@ -144,11 +144,13 @@ class OrdenTrabajoEntity extends Entity
|
||||
helper('filesystem');
|
||||
$path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"];
|
||||
$portada_path = null;
|
||||
if ($path) {
|
||||
if (file_exists($path)) {
|
||||
$portada_path = $path;
|
||||
} else {
|
||||
$portada_path = null;
|
||||
if ($this->attributes["portada_path"]) {
|
||||
if ($path) {
|
||||
if (file_exists($path)) {
|
||||
$portada_path = $path;
|
||||
} else {
|
||||
$portada_path = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $portada_path;
|
||||
|
||||
@ -44,7 +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->full_path ? "data:image/png;base64," . base64_encode(file_get_contents($ot->full_path)) : '/assets/img/portada_not_found.png' ?>" />
|
||||
<?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">
|
||||
@ -58,7 +64,7 @@ $settings = $session->get('settings');
|
||||
<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>ROTATIVA</strong>
|
||||
<strong>POD</strong>
|
||||
<?php elseif ($presupuesto->presupuestoLineaImpresion()->isRotativa()): ?>
|
||||
<strong>ROTATIVA</strong>
|
||||
<?php else: ?>
|
||||
@ -241,8 +247,8 @@ $settings = $session->get('settings');
|
||||
<th>Tiempo</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?= $presupuesto->paginas ?></td>
|
||||
<td><?= $presupuesto->tirada ?> </td>
|
||||
<td><?= $presupuesto->paginas * $presupuesto->tirada ?></td>
|
||||
<td><?= $presupuesto->tirada ?> </td>
|
||||
<td>??</td>
|
||||
<td><?= json_decode($linea_impresion->formas)->formas ?></td>
|
||||
<td><strong><?= $linea_impresion->maquina()->nombre ?></strong></td>
|
||||
@ -252,7 +258,11 @@ $settings = $session->get('settings');
|
||||
<tr>
|
||||
<td colspan="4"><?= $linea_impresion->papel_impresion ?></td>
|
||||
<td><?= $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?></td>
|
||||
<td colspan="2"><?= number_format($linea_impresion->rotativa_metros_total, 2, ',', '.') ?> metros</td>
|
||||
<td colspan="2">
|
||||
<?php if ($linea_impresion->isRotativa()): ?>
|
||||
<?= number_format($linea_impresion->rotativa_metros_total, 2, ',', '.') ?> metros
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
$(() => {
|
||||
var opt = {
|
||||
margin: 2,
|
||||
filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",
|
||||
image: { type: 'jpeg', quality: 1 },
|
||||
html2canvas: { scale: 4 },
|
||||
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
|
||||
};
|
||||
let elementToPdf = $('body')[0]
|
||||
html2pdf().set(opt).from(elementToPdf).save()
|
||||
// var opt = {
|
||||
// margin: 2,
|
||||
// filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",
|
||||
// image: { type: 'jpeg', quality: 1 },
|
||||
// html2canvas: { scale: 4 },
|
||||
// jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
|
||||
// };
|
||||
// let elementToPdf = $('body')[0]
|
||||
// html2pdf().set(opt).from(elementToPdf).save()
|
||||
})
|
||||
Reference in New Issue
Block a user