Browse Source

Merge pull request #146 from andrewdwallo/development-3.x

Development 3.x
3.x
Andrew Wallo 5 months ago
parent
commit
79d5e2f972
No account linked to committer's email address
1 changed files with 18 additions and 18 deletions
  1. 18
    18
      app/Services/AccountService.php

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

299
             })
299
             })
300
             ->whereIn('journal_entries.account_id', $accountIds)
300
             ->whereIn('journal_entries.account_id', $accountIds)
301
             ->selectRaw('
301
             ->selectRaw('
302
-            SUM(CASE
303
-                WHEN transactions.posted_at < ? AND journal_entries.type = "debit" THEN journal_entries.amount
304
-                WHEN transactions.posted_at < ? AND journal_entries.type = "credit" THEN -journal_entries.amount
305
-                ELSE 0
306
-            END) AS totalStartingBalance,
307
-            SUM(CASE
308
-                WHEN transactions.posted_at BETWEEN ? AND ? AND journal_entries.type = "debit" THEN journal_entries.amount
309
-                WHEN transactions.posted_at BETWEEN ? AND ? AND journal_entries.type = "credit" THEN -journal_entries.amount
310
-                ELSE 0
311
-            END) AS totalNetMovement
312
-        ', [
302
+                SUM(CASE
303
+                    WHEN transactions.posted_at < ? AND journal_entries.type = \'debit\' THEN journal_entries.amount
304
+                    WHEN transactions.posted_at < ? AND journal_entries.type = \'credit\' THEN -journal_entries.amount
305
+                    ELSE 0
306
+                END) AS totalStartingBalance,
307
+                SUM(CASE
308
+                    WHEN transactions.posted_at BETWEEN ? AND ? AND journal_entries.type = \'debit\' THEN journal_entries.amount
309
+                    WHEN transactions.posted_at BETWEEN ? AND ? AND journal_entries.type = \'credit\' THEN -journal_entries.amount
310
+                    ELSE 0
311
+                END) AS totalNetMovement
312
+            ', [
313
                 $startDate,
313
                 $startDate,
314
                 $startDate,
314
                 $startDate,
315
                 $startDate,
315
                 $startDate,
340
                     ->where('transactions.posted_at', '<', $startDate);
340
                     ->where('transactions.posted_at', '<', $startDate);
341
             })
341
             })
342
             ->whereIn('journal_entries.account_id', $accountIds)
342
             ->whereIn('journal_entries.account_id', $accountIds)
343
-            ->selectRaw('
344
-            SUM(CASE
345
-                WHEN transactions.posted_at < ? AND journal_entries.type = "debit" THEN journal_entries.amount
346
-                WHEN transactions.posted_at < ? AND journal_entries.type = "credit" THEN -journal_entries.amount
347
-                ELSE 0
348
-            END) AS totalStartingBalance
349
-        ', [
343
+            ->selectRaw("
344
+                SUM(CASE
345
+                    WHEN transactions.posted_at < ? AND journal_entries.type = 'debit' THEN journal_entries.amount
346
+                    WHEN transactions.posted_at < ? AND journal_entries.type = 'credit' THEN -journal_entries.amount
347
+                    ELSE 0
348
+                END) AS totalStartingBalance
349
+            ", [
350
                 $startDate,
350
                 $startDate,
351
                 $startDate,
351
                 $startDate,
352
             ])
352
             ])

Loading…
Cancel
Save