Method no longer used.

This commit is contained in:
James Cole 2016-01-01 19:55:00 +01:00
parent 94810e371a
commit 2f131dc170
2 changed files with 0 additions and 56 deletions

View File

@ -280,43 +280,6 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
return $return;
}
/**
* Returns an array with the following key:value pairs:
*
* yyyy-mm-dd:<amount>
*
* Where yyyy-mm-dd is the date and <amount> is the money spent using DEPOSITS in the $budget
* from all the users accounts.
*
* @param Budget $budget
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function spentPerDayForAccounts(Budget $budget, Collection $accounts, Carbon $start, Carbon $end)
{
$ids = $accounts->pluck('id')->toArray();
/** @var Collection $query */
$query = $budget->transactionJournals()
->transactionTypes([TransactionType::WITHDRAWAL])
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->whereIn('transactions.account_id', $ids)
->where('transactions.amount', '<', 0)
->before($end)
->after($start)
->groupBy('dateFormatted')->get(['transaction_journals.date as dateFormatted', DB::Raw('SUM(`transactions`.`amount`) AS `sum`')]);
$return = [];
foreach ($query->toArray() as $entry) {
$return[$entry['dateFormatted']] = $entry['sum'];
}
return $return;
}
/**
* @return Collection
*/

View File

@ -84,25 +84,6 @@ interface BudgetRepositoryInterface
*/
public function spentPerDay(Budget $budget, Carbon $start, Carbon $end);
/**
* Returns an array with the following key:value pairs:
*
* yyyy-mm-dd:<amount>
*
* Where yyyy-mm-dd is the date and <amount> is the money spent using WITHDRAWALS in the $budget
* from the given users accounts..
*
* @param Budget $budget
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function spentPerDayForAccounts(Budget $budget, Collection $accounts, Carbon $start, Carbon $end);
/**
* Returns an array with the following key:value pairs:
*