fix: [receivables] 상위 거래처 집계에서 soft delete 레코드 제외

- orders, deposits, bills 서브쿼리에 whereNull('deleted_at') 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
유병철
2026-03-06 10:59:16 +09:00
parent a7973bb555
commit be9c1baa34

View File

@@ -270,18 +270,21 @@ private function getTopReceivableVendors(int $tenantId, int $limit = 3): array
->select('client_id', \DB::raw('SUM(total_amount) as total'))
->where('tenant_id', $tenantId)
->whereNotNull('client_id')
->whereNull('deleted_at')
->groupBy('client_id');
$depositsSub = \DB::table('deposits')
->select('client_id', \DB::raw('SUM(amount) as total'))
->where('tenant_id', $tenantId)
->whereNotNull('client_id')
->whereNull('deleted_at')
->groupBy('client_id');
$billsSub = \DB::table('bills')
->select('client_id', \DB::raw('SUM(amount) as total'))
->where('tenant_id', $tenantId)
->whereNotNull('client_id')
->whereNull('deleted_at')
->where('bill_type', 'received')
->groupBy('client_id');