From e1c0701629d8d34a2371596612d08514e71e5630 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Mon, 12 Jan 2026 21:39:22 +0700 Subject: [PATCH] refactor(FE): Adapt customer payment report types and exports --- .../finance/export/CustomerPaymentExportPDF.tsx | 9 ++++----- .../finance/export/CustomerPaymentExportXLSX.tsx | 6 ++++-- .../pages/report/finance/tab/CustomerPaymentTab.tsx | 12 ++++++++---- src/services/api/report/finance-report.ts | 8 ++++---- src/types/api/report/customer-payment.d.ts | 13 ++++--------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx b/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx index e224d0f0..88c556de 100644 --- a/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx +++ b/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx @@ -161,10 +161,7 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { {customerReport.customer.name} - {customerReport.customer_address || ''} - - - NPWP: {customerReport.customer_npwp || '-'} + {customerReport.customer.address || ''} {customerReport.summary && ( @@ -266,7 +263,9 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { - {formatNumber(item.aging)} hari + + {item.aging_day ? formatNumber(item.aging_day) : '-'} hari + {item.reference || '-'} diff --git a/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx b/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx index 3cc4d67a..d51aa3b7 100644 --- a/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx +++ b/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx @@ -30,9 +30,11 @@ export const generateCustomerPaymentExcel = ( 'Tanggal Realisasi': item.realization_date ? formatDate(item.realization_date, 'DD MMM YYYY') : '', - Aging: formatNumber(item.aging || 0), + Aging: formatNumber(item.aging_day || 0), Referensi: item.reference || '', - 'Nomor Polisi': item.vehicle_plate || '', + 'Nomor Polisi': Array.isArray(item.vehicle_plate) + ? item.vehicle_plate.join(', ') + : '', 'Ekor/Qty': formatNumber(item.qty || 0), 'Berat (Kg)': formatNumber(item.weight || 0), AVG: formatNumber(item.average_weight || 0), diff --git a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx index f57f7335..1d8d1993 100644 --- a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx +++ b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx @@ -279,10 +279,14 @@ const CustomerPaymentTab = () => { { id: 'aging', header: 'Aging', - accessorKey: 'aging', + accessorKey: 'aging_day', cell: (props) => { - const value = props.row.original.aging; - return
{formatNumber(value)} hari
; + const value = props.row.original.aging_day; + return ( +
+ {value ? formatNumber(value) : '-'} hari +
+ ); }, }, { @@ -662,7 +666,7 @@ const CustomerPaymentTab = () => {