From 4b75367ae8bbe2dab6a2bca3348301f600c4f2d4 Mon Sep 17 00:00:00 2001 From: arm <7211155+armhub@users.noreply.github.com> Date: Mon, 18 Nov 2024 12:06:40 +0100 Subject: [PATCH] Add non-Germany affiliate tax handling in pdf invoice generation Co-authored-by: arm --- .../api/worker/invoicegen/InvoiceTexts.ts | 2 ++ .../worker/invoicegen/PdfInvoiceGenerator.ts | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/common/api/worker/invoicegen/InvoiceTexts.ts b/src/common/api/worker/invoicegen/InvoiceTexts.ts index f43a69718207..b5200b84daa0 100644 --- a/src/common/api/worker/invoicegen/InvoiceTexts.ts +++ b/src/common/api/worker/invoicegen/InvoiceTexts.ts @@ -34,6 +34,7 @@ export default { yourVatId: "Your VAT identification number:", netPricesNoVatInGermany: "All prices are net prices and not subject to value added tax in Germany.", noVatInGermany: "Prices are not subject to value added tax in Germany.", + reverseChargeAffiliate: "All prices are net prices. We are liable for VAT under the reverse charge mechanism", paymentInvoiceDue1: "The payment is due 7 days after the invoice date without any deduction. Please", paymentInvoiceDue2: "transfer the grand total with reference to the invoice number to our account:", @@ -102,6 +103,7 @@ export default { yourVatId: "Ihre Umsatzsteuer-Identifikationsnummer:", netPricesNoVatInGermany: "Alle Beträge sind netto und werden nicht in Deutschland versteuert.", noVatInGermany: "Beträge werden nicht in Deutschland versteuert.", + reverseChargeAffiliate: "Alle Beträge sind netto. Die Steuerschuldnerschaft geht auf uns als Leistungsempfänger über.", quantity: "Menge", item: "Item", diff --git a/src/common/api/worker/invoicegen/PdfInvoiceGenerator.ts b/src/common/api/worker/invoicegen/PdfInvoiceGenerator.ts index b229ff11bd1a..f3cf50da45d6 100644 --- a/src/common/api/worker/invoicegen/PdfInvoiceGenerator.ts +++ b/src/common/api/worker/invoicegen/PdfInvoiceGenerator.ts @@ -8,7 +8,7 @@ const enum VatType { ADD_VAT = "1", VAT_INCLUDED_SHOWN = "2", VAT_INCLUDED_HIDDEN = "3", - NO_VAT_REVERSE_CHARGE = "4", + NO_VAT_CHARGE_TUTAO = "4", } const enum InvoiceType { @@ -223,7 +223,8 @@ export class PdfInvoiceGenerator { "", "", InvoiceTexts[this.languageCode].grandTotal, - this.formatInvoiceCurrency(this.invoice.grandTotal), + // in case of NO_VAT_CHARGE_TUTAO we must not show the VAT in the invoice, but we pay the taxes ourselves, so they need to be existing on the invoice + this.formatInvoiceCurrency(this.invoice.vatType == VatType.NO_VAT_CHARGE_TUTAO ? this.invoice.subTotal : this.invoice.grandTotal), ]) } @@ -239,7 +240,6 @@ export class PdfInvoiceGenerator { case VatType.VAT_INCLUDED_SHOWN: break case VatType.NO_VAT: - case VatType.NO_VAT_REVERSE_CHARGE: if (this.invoice.vatIdNumber != null) { this.doc .addText(InvoiceTexts[this.languageCode].reverseChargeVatIdNumber1) @@ -253,6 +253,19 @@ export class PdfInvoiceGenerator { this.doc.addText(InvoiceTexts[this.languageCode].netPricesNoVatInGermany) } break + case VatType.NO_VAT_CHARGE_TUTAO: + this.doc + .addText(InvoiceTexts[this.languageCode].reverseChargeAffiliate) + .addLineBreak() + .addText(InvoiceTexts[this.languageCode].reverseChargeVatIdNumber2) + if (this.invoice.vatIdNumber != null) { + this.doc + .addLineBreak() + .addText(`${InvoiceTexts[this.languageCode].yourVatId} `) + .changeFont(PDF_FONTS.BOLD, 11) + .addText(`${this.invoice.vatIdNumber}`) + } + break case VatType.VAT_INCLUDED_HIDDEN: this.doc.addText(InvoiceTexts[this.languageCode].noVatInGermany) break