diff --git a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx
index ef320c15..d60d740a 100644
--- a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx
+++ b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx
@@ -302,49 +302,35 @@ const CustomerPaymentTab = () => {
{
id: 'no',
header: 'No',
- cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- return isInitialBalanceRow ? 'Saldo Awal' : props.row.index;
- },
+ cell: (props) => props.row.index,
footer: () =>
@@ -357,11 +343,8 @@ const CustomerPaymentTab = () => {
id: 'reference',
header: 'Referensi',
accessorKey: 'reference',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return '-';
const value = props.row.original.reference;
return value || '-';
},
@@ -370,11 +353,8 @@ const CustomerPaymentTab = () => {
id: 'vehicle_plate',
header: 'Nomor Polisi',
accessorKey: 'vehicle_numbers',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return '-';
const value = props.row.original.vehicle_numbers;
return value || '-';
},
@@ -383,11 +363,8 @@ const CustomerPaymentTab = () => {
id: 'qty',
header: 'Ekor/Qty',
accessorKey: 'qty',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.qty;
return
{formatNumber(value)}
;
},
@@ -401,11 +378,8 @@ const CustomerPaymentTab = () => {
id: 'weight',
header: 'Berat (Kg)',
accessorKey: 'weight',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.weight;
return
{formatNumber(value)}
;
},
@@ -419,11 +393,8 @@ const CustomerPaymentTab = () => {
id: 'average_weight',
header: 'AVG',
accessorKey: 'average_weight',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.average_weight;
return
{formatNumber(value)}
;
},
@@ -435,11 +406,8 @@ const CustomerPaymentTab = () => {
id: 'price',
header: 'Harga Awal',
accessorKey: 'price',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.price;
return
{formatCurrency(value)}
;
},
@@ -453,11 +421,8 @@ const CustomerPaymentTab = () => {
id: 'credit_note',
header: 'CN',
accessorKey: 'credit_note',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.credit_note;
return
{formatCurrency(value)}
;
},
@@ -471,11 +436,8 @@ const CustomerPaymentTab = () => {
id: 'final_price',
header: 'Harga Akhir',
accessorKey: 'final_price',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.final_price;
return
{formatCurrency(value)}
;
},
@@ -489,11 +451,8 @@ const CustomerPaymentTab = () => {
id: 'ppn',
header: 'PPN (%)',
accessorKey: 'ppn',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.ppn;
return
{formatNumber(value)}%
;
},
@@ -505,11 +464,8 @@ const CustomerPaymentTab = () => {
id: 'total',
header: 'Total',
accessorKey: 'total_price',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.total_price;
return
{formatCurrency(value)}
;
},
@@ -523,11 +479,8 @@ const CustomerPaymentTab = () => {
id: 'payment',
header: 'Pembayaran',
accessorKey: 'payment_amount',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return
-
;
const value = props.row.original.payment_amount;
return
{formatCurrency(value)}
;
},
@@ -541,6 +494,7 @@ const CustomerPaymentTab = () => {
id: 'accounts_receivable',
header: 'Saldo Piutang',
accessorKey: 'accounts_receivable',
+ enableSorting: false,
cell: (props) => {
const value = props.row.original.accounts_receivable;
return (
@@ -557,11 +511,8 @@ const CustomerPaymentTab = () => {
id: 'notes',
header: 'Keterangan',
accessorKey: 'status',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return '-';
const value = props.row.original.status;
if (!value) {
@@ -586,11 +537,8 @@ const CustomerPaymentTab = () => {
id: 'pickup_info',
header: 'Pengambilan',
accessorKey: 'pickup_info',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return '-';
const value = props.row.original.pickup_info;
return value || '-';
},
@@ -599,11 +547,8 @@ const CustomerPaymentTab = () => {
id: 'sales_marketing',
header: 'Sales/Marketing',
accessorKey: 'sales_person',
+ enableSorting: false,
cell: (props) => {
- const isInitialBalanceRow =
- Object.keys(props.row.original).length === 1 &&
- 'accounts_receivable' in props.row.original;
- if (isInitialBalanceRow) return '-';
const value = props.row.original.sales_person;
return value || '-';
},
@@ -854,6 +799,30 @@ const CustomerPaymentTab = () => {
'px-4 py-3 text-xs text-gray-900 whitespace-nowrap',
paginationClassName: 'hidden',
}}
+ renderCustomRow={(row) => {
+ if (row.index === 0) {
+ return (
+
+ |
+
+
+ {formatCurrency(row.original.accounts_receivable)}
+
+ |
+ |
+
+ );
+ }
+ }}
/>
);