Skip to content

Commit

Permalink
- Fixed $totalInformationalTaxAmount variable name and `setTotalInf…
Browse files Browse the repository at this point in the history
…ormationalTaxAmount` method name for consistency.

- Changed property visibilities to protected.
  • Loading branch information
firebed committed Oct 12, 2024
1 parent 0963c14 commit abcfd74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/Actions/Traits/SummarizesInvoiceTaxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
}
}

Expand All @@ -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;
}
}
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Models/InvoiceSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit abcfd74

Please sign in to comment.