Aggiunta stampa preventivo (solo totale imponibile)

This commit is contained in:
Pek5892 2023-11-14 10:48:04 +01:00
parent c762f8fa55
commit 1d0efdf6d3
2 changed files with 69 additions and 48 deletions

View File

@ -58,7 +58,7 @@ $has_image = $righe->search(function ($item) {
return !empty($item->articolo->immagine);
}) !== false && $options['images'] == true;
$columns = 6;
$columns = $options['no-iva'] ? 5 : 6;
$columns = $options['pricing'] ? $columns : 3;
if ($has_image) {
@ -170,8 +170,12 @@ echo "
if ($options['pricing']) {
echo "
<th class='text-center' style='width:15%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
<th class='text-center' style='width:10%'>".tr('IVA', [], ['upper' => true])." (%)</th>
<th class='text-center' style='width:15%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>";
if (!$options['no-iva']) {
echo"
<th class='text-center' style='width:10%'>".tr('IVA', [], ['upper' => true])." (%)</th>";
}
echo"
<th class='text-center' style='width:15%'>".($options['hide-total'] ? tr('Importo ivato', [], ['upper' => true]) : tr('Importo', [], ['upper' => true])).'</th>';
}
@ -273,13 +277,13 @@ foreach ($righe as $key => $riga) {
echo '
</td>';
if (!$options['no-iva']) {
// Iva
echo '
<td class="text-center" style="vertical-align: middle">
'.Translator::numberToLocale($riga->aliquota->percentuale, 2).'
</td>';
}
// Imponibile
echo '
<td class="text-right" style="vertical-align: middle" >
@ -293,8 +297,11 @@ foreach ($righe as $key => $riga) {
if ($options['pricing']) {
echo '
<td></td>
<td></td>
<td></td>';
if (!$options['no-iva']) {
echo'
<td></td>';
}
}
}
}
@ -314,8 +321,9 @@ foreach ($righe as $key => $riga) {
<td colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
'.moneyFormat($subtotale_gruppo, 2).'
</td>
</tr>
</tr>';
if (!$options['no-iva']) {
echo'
<tr>
<td colspan="'.($options['show-only-total'] ? 2 : 5).'" class="text-right">
<b>'.tr('Iva', [], ['upper' => true]).':</b>
@ -324,16 +332,15 @@ foreach ($righe as $key => $riga) {
'.moneyFormat($iva_gruppo, 2).'
</td>
</tr>
<tr>
<td colspan="'.($options['show-only-total'] ? 2 : 5).'" class="text-right">
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right">
<b>'.tr('Subtotale ivato', [], ['upper' => true]).':</b>
</td>
<td colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($subtotale_gruppo + $iva_gruppo, 2).'</b>
</td>
</tr>';
}
$autofill->next();
$autofill->next();
$autofill->next();
@ -360,11 +367,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'] ? ($options['no-iva'] ?3: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) ? ($options['no-iva'] ? 1 : 2) : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, 2).'</b>
</th>
</tr>';
@ -396,6 +403,7 @@ if (($options['pricing'] && !isset($options['hide-total'])) || $options['show-on
}
// IVA
if (!$options['no-iva']) {
echo '
<tr>
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
@ -441,11 +449,21 @@ if (($options['pricing'] && !isset($options['hide-total'])) || $options['show-on
</th>
</tr>';
}
}
}
echo '
</table>';
if ($options['no-iva']) {
echo'
<p colspan="3" class="text-right text-muted">
<small>Importo IVA esclusa</small>
</p>
';
}
// CONDIZIONI GENERALI DI FORNITURA
echo '

View File

@ -30,3 +30,6 @@ ORDER BY
-- Serial in Contratti
ALTER TABLE `mg_prodotti` ADD `id_riga_contratto` INT NULL AFTER `id_riga_intervento`;
ALTER TABLE `mg_prodotti` ADD FOREIGN KEY (`id_riga_contratto`) REFERENCES `co_righe_contratti`(`id`) ON DELETE CASCADE;
-- Aggiunta stampa preventivo (solo totale imponibile)
INSERT INTO `zz_prints` (`id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`, `available_options`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Preventivi'), '1', 'Preventivo(solo totale imponibile)', 'Preventivo (solo totale imponibile)', 'Preventivo num. {numero} del {data} rev {revisione}', 'preventivi', 'idpreventivo', '{\"pricing\": false, \"last-page-footer\": true, \"images\": true, \"no-iva\":true, \"show-only-total\":true }', 'fa fa-print', '', '', '0', '0', '1', '1', '{\"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\"}');