From 6a0379e226f69293a06b2a2af54a1e56272cdfa7 Mon Sep 17 00:00:00 2001 From: adonis Date: Sun, 5 Jul 2026 16:42:33 +0330 Subject: [PATCH] added pargar accounting --- src/utils/productAssets.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/utils/productAssets.ts b/src/utils/productAssets.ts index b2ca6b8..b630df5 100644 --- a/src/utils/productAssets.ts +++ b/src/utils/productAssets.ts @@ -782,11 +782,11 @@ export function getRialCashAmount( walletInfo?: Record | null, wallets?: UserWalletLine[] | null ): number { - const aggregated = walletInfo?.count_cash_wallet ?? walletInfo?.count_cash - if (aggregated != null && aggregated !== '') { - const parsed = Number(aggregated) - if (!Number.isNaN(parsed)) { - return parsed + const directCash = walletInfo?.cash + if (directCash != null && directCash !== '') { + const parsedDirect = Number(directCash) + if (!Number.isNaN(parsedDirect)) { + return parsedDirect } } @@ -795,7 +795,15 @@ export function getRialCashAmount( return mainCash } - return Number(walletInfo?.cash ?? 0) + const aggregated = walletInfo?.count_cash_wallet ?? walletInfo?.count_cash + if (aggregated != null && aggregated !== '') { + const parsed = Number(aggregated) + if (!Number.isNaN(parsed)) { + return parsed + } + } + + return 0 } export function getCashWalletBalance(