2020-10-13 17:50:37 +02:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-10-13 17:50:37 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2023-05-19 11:41:11 +02:00
|
|
|
$totale_iva_vendite = sum(array_column($iva_vendite, 'iva'), null, 2);
|
|
|
|
$totale_subtotale_vendite = sum(array_column($iva_vendite, 'subtotale'), null, 2);
|
|
|
|
$totale_iva_acquisti = sum(array_column($iva_acquisti, 'iva'), null, 2);
|
|
|
|
$totale_subtotale_acquisti = sum(array_column($iva_acquisti, 'subtotale'), null, 2);
|
|
|
|
|
|
|
|
$totale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'iva'), null, 2);
|
|
|
|
$totale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'iva'), null, 2);
|
|
|
|
$subtotale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'subtotale'), null, 2);
|
|
|
|
$subtotale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'subtotale'), null, 2);
|
|
|
|
|
|
|
|
$totale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'iva'), null, 2);
|
|
|
|
$totale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'iva'), null, 2);
|
|
|
|
$subtotale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'subtotale'), null, 2);
|
|
|
|
$subtotale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'subtotale'), null, 2);
|
|
|
|
|
|
|
|
$totale_iva_vendite_anno_precedente = sum(array_column($iva_vendite_anno_precedente, 'iva'), null, 2);
|
|
|
|
$totale_iva_acquisti_anno_precedente = sum(array_column($iva_acquisti_anno_precedente, 'iva'), null, 2);
|
2020-10-13 17:50:37 +02:00
|
|
|
$totale_iva_anno_precedente = $totale_iva_vendite_anno_precedente - $totale_iva_acquisti_anno_precedente;
|
|
|
|
|
2023-05-19 11:41:11 +02:00
|
|
|
$totale_iva_vendite_periodo_precedente = sum(array_column($iva_vendite_periodo_precedente, 'iva'), null, 2);
|
|
|
|
$totale_iva_acquisti_periodo_precedente = sum(array_column($iva_acquisti_periodo_precedente, 'iva'), null, 2);
|
2020-10-13 17:50:37 +02:00
|
|
|
$totale_iva_periodo_precedente = $totale_iva_vendite_periodo_precedente - $totale_iva_acquisti_periodo_precedente;
|
|
|
|
|
|
|
|
$totale_iva = $totale_iva_esigibile - $totale_iva_detraibile;
|
|
|
|
|
2023-04-13 17:03:07 +02:00
|
|
|
if ($periodo['valore'] == 'Trimestrale' && $totale_iva > 25.82) {
|
2023-04-13 10:56:14 +02:00
|
|
|
if ($totale_iva_periodo_precedente < 25.82 && $totale_iva_periodo_precedente > 0) {
|
|
|
|
$totale_iva += $totale_iva_periodo_precedente;
|
|
|
|
}
|
2020-10-13 17:50:37 +02:00
|
|
|
$maggiorazione = $totale_iva * 0.01;
|
|
|
|
$totale_iva_maggiorata = $totale_iva + $maggiorazione;
|
|
|
|
}
|
|
|
|
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<h5 class="text-center">VENDITE</h5>
|
|
|
|
<table class="table table-condensed table-striped table-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="15%">Aliquota</th>
|
|
|
|
<th width="15%">Natura IVA</th>
|
|
|
|
<th width="30%">Descrizione</th>
|
|
|
|
<th class="text-right" width="20%">Imponibile</th>
|
|
|
|
<th class="text-right" width="20%">Imposta</th>
|
|
|
|
</tr>
|
2021-01-19 17:09:19 +01:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<th class="text-center" colspan="5">IVA ESIGIBILE DEL PERIODO</th>
|
2021-01-19 17:09:19 +01:00
|
|
|
</tr>';
|
2021-02-18 18:48:44 +01:00
|
|
|
|
2023-05-19 11:41:11 +02:00
|
|
|
// Somma importi arrotondati per fattura
|
2023-08-04 14:54:28 +02:00
|
|
|
$aliquote = [];
|
2023-05-19 11:41:11 +02:00
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
foreach ($iva_vendite_esigibile as $record) {
|
2023-10-27 12:24:13 +02:00
|
|
|
$aliquote[$record['descrizione']]['aliquota'] = $record['aliquota'];
|
|
|
|
$aliquote[$record['descrizione']]['cod_iva'] = $record['cod_iva'];
|
|
|
|
$aliquote[$record['descrizione']]['descrizione'] = $record['descrizione'];
|
|
|
|
$aliquote[$record['descrizione']]['subtotale'] += sum($record['subtotale'], null, 2);
|
|
|
|
$aliquote[$record['descrizione']]['iva'] += sum($record['iva'], null, 2);
|
2023-05-19 11:41:11 +02:00
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
foreach ($aliquote as $aliquota => $record) {
|
2020-10-13 17:50:37 +02:00
|
|
|
echo '
|
|
|
|
<tr>
|
2023-05-22 11:51:08 +02:00
|
|
|
<td>'.round($record['aliquota']).'%</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>'.$record['cod_iva'].'</td>
|
|
|
|
<td>'.$record['descrizione'].'</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($record['subtotale'], 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($record['iva'], 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>';
|
|
|
|
}
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<td colspan="2"></td>
|
|
|
|
<td>TOTALI</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($subtotale_iva_esigibile, 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_esigibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<th class="text-center" colspan="5">IVA NON ESIGIBILE DEL PERIODO</th>
|
|
|
|
</tr>';
|
|
|
|
|
2023-05-19 11:41:11 +02:00
|
|
|
// Somma importi arrotondati per fattura
|
2023-08-04 14:54:28 +02:00
|
|
|
$aliquote = [];
|
2023-05-19 11:41:11 +02:00
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
foreach ($iva_vendite_nonesigibile as $record) {
|
2023-10-27 12:24:13 +02:00
|
|
|
$aliquote[$record['descrizione']]['aliquota'] = $record['aliquota'];
|
|
|
|
$aliquote[$record['descrizione']]['cod_iva'] = $record['cod_iva'];
|
|
|
|
$aliquote[$record['descrizione']]['descrizione'] = $record['descrizione'];
|
|
|
|
$aliquote[$record['descrizione']]['subtotale'] += sum($record['subtotale'], null, 2);
|
|
|
|
$aliquote[$record['descrizione']]['iva'] += sum($record['iva'], null, 2);
|
2023-05-19 11:41:11 +02:00
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
foreach ($aliquote as $aliquota => $record) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
2023-05-22 11:51:08 +02:00
|
|
|
<td>'.round($record['aliquota']).'%</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>'.$record['cod_iva'].'</td>
|
|
|
|
<td>'.$record['descrizione'].'</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($record['subtotale'], 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($record['iva'], 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>';
|
|
|
|
}
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<td colspan="2"></td>
|
|
|
|
<td>TOTALI</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($subtotale_iva_nonesigibile, 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_nonesigibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<th class="text-center" colspan="5">RIEPILOGO GENERALE IVA VENDITE</th>
|
|
|
|
</tr>';
|
2023-05-19 11:41:11 +02:00
|
|
|
|
|
|
|
// Somma importi arrotondati per fattura
|
2023-08-04 14:54:28 +02:00
|
|
|
$aliquote = [];
|
2023-05-19 11:41:11 +02:00
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
foreach ($iva_vendite as $record) {
|
2023-10-27 12:24:13 +02:00
|
|
|
$aliquote[$record['descrizione']]['aliquota'] = $record['aliquota'];
|
|
|
|
$aliquote[$record['descrizione']]['cod_iva'] = $record['cod_iva'];
|
|
|
|
$aliquote[$record['descrizione']]['descrizione'] = $record['descrizione'];
|
|
|
|
$aliquote[$record['descrizione']]['subtotale'] += sum($record['subtotale'], null, 2);
|
|
|
|
$aliquote[$record['descrizione']]['iva'] += sum($record['iva'], null, 2);
|
2023-05-19 11:41:11 +02:00
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
foreach ($aliquote as $aliquota => $record) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
2023-05-22 11:51:08 +02:00
|
|
|
<td>'.round($record['aliquota']).'%</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>'.$record['cod_iva'].'</td>
|
|
|
|
<td>'.$record['descrizione'].'</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($record['subtotale'], 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($record['iva'], 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>';
|
|
|
|
}
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<th colspan="2"></th>
|
|
|
|
<th>TOTALE</th>
|
2023-03-15 09:53:31 +01:00
|
|
|
<th class=text-right>'.moneyFormat($totale_subtotale_vendite, 2).'</th>
|
|
|
|
<th class=text-right>'.moneyFormat($totale_iva_vendite, 2).'</th>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<h5 class="text-center">ACQUISTI</h5>
|
|
|
|
<table class="table table-condensed table-striped table-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="15%">Aliquota</th>
|
|
|
|
<th width="15%">Natura IVA</th>
|
|
|
|
<th width="30%">Descrizione</th>
|
|
|
|
<th class="text-right" width="20%">Imponibile</th>
|
|
|
|
<th class="text-right" width="20%">Imposta</th>
|
|
|
|
</tr>
|
2021-01-19 17:09:19 +01:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<th class="text-center" colspan="5">IVA DETRAIBILE DEL PERIODO</th>
|
2021-01-19 17:09:19 +01:00
|
|
|
</tr>';
|
2020-10-13 17:50:37 +02:00
|
|
|
|
2023-05-19 11:41:11 +02:00
|
|
|
// Somma importi arrotondati per fattura
|
2023-08-04 14:54:28 +02:00
|
|
|
$aliquote = [];
|
2023-05-19 11:41:11 +02:00
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
foreach ($iva_acquisti_detraibile as $record) {
|
2023-10-27 12:24:13 +02:00
|
|
|
$aliquote[$record['descrizione']]['aliquota'] = $record['aliquota'];
|
|
|
|
$aliquote[$record['descrizione']]['cod_iva'] = $record['cod_iva'];
|
|
|
|
$aliquote[$record['descrizione']]['descrizione'] = $record['descrizione'];
|
|
|
|
$aliquote[$record['descrizione']]['subtotale'] += sum($record['subtotale'], null, 2);
|
|
|
|
$aliquote[$record['descrizione']]['iva'] += sum($record['iva'], null, 2);
|
2023-05-19 11:41:11 +02:00
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
foreach ($aliquote as $aliquota => $record) {
|
2020-10-13 17:50:37 +02:00
|
|
|
echo '
|
|
|
|
<tr>
|
2023-05-22 11:51:08 +02:00
|
|
|
<td>'.round($record['aliquota']).'%</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>'.$record['cod_iva'].'</td>
|
|
|
|
<td>'.$record['descrizione'].'</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($record['subtotale'], 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($record['iva'], 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>';
|
|
|
|
}
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<td colspan="2"></td>
|
|
|
|
<td>TOTALI</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($subtotale_iva_detraibile, 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_detraibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<th class="text-center" colspan="5">IVA NON DETRAIBILE DEL PERIODO</th>
|
|
|
|
</tr>';
|
|
|
|
|
2023-05-19 11:41:11 +02:00
|
|
|
// Somma importi arrotondati per fattura
|
2023-08-04 14:54:28 +02:00
|
|
|
$aliquote = [];
|
2023-05-19 11:41:11 +02:00
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
foreach ($iva_acquisti_nondetraibile as $record) {
|
2023-10-27 12:24:13 +02:00
|
|
|
$aliquote[$record['descrizione']]['aliquota'] = $record['aliquota'];
|
|
|
|
$aliquote[$record['descrizione']]['cod_iva'] = $record['cod_iva'];
|
|
|
|
$aliquote[$record['descrizione']]['descrizione'] = $record['descrizione'];
|
|
|
|
$aliquote[$record['descrizione']]['subtotale'] += sum($record['subtotale'], null, 2);
|
|
|
|
$aliquote[$record['descrizione']]['iva'] += sum($record['iva'], null, 2);
|
2023-05-19 11:41:11 +02:00
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
foreach ($aliquote as $aliquota => $record) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
2023-05-22 11:51:08 +02:00
|
|
|
<td>'.round($record['aliquota']).'%</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>'.$record['cod_iva'].'</td>
|
|
|
|
<td>'.$record['descrizione'].'</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($record['subtotale'], 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($record['iva'], 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>';
|
|
|
|
}
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<td colspan="2"></td>
|
|
|
|
<td>TOTALI</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($subtotale_iva_nondetraibile, 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_nondetraibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<th class="text-center" colspan="5">RIEPILOGO GENERALE IVA ACQUISTI</th>
|
|
|
|
</tr>';
|
2023-05-19 11:41:11 +02:00
|
|
|
|
|
|
|
// Somma importi arrotondati per fattura
|
2023-08-04 14:54:28 +02:00
|
|
|
$aliquote = [];
|
2023-05-19 11:41:11 +02:00
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
foreach ($iva_acquisti as $record) {
|
2023-10-27 12:24:13 +02:00
|
|
|
$aliquote[$record['descrizione']]['aliquota'] = $record['aliquota'];
|
|
|
|
$aliquote[$record['descrizione']]['cod_iva'] = $record['cod_iva'];
|
|
|
|
$aliquote[$record['descrizione']]['descrizione'] = $record['descrizione'];
|
|
|
|
$aliquote[$record['descrizione']]['subtotale'] += sum($record['subtotale'], null, 2);
|
|
|
|
$aliquote[$record['descrizione']]['iva'] += sum($record['iva'], null, 2);
|
2023-05-19 11:41:11 +02:00
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
foreach ($aliquote as $aliquota => $record) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
2023-05-22 11:51:08 +02:00
|
|
|
<td>'.round($record['aliquota']).'%</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>'.$record['cod_iva'].'</td>
|
|
|
|
<td>'.$record['descrizione'].'</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($record['subtotale'], 2).'</td>
|
|
|
|
<td class=text-right>'.moneyFormat($record['iva'], 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
2021-02-18 18:48:44 +01:00
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<th colspan="2"></th>
|
|
|
|
<th>TOTALE</th>
|
2023-03-15 09:53:31 +01:00
|
|
|
<th class=text-right>'.moneyFormat($totale_subtotale_acquisti, 2).'</th>
|
|
|
|
<th class=text-right>'.moneyFormat($totale_iva_acquisti, 2).'</th>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<table class="table table-condensed table-striped table-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2023-05-19 11:41:11 +02:00
|
|
|
<th class="text-center" colspan="2">PROSPETTO RIEPILOGATIVO DI LIQUIDAZIONE IVA</th>
|
2020-10-13 17:50:37 +02:00
|
|
|
<tr>
|
|
|
|
<th width="70%">DESCRIZIONE</th>
|
|
|
|
<th class="text-right" width="30%">IMPORTO</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>';
|
2020-10-16 08:31:10 +02:00
|
|
|
if ($totale_iva_anno_precedente >= 0) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo ' <td>DEBITO ANNO PRECEDENTE</td>';
|
2020-10-16 08:31:10 +02:00
|
|
|
} else {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo ' <td>CREDITO ANNO PRECEDENTE</td>';
|
2020-10-13 17:50:37 +02:00
|
|
|
}
|
2023-03-15 09:53:31 +01:00
|
|
|
echo '<td class=text-right>'.moneyFormat(abs($totale_iva_anno_precedente), 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>';
|
2020-10-16 08:31:10 +02:00
|
|
|
if ($totale_iva_periodo_precedente >= 0) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo ' <td>DEBITO PERIODO PRECEDENTE</td>';
|
2020-10-16 08:31:10 +02:00
|
|
|
} else {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo ' <td>CREDITO PERIODO PRECEDENTE</td>';
|
2020-10-13 17:50:37 +02:00
|
|
|
}
|
2023-03-15 09:53:31 +01:00
|
|
|
echo ' <td class=text-right>'.moneyFormat(abs($totale_iva_periodo_precedente), 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>TOTALE IVA SU VENDITE ESIGIBILE</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_esigibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>TOTALE IVA OGGETTIVAMENTE NON A DEBITO SU VENDITE</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_nonesigibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>TOTALE IVA SU ACQUISTI DETRAIBILI</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_detraibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>TOTALE IVA OGGETTIVAMENTE INDETRAIBILI SU ACQUISTI</td>
|
2023-03-15 09:53:31 +01:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_nondetraibile, 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2023-04-12 09:50:18 +02:00
|
|
|
<td>VARIAZIONE DI IMPOSTA RELATIVE A PERIODI PRECEDENTI</td>';
|
2023-04-12 09:55:32 +02:00
|
|
|
if ($totale_iva_periodo_precedente < 25.82 && $totale_iva_periodo_precedente > 0) {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-12 09:50:18 +02:00
|
|
|
<td class=text-right>'.moneyFormat(abs($totale_iva_periodo_precedente), 2).'</td>';
|
|
|
|
} else {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-12 09:50:18 +02:00
|
|
|
<td class=text-right></td>';
|
2023-08-04 14:54:28 +02:00
|
|
|
}
|
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>DI CUI INTERESSI PER RAVVEDIMENTO</td>
|
|
|
|
<td class=text-right></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>DI CUI INTERESSI PER MAGGIORAZIONE TRIMESTRALI</td>
|
|
|
|
<td class=text-right></td>
|
|
|
|
</tr>
|
2023-04-12 09:50:18 +02:00
|
|
|
<tr>
|
2020-10-13 17:50:37 +02:00
|
|
|
<td>CREDITO IVA COMPENSABILE</td>
|
|
|
|
<td class=text-right></td>
|
|
|
|
</tr>
|
|
|
|
<tr>';
|
2020-10-16 08:31:10 +02:00
|
|
|
if ($totale_iva >= 0) {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo ' <td>IVA A DEBITO</td>';
|
2020-10-16 08:31:10 +02:00
|
|
|
} else {
|
2021-02-18 18:48:44 +01:00
|
|
|
echo ' <td>IVA A CREDITO</td>';
|
2020-10-13 17:50:37 +02:00
|
|
|
}
|
2023-03-15 09:53:31 +01:00
|
|
|
echo ' <td class=text-right>'.moneyFormat(abs($totale_iva), 2).'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>CREDITO SPECIALE DI IMPOSTA</td>
|
|
|
|
<td class=text-right></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>MAGGIORAZIONE 1,00%</td>
|
2023-04-12 09:58:40 +02:00
|
|
|
<td class=text-right>'.($periodo['valore'] == 'Trimestrale' && $totale_iva > 25.82 ? moneyFormat($maggiorazione, 2) : '').'</td>
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2023-04-12 09:50:18 +02:00
|
|
|
<td>IVA A DEBITO CON MAGGIORAZIONE</td>';
|
2023-04-13 17:03:07 +02:00
|
|
|
if ($totale_iva > 25.82 && $periodo['valore'] == 'Trimestrale') {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-12 09:50:18 +02:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_maggiorata, 2).'</td>';
|
|
|
|
} else {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-12 09:50:18 +02:00
|
|
|
<td class=text-right></td>';
|
2023-08-04 14:54:28 +02:00
|
|
|
}
|
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2023-04-12 09:50:18 +02:00
|
|
|
<td>IMPORTO DA VERSARE</td>';
|
|
|
|
if ($totale_iva > 25.82) {
|
2023-04-13 17:03:07 +02:00
|
|
|
if ($periodo['valore'] == 'Mensile') {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-13 10:56:14 +02:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva, 2).'</td>';
|
|
|
|
} else {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-13 10:56:14 +02:00
|
|
|
<td class=text-right>'.moneyFormat($totale_iva_maggiorata, 2).'</td>';
|
|
|
|
}
|
2023-04-12 09:50:18 +02:00
|
|
|
} else {
|
2023-08-04 14:54:28 +02:00
|
|
|
echo '
|
2023-04-12 09:50:18 +02:00
|
|
|
<td class=text-right></td>';
|
2023-08-04 14:54:28 +02:00
|
|
|
}
|
|
|
|
echo '
|
2020-10-13 17:50:37 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>CREDITO INFRANNUALE DI IMPOSTA CHIESTO A RIMBORSO</td>
|
|
|
|
<td class=text-right></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>CREDITO INFRANNUALE DA UTILIZZARE IN COMPENSAZIONE</td>
|
|
|
|
<td class=text-right></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
2020-10-16 08:31:10 +02:00
|
|
|
</table>';
|