Skip to content

Commit 3a0b2cc

Browse files
fix: minori stampa liquidazione iva e registro iva
1 parent e7140c6 commit 3a0b2cc

6 files changed

Lines changed: 57 additions & 28 deletions

File tree

templates/liquidazione_iva/header.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@
2626
*
2727
* La personalizzazione specifica dell'header deve comunque seguire lo standard della cartella custom: anche se il file header.php non esiste nella stampa originaria, se si vuole personalizzare l'header bisogna crearlo all'interno della cartella custom.
2828
*/
29+
30+
echo '
31+
<div class="row" style="'.((!empty($settings['header-font-size'])) ? 'font-size:'.($settings['header-font-size']).'px;' : '').'" >
32+
<div class="col-xs-6" >
33+
<p><b>'.$f_ragionesociale.'</b></p>
34+
<p>'.$f_indirizzo.'</p>
35+
<p>'.$f_citta_full.'</p>
36+
<p>'.(!empty($f_piva) ? tr('P.Iva').': '.$f_piva : '').'</p>
37+
<p>'.(!empty($f_codicefiscale) ? tr('C.F.').': '.$f_codicefiscale : '').'</p>
38+
</div>
39+
</div>';
40+
2941
$year_start = date('Y', strtotime((string) $date_start));
3042
$year_end = date('Y', strtotime((string) $date_end));
3143

templates/registro_iva/bottom.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
include_once __DIR__.'/../../core.php';
2222

23-
$totale_iva = sum(array_column($records, 'iva'), null, 2);
23+
$totale_iva_detraibile = sum(array_column($records, 'iva_detraibile'), null, 2);
24+
$totale_iva_indetraibile = sum(array_column($records, 'iva_indetraibile'), null, 2);
2425
$totale_subtotale = sum(array_column($records, 'subtotale'), null, 2);
2526

2627
echo '
@@ -35,15 +36,17 @@
3536
<tr bgcolor="#dddddd">
3637
<th>'.tr('Iva').'</th>
3738
<th class="text-center">'.tr('Imponibile').'</th>
38-
<th class="text-center">'.tr('Imposta').'</th>
39+
<th class="text-center">'.tr('Iva det.').'</th>
40+
<th class="text-center">'.tr('Iva indet.').'</th>
3941
</tr>
4042
</thead>
4143
4244
<tbody>';
4345

4446
foreach ($iva as $descrizione => $tot_iva) {
4547
if (!empty($descrizione)) {
46-
$somma_iva = sum($iva[$descrizione], null, 2);
48+
$somma_iva_detraibile = sum($iva[$descrizione]['detraibile'], null, 2);
49+
$somma_iva_indetraibile = sum($iva[$descrizione]['indetraibile'], null, 2);
4750
$somma_totale = sum($totale[$descrizione], null, 2);
4851

4952
echo '
@@ -57,7 +60,11 @@
5760
</td>
5861
5962
<td class="text-right">
60-
'.moneyFormat($somma_iva, 2).'
63+
'.moneyFormat($somma_iva_detraibile, 2).'
64+
</td>
65+
66+
<td class="text-right">
67+
'.moneyFormat($somma_iva_indetraibile, 2).'
6168
</td>
6269
</tr>';
6370
}
@@ -70,7 +77,8 @@
7077
<b>'.tr('Totale', [], ['upper' => true]).':</b>
7178
</td>
7279
<td class="text-right">'.moneyFormat($totale_subtotale, 2).'</td>
73-
<td class="text-right">'.moneyFormat($totale_iva, 2).'</td>
80+
<td class="text-right">'.moneyFormat($totale_iva_detraibile, 2).'</td>
81+
<td class="text-right">'.moneyFormat($totale_iva_indetraibile, 2).'</td>
7482
</tr>
7583
</tbody>
7684
</table>';

templates/registro_iva/header.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
*/
2929

3030
echo '
31-
<div class="text-right">
32-
<p><b>'.$f_ragionesociale.'</b></p>
31+
<div class="row" style="'.((!empty($settings['header-font-size'])) ? 'font-size:'.($settings['header-font-size']).'px;' : '').'" >
32+
<div class="col-xs-6" >
33+
<p><b>'.$f_ragionesociale.'</b></p>
34+
<p>'.$f_indirizzo.'</p>
35+
<p>'.$f_citta_full.'</p>
36+
<p>'.(!empty($f_piva) ? tr('P.Iva').': '.$f_piva : '').'</p>
37+
<p>'.(!empty($f_codicefiscale) ? tr('C.F.').': '.$f_codicefiscale : '').'</p>
38+
</div>
3339
</div>';

templates/registro_iva/init.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
SUM(`subtotale`) as subtotale,
5151
SUM(`totale`) as totale,
5252
SUM(`iva`) AS iva,
53-
`ragione_sociale`,
54-
`codice_anagrafica`
53+
`ragione_sociale`
5554
FROM
5655
(
5756
SELECT
@@ -70,9 +69,9 @@
7069
IF(`numero` = "", `numero_esterno`, `numero`) AS numero,
7170
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`)*(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS subtotale,
7271
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`+`iva`+`co_righe_documenti`.`rivalsainps` * `percentuale`/100)*(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS totale,
73-
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`) *`percentuale`/100 *(100-`indetraibile`)/100 *(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS iva,
74-
`an_anagrafiche`.`ragione_sociale`,
75-
`an_anagrafiche`.`codice` AS codice_anagrafica
72+
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`) *`percentuale`/100 *(100-`indetraibile`)/100 *(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS iva_detraibile,
73+
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`) *`percentuale`/100 *`indetraibile`/100 *(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS iva_indetraibile,
74+
`an_anagrafiche`.`ragione_sociale`
7675
FROM
7776
`co_iva`
7877
LEFT JOIN `co_iva_lang` ON (`co_iva`.`id` = `co_iva_lang`.`id_record` AND `co_iva_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
@@ -85,7 +84,7 @@
8584
GROUP BY
8685
`co_iva`.`id`, `co_documenti`.`id`
8786
HAVING
88-
data_competenza_iva BETWEEN '.prepare($date_start).' AND '.prepare($date_end).'
87+
data_competenza_iva BETWEEN '.prepare($date_start).' AND '.prepare($date_end).', totale > 0
8988
UNION
9089
SELECT
9190
`vb_venditabanco`.`data` as data_competenza_iva,
@@ -99,9 +98,9 @@
9998
`vb_venditabanco`.`numero` AS numero,
10099
SUM(`vb_righe_venditabanco`.`subtotale`) as subtotale,
101100
SUM(`subtotale`-`sconto` + `iva`) as totale,
102-
SUM(`iva`) as iva,
103-
`an_anagrafiche`.`ragione_sociale`,
104-
`an_anagrafiche`.`codice` AS codice_anagrafica
101+
SUM(`iva`) AS iva_detraibile,
102+
0 AS `iva_indetraibile`,
103+
`an_anagrafiche`.`ragione_sociale`
105104
FROM `co_iva`
106105
LEFT JOIN `co_iva_lang` ON (`co_iva`.`id` = `co_iva_lang`.`id_record` AND `co_iva_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
107106
INNER JOIN `vb_righe_venditabanco` ON `vb_righe_venditabanco`.`idiva` = `co_iva`.`id`
@@ -117,7 +116,7 @@
117116
data_competenza_iva BETWEEN '.prepare($date_start).' AND '.prepare($date_end).'
118117
) AS tabella
119118
GROUP BY
120-
`data_competenza_iva`, `iva`, `id`, `data_registrazione`, `data`, `numero_esterno`, `codice_tipo_documento_fe`, `percentuale`, `descrizione`, `numero`, `ragione_sociale`, `codice_anagrafica`
119+
`data_competenza_iva`, `iva`, `id`, `data_registrazione`, `data`, `numero_esterno`, `codice_tipo_documento_fe`, `percentuale`, `descrizione`, `numero`, `ragione_sociale`
121120
ORDER BY CAST(`numero_esterno` AS UNSIGNED)';
122121
} else {
123122
$query = '
@@ -134,12 +133,13 @@
134133
`co_iva`.`percentuale`,
135134
`co_iva_lang`.`title` as descrizione,
136135
`co_documenti`.`id` AS id,
136+
`co_documenti`.`split_payment`,
137137
IF(`numero` = "", `numero_esterno`, `numero`) AS numero,
138138
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`)*(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS subtotale,
139139
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`+`iva`+`co_righe_documenti`.`rivalsainps` * `percentuale`/100)*(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS totale,
140-
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`) *`percentuale`/100 *(100-`indetraibile`)/100 *(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS iva,
141-
`an_anagrafiche`.`ragione_sociale`,
142-
`an_anagrafiche`.`codice` AS codice_anagrafica
140+
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`) *`percentuale`/100 *(100-`indetraibile`)/100 *(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS iva_detraibile,
141+
SUM((`subtotale`-`sconto`+`co_righe_documenti`.`rivalsainps`) *`percentuale`/100 *`indetraibile`/100 *(IF(`co_tipidocumento`.`reversed` = 0, 1,-1 ))) AS iva_indetraibile,
142+
`an_anagrafiche`.`ragione_sociale`
143143
FROM
144144
`co_iva`
145145
LEFT JOIN `co_iva_lang` ON (`co_iva`.`id` = `co_iva_lang`.`id_record` AND `co_iva_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
@@ -152,7 +152,7 @@
152152
GROUP BY
153153
`co_iva`.`id`, `co_documenti`.`id`
154154
HAVING
155-
data_competenza_iva BETWEEN '.prepare($date_start).' AND '.prepare($date_end).'
155+
data_competenza_iva BETWEEN '.prepare($date_start).' AND '.prepare($date_end).', totale > 0
156156
ORDER BY
157157
CAST( IF(`dir`="entrata", `co_documenti`.`numero_esterno`, `co_documenti`.`numero`) AS UNSIGNED)';
158158
}

templates/registro_iva/piece.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,26 @@
3333
<td>'.($different ? $record['numero_esterno'] : '').'</td>
3434
<td>'.($different ? Translator::datetoLocale($record['data']) : '').'</td>
3535
<td>'.($different ? $record['codice_tipo_documento_fe'] : '').'</td>
36-
<td>'.($different ? $record['codice_anagrafica'].' '.safe_truncate(mb_strtoupper(html_entity_decode((string) $record['ragione_sociale']), 'UTF-8'), 50) : '').'</td>
36+
<td>'.($different ? safe_truncate(mb_strtoupper(html_entity_decode($record['ragione_sociale']), 'UTF-8'), 50) : '').'</td>
3737
<td class="text-right">'.moneyFormat($record['totale'], 2).'</td>';
3838

3939
echo '
4040
<td class="text-right">'.moneyFormat($record['subtotale'], 2).'</td>
4141
<td class="text-left">'.Translator::numberToLocale($record['percentuale'], 0).'</td>
42-
<td class="text-left">'.$record['descrizione'].'</td>
43-
<td class="text-right">'.moneyFormat($record['iva'], 2).'</td>
42+
<td class="text-left">'.$record['descrizione'].' '.($record['split_payment'] ? tr('(Split payment)') : '').'</td>
43+
<td class="text-right">'.moneyFormat($record['iva_detraibile'], 2).'</td>
44+
<td class="text-right">'.moneyFormat($record['iva_indetraibile'], 2).'</td>
45+
4446
</tr>';
4547

46-
$iva[$record['descrizione']][] = $record['iva'];
48+
$iva[$record['descrizione']]['detraibile'][] = $record['iva_detraibile'];
49+
$iva[$record['descrizione']]['indetraibile'][] = $record['iva_indetraibile'];
4750
$totale[$record['descrizione']][] = $record['subtotale'];
4851

4952
$numero = $record['numero'];
5053
$data_registrazione = $record['data_registrazione'];
5154
$numero_esterno = $record['numero'];
5255
$data = $record['data'];
5356
$codice_fe = $record['numero'];
54-
$codice_anagrafica = $record['numero'];
5557

5658
$different = 0;

templates/registro_iva/top.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
<th>'.tr('Tot. doc.').'</th>
5959
<th>'.tr('Imponibile').'</th>
6060
<th>%</th>
61-
<th>'.tr('Iva').'</th>
62-
<th>'.tr('Imposta').'</th>
61+
<th>'.tr('Aliquota').'</th>
62+
<th>'.tr('Iva det.').'</th>
63+
<th>'.tr('Iva indet.').'</th>
6364
</tr>
6465
</thead>
6566

0 commit comments

Comments
 (0)