From e9d34e19ada564702f6e1e14dc4b8fa97fa73ba5 Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Wed, 6 Nov 2024 17:24:42 +0200 Subject: [PATCH] fix: due invoice server invoice --- packages/server/src/interfaces/SaleInvoice.ts | 9 +++++---- .../services/Sales/Invoices/SaleInvoicePdf.ts | 3 --- .../src/services/Sales/Invoices/utils.ts | 2 +- .../src/components/InvoicePaperTemplate.tsx | 19 ++++++++++--------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/server/src/interfaces/SaleInvoice.ts b/packages/server/src/interfaces/SaleInvoice.ts index 01fc8bf26..c3bdcde33 100644 --- a/packages/server/src/interfaces/SaleInvoice.ts +++ b/packages/server/src/interfaces/SaleInvoice.ts @@ -338,21 +338,22 @@ export interface InvoicePdfTemplateAttributes { subtotalLabel: string; discountLabel: string; paymentMadeLabel: string; - balanceDueLabel: string; showTotal: boolean; showSubtotal: boolean; showDiscount: boolean; showTaxes: boolean; showPaymentMade: boolean; - showDueAmount: boolean; - showBalanceDue: boolean; total: string; subtotal: string; discount: string; paymentMade: string; - balanceDue: string; + + // Due Amount + dueAmount: string; + showDueAmount: boolean; + dueAmountLabel: string; termsConditionsLabel: string; showTermsConditions: boolean; diff --git a/packages/server/src/services/Sales/Invoices/SaleInvoicePdf.ts b/packages/server/src/services/Sales/Invoices/SaleInvoicePdf.ts index 1390ff9da..a664ead35 100644 --- a/packages/server/src/services/Sales/Invoices/SaleInvoicePdf.ts +++ b/packages/server/src/services/Sales/Invoices/SaleInvoicePdf.ts @@ -19,9 +19,6 @@ export class SaleInvoicePdf { @Inject() private chromiumlyTenancy: ChromiumlyTenancy; - @Inject() - private templateInjectable: TemplateInjectable; - @Inject() private getInvoiceService: GetSaleInvoice; diff --git a/packages/server/src/services/Sales/Invoices/utils.ts b/packages/server/src/services/Sales/Invoices/utils.ts index 833822459..0db99bf55 100644 --- a/packages/server/src/services/Sales/Invoices/utils.ts +++ b/packages/server/src/services/Sales/Invoices/utils.ts @@ -27,7 +27,7 @@ export const transformInvoiceToPdfTemplate = ( total: invoice.totalFormatted, subtotal: invoice.subtotalFormatted, paymentMade: invoice.paymentAmountFormatted, - balanceDue: invoice.balanceAmountFormatted, + dueAmount: invoice.dueAmountFormatted, termsConditions: invoice.termsConditions, statement: invoice.invoiceMessage, diff --git a/shared/pdf-templates/src/components/InvoicePaperTemplate.tsx b/shared/pdf-templates/src/components/InvoicePaperTemplate.tsx index 669c734cc..f14561921 100644 --- a/shared/pdf-templates/src/components/InvoicePaperTemplate.tsx +++ b/shared/pdf-templates/src/components/InvoicePaperTemplate.tsx @@ -71,10 +71,12 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps { totalLabel?: string; total?: string; + // Discount showDiscount?: boolean; discountLabel?: string; discount?: string; + // Subtotal showSubtotal?: boolean; subtotalLabel?: string; subtotal?: string; @@ -85,10 +87,10 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps { showTaxes?: boolean; + // Due Amount showDueAmount?: boolean; - showBalanceDue?: boolean; - balanceDueLabel?: string; - balanceDue?: string; + dueAmountLabel?: string; + dueAmount?: string; // Footer termsConditionsLabel?: string; @@ -144,7 +146,7 @@ export function InvoicePaperTemplate({ subtotalLabel = 'Subtotal', discountLabel = 'Discount', paymentMadeLabel = 'Payment Made', - balanceDueLabel = 'Balance Due', + dueAmountLabel = 'Balance Due', // Totals showTotal = true, @@ -153,13 +155,12 @@ export function InvoicePaperTemplate({ showTaxes = true, showPaymentMade = true, showDueAmount = true, - showBalanceDue = true, total = '$662.75', subtotal = '630.00', discount = '0.00', paymentMade = '100.00', - balanceDue = '$562.75', + dueAmount = '$562.75', // Footer paragraphs. termsConditionsLabel = 'Terms & Conditions', @@ -297,10 +298,10 @@ export function InvoicePaperTemplate({ amount={paymentMade} /> )} - {showBalanceDue && ( + {showDueAmount && (