mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-22 20:16:22 +00:00 
			
		
		
		
	Some expanded things.
This commit is contained in:
		| @@ -136,6 +136,15 @@ class ReportHelper implements ReportHelperInterface | ||||
|         } | ||||
|  | ||||
|         // then a new line for without budget. | ||||
|         $empty = new BalanceLine; | ||||
|         foreach ($accounts as $account) { | ||||
|             $spent        = $this->query->spentNoBudget($account, $start, $end); | ||||
|             $balanceEntry = new BalanceEntry; | ||||
|             $balanceEntry->setAccount($account); | ||||
|             $balanceEntry->setSpent($spent); | ||||
|             $empty->addBalanceEntry($balanceEntry); | ||||
|         } | ||||
|         $balance->addBalanceLine($empty); | ||||
|  | ||||
|         $balance->setBalanceHeader($header); | ||||
|  | ||||
|   | ||||
| @@ -138,7 +138,6 @@ class ReportQuery implements ReportQueryInterface | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * This method returns all "income" journals in a certain period, which are both transfers from a shared account | ||||
|      * and "ordinary" deposits. The query used is almost equal to ReportQueryInterface::journalsByRevenueAccount but it does | ||||
| @@ -203,7 +202,6 @@ class ReportQuery implements ReportQueryInterface | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * Gets a list of expense accounts and the expenses therein, grouped by that expense account. | ||||
|      * This result excludes transfers to shared accounts which are expenses, technically. | ||||
| @@ -273,8 +271,9 @@ class ReportQuery implements ReportQueryInterface | ||||
|  | ||||
|         return floatval( | ||||
|             Auth::user()->transactionjournals() | ||||
|                 ->leftJoin('transactions' , 'transactions.transaction_journal_id', '=', 'transaction_journals.id') | ||||
|                 ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') | ||||
|                 ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') | ||||
|                 ->transactionTypes(['Withdrawal']) | ||||
|                 ->where('transactions.amount', '<', 0) | ||||
|                 ->where('transactions.account_id', $account->id) | ||||
|                 ->before($end) | ||||
| @@ -284,6 +283,30 @@ class ReportQuery implements ReportQueryInterface | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Account $account | ||||
|      * @param Carbon  $start | ||||
|      * @param Carbon  $end | ||||
|      * @param bool    $shared | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false) | ||||
|     { | ||||
|         return floatval( | ||||
|             Auth::user()->transactionjournals() | ||||
|                 ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') | ||||
|                 ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') | ||||
|                 ->where('transactions.amount', '<', 0) | ||||
|                 ->transactionTypes(['Withdrawal']) | ||||
|                 ->where('transactions.account_id', $account->id) | ||||
|                 ->before($end) | ||||
|                 ->after($start) | ||||
|                 ->whereNull('budget_transaction_journal.budget_id') | ||||
|                 ->sum('transactions.amount') | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Carbon $start | ||||
|      * @param Carbon $end | ||||
|   | ||||
| @@ -65,7 +65,17 @@ interface ReportQueryInterface | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function spentInBudget(Account $account, Budget $budget, Carbon $start, Carbon $end, $shared = false); // I think shared is irrelevant. | ||||
|     public function spentInBudget(Account $account, Budget $budget, Carbon $start, Carbon $end, $shared = false); | ||||
|  | ||||
|     /** | ||||
|      * @param Account $account | ||||
|      * @param Carbon  $start | ||||
|      * @param Carbon  $end | ||||
|      * @param bool    $shared | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false); | ||||
|  | ||||
|  | ||||
|     /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user