Stampe con footer in ultima pagina

Aggiunto supporto a footer specifici per l'ultima pagina della stampa: vengono **aggiunti** al footer presente di default con una distanza fissa dal bordo in basso.
This commit is contained in:
Thomas Zilio 2019-07-29 16:54:20 +02:00
parent e9f1c1da34
commit 56f4e10e84
17 changed files with 84 additions and 58 deletions

View File

@ -100,7 +100,7 @@ $_SESSION['superselect']['idsede_destinazione'] = $record['idsede_destinazione']
?>
</div>
</div>
<?php
// Conteggio numero articoli ddt in uscita
$articolo = $dbo->fetchArray('SELECT mg_articoli.id FROM ((mg_articoli INNER JOIN dt_righe_ddt ON mg_articoli.id=dt_righe_ddt.idarticolo) INNER JOIN dt_ddt ON dt_ddt.id=dt_righe_ddt.idddt) WHERE dt_ddt.id='.prepare($id_record));
@ -109,7 +109,7 @@ $_SESSION['superselect']['idsede_destinazione'] = $record['idsede_destinazione']
<div class="col-md-3">
{[ "type": "select", "label": "<?php echo ($dir == 'uscita') ? tr('Fornitore') : tr('Destinatario'); ?>", "name": "idanagrafica", "required": 1, "value": "$idanagrafica$", "ajax-source": "clienti_fornitori" ]}
</div>
<?php
if ($dir == 'entrata') {
?>
@ -127,7 +127,7 @@ $_SESSION['superselect']['idsede_destinazione'] = $record['idsede_destinazione']
</div>
<div class="col-md-3">
{[ "type": "select", "label": "<?php echo tr('Destinazione merce'); ?>", "name": "idsede_destinazione", "ajax-source": "sedi_azienda", "value": "$idsede_destinazione$" ]}
</div>
</div>
<?php
}
@ -182,7 +182,7 @@ $_SESSION['superselect']['idsede_destinazione'] = $record['idsede_destinazione']
$("#idvettore").next().next().find("button.bound:nth-child(1)").prop("disabled", false);
}
});
$("#idcausalet").change( function(){
if ($(this).val() == 3) {
$("#tipo_resa").attr("disabled", false);

View File

@ -13,9 +13,12 @@ if ($module['name'] == 'Ddt di vendita') {
if (isset($id_record)) {
$ddt = DDT::with('tipo', 'stato')->find($id_record);
$record = $dbo->fetchOne('SELECT dt_ddt.*, dt_ddt.note, dt_ddt.idpagamento, dt_ddt.id AS idddt, dt_statiddt.descrizione AS `stato`, dt_tipiddt.descrizione AS `descrizione_tipodoc`,
(SELECT tipo FROM an_anagrafiche WHERE idanagrafica = dt_ddt.idanagrafica) AS tipo_anagrafica,
(SELECT completato FROM dt_statiddt WHERE dt_statiddt.id=dt_ddt.idstatoddt) AS flag_completato
$record = $dbo->fetchOne('SELECT dt_ddt.*,
dt_ddt.id AS idddt,
dt_statiddt.descrizione AS `stato`,
dt_statiddt.completato AS `flag_completato`,
dt_tipiddt.descrizione AS `descrizione_tipodoc`,
an_anagrafiche.tipo AS tipo_anagrafica
FROM dt_ddt
LEFT OUTER JOIN dt_statiddt ON dt_ddt.idstatoddt=dt_statiddt.id
INNER JOIN an_anagrafiche ON dt_ddt.idanagrafica=an_anagrafiche.idanagrafica
@ -30,7 +33,7 @@ if (isset($id_record)) {
// Se la sede del ddt non è di mia competenza, blocco il ddt in modifica
$field_name = ($dir == 'entrata') ? 'idsede_partenza' : 'idsede_destinazione';
if (!in_array($record[$field_name], $user->sedi)) {
if (!Auth::admin() && !in_array($record[$field_name], $user->sedi)) {
$record['flag_completato'] = 1;
}
}

View File

@ -437,10 +437,8 @@ class Prints
'font-size' => $settings['font-size'],
'margin_left' => $settings['margins']['left'],
'margin_right' => $settings['margins']['right'],
'margin_top' => $settings['margins']['top'] + $settings['header-height'],
'margin_bottom' => $settings['margins']['bottom'] + $settings['footer-height'],
'margin_header' => $settings['margins']['top'],
'margin_footer' => $settings['margins']['bottom'],
'setAutoBottomMargin' => 'stretch',
'setAutoTopMargin' => 'stretch',
// Abilitazione per lo standard PDF/A
//'PDFA' => true,
@ -478,14 +476,14 @@ class Prints
include self::filepath($id_print, 'header.php');
$head = ob_get_clean();
// Header di default
$head = !empty($head) ? $head : '$default_header$';
// Generazione dei contenuti del footer
ob_start();
include self::filepath($id_print, 'footer.php');
$foot = ob_get_clean();
// Header di default
$head = !empty($head) ? $head : '$default_header$';
// Footer di default
$foot = !empty($foot) ? $foot : '$default_footer$';
@ -493,8 +491,8 @@ class Prints
include DOCROOT.'/templates/replace.php';
// Impostazione di header e footer
$mpdf->SetHTMLFooter($foot);
$mpdf->SetHTMLHeader($head);
$mpdf->SetHTMLFooter($foot);
// Generazione dei contenuti della stampa
@ -526,6 +524,16 @@ class Prints
$report = '';
}
// Footer per l'ultima pagina
if (!empty($options['last-page-footer'])) {
$is_last_page = true;
// Generazione dei contenuti del footer
ob_start();
include self::filepath($id_print, 'footer.php');
$foot = ob_get_clean();
}
// Operazioni di sostituzione
include DOCROOT.'/templates/replace.php';
@ -541,6 +549,13 @@ class Prints
// Aggiunta dei contenuti
$mpdf->WriteHTML($report);
// Impostazione footer per l'ultima pagina
if (!empty($options['last-page-footer'])) {
$mpdf->WriteHTML('<div class="fake-footer">'.$foot.'</div>');
$mpdf->WriteHTML('<div style="position:absolute; bottom: 13mm; margin-right: '.($settings['margins']['right']).'mm">'.$foot.'</div>');
}
// Creazione effettiva del PDF
$mpdf->Output($path, $mode);

View File

@ -10,8 +10,6 @@ $settings = [
'left' => 12,
'right' => 12,
],
'header-height' => 35,
'footer-height' => 5,
'header-font-size' => 10,
];

View File

@ -122,3 +122,18 @@ table#contents tbody td {
.cell-padded {
padding: 4px;
}
.fake-footer p,
.fake-footer table,
.fake-footer table.table-bordered th,
.fake-footer table.table-striped tbody tr td,
.fake-footer th,
.fake-footer tbody,
.fake-footer thead,
.fake-footer tfoot,
.fake-footer td,
.fake-footer tr {
color: white !important;
background: none !important;
border-color: white !important;
}

View File

@ -6,5 +6,4 @@ $orientation = (isset($_SESSION['settings']['orientation'])) ? $_SESSION['settin
return [
'format' => $format,
'orientation' => $orientation,
// 'header-height' => 0,
];

View File

@ -4,7 +4,11 @@ include_once __DIR__.'/../../core.php';
// Creazione righe fantasma
$autofill = new \Util\Autofill($options['pricing'] ? 5 : 2);
$autofill->setRows(16);
$rows_per_page = 16;
if (!empty($options['last-page-footer'])) {
$rows_per_page += 10;
}
$autofill->setRows($rows_per_page);
// Intestazione tabella per righe
echo "

View File

@ -1,5 +1,9 @@
<?php
if (!empty($options['last-page-footer']) && !$is_last_page) {
return;
}
// Calcoli
$imponibile = $documento->imponibile;
$sconto = $documento->sconto;
@ -180,5 +184,6 @@ echo '
</tr>
</table>';
echo '
$default_footer$';
if (empty($options['last-page-footer'])) {
echo '$default_footer$';
}

View File

@ -48,8 +48,6 @@ if (!empty($documento['idsede_destinazione'])) {
if (!empty($rsd[0]['provincia'])) {
$destinazione .= ' ('.$rsd[0]['provincia'].')';
}
$settings['header-height'] += 8;
}
// Sostituzioni specifiche

View File

@ -1,6 +0,0 @@
<?php
return [
'header-height' => 67,
'footer-height' => 80,
];

View File

@ -6,8 +6,12 @@ $v_iva = [];
$v_totale = [];
// Creazione righe fantasma
$autofill = new \Util\Autofill(5, 70);
$autofill->setRows($fattura_accompagnatoria ? 15 : 20, $fattura_accompagnatoria ? 10 : 15);
$autofill = new \Util\Autofill(5, 40);
$rows_per_page = $fattura_accompagnatoria ? 15 : 20;
if (!empty($options['last-page-footer'])) {
$rows_per_page += 10;
}
$autofill->setRows($rows_per_page);
// Intestazione tabella per righe
echo "

View File

@ -1,5 +1,9 @@
<?php
if (!empty($options['last-page-footer']) && !$is_last_page) {
return;
}
// Calcoli
$imponibile = abs($documento->imponibile);
$sconto = $documento->sconto;
@ -391,18 +395,6 @@ echo '
</tr>
</table>';
if ($options['hide_footer']) {
echo '
<table style="color:#aaa; font-size:10px;">
<tr>
<td align="left" style="width:97mm; height:5mm;">
&nbsp;
</td>
<td align="right" style="width:97mm;">
&nbsp;
</td>
</tr>
</table>';
} else {
if (empty($options['last-page-footer'])) {
echo '$default_footer$';
}

View File

@ -70,8 +70,6 @@ if (!empty($record['idsede_destinazione'])) {
if (!empty($rsd[0]['provincia'])) {
$destinazione .= ' ('.$rsd[0]['provincia'].')';
}
$settings['header-height'] += 15;
}
// Sostituzioni specifiche

View File

@ -1,6 +0,0 @@
<?php
return [
'header-height' => 70,
'footer-height' => 55,
];

View File

@ -87,10 +87,12 @@ foreach ($replace as $prefix => $values) {
// Header di default
$header_file = App::filepath('templates/base|custom|/header.php');
$default_header = include $header_file;
$default_header = !empty($options['hide-header']) ? '' : $default_header;
// Footer di default
$footer_file = App::filepath('templates/base|custom|/footer.php');
$default_footer = include $footer_file;
$default_footer = !empty($options['hide-footer']) ? '' : $default_footer;
// Logo di default
$default_logo = App::filepath('templates/base|custom|/logo_azienda.jpg');

View File

@ -1,5 +0,0 @@
<?php
return [
'header-height' => 60,
];

View File

@ -1,4 +1,6 @@
UPDATE `zz_prints` SET `filename` = 'Preventivo num. {numero} del {data}' WHERE `name` = 'Preventivo (senza totali)';
UPDATE `zz_prints` SET `filename` = 'Fattura num. {numero} del {data}' WHERE `name` = 'Fattura di vendita (senza intestazione)';
UPDATE `zz_prints` SET `filename` = 'Calendario' WHERE `name` = 'Stampa calendario';
DELETE FROM `zz_plugins` WHERE `name` = 'Pianificazione ordini di servizio';
@ -250,3 +252,11 @@ INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`,
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Nome', 'name', 2, 1, 0, 0, 1),
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Modulo', '(SELECT name FROM zz_modules WHERE id = zz_checklists.id_module)', 5, 1, 0, 1, 1),
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Plugin', '(SELECT name FROM zz_plugins WHERE id = zz_checklists.id_plugin)', 5, 1, 0, 1, 1);
-- Miglioramento gestione header e footer per le stampe
UPDATE `zz_prints` SET `options` = REPLACE(`options`, "hide_header", "hide-header");
UPDATE `zz_prints` SET `options` = REPLACE(`options`, "hide_footer", "hide-footer");
UPDATE `zz_prints` SET `options` = '{"last-page-footer": true}' WHERE `zz_prints`.`name` = 'Fattura di vendita';
UPDATE `zz_prints` SET `options` = '{"hide-header": true, "hide-footer": true, "last-page-footer": true}' WHERE `zz_prints`.`name` = 'Fattura di vendita (senza intestazione)';
UPDATE `zz_prints` SET `options` = '{"pricing":true, "last-page-footer": true}' WHERE `zz_prints`.`name` = 'Ordine cliente';
UPDATE `zz_prints` SET `options` = '{"pricing":false, "last-page-footer": true}' WHERE `zz_prints`.`name` = 'Ordine cliente (senza costi)';