fix: pdf template customization

This commit is contained in:
Ahmed Bouhuolia
2024-09-17 18:19:28 +02:00
parent bb0d91a9cb
commit 5f40d50852
16 changed files with 74 additions and 41 deletions

View File

@@ -18,7 +18,7 @@ export class PaymentReceivedBrandingTemplate {
public async getPaymentReceivedPdfTemplate(
tenantId: number,
paymentTemplateId: number
): Promise<PdfTemplate> {
) {
const template = await this.getPdfTemplateService.getPdfTemplate(
tenantId,
paymentTemplateId

View File

@@ -7,6 +7,15 @@ export const transformPaymentReceivedToPdfTemplate = (
payment: IPaymentReceived
): Partial<PaymentReceivedPdfTemplateAttributes> => {
return {
// ...payment
total: payment.formattedAmount,
subtotal: payment.subtotalFormatted,
paymentReceivedNumebr: payment.paymentReceiveNo,
paymentReceivedDate: payment.formattedPaymentDate,
customerName: payment.customer.displayName,
lines: payment.entries.map((entry) => ({
invoiceNumber: entry.invoice.invoiceNo,
invoiceAmount: entry.invoice.totalFormatted,
paidAmount: entry.paymentAmountFormatted,
})),
};
};