From 61cd56be228f4f024e95f9885d2c3880f5f0d0df Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 10 Jun 2026 14:50:50 +0700 Subject: [PATCH 1/4] feat: add total_price to recording stock type and display it in recording detail form --- .../production/recording/form/RecordingForm.tsx | 12 +++++++++--- src/types/api/production/recording.d.ts | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 38bbe94a..0d4a761b 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -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,7 +1519,8 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { (tersedia: {formatNumber(availableStock)} | pending:{' '} {formatNumber(pendingQty)} | - pakai: {formatNumber(requestedUsage)}) + pakai: {formatNumber(requestedUsage)} + {showTotalPrice && <> | total harga: {totalPrice}}) ); } @@ -1529,13 +1533,15 @@ 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: {totalPrice}}) ); } return ( - (tersedia: {formatNumber(availableStock)}) + (tersedia: {formatNumber(availableStock)} + {showTotalPrice && <> | total harga: {totalPrice}}) ); }, 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; }; From 7061031cd9334e5eda062f4d4061d987a7aba54c Mon Sep 17 00:00:00 2001 From: MacBook Air M1 Date: Wed, 10 Jun 2026 21:15:59 +0700 Subject: [PATCH 2/4] show total price when pending is 0 --- .../pages/production/recording/form/RecordingForm.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 0d4a761b..9735a9b4 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -1524,6 +1524,13 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { ); } + if (showTotalPrice) { + return ( + + (total harga: {totalPrice}) + + ); + } return null; } From 89a6312761e3f3c57f4f6286640dc5df92e36828 Mon Sep 17 00:00:00 2001 From: MacBook Air M1 Date: Wed, 10 Jun 2026 22:18:44 +0700 Subject: [PATCH 3/4] adjust laporan depresiasi --- .../pages/report/expense/tab/ReportDepreciationTab.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ), }, ], From a7cdf0f7851995751ee111f3d02838a7b9d5b56b Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Thu, 11 Jun 2026 11:14:31 +0700 Subject: [PATCH 4/4] fix: format total price --- .../production/recording/form/RecordingForm.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 0d4a761b..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,7 +1509,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { const { pendingQty } = getStockPendingInfo( stock.product_warehouse_id.value ); - const totalPrice = initialValues?.stocks?.[stockIdx].total_price; + const totalPrice = initialValues?.stocks?.[stockIdx]?.total_price; const showTotalPrice = type === 'detail' && typeof totalPrice === 'number'; @@ -1520,11 +1520,13 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { (tersedia: {formatNumber(availableStock)} | pending:{' '} {formatNumber(pendingQty)} | pakai: {formatNumber(requestedUsage)} - {showTotalPrice && <> | total harga: {totalPrice}}) + {showTotalPrice && ( + <> | total harga: {formatCurrency(totalPrice)} + )} + ) ); } - return null; } if (requestedUsage > 0) { @@ -1534,14 +1536,17 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { {formatNumber(requestedUsage)} | sisa:{' '} {formatNumber(Math.max(remainingStock, 0))} | dipinjam:{' '} {formatNumber(Math.max(-remainingStock, 0))} - {showTotalPrice && <> | total harga: {totalPrice}}) + {showTotalPrice && ( + <> | total harga: {formatCurrency(totalPrice)} + )} + ) ); } return ( (tersedia: {formatNumber(availableStock)} - {showTotalPrice && <> | total harga: {totalPrice}}) + {showTotalPrice && <> | total harga: {formatCurrency(totalPrice)}}) ); },