Bugfix articoli Interventi

This commit is contained in:
Thomas Zilio 2018-09-28 12:04:20 +02:00
parent 57a5d41480
commit a9685afd60
1 changed files with 9 additions and 5 deletions

View File

@ -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;