Skip to content

Commit

Permalink
Migliorate logiche options per stampe
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasalva87 committed Mar 10, 2023
1 parent c7b7999 commit 1423f98
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion templates/ordini/body.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
'.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,
Expand Down
34 changes: 17 additions & 17 deletions templates/preventivi/body.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
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>';
}

Expand Down Expand Up @@ -259,7 +259,7 @@
// 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
Expand Down Expand Up @@ -302,15 +302,15 @@
$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>';
Expand All @@ -319,23 +319,23 @@
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>';

// 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>';
Expand All @@ -344,22 +344,22 @@
// 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>';

// 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>';
Expand All @@ -368,21 +368,21 @@
// 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>';

// 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>';
Expand Down
10 changes: 8 additions & 2 deletions update/2_4_42.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)';

0 comments on commit 1423f98

Please sign in to comment.