From a9685afd601a40d27b9e75251775f21533e5e85b Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Fri, 28 Sep 2018 12:04:20 +0200 Subject: [PATCH] Bugfix articoli Interventi --- modules/interventi/src/Articolo.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/interventi/src/Articolo.php b/modules/interventi/src/Articolo.php index 0dbd31c40..429a59118 100644 --- a/modules/interventi/src/Articolo.php +++ b/modules/interventi/src/Articolo.php @@ -79,12 +79,8 @@ class Articolo extends Article public function fixIvaIndetraibile() { - $iva = database()->fetchOne('SELECT * FROM co_iva WHERE id = :id_iva', [ - ':id_iva' => $this->idiva, - ]); - - $this->iva_indetraibile = $this->iva / 100 * $iva['indetraibile']; } + public function setCostoUnitarioAttribute($value) { $this->prezzo_vendita = $value; @@ -97,6 +93,14 @@ class Articolo extends Article return $this->prezzo_vendita; } + /** + * Effettua i conti per il subtotale della riga. + */ + protected function fixSubtotale() + { + $this->fixIva(); + } + public function getSubtotaleAttribute() { return $this->prezzo_vendita * $this->qta;