feat(FE-344,345): Integrate HPP Ekspedisi into Closing detail

This commit is contained in:
rstubryan
2025-12-11 15:04:37 +07:00
parent 38b91a57f0
commit bd8d121113
4 changed files with 79 additions and 53 deletions
@@ -21,25 +21,16 @@ const CostOfRevenueExpeditionReportTable = ({
}: CostOfRevenueExpeditionReportTableProps) => {
const costOfRevenueExpeditionData: BaseCostOfRevenueExpedition[] =
useMemo(() => {
return initialValues?.cos_expeditions || [];
return initialValues?.expedition_costs || [];
}, [initialValues]);
const totals = useMemo(() => {
if (costOfRevenueExpeditionData.length === 0) {
return {
totalHpp: 0,
};
}
const totalHpp = costOfRevenueExpeditionData.reduce(
(sum, item) => sum + (item.hpp || 0),
0
);
const totalHpp = initialValues?.total_hpp_amount || 0;
return {
totalHpp,
};
}, [costOfRevenueExpeditionData]);
}, [initialValues]);
const costOfRevenueExpeditionColumns: ColumnDef<BaseCostOfRevenueExpedition>[] =
useMemo(
@@ -58,14 +49,14 @@ const CostOfRevenueExpeditionReportTable = ({
),
},
{
id: 'expedition_name',
accessorKey: 'expedition_name',
id: 'expedition_vendor_name',
accessorKey: 'expedition_vendor_name',
header: 'Nama Ekspedisi',
cell: (props) => props.getValue() || '-',
},
{
id: 'hpp',
accessorKey: 'hpp',
id: 'hpp_amount',
accessorKey: 'hpp_amount',
header: 'HPP Ekspedisi',
cell: (props) => {
const value = props.getValue() as number;