Migliorate logiche options per stampe

This commit is contained in:
Luca 2023-03-10 16:38:53 +01:00
parent c7b79990a8
commit 1423f98e40
3 changed files with 26 additions and 20 deletions

View File

@ -128,7 +128,7 @@ foreach ($righe as $riga) {
'.nl2br($r['descrizione']);
if ($riga->isArticolo()) {
if ($documento->direzione == 'entrata' && !$options['hide_codice']) {
if ($documento->direzione == 'entrata' && !$options['hide-item-number']) {
// Codice articolo
$text = tr('COD. _COD_', [
'_COD_' => $riga->codice,

View File

@ -171,7 +171,7 @@ echo "
if ($options['pricing']) {
echo "
<th class='text-center' style='width:15%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
<th class='text-center' style='width:15%'>".( $options['hide_total'] ? tr('Importo ivato', [], ['upper' => true ]) : tr( 'Importo', [], ['upper' => true]) )."</th>
<th class='text-center' style='width:15%'>".( $options['hide-total'] ? tr('Importo ivato', [], ['upper' => true ]) : tr( 'Importo', [], ['upper' => true]) )."</th>
<th class='text-center' style='width:10%'>".tr('IVA', [], ['upper' => true]).' (%)</th>';
}
@ -259,7 +259,7 @@ foreach ($righe as $riga) {
// Imponibile
echo '
<td class="text-right" style="vertical-align: middle" >
'.( ($options['hide_total'] || $prezzi_ivati) ? moneyFormat($riga->totale) : moneyFormat($riga->totale_imponibile) ).'
'.( ($options['hide-total'] || $prezzi_ivati) ? moneyFormat($riga->totale) : moneyFormat($riga->totale_imponibile) ).'
</td>';
// Iva
@ -302,15 +302,15 @@ $netto_a_pagare = $documento->netto;
$show_sconto = $sconto > 0;
// TOTALE COSTI FINALI
if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_only_total']) {
if (($options['pricing'] && !isset($options['hide-total'])) || $options['show-only-total']) {
// Totale imponibile
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, 2).'</b>
</th>
</tr>';
@ -319,11 +319,11 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
if ($show_sconto) {
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Sconto', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($sconto, 2).'</b>
</th>
</tr>';
@ -331,11 +331,11 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
// Totale imponibile
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Totale imponibile', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($totale_imponibile, 2).'</b>
</th>
</tr>';
@ -344,11 +344,11 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
// IVA
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Totale IVA', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($totale_iva, 2).'</b>
</th>
</tr>';
@ -356,10 +356,10 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
// TOTALE
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Totale documento', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($totale, 2).'</b>
</th>
</tr>';
@ -368,10 +368,10 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
// SCONTO IN FATTURA
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Sconto in fattura', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($sconto_finale, 2).'</b>
</th>
</tr>';
@ -379,10 +379,10 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
// NETTO A PAGARE
echo '
<tr>
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Netto a pagare', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show_only_total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($netto_a_pagare, 2).'</b>
</th>
</tr>';

View File

@ -28,5 +28,11 @@ UPDATE `zz_settings` SET `valore` = 'col-md-3', `tipo` = 'list[col-md-1,col-md-2
UPDATE `zz_widgets` SET `class` = NULL;
-- Aggiunto available_options per zz_prints
ALTER TABLE `zz_prints` ADD `available_options` VARCHAR(255) NULL AFTER `enabled`;
UPDATE `zz_prints` SET `available_options` = '{"pricing":"Visualizza prezzi sulla stampa", "last-page-footer": "Visualizza footer ultima pagina", "hide-item-number": "Nasconde codici degli articoli"}' WHERE `zz_prints`.`name` = 'Preventivo';
ALTER TABLE `zz_prints` ADD `available_options` TEXT NULL AFTER `enabled`;
UPDATE `zz_prints` SET `available_options` = '{\"pricing\":\"Visualizzare i prezzi\", \"hide-total\": \"Nascondere i totali delle righe\", \"show-only-total\": \"Visualizzare solo i totali del documento\", \"hide-header\": \"Nascondere intestazione\", \"hide-footer\": \"Nascondere footer\", \"last-page-footer\": \"Visualizzare footer solo su ultima pagina\", \"hide-item-number\": \"Nascondere i codici degli articoli\"}' WHERE `zz_prints`.`name` = 'Preventivo';
UPDATE `zz_prints` SET `options` = '{\"pricing\": true, \"last-page-footer\": true, \"hide-item-number\": true}' WHERE `zz_prints`.`name` = 'Ordine cliente (senza codici)';
UPDATE `zz_prints` SET `options` = '{\"pricing\":true, \"hide-total\":true}' WHERE `zz_prints`.`name` = 'Preventivo (senza totali)';
UPDATE `zz_prints` SET `options` = '{\"pricing\":false, \"show-only-total\":true}' WHERE `zz_prints`.`name` = 'Preventivo (solo totale)';