diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 38bbe94a..f8f0bbc7 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -72,7 +72,7 @@ import { } from '@/components/pages/production/recording/form/RecordingForm.schema'; import { isResponseSuccess, isResponseError } from '@/lib/api-helper'; -import { formatDate, formatNumber, cn } from '@/lib/helper'; +import { formatDate, formatNumber, cn, formatCurrency } from '@/lib/helper'; import { getProductWarehouseOptionLabel, isProductWarehouseSelectableForKandang, @@ -1509,6 +1509,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { const { pendingQty } = getStockPendingInfo( stock.product_warehouse_id.value ); + const totalPrice = initialValues?.stocks?.[stockIdx]?.total_price; + const showTotalPrice = + type === 'detail' && typeof totalPrice === 'number'; if (isDetail) { if (pendingQty > 0) { @@ -1516,11 +1519,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { (tersedia: {formatNumber(availableStock)} | pending:{' '} {formatNumber(pendingQty)} | - pakai: {formatNumber(requestedUsage)}) + pakai: {formatNumber(requestedUsage)} + {showTotalPrice && ( + <> | total harga: {formatCurrency(totalPrice)} + )} + ) ); } - return null; } if (requestedUsage > 0) { @@ -1529,13 +1535,18 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { (tersedia: {formatNumber(availableStock)} | pakai:{' '} {formatNumber(requestedUsage)} | sisa:{' '} {formatNumber(Math.max(remainingStock, 0))} | dipinjam:{' '} - {formatNumber(Math.max(-remainingStock, 0))}) + {formatNumber(Math.max(-remainingStock, 0))} + {showTotalPrice && ( + <> | total harga: {formatCurrency(totalPrice)} + )} + ) ); } return ( - (tersedia: {formatNumber(availableStock)}) + (tersedia: {formatNumber(availableStock)} + {showTotalPrice && <> | total harga: {formatCurrency(totalPrice)}}) ); }, diff --git a/src/components/pages/report/expense/tab/ReportDepreciationTab.tsx b/src/components/pages/report/expense/tab/ReportDepreciationTab.tsx index f6e34f95..93264bc7 100644 --- a/src/components/pages/report/expense/tab/ReportDepreciationTab.tsx +++ b/src/components/pages/report/expense/tab/ReportDepreciationTab.tsx @@ -120,7 +120,7 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => { 'IDR', 'id-ID', 0, - 10 + 2 ), }, { @@ -143,7 +143,7 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => { 'IDR', 'id-ID', 0, - 10 + 2 ), }, ], diff --git a/src/types/api/production/recording.d.ts b/src/types/api/production/recording.d.ts index 9a8690c5..0d2c991a 100644 --- a/src/types/api/production/recording.d.ts +++ b/src/types/api/production/recording.d.ts @@ -67,6 +67,7 @@ export type RecordingStock = { qty?: number; usage_amount?: number; pending_qty: number; + total_price?: number; product_warehouse: ProductWarehouse; };