diff --git a/src/Actions/Traits/SummarizesInvoiceTaxes.php b/src/Actions/Traits/SummarizesInvoiceTaxes.php index fd35efa..c0d5c0f 100644 --- a/src/Actions/Traits/SummarizesInvoiceTaxes.php +++ b/src/Actions/Traits/SummarizesInvoiceTaxes.php @@ -10,17 +10,17 @@ trait SummarizesInvoiceTaxes { - public float $totalWithheldAmount = 0; - public float $totalFeesAmount = 0; - public float $totalStampDutyAmount = 0; - public float $totalOtherTaxesAmount = 0; - public float $totalDeductionsAmount = 0; + protected float $totalWithheldAmount = 0; + protected float $totalFeesAmount = 0; + protected float $totalStampDutyAmount = 0; + protected float $totalOtherTaxesAmount = 0; + protected float $totalDeductionsAmount = 0; /** * @var float Tax amounts that do not affect gross value * and should be excluded from total gross value. */ - public float $totalInformationTaxAmount = 0; + protected float $totalInformationalTaxAmount = 0; protected function addTaxesFromInvoiceRow(InvoiceDetails $row): void { @@ -32,7 +32,7 @@ protected function addTaxesFromInvoiceRow(InvoiceDetails $row): void $withheldCategory = $row->getWithheldPercentCategory(); if ($withheldCategory !== null && !$withheldCategory->affectsTotalGrossValue()) { - $this->totalInformationTaxAmount += abs($row->getWithheldAmount() ?? 0); + $this->totalInformationalTaxAmount += abs($row->getWithheldAmount() ?? 0); } } @@ -54,7 +54,7 @@ protected function addTaxesFromTaxTotals(TaxTotals $tax): void : WithheldPercentCategory::tryFrom($tax->getTaxCategory()); if ($taxCategory !== null && !$taxCategory->affectsTotalGrossValue()) { - $this->totalInformationTaxAmount += $amount; + $this->totalInformationalTaxAmount += $amount; } } } @@ -76,15 +76,15 @@ protected function saveTaxes(InvoiceSummary $summary): void $deductionsAmount = $this->round($summary->getTotalDeductionsAmount() + $this->totalDeductionsAmount); $summary->setTotalDeductionsAmount($deductionsAmount); - $informationalTaxes = $this->round($summary->getTotalInformationalTaxAmount() + $this->totalInformationTaxAmount); - $summary->setTotalInformationTaxAmount($informationalTaxes); + $informationalTaxes = $this->round($summary->getTotalInformationalTaxAmount() + $this->totalInformationalTaxAmount); + $summary->setTotalInformationalTaxAmount($informationalTaxes); } - public function getTotalTaxes(): float + protected function getTotalTaxes(): float { return -$this->totalWithheldAmount -$this->totalDeductionsAmount - +$this->totalInformationTaxAmount + +$this->totalInformationalTaxAmount +$this->totalFeesAmount +$this->totalStampDutyAmount +$this->totalOtherTaxesAmount; diff --git a/src/Models/InvoiceSummary.php b/src/Models/InvoiceSummary.php index d9a8c25..2da2cba 100644 --- a/src/Models/InvoiceSummary.php +++ b/src/Models/InvoiceSummary.php @@ -115,7 +115,7 @@ public function getTotalInformationalTaxAmount(): float * @param float $amount Το σύνολο των προκαταβληθέντων φόρων που δεν επηρεάζουν τη συνολική αξία (πληρωτέο ποσό) του παραστατικού. * @return $this */ - public function setTotalInformationTaxAmount(float $amount): static + public function setTotalInformationalTaxAmount(float $amount): static { $this->totalInformationalTaxAmount = $amount; return $this;