Browse Source

Merge pull request #83 from andrewdwallo/fix/group-by-error

fix #82
3.x
Andrew Wallo 10 months ago
parent
commit
2352c1416f
No account linked to committer's email address
1 changed files with 18 additions and 2 deletions
  1. 18
    2
      app/Services/AccountService.php

+ 18
- 2
app/Services/AccountService.php View File

@@ -170,7 +170,15 @@ class AccountService
170 170
                 $join->on('transactions.id', '=', 'journal_entries.transaction_id')
171 171
                     ->where('transactions.posted_at', '<=', $endDate);
172 172
             })
173
-            ->groupBy('accounts.id')
173
+            ->groupBy([
174
+                'accounts.id',
175
+                'accounts.name',
176
+                'accounts.category',
177
+                'accounts.type',
178
+                'accounts.subtype_id',
179
+                'accounts.currency_code',
180
+                'accounts.code',
181
+            ])
174 182
             ->with(['subtype:id,name,inverse_cash_flow']);
175 183
 
176 184
         if (! empty($accountIds)) {
@@ -230,7 +238,15 @@ class AccountService
230 238
                     ->whereNotNull('bank_accounts.bank_account_id')
231 239
                     ->whereColumn('je.transaction_id', 'journal_entries.transaction_id');
232 240
             })
233
-            ->groupBy('accounts.id')
241
+            ->groupBy([
242
+                'accounts.id',
243
+                'accounts.name',
244
+                'accounts.category',
245
+                'accounts.type',
246
+                'accounts.subtype_id',
247
+                'accounts.currency_code',
248
+                'accounts.code',
249
+            ])
234 250
             ->with(['subtype:id,name,inverse_cash_flow']);
235 251
 
236 252
         if (! empty($accountIds)) {

Loading…
Cancel
Save