- {formatCurrency(value)}
+ {
+ id: 'value_transport',
+ header: 'Value Transport (Rp)',
+ accessorKey: 'value_transport',
+ cell: (props) => {
+ const value = props.getValue() as number;
+ return
- );
+ ),
},
- },
- {
- header: 'Jumlah (Rp)',
- accessorKey: 'total',
- cell: (props) => {
- const value = props.getValue() as number;
- const isFooter = '_isFooter' in props.row.original;
- return (
-
- {formatCurrency(value)}
+ {
+ id: 'total',
+ header: 'Jumlah (Rp)',
+ accessorKey: 'total',
+ cell: (props) => {
+ const value = props.getValue() as number;
+ return
{formatCurrency(value)}
;
+ },
+ footer: () => (
+
+ {formatCurrency(totals.totalJumlah)}
- );
+ ),
},
- },
- {
- header: 'Ekspedisi',
- accessorKey: 'expedition_vendor_name',
- cell: (props) => {
- const isFooter = '_isFooter' in props.row.original;
- if (isFooter) return null;
- return props.row.original.expedition_vendor_name;
+ {
+ id: 'expedition_vendor_name',
+ header: 'Ekspedisi',
+ accessorKey: 'expedition_vendor_name',
+ cell: (props) => props.getValue() || '-',
},
- },
- {
- header: 'Surat Jalan',
- accessorKey: 'travel_number',
- cell: (props) => {
- const isFooter = '_isFooter' in props.row.original;
- if (isFooter) return null;
- return props.row.original.travel_number;
+ {
+ id: 'travel_number',
+ header: 'Surat Jalan',
+ accessorKey: 'travel_number',
+ cell: (props) => props.getValue() || '-',
},
- },
- ];
+ ];
+ return tableColumns;
+ };
return (
<>
@@ -451,31 +395,8 @@ const PurchasesPerSupplierTab = () => {
totalJumlah,
};
- const footerData =
- supplier.items.length > 0
- ? [
- {
- id: -999,
- no: 'Total',
- received_date: '',
- po_date: null,
- po_number: null,
- product_name: null,
- destination_warehouse: null,
- qty: totals.totalQty,
- price: totals.totalPrice,
- purchase_amount: totals.totalPurchaseAmount,
- transport: totals.totalTransport,
- value_transport: totals.totalValueTransport,
- total: totals.totalJumlah,
- expedition_vendor_name: null,
- travel_number: null,
- _isFooter: true,
- },
- ]
- : [];
-
const totalPurchase = totals.totalJumlah;
+ const tableColumns = getTableColumns(totals);
return (
{
data={supplier.items}
columns={tableColumns}
pageSize={10}
- footerData={footerData}
renderFooter={supplier.items.length > 0}
className={{
tableWrapperClassName: 'overflow-x-auto mt-4',