Skip to content

Commit

Permalink
Merge pull request #446 from invopop/gr-other-taxes
Browse files Browse the repository at this point in the history
Add support for other tax categories to myDATA addon
  • Loading branch information
cavalle authored Dec 16, 2024
2 parents 302269b + d596396 commit ab5152d
Show file tree
Hide file tree
Showing 8 changed files with 506 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

### Added

- `gr-mydata`: added `gr-mydata-other-tax` extension to set the category of other taxes in charges.

## [v0.207.0] - 2024-12-12

### Added
Expand Down
145 changes: 143 additions & 2 deletions addons/gr/mydata/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const (
ExtKeyIncomeCat = "gr-mydata-income-cat"
ExtKeyIncomeType = "gr-mydata-income-type"
ExtKeyPaymentMeans = "gr-mydata-payment-means"

InvoiceTypeRetailPrefix = "11."
ExtKeyOtherTax = "gr-mydata-other-tax"
)

var extensions = []*cbc.Definition{
Expand Down Expand Up @@ -1024,4 +1023,146 @@ var extensions = []*cbc.Definition{
},
},
},
{
Key: ExtKeyOtherTax,
Name: i18n.String{
i18n.EN: "Other taxes category",
i18n.EL: "Κατηγορία Λοιπών Φόρων",
},
Values: []*cbc.Definition{
{
Code: "1",
Name: i18n.String{
i18n.EN: "a1) 20% fire insurance premiums",
i18n.EL: "α1) Ασφάλιστρα κλάδου πυρός 20%",
},
},
{
Code: "2",
Name: i18n.String{
i18n.EN: "a2) 20% fire insurance premiums",
i18n.EL: "α2) Ασφάλιστρα κλάδου πυρός 20%",
},
},
{
Code: "3",
Name: i18n.String{
i18n.EN: "b) 4% life insurance premiums",
i18n.EL: "β) Ασφάλιστρα κλάδου ζωής 4%",
},
},
{
Code: "4",
Name: i18n.String{
i18n.EN: "c) 15% other insurance premiums",
i18n.EL: "γ) Ασφάλιστρα λοιπών κλάδων 15%",
},
},
{
Code: "5",
Name: i18n.String{
i18n.EN: "d) 0% tax-exempt insurance premiums",
i18n.EL: "δ) Απαλλασσόμενα φόρου ασφάλιστρα 0%",
},
},
{
Code: "6",
Name: i18n.String{
i18n.EN: "Hotels 1-2 stars 0,50 €",
i18n.EL: "Ξενοδοχεία 1-2 αστέρων 0,50 €",
},
},
{
Code: "7",
Name: i18n.String{
i18n.EN: "Hotels 3 stars 1,50 €",
i18n.EL: "Ξενοδοχεία 3 αστέρων 1,50 €",
},
},
{
Code: "8",
Name: i18n.String{
i18n.EN: "Hotels 4 stars 3,00 €",
i18n.EL: "Ξενοδοχεία 4 αστέρων 3,00 €",
},
},
{
Code: "9",
Name: i18n.String{
i18n.EN: "Hotels 5 stars 4,00 €",
i18n.EL: "Ξενοδοχεία 5 αστέρων 4,00 €",
},
},
{
Code: "10",
Name: i18n.String{
i18n.EN: "Rental rooms - Furnished rooms - Apartments 0,50 €",
i18n.EL: "Ενοικιαζόμενα δωμάτια - Επιπλωμένα δωμάτια - Διαμερίσματα 0,50 €",
},
},
{
Code: "11",
Name: i18n.String{
i18n.EN: "Special 5% tax on tv-broadcast commercials (EFTD)",
i18n.EL: "Ειδικός φόρος στις διαφημίσεις που προβάλλονται από την τηλεόραση (ΕΦΔΤ) 5%",
},
},
{
Code: "12",
Name: i18n.String{
i18n.EN: "10% luxury tax on the taxable value of intra-community acquired goods and those imported from third countries",
i18n.EL: "Φόρος πολυτελείας 10% επί της φορολογητέας αξίας για τα ενδοκοινοτικά αποκτήματα και εισαγόμενα από τρίτες χώρες",
},
},
{
Code: "13",
Name: i18n.String{
i18n.EN: "10% luxury tax on the selling price before VAT for domestically produced goods",
i18n.EL: "Φόρος πολυτελείας 10% επί της τιμής πώλησης προ Φ.Π.Α. για τα εγχωρίως παραγόμενα",
},
},
{
Code: "14",
Name: i18n.String{
i18n.EN: "80% Public fees on the admission ticket price for casinos",
i18n.EL: "Δικαιώματα του Δημοσίου στα εισιτήρια των καζίνο (80% επί του εισιτηρίου)",
},
},
{
Code: "15",
Name: i18n.String{
i18n.EN: "Fire industry insurance premiums 20%",
i18n.EL: "Ασφάλιστρα κλάδου πυρός 20%",
},
},
{
Code: "16",
Name: i18n.String{
i18n.EN: "Customs duties- Taxes",
i18n.EL: "Λοιποί Τελωνειακοί Δασμοί-Φόροι",
},
},
{
Code: "17",
Name: i18n.String{
i18n.EN: "Other Taxes",
i18n.EL: "Λοιποί Φόροι",
},
},
{
Code: "18",
Name: i18n.String{
i18n.EN: "Charges of other Taxes",
i18n.EL: "Επιβαρύνσεις Λοιπών Φόρων",
},
},
{
Code: "19",
Name: i18n.String{
i18n.EN: "Special consumption tax",
i18n.EL: "ΕΦΚ",
},
},
},
},
}
25 changes: 13 additions & 12 deletions addons/gr/mydata/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func validateInvoice(inv *bill.Invoice) error {
),
validation.Field(&inv.Customer,
validation.When(
!IsRetail(inv),
requiresValidCustomer(inv),
validation.Required,
validation.By(validateBusinessParty),
validation.By(validateBusinessCustomer),
Expand All @@ -40,10 +40,6 @@ func validateInvoice(inv *bill.Invoice) error {
),
validation.Skip,
),
validation.Field(&inv.Charges,
validation.Empty.Error("not supported by mydata"),
validation.Skip,
),
validation.Field(&inv.Discounts,
validation.Empty.Error("not supported by mydata"),
validation.Skip,
Expand Down Expand Up @@ -182,13 +178,18 @@ func validateInvoicePreceding(value any) error {
)
}

// IsRetail returns true if the invoice type corresponds to a retail invoice.
func IsRetail(inv *bill.Invoice) bool {
if inv.Tax == nil || inv.Tax.Ext == nil {
return false
}
// requiresValidCustomer returns true if the invoice type requires a customer.
func requiresValidCustomer(inv *bill.Invoice) bool {
// Invoice type categories that require a valid customer.
typeCats := []string{"1", "2", "5"}

it := inv.Tax.Ext[ExtKeyInvoiceType].String()

it := inv.Tax.Ext[ExtKeyInvoiceType]
for _, prefix := range typeCats {
if strings.HasPrefix(it, prefix+".") {
return true
}
}

return strings.HasPrefix(string(it), InvoiceTypeRetailPrefix)
return false
}
15 changes: 15 additions & 0 deletions addons/gr/mydata/invoices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ func TestSimplifiedInvoiceValidation(t *testing.T) {
assert.NoError(t, inv.Validate())
}

func TestOtherInvoiceTypeValidation(t *testing.T) {
inv := validInvoice()
inv.Type = bill.InvoiceTypeOther
inv.Tax = &bill.Tax{
Ext: tax.Extensions{
mydata.ExtKeyInvoiceType: "8.2",
},
}
inv.Customer.TaxID = nil
inv.Customer.Addresses = nil

require.NoError(t, inv.Calculate())
assert.NoError(t, inv.Validate())
}

func TestPrecedingValidation(t *testing.T) {
inv := validInvoice()

Expand Down
142 changes: 142 additions & 0 deletions data/addons/gr-mydata-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,148 @@
}
}
]
},
{
"key": "gr-mydata-other-tax",
"name": {
"el": "Κατηγορία Λοιπών Φόρων",
"en": "Other taxes category"
},
"values": [
{
"code": "1",
"name": {
"el": "α1) Ασφάλιστρα κλάδου πυρός 20%",
"en": "a1) 20% fire insurance premiums"
}
},
{
"code": "2",
"name": {
"el": "α2) Ασφάλιστρα κλάδου πυρός 20%",
"en": "a2) 20% fire insurance premiums"
}
},
{
"code": "3",
"name": {
"el": "β) Ασφάλιστρα κλάδου ζωής 4%",
"en": "b) 4% life insurance premiums"
}
},
{
"code": "4",
"name": {
"el": "γ) Ασφάλιστρα λοιπών κλάδων 15%",
"en": "c) 15% other insurance premiums"
}
},
{
"code": "5",
"name": {
"el": "δ) Απαλλασσόμενα φόρου ασφάλιστρα 0%",
"en": "d) 0% tax-exempt insurance premiums"
}
},
{
"code": "6",
"name": {
"el": "Ξενοδοχεία 1-2 αστέρων 0,50 €",
"en": "Hotels 1-2 stars 0,50 €"
}
},
{
"code": "7",
"name": {
"el": "Ξενοδοχεία 3 αστέρων 1,50 €",
"en": "Hotels 3 stars 1,50 €"
}
},
{
"code": "8",
"name": {
"el": "Ξενοδοχεία 4 αστέρων 3,00 €",
"en": "Hotels 4 stars 3,00 €"
}
},
{
"code": "9",
"name": {
"el": "Ξενοδοχεία 5 αστέρων 4,00 €",
"en": "Hotels 5 stars 4,00 €"
}
},
{
"code": "10",
"name": {
"el": "Ενοικιαζόμενα δωμάτια - Επιπλωμένα δωμάτια - Διαμερίσματα 0,50 €",
"en": "Rental rooms - Furnished rooms - Apartments 0,50 €"
}
},
{
"code": "11",
"name": {
"el": "Ειδικός φόρος στις διαφημίσεις που προβάλλονται από την τηλεόραση (ΕΦΔΤ) 5%",
"en": "Special 5% tax on tv-broadcast commercials (EFTD)"
}
},
{
"code": "12",
"name": {
"el": "Φόρος πολυτελείας 10% επί της φορολογητέας αξίας για τα ενδοκοινοτικά αποκτήματα και εισαγόμενα από τρίτες χώρες",
"en": "10% luxury tax on the taxable value of intra-community acquired goods and those imported from third countries"
}
},
{
"code": "13",
"name": {
"el": "Φόρος πολυτελείας 10% επί της τιμής πώλησης προ Φ.Π.Α. για τα εγχωρίως παραγόμενα",
"en": "10% luxury tax on the selling price before VAT for domestically produced goods"
}
},
{
"code": "14",
"name": {
"el": "Δικαιώματα του Δημοσίου στα εισιτήρια των καζίνο (80% επί του εισιτηρίου)",
"en": "80% Public fees on the admission ticket price for casinos"
}
},
{
"code": "15",
"name": {
"el": "Ασφάλιστρα κλάδου πυρός 20%",
"en": "Fire industry insurance premiums 20%"
}
},
{
"code": "16",
"name": {
"el": "Λοιποί Τελωνειακοί Δασμοί-Φόροι",
"en": "Customs duties- Taxes"
}
},
{
"code": "17",
"name": {
"el": "Λοιποί Φόροι",
"en": "Other Taxes"
}
},
{
"code": "18",
"name": {
"el": "Επιβαρύνσεις Λοιπών Φόρων",
"en": "Charges of other Taxes"
}
},
{
"code": "19",
"name": {
"el": "ΕΦΚ",
"en": "Special consumption tax"
}
}
]
}
],
"tags": [
Expand Down
Loading

0 comments on commit ab5152d

Please sign in to comment.