diff --git a/changelog.md b/changelog.md index 818fc22..45933bb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-11-27 - 1.0.102 - fix(contentinvoice) +Fixed currency display issues in invoice content rendering. + +- Corrected the usage of currency property to consistently pull from letterData content for invoice items. +- Ensured currency is correctly displayed in the invoice PDF generation. + ## 2024-11-27 - 1.0.101 - fix(shared) Fixed the demo letter item details by replacing `currency` with `position` to correctly define the item position. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 972cb80..a0c1461 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@design.estate/dees-document', - version: '1.0.101', + version: '1.0.102', description: 'A comprehensive solution for generating documents like invoices, integrating elements, templates, and services to streamline document creation.' } diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 972cb80..a0c1461 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@design.estate/dees-document', - version: '1.0.101', + version: '1.0.102', description: 'A comprehensive solution for generating documents like invoices, integrating elements, templates, and services to streamline document creation.' } diff --git a/ts_web/elements/contentinvoice.ts b/ts_web/elements/contentinvoice.ts index 20cb7ff..cb5baf5 100644 --- a/ts_web/elements/contentinvoice.ts +++ b/ts_web/elements/contentinvoice.ts @@ -292,9 +292,9 @@ export class DeContentInvoice extends DeesElement {
${invoiceItem.name}
${invoiceItem.unitQuantity}
${invoiceItem.unitType}
-
${invoiceItem.unitNetPrice} ${invoiceItem.currency}
+
${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}
- ${invoiceItem.unitQuantity * invoiceItem.unitNetPrice} ${invoiceItem.currency} + ${invoiceItem.unitQuantity * invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}
` @@ -343,7 +343,7 @@ export class DeContentInvoice extends DeesElement { IBAN: ${this.letterData?.from?.sepaConnection?.iban}
BIC: ${this.letterData?.from?.sepaConnection?.bic}
Description: ${this.letterData?.content.invoiceData?.id}
- Amount: ${this.getTotalGross()} ${this.letterData?.content.invoiceData.items[0].currency} + Amount: ${this.getTotalGross()} ${this.letterData?.content.invoiceData.currency} ${this.letterData?.content?.contractData?.contractDate ? html` diff --git a/ts_web/elements/document.ts b/ts_web/elements/document.ts index 925c742..6c2ee21 100644 --- a/ts_web/elements/document.ts +++ b/ts_web/elements/document.ts @@ -121,17 +121,20 @@ export class DeDocument extends DeesElement { } public latestRenderedLetterData: plugins.tsclass.business.ILetter = null; + + public async renderDocument() { const domtools = await this.domtoolsPromise; const documentContainer = this.shadowRoot.querySelector('.documentContainer'); let pages: DePage[] = []; let pageCounter = 0; let complete = false; - const content: DeContentInvoice = document.createElement( - 'dedocument-contentinvoice' - ) as DeContentInvoice; + + // lets append the content + const content: DeContentInvoice = new DeContentInvoice(); content.letterData = this.letterData; document.body.appendChild(content); + await domtools.convenience.smartdelay.delayFor(0); let overallContentOffset: number = 0; let currentContentOffset: number; @@ -179,7 +182,7 @@ export class DeDocument extends DeesElement { this.latestRenderedLetterData = this.letterData; } - async updated(changedProperties: Map): void { + async updated(changedProperties: Map): Promise { super.updated(changedProperties); const domtools = await this.domtoolsPromise; const renderedDocIsUpToDate = domtools.convenience.smartjson.deepEqualObjects(this.letterData, this.latestRenderedLetterData); diff --git a/ts_web/elements/shared/demoletter.ts b/ts_web/elements/shared/demoletter.ts index 0a44439..8023db0 100644 --- a/ts_web/elements/shared/demoletter.ts +++ b/ts_web/elements/shared/demoletter.ts @@ -59,11 +59,13 @@ export const demoLetter: tsclass.business.ILetter = { deliveryDate: new Date().getTime(), periodOfPerformance: null, printResult: null, - + currency: 'EUR', + notes: [], + type: 'debitnote', items: [ { name: 'Item with 19% VAT', - unitQuantity: 1, + unitQuantity: 2, unitNetPrice: 100, unitType: 'hours', vatPercentage: 19, @@ -71,7 +73,7 @@ export const demoLetter: tsclass.business.ILetter = { }, { name: 'Item with 7% VAT', - unitQuantity: 1, + unitQuantity: 4, unitNetPrice: 100, unitType: 'hours', vatPercentage: 7, @@ -79,7 +81,7 @@ export const demoLetter: tsclass.business.ILetter = { }, { name: 'Item with 7% VAT', - unitQuantity: 1, + unitQuantity: 3, unitNetPrice: 230, unitType: 'hours', vatPercentage: 7, @@ -95,14 +97,14 @@ export const demoLetter: tsclass.business.ILetter = { }, { name: 'Item with 0% VAT', - unitQuantity: 1, + unitQuantity: 6, unitNetPrice: 230, unitType: 'hours', vatPercentage: 0, position: 4, },{ name: 'Item with 19% VAT', - unitQuantity: 1, + unitQuantity: 8, unitNetPrice: 100, unitType: 'hours', vatPercentage: 19, @@ -110,7 +112,7 @@ export const demoLetter: tsclass.business.ILetter = { }, { name: 'Item with 7% VAT', - unitQuantity: 1, + unitQuantity: 9, unitNetPrice: 100, unitType: 'hours', vatPercentage: 7, @@ -118,7 +120,7 @@ export const demoLetter: tsclass.business.ILetter = { }, { name: 'Item with 7% VAT', - unitQuantity: 1, + unitQuantity: 4, unitNetPrice: 230, unitType: 'hours', vatPercentage: 7, @@ -126,7 +128,7 @@ export const demoLetter: tsclass.business.ILetter = { }, { name: 'Item with 21% VAT', - unitQuantity: 1, + unitQuantity: 3, unitNetPrice: 230, unitType: 'hours', vatPercentage: 21, @@ -140,6 +142,54 @@ export const demoLetter: tsclass.business.ILetter = { vatPercentage: 0, position: 10, }, + { + name: 'Item with 0% VAT', + unitQuantity: 1, + unitNetPrice: 230, + unitType: 'hours', + vatPercentage: 0, + position: 10, + }, + { + name: 'Item with 0% VAT', + unitQuantity: 1, + unitNetPrice: 230, + unitType: 'hours', + vatPercentage: 0, + position: 10, + }, + { + name: 'Item with 0% VAT', + unitQuantity: 1, + unitNetPrice: 230, + unitType: 'hours', + vatPercentage: 0, + position: 10, + }, + { + name: 'Item with 0% VAT', + unitQuantity: 1, + unitNetPrice: 230, + unitType: 'hours', + vatPercentage: 0, + position: 10, + }, + { + name: 'Item with 0% VAT', + unitQuantity: 1, + unitNetPrice: 230, + unitType: 'hours', + vatPercentage: 0, + position: 10, + }, + { + name: 'Item with 0% VAT', + unitQuantity: 1, + unitNetPrice: 230, + unitType: 'hours', + vatPercentage: 0, + position: 10, + }, ], } },