fix some bugs 3

This commit is contained in:
2026-07-18 15:30:59 +03:30
parent f7edf4e2d3
commit 45f2d8bf70
5 changed files with 41 additions and 28 deletions
+14 -9
View File
@@ -59,7 +59,8 @@ class AssetSummaryService
$metalsWithProductWallet,
$mainWalletProductIds,
$userWallets,
$customerId
$customerId,
$ownerType
),
$this->buildInventoryCards($userWallets, $catalogById, $mainWalletProductIds, $mainWallet),
);
@@ -71,7 +72,8 @@ class AssetSummaryService
$catalogById,
$metalsWithProductWallet,
$mainWalletProductIds,
$customerId
$customerId,
$ownerType
);
$cashWallet = $this->walletBalanceService->mainWalletCash($userWallets);
$assetsRialValue = $this->sumAssetsRialValue(
@@ -218,12 +220,13 @@ class AssetSummaryService
array $metalsWithProductWallet = [],
array $mainWalletProductIds = [],
Collection $userWallets,
int $customerId = 0
int $customerId = 0,
int $ownerType = 0
): array {
$cards = [];
$mainWalletGrams = Controller::weightToGrams(
$customerId > 0
? $this->walletBalanceService->effectiveMainWalletGold($customerId)
? $this->walletBalanceService->effectiveMainWalletGold($customerId, $ownerType)
: $this->effectiveMainWalletGold($userWallets, $mainWallet, $mainWalletProductIds)
);
$assignedMetalIds = [];
@@ -237,9 +240,10 @@ class AssetSummaryService
}
$mainWalletWeight = $customerId > 0
? $this->walletBalanceService->effectiveMainWalletGold($customerId)
? $this->walletBalanceService->effectiveMainWalletGold($customerId, $ownerType)
: $this->effectiveMainWalletGold($userWallets, $mainWallet, $mainWalletProductIds);
if ($mainWalletWeight <= 0) {
// صفر کامل را نشان نده؛ منفی را نشان بده تا اختلاف موجودی دیده شود
if (abs($mainWalletWeight) < 0.000001) {
return [];
}
@@ -322,7 +326,7 @@ class AssetSummaryService
public function productDisplayQuantity(int $customerId, int $ownerType, int $productId): float
{
if ($this->configService->isMainWalletProduct($productId)) {
return $this->walletBalanceService->effectiveMainWalletGold($customerId);
return $this->walletBalanceService->effectiveMainWalletGold($customerId, $ownerType);
}
$card = $this->productInventoryCard($customerId, $ownerType, $productId);
@@ -609,7 +613,8 @@ class AssetSummaryService
Collection $catalogById,
array $metalsWithProductWallet = [],
array $mainWalletProductIds = [],
int $customerId = 0
int $customerId = 0,
int $ownerType = 0
): array {
if ($metalIds === []) {
return [];
@@ -617,7 +622,7 @@ class AssetSummaryService
$mainWalletGrams = Controller::weightToGrams(
$customerId > 0
? $this->walletBalanceService->effectiveMainWalletGold($customerId)
? $this->walletBalanceService->effectiveMainWalletGold($customerId, $ownerType)
: $this->effectiveMainWalletGold($userWallets, $mainWallet, $mainWalletProductIds)
);
$totals = [];