Skip to content

Commit

Permalink
fix: due invoice server invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Nov 6, 2024
1 parent 107532f commit e9d34e1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
9 changes: 5 additions & 4 deletions packages/server/src/interfaces/SaleInvoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions packages/server/src/services/Sales/Invoices/SaleInvoicePdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export class SaleInvoicePdf {
@Inject()
private chromiumlyTenancy: ChromiumlyTenancy;

@Inject()
private templateInjectable: TemplateInjectable;

@Inject()
private getInvoiceService: GetSaleInvoice;

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/Sales/Invoices/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 10 additions & 9 deletions shared/pdf-templates/src/components/InvoicePaperTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -144,7 +146,7 @@ export function InvoicePaperTemplate({
subtotalLabel = 'Subtotal',
discountLabel = 'Discount',
paymentMadeLabel = 'Payment Made',
balanceDueLabel = 'Balance Due',
dueAmountLabel = 'Balance Due',

// Totals
showTotal = true,
Expand All @@ -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',
Expand Down Expand Up @@ -297,10 +298,10 @@ export function InvoicePaperTemplate({
amount={paymentMade}
/>
)}
{showBalanceDue && (
{showDueAmount && (
<PaperTemplate.TotalLine
label={balanceDueLabel}
amount={balanceDue}
label={dueAmountLabel}
amount={dueAmount}
border={PaperTemplateTotalBorder.Dark}
style={{ fontWeight: 500 }}
/>
Expand Down

0 comments on commit e9d34e1

Please sign in to comment.