Skip to content

Commit 43a9e9b

Browse files
committed
fix: ricalcolo iva su sconto righe
1 parent 2132c23 commit 43a9e9b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Common/Components/Accounting.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public function getIvaAttribute()
106106
*/
107107
public function setPrezzoUnitario($prezzo_unitario, $id_iva)
108108
{
109+
// Salva il valore dello sconto esistente prima di cambiare l'aliquota IVA
110+
$sconto_esistente = $this->sconto_unitario;
111+
109112
$this->id_iva = $id_iva;
110113

111114
// Gestione IVA incorporata
@@ -114,6 +117,11 @@ public function setPrezzoUnitario($prezzo_unitario, $id_iva)
114117
} else {
115118
$this->prezzo_unitario = $prezzo_unitario;
116119
}
120+
121+
// Ricalcola l'IVA dello sconto esistente con la nuova aliquota
122+
if ($sconto_esistente > 0) {
123+
$this->sconto_unitario = $sconto_esistente;
124+
}
117125
}
118126

119127
/**

0 commit comments

Comments
 (0)