fix some bug

This commit is contained in:
2026-07-01 20:59:24 +03:30
parent e3a883d224
commit a69316e0de
10 changed files with 226 additions and 14 deletions
@@ -500,7 +500,13 @@ class WalletController extends Controller
TableEngine::create($sumQuery, $request->all())
->initSearch(['customer.name']);
$sumRows = (clone $sumQuery)->with('product:id,metal_id,unit,amount,group_type,trade_by_quantity,direct_price,title')->get();
$walletTableWith = [
'customer:id,name,mobile',
'fund:id,title',
'product:id,metal_id,unit,amount,group_type,trade_by_quantity,direct_price,title',
];
$sumRows = (clone $sumQuery)->with($walletTableWith)->get();
$metalBalances = $balanceService->buildWalletMetalSums($sumRows, $catalogMetalIds);
$totalGold = array_sum(array_column($metalBalances, 'gold'));
$totalGoldToCash = array_sum(array_column($metalBalances, 'goldToCash'));
@@ -514,9 +520,9 @@ class WalletController extends Controller
'metalBalances' => $metalBalances,
];
$records = Wallet::with(['customer', 'product:id,metal_id,unit,amount,group_type,trade_by_quantity,direct_price,title']);
$records = Wallet::with($walletTableWith);
TableEngine::create($records, $request->all())
->initSearch(['customer.name'])
->initSearch(['customer.name', 'customer.mobile', 'product.title', 'fund.title'])
->select(['*'])
->export($records);