mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
24 lines
818 B
TypeScript
24 lines
818 B
TypeScript
import {
|
|
IPaymentReceived,
|
|
PaymentReceivedPdfTemplateAttributes,
|
|
} from '@/interfaces';
|
|
import { contactAddressTextFormat } from '@/utils/address-text-format';
|
|
|
|
export const transformPaymentReceivedToPdfTemplate = (
|
|
payment: IPaymentReceived
|
|
): Partial<PaymentReceivedPdfTemplateAttributes> => {
|
|
return {
|
|
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,
|
|
})),
|
|
customerAddress: contactAddressTextFormat(payment.customer),
|
|
};
|
|
};
|