diff --git a/modules/interventi/src/Components/Sessione.php b/modules/interventi/src/Components/Sessione.php index f543e8395..59edb6e1c 100755 --- a/modules/interventi/src/Components/Sessione.php +++ b/modules/interventi/src/Components/Sessione.php @@ -401,7 +401,7 @@ class Sessione extends Model */ 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() diff --git a/src/Common/Components/Accounting.php b/src/Common/Components/Accounting.php index 7fad0d717..557db4f1a 100644 --- a/src/Common/Components/Accounting.php +++ b/src/Common/Components/Accounting.php @@ -321,7 +321,7 @@ abstract class Accounting extends Component */ public function getMarginePercentualeAttribute() { - return $this->imponibile ? (1 - ($this->spesa / $this->imponibile)) * 100 : 100; + return $this->imponibile ? (($this->imponibile / $this->spesa) - 1) * 100 : 100; } /** diff --git a/src/Common/Document.php b/src/Common/Document.php index 0120e41b4..d376e1460 100755 --- a/src/Common/Document.php +++ b/src/Common/Document.php @@ -226,7 +226,7 @@ abstract class Document extends Model implements ReferenceInterface, DocumentInt */ 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()