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

View File

@ -30,3 +30,6 @@ ORDER BY
-- Serial in Contratti -- Serial in Contratti
ALTER TABLE `mg_prodotti` ADD `id_riga_contratto` INT NULL AFTER `id_riga_intervento`; 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; 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\"}');