Skip to content

Commit

Permalink
Fix gross value calculation to ignore informational taxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
firebed committed Jan 10, 2025
1 parent 32c642e commit b7934f1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Actions/Traits/SummarizesInvoiceTaxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ trait SummarizesInvoiceTaxes
/**
* @var float Tax amounts that do not affect gross value
* and should be excluded from total gross value.
* @deprecated
*/
protected float $totalInformationalTaxAmount = 0;

Expand Down Expand Up @@ -84,7 +85,6 @@ protected function getTotalTaxes(): float
{
return -$this->totalWithheldAmount
-$this->totalDeductionsAmount
+$this->totalInformationalTaxAmount
+$this->totalFeesAmount
+$this->totalStampDutyAmount
+$this->totalOtherTaxesAmount;
Expand Down
5 changes: 4 additions & 1 deletion src/Enums/WithheldPercentCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ public function label(): string
self::TAX_18 => "Παρακράτηση Φόρου Μερίσματα 5% [περ.α παρ. 1 αρ. 64 ν. 4172/2013]",
};
}


/**
* @deprecated
*/
public function affectsTotalGrossValue(): bool
{
return !in_array($this, [
Expand Down
5 changes: 5 additions & 0 deletions src/Models/InvoiceSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class InvoiceSummary extends Type
'expensesClassification' => ExpensesClassification::class,
];

/**
* @deprecated
*/
private float $totalInformationalTaxAmount = 0;

/**
Expand Down Expand Up @@ -105,6 +108,7 @@ public function setTotalWithheldAmount(float $totalWithheldAmount): static

/**
* @return float Το σύνολο των προκαταβληθέντων φόρων που δεν επηρεάζουν τη συνολική αξία (πληρωτέο ποσό) του παραστατικού.
* @deprecated
*/
public function getTotalInformationalTaxAmount(): float
{
Expand All @@ -114,6 +118,7 @@ public function getTotalInformationalTaxAmount(): float
/**
* @param float $amount Το σύνολο των προκαταβληθέντων φόρων που δεν επηρεάζουν τη συνολική αξία (πληρωτέο ποσό) του παραστατικού.
* @return $this
* @deprecated
*/
public function setTotalInformationalTaxAmount(float $amount): static
{
Expand Down
7 changes: 5 additions & 2 deletions tests/SummarizeInvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ public function test_it_summarizes_invoice_taxes()
$this->assertEquals(17_955.97, $summary->getTotalGrossValue());
}

public function test_informational_tax_amounts_are_excluded_from_gross_value()
/**
* @deprecated
*/
public function test_informational_tax_amounts_are_not_excluded_from_gross_value()
{
$row = (new InvoiceDetails())
->setNetValue(15_000)
Expand Down Expand Up @@ -347,7 +350,7 @@ public function test_informational_tax_amounts_are_excluded_from_gross_value()
$this->assertEquals(0, $summary->getTotalDeductionsAmount());
$this->assertEquals(0, $summary->getTotalFeesAmount());
$this->assertEquals(0, $summary->getTotalStampDutyAmount());
$this->assertEquals(15_600.00, $summary->getTotalGrossValue());
$this->assertEquals(15_438.45, $summary->getTotalGrossValue());
$this->assertEquals(161.55, $summary->getTotalInformationalTaxAmount());
}

Expand Down

0 comments on commit b7934f1

Please sign in to comment.