Fix calcolo margine percentuale

This commit is contained in:
MatteoPistorello 2021-12-13 09:27:04 +01:00
parent c62185c937
commit e70c5c7077
3 changed files with 3 additions and 3 deletions

View File

@ -401,7 +401,7 @@ class Sessione extends Model
*/ */
public function getMarginePercentualeAttribute() public function getMarginePercentualeAttribute()
{ {
return $this->imponibile ? (1 - ($this->spesa / $this->imponibile)) * 100 : 100; return $this->imponibile ? (($this->imponibile / $this->spesa) - 1) * 100 : 100;
} }
public function getIvaIndetraibileAttribute() public function getIvaIndetraibileAttribute()

View File

@ -321,7 +321,7 @@ abstract class Accounting extends Component
*/ */
public function getMarginePercentualeAttribute() public function getMarginePercentualeAttribute()
{ {
return $this->imponibile ? (1 - ($this->spesa / $this->imponibile)) * 100 : 100; return $this->imponibile ? (($this->imponibile / $this->spesa) - 1) * 100 : 100;
} }
/** /**

View File

@ -226,7 +226,7 @@ abstract class Document extends Model implements ReferenceInterface, DocumentInt
*/ */
public function getMarginePercentualeAttribute() public function getMarginePercentualeAttribute()
{ {
return $this->imponibile ? (1 - ($this->spesa / $this->totale_imponibile)) * 100 : 100; return $this->imponibile ? (($this->totale_imponibile / $this->spesa) - 1) * 100 : 100;
} }
public function delete() public function delete()