Skip to content

Commit a90411c

Browse files
committed
fix: stampa fattura con sconto finale percentuale
1 parent 7be63d2 commit a90411c

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

templates/fatture/footer.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
$has_rivalsa = !empty($rivalsa);
6060
$has_ritenuta = !empty($record['ritenutaacconto']) || !empty($documento->totale_ritenuta_contributi);
6161
$has_split_payment = !empty($record['split_payment']);
62+
$sconto_finale = $documento->sconto_finale_percentuale ? $documento->totale*$documento->sconto_finale_percentuale/100 : $documento->sconto_finale;
6263
$has_sconto_finale = !empty($sconto_finale);
6364

6465
$etichette = [
@@ -462,13 +463,18 @@
462463
* Sconto in | Totale (+ Rivalsa INPS - Ritenuta - Totale IVA [se split payment] - Sconto finale)
463464
*/
464465
if ($has_sconto_finale) {
465-
$first_colspan = 1;
466-
$second_colspan = 2;
466+
$first_colspan = 2;
467+
$second_colspan = 1;
467468

468469
echo '
469470
<tr>
470-
<th class="text-center small" colspan="'.$first_colspan.'">
471-
'.tr('Sconto in fattura', [], ['upper' => true]).($documento->sconto_finale_percentuale ? ' ('.numberFormat($documento->sconto_finale_percentuale, 2).'%)' : '').'
471+
<th class="text-center small" colspan="'.$first_colspan.'">';
472+
if ($documento->sconto_finale_percentuale) {
473+
echo tr('Sconto in fattura', [], ['upper' => true]).' ('.numberFormat($documento->sconto_finale_percentuale, 2).'%)';
474+
} else {
475+
echo tr('Sconto in fattura', [], ['upper' => true]).' ('.moneyFormat($documento->sconto_finale, 2).')';
476+
}
477+
echo'
472478
</th>
473479
474480
<th class="text-center small" colspan="'.$second_colspan.'">

0 commit comments

Comments
 (0)