From f1dba4012aed8dfef95771863f937f1683451e72 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Wed, 14 Jan 2026 22:17:24 +0700 Subject: [PATCH] refactor(FE): Update customer payment types and exports --- .../export/CustomerPaymentExportPDF.tsx | 18 ++++-------------- .../export/CustomerPaymentExportXLSX.tsx | 12 +++++++----- .../report/finance/tab/CustomerPaymentTab.tsx | 8 ++------ src/types/api/report/customer-payment.d.ts | 7 +++---- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx b/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx index 8dce38ad..71969e8a 100644 --- a/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx +++ b/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx @@ -284,7 +284,7 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { Aging - + Referensi @@ -305,9 +305,6 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { Harga Akhir - - Pajak - Total @@ -361,7 +358,7 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { {item.aging_day ? formatNumber(item.aging_day) : '-'} hari - + {item.reference || '-'} @@ -435,7 +432,7 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { - + @@ -453,20 +450,13 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { - - {formatCurrency( - customerReport.summary.total_initial_amount - )} - + {formatCurrency(customerReport.summary.total_final_amount)} - - - {formatCurrency(customerReport.summary.total_grand_amount)} diff --git a/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx b/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx index b14b5ef6..3fb21488 100644 --- a/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx +++ b/src/components/pages/report/finance/export/CustomerPaymentExportXLSX.tsx @@ -32,7 +32,9 @@ export const generateCustomerPaymentExcel = ( : '', Aging: formatNumber(item.aging_day || 0), Referensi: item.reference || '', - 'Nomor Polisi': item.vehicle_numbers || '', + 'Nomor Polisi': Array.isArray(item.vehicle_numbers) + ? item.vehicle_numbers.join(', ') + : '', 'Ekor/Qty': formatNumber(item.qty || 0), 'Berat (Kg)': formatNumber(item.weight || 0), AVG: formatNumber(item.average_weight || 0), @@ -42,7 +44,9 @@ export const generateCustomerPaymentExcel = ( Pembayaran: formatCurrency(item.payment_amount || 0), 'Saldo Piutang': formatCurrency(item.accounts_receivable || 0), Keterangan: item.status || '', - Pengambilan: item.pickup_info || '', + Pengambilan: Array.isArray(item.pickup_info) + ? item.pickup_info.join(', ') + : '', 'Sales/Marketing': item.sales_person || '', }) ); @@ -58,9 +62,7 @@ export const generateCustomerPaymentExcel = ( 'Ekor/Qty': formatNumber(customerReport.summary.total_qty || 0), 'Berat (Kg)': formatNumber(customerReport.summary.total_weight || 0), AVG: '', - 'Harga Awal': formatCurrency( - customerReport.summary.total_initial_amount || 0 - ), + 'Harga Awal': '', 'Harga Akhir': formatCurrency( customerReport.summary.total_final_amount || 0 ), diff --git a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx index 928c9c41..18a8674a 100644 --- a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx +++ b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx @@ -412,9 +412,7 @@ const CustomerPaymentTab = () => { return
{formatCurrency(value)}
; }, footer: () => ( -
- {formatCurrency(summary.total_initial_amount) || '-'} -
+
-
), }, { @@ -510,7 +508,7 @@ const CustomerPaymentTab = () => { status: getPaymentStatusIndicatorColor(value), }} > - {getPaymentStatusText(value)} + {getPaymentStatusText(value)} ); }, @@ -729,8 +727,6 @@ const CustomerPaymentTab = () => { const summary = customerReport.summary || { total_qty: 0, total_weight: 0, - total_initial_amount: 0, - total_credit_note: 0, total_final_amount: 0, total_grand_amount: 0, total_payment: 0, diff --git a/src/types/api/report/customer-payment.d.ts b/src/types/api/report/customer-payment.d.ts index f25f510a..9169c99b 100644 --- a/src/types/api/report/customer-payment.d.ts +++ b/src/types/api/report/customer-payment.d.ts @@ -7,7 +7,7 @@ export type CustomerPaymentRow = { trans_date: string; delivery_date: string | null; reference: string; - vehicle_numbers: string; + vehicle_numbers: string[]; qty: number; weight: number; average_weight: number; @@ -16,16 +16,15 @@ export type CustomerPaymentRow = { total_price: number; payment_amount: number; accounts_receivable: number; - aging_day: number; + aging_day: number | null; status: string; - pickup_info: string; + pickup_info: string[]; sales_person: string; }; export type CustomerPaymentSummary = { total_qty: number; total_weight: number; - total_initial_amount: number; total_final_amount: number; total_grand_amount: number; total_payment: number;