diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php
index 2b8b0b45..e6888b26 100755
--- a/ci4/app/Config/Routes.php
+++ b/ci4/app/Config/Routes.php
@@ -575,6 +575,7 @@ $routes->group(
function ($routes) {
$routes->get('index/(:num)', 'PrintAlbaranes::index/$1', ['as' => 'viewAlbaranPDF']);
$routes->get('generar/(:num)', 'PrintAlbaranes::generar/$1', ['as' => 'albaranToPdf']);
+ $routes->get('generar-anonimo/(:num)', 'PrintAlbaranes::generarAnonimo/$1', ['as' => 'albaranAnonimoToPdf']);
}
);
diff --git a/ci4/app/Controllers/Pdf/PrintAlbaranes.php b/ci4/app/Controllers/Pdf/PrintAlbaranes.php
index 4ebaeb73..56da19e5 100755
--- a/ci4/app/Controllers/Pdf/PrintAlbaranes.php
+++ b/ci4/app/Controllers/Pdf/PrintAlbaranes.php
@@ -71,4 +71,55 @@ class PrintAlbaranes extends BaseController
->setHeader('Content-Length', strlen($output))
->setBody($output);
}
+
+ public function generarAnonimo($albaran_id)
+ {
+
+ // Cargar modelos
+ $albaranModel = model('App\Models\Albaranes\AlbaranModel');
+ $lineasAlbaranModel = model('App\Models\Albaranes\AlbaranLineaModel');
+
+ // Informacion del presupuesto
+ $data['albaran'] = $albaranModel->getResourceForPdf($albaran_id)->get()->getRow();
+ $data['albaranLineas'] = $lineasAlbaranModel->getResourceForPdf($albaran_id)->get()->getResultObject();
+
+
+ // Obtener contenido HTML de la vista
+ $html = view(getenv('theme.path') . 'pdfs/albaran-anonimo', $data);
+
+ // Cargar CSS desde archivo local
+ $css = file_get_contents(FCPATH . 'themes/vuexy/css/pdf.albaran.css');
+ // Combinar CSS y HTML
+ $html_con_css = "" . $html;
+
+ // Crear una instancia de Dompdf
+ $options = new \Dompdf\Options();
+ $options->set('isHtml5ParserEnabled', true);
+ $options->set('isPhpEnabled', true);
+ $options->set('isRemoteEnabled', true);
+ $dompdf = new \Dompdf\Dompdf($options);
+
+ // Contenido HTML del documento
+ $dompdf->loadHtml($html_con_css);
+
+ // Establecer el tamaño del papel
+ $dompdf->setPaper('A4', 'portrait');
+
+ // Renderizar el PDF
+ $dompdf->render();
+
+ // Obtener el contenido generado
+ $output = $dompdf->output();
+
+ // Establecer las cabeceras para visualizar en lugar de descargar
+ $file_name = "alabaran-$albaran_id.pdf";
+ return $this->response
+ ->setStatusCode(200)
+ ->setHeader('Content-Type', 'application/pdf')
+ ->setHeader('Content-Disposition', 'inline; filename="' . $file_name . '"')
+ ->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
+ ->setHeader('Pragma', 'public')
+ ->setHeader('Content-Length', strlen($output))
+ ->setBody($output);
+ }
}
\ No newline at end of file
diff --git a/ci4/app/Language/es/Albaran.php b/ci4/app/Language/es/Albaran.php
index fcfcb674..67dc8b37 100644
--- a/ci4/app/Language/es/Albaran.php
+++ b/ci4/app/Language/es/Albaran.php
@@ -28,6 +28,7 @@ return [
'addIva' => 'Añadir IVA',
'nuevaLinea' => 'Nueva línea',
'imprimirAlbaran' => 'Imprimir albarán',
+ 'imprimirAlbaranAnonimo' => 'Imprimir albarán anónimo',
'borrarAlbaran' => 'Borrar albarán',
'borrarAlbaranConfirm' => '¿Está seguro de que desea borrar el albarán?',
'borrar' => 'Borrar',
diff --git a/ci4/app/Views/themes/vuexy/pdfs/albaran-anonimo.php b/ci4/app/Views/themes/vuexy/pdfs/albaran-anonimo.php
new file mode 100644
index 00000000..db93eda4
--- /dev/null
+++ b/ci4/app/Views/themes/vuexy/pdfs/albaran-anonimo.php
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mostrar_precios == 1; ?>
+
+
+
+
+
+
+ |
+ Nº ALBARÁN:
+ |
+
+ = $albaran->id ?>
+ |
+
+ |
+
+ |
+
+ FECHA:
+ |
+
+ = $albaran->fecha_albaran ? $albaran->fecha_albaran : date('d-m-Y') ?>
+ |
+
+
+
+
+ | Cliente: = $albaran->cliente ?> |
+
+
+ | Att: = $albaran->att ?> |
+
+
+ | = $albaran->direccion ?> |
+
+
+
+
+ | Cajas: = $albaran->cajas ?> |
+
+
+
+
+
+
+
+ | Nº Unid. |
+ Pedido |
+ Título |
+ ISBN |
+ Ref. Cliente |
+
+ €/ud. |
+ Subtotal |
+
+
+
+
+
+
+ total;
+ ?>
+
+ |
+ = $linea->unidades ?>
+ |
+
+ = $linea->pedido ?>
+ |
+
+ = $linea->titulo ?>
+ |
+
+ = $linea->isbn ?>
+ |
+
+ = $linea->ref_cliente ?>
+ |
+
+
+ titulo, "IVA")): ?>
+ = number_format($linea->precio_unidad, 4, ',', '.') ?>
+
+ |
+
+ = number_format($linea->total, 2, ',', '.') ?>
+ |
+
+
+
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+ |
+ RECIBÍ
+ |
+
+
+ TOTAL
+ |
+
+ = ($total_precio) ?>
+ |
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/httpdocs/assets/js/safekat/components/albaranComponent.js b/httpdocs/assets/js/safekat/components/albaranComponent.js
index 12f1ac11..964a2053 100644
--- a/httpdocs/assets/js/safekat/components/albaranComponent.js
+++ b/httpdocs/assets/js/safekat/components/albaranComponent.js
@@ -192,6 +192,9 @@ class AlbaranComponent {
+
@@ -600,7 +603,14 @@ class AlbaranComponent {
var albaran_id = this.id;
window.open('/print-albaran/generar/'+ albaran_id , '_blank');
- });
+ });
+
+ $('#imprimir_albaran_anonimo_' + this.id).on('click', (e) => {
+
+ var albaran_id = this.id;
+ window.open('/print-albaran/generar-anonimo/'+ albaran_id , '_blank');
+
+ });
}
_initAutoNumericInputs() {