fix: due invoice server invoice

This commit is contained in:
Ahmed Bouhuolia
2024-11-06 17:24:42 +02:00
parent 107532fe26
commit e9d34e19ad
4 changed files with 16 additions and 17 deletions

View File

@@ -338,21 +338,22 @@ export interface InvoicePdfTemplateAttributes {
subtotalLabel: string; subtotalLabel: string;
discountLabel: string; discountLabel: string;
paymentMadeLabel: string; paymentMadeLabel: string;
balanceDueLabel: string;
showTotal: boolean; showTotal: boolean;
showSubtotal: boolean; showSubtotal: boolean;
showDiscount: boolean; showDiscount: boolean;
showTaxes: boolean; showTaxes: boolean;
showPaymentMade: boolean; showPaymentMade: boolean;
showDueAmount: boolean;
showBalanceDue: boolean;
total: string; total: string;
subtotal: string; subtotal: string;
discount: string; discount: string;
paymentMade: string; paymentMade: string;
balanceDue: string;
// Due Amount
dueAmount: string;
showDueAmount: boolean;
dueAmountLabel: string;
termsConditionsLabel: string; termsConditionsLabel: string;
showTermsConditions: boolean; showTermsConditions: boolean;

View File

@@ -19,9 +19,6 @@ export class SaleInvoicePdf {
@Inject() @Inject()
private chromiumlyTenancy: ChromiumlyTenancy; private chromiumlyTenancy: ChromiumlyTenancy;
@Inject()
private templateInjectable: TemplateInjectable;
@Inject() @Inject()
private getInvoiceService: GetSaleInvoice; private getInvoiceService: GetSaleInvoice;

View File

@@ -27,7 +27,7 @@ export const transformInvoiceToPdfTemplate = (
total: invoice.totalFormatted, total: invoice.totalFormatted,
subtotal: invoice.subtotalFormatted, subtotal: invoice.subtotalFormatted,
paymentMade: invoice.paymentAmountFormatted, paymentMade: invoice.paymentAmountFormatted,
balanceDue: invoice.balanceAmountFormatted, dueAmount: invoice.dueAmountFormatted,
termsConditions: invoice.termsConditions, termsConditions: invoice.termsConditions,
statement: invoice.invoiceMessage, statement: invoice.invoiceMessage,

View File

@@ -71,10 +71,12 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps {
totalLabel?: string; totalLabel?: string;
total?: string; total?: string;
// Discount
showDiscount?: boolean; showDiscount?: boolean;
discountLabel?: string; discountLabel?: string;
discount?: string; discount?: string;
// Subtotal
showSubtotal?: boolean; showSubtotal?: boolean;
subtotalLabel?: string; subtotalLabel?: string;
subtotal?: string; subtotal?: string;
@@ -85,10 +87,10 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps {
showTaxes?: boolean; showTaxes?: boolean;
// Due Amount
showDueAmount?: boolean; showDueAmount?: boolean;
showBalanceDue?: boolean; dueAmountLabel?: string;
balanceDueLabel?: string; dueAmount?: string;
balanceDue?: string;
// Footer // Footer
termsConditionsLabel?: string; termsConditionsLabel?: string;
@@ -144,7 +146,7 @@ export function InvoicePaperTemplate({
subtotalLabel = 'Subtotal', subtotalLabel = 'Subtotal',
discountLabel = 'Discount', discountLabel = 'Discount',
paymentMadeLabel = 'Payment Made', paymentMadeLabel = 'Payment Made',
balanceDueLabel = 'Balance Due', dueAmountLabel = 'Balance Due',
// Totals // Totals
showTotal = true, showTotal = true,
@@ -153,13 +155,12 @@ export function InvoicePaperTemplate({
showTaxes = true, showTaxes = true,
showPaymentMade = true, showPaymentMade = true,
showDueAmount = true, showDueAmount = true,
showBalanceDue = true,
total = '$662.75', total = '$662.75',
subtotal = '630.00', subtotal = '630.00',
discount = '0.00', discount = '0.00',
paymentMade = '100.00', paymentMade = '100.00',
balanceDue = '$562.75', dueAmount = '$562.75',
// Footer paragraphs. // Footer paragraphs.
termsConditionsLabel = 'Terms & Conditions', termsConditionsLabel = 'Terms & Conditions',
@@ -297,10 +298,10 @@ export function InvoicePaperTemplate({
amount={paymentMade} amount={paymentMade}
/> />
)} )}
{showBalanceDue && ( {showDueAmount && (
<PaperTemplate.TotalLine <PaperTemplate.TotalLine
label={balanceDueLabel} label={dueAmountLabel}
amount={balanceDue} amount={dueAmount}
border={PaperTemplateTotalBorder.Dark} border={PaperTemplateTotalBorder.Dark}
style={{ fontWeight: 500 }} style={{ fontWeight: 500 }}
/> />