2015-02-22 09:46:21 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Budget;
|
2015-02-23 21:19:16 +01:00
|
|
|
|
|
|
|
use Carbon\Carbon;
|
2015-02-22 09:46:21 +01:00
|
|
|
use FireflyIII\Models\Budget;
|
2015-02-22 15:40:13 +01:00
|
|
|
use FireflyIII\Models\LimitRepetition;
|
2015-05-26 20:28:18 +02:00
|
|
|
use Illuminate\Pagination\LengthAwarePaginator;
|
2015-04-05 10:36:28 +02:00
|
|
|
use Illuminate\Support\Collection;
|
2015-02-23 21:19:16 +01:00
|
|
|
|
2015-02-22 09:46:21 +01:00
|
|
|
/**
|
|
|
|
* Interface BudgetRepositoryInterface
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Repositories\Budget
|
|
|
|
*/
|
|
|
|
interface BudgetRepositoryInterface
|
|
|
|
{
|
2015-04-06 09:15:59 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function cleanupBudgets();
|
|
|
|
|
2015-02-22 15:40:13 +01:00
|
|
|
/**
|
|
|
|
* @param Budget $budget
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function destroy(Budget $budget);
|
2015-02-22 09:46:21 +01:00
|
|
|
|
2015-12-28 17:57:03 +01:00
|
|
|
/**
|
|
|
|
* Returns an array with every budget in it and the expenses for each budget
|
|
|
|
* per month.
|
|
|
|
*
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getBudgetsAndExpenses(Carbon $start, Carbon $end);
|
|
|
|
|
2015-05-20 06:50:15 +02:00
|
|
|
/**
|
|
|
|
* Takes tags into account.
|
|
|
|
*
|
|
|
|
* @param Budget $budget
|
|
|
|
* @param Carbon $date
|
|
|
|
*
|
|
|
|
* @return float
|
|
|
|
*/
|
2015-12-13 10:05:13 +01:00
|
|
|
public function expensesOnDay(Budget $budget, Carbon $date);
|
2015-05-20 06:50:15 +02:00
|
|
|
|
2015-04-05 10:36:28 +02:00
|
|
|
/**
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveBudgets();
|
|
|
|
|
|
|
|
/**
|
2015-04-06 09:15:59 +02:00
|
|
|
* @param Budget $budget
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
2015-04-05 10:36:28 +02:00
|
|
|
* @return Collection
|
|
|
|
*/
|
2015-04-06 09:15:59 +02:00
|
|
|
public function getBudgetLimitRepetitions(Budget $budget, Carbon $start, Carbon $end);
|
2015-04-05 10:36:28 +02:00
|
|
|
|
2015-04-03 19:39:36 +02:00
|
|
|
/**
|
2015-04-06 09:15:59 +02:00
|
|
|
* @param Budget $budget
|
|
|
|
*
|
|
|
|
* @return Collection
|
2015-04-03 19:39:36 +02:00
|
|
|
*/
|
2015-04-06 09:15:59 +02:00
|
|
|
public function getBudgetLimits(Budget $budget);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getBudgets();
|
2015-04-03 19:39:36 +02:00
|
|
|
|
2015-12-27 21:17:04 +01:00
|
|
|
/**
|
|
|
|
* Returns a list of budgets, budget limits and limit repetitions
|
|
|
|
* (doubling any of them in a left join)
|
|
|
|
*
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getBudgetsAndLimitsInRange(Carbon $start, Carbon $end);
|
|
|
|
|
2015-02-22 09:46:21 +01:00
|
|
|
/**
|
|
|
|
* @param Budget $budget
|
2015-09-27 17:44:49 +02:00
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
2015-02-22 09:46:21 +01:00
|
|
|
*
|
2015-04-06 09:15:59 +02:00
|
|
|
* @return LimitRepetition|null
|
2015-02-22 09:46:21 +01:00
|
|
|
*/
|
2015-09-27 17:44:49 +02:00
|
|
|
public function getCurrentRepetition(Budget $budget, Carbon $start, Carbon $end);
|
2015-02-22 09:46:21 +01:00
|
|
|
|
2015-04-07 17:51:22 +02:00
|
|
|
/**
|
|
|
|
* @param Budget $budget
|
|
|
|
*
|
|
|
|
* @return Carbon
|
|
|
|
*/
|
|
|
|
public function getFirstBudgetLimitDate(Budget $budget);
|
|
|
|
|
2015-04-05 10:36:28 +02:00
|
|
|
/**
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2015-04-06 09:15:59 +02:00
|
|
|
public function getInactiveBudgets();
|
2015-04-05 10:36:28 +02:00
|
|
|
|
|
|
|
/**
|
2015-04-06 09:15:59 +02:00
|
|
|
* Returns all the transaction journals for a limit, possibly limited by a limit repetition.
|
|
|
|
*
|
|
|
|
* @param Budget $budget
|
|
|
|
* @param LimitRepetition $repetition
|
|
|
|
* @param int $take
|
|
|
|
*
|
2015-05-26 20:28:18 +02:00
|
|
|
* @return LengthAwarePaginator
|
2015-04-06 09:15:59 +02:00
|
|
|
*/
|
|
|
|
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50);
|
|
|
|
|
2015-04-07 17:51:22 +02:00
|
|
|
/**
|
2015-12-25 07:52:56 +01:00
|
|
|
* @deprecated
|
2015-12-28 07:12:47 +01:00
|
|
|
*
|
2015-04-07 17:51:22 +02:00
|
|
|
* @param Budget $budget
|
|
|
|
*
|
|
|
|
* @return Carbon
|
|
|
|
*/
|
|
|
|
public function getLastBudgetLimitDate(Budget $budget);
|
|
|
|
|
|
|
|
/**
|
2015-12-25 07:52:56 +01:00
|
|
|
* @deprecated
|
2015-12-28 07:12:47 +01:00
|
|
|
*
|
2015-04-07 17:51:22 +02:00
|
|
|
* @param Budget $budget
|
|
|
|
* @param Carbon $date
|
|
|
|
*
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getLimitAmountOnDate(Budget $budget, Carbon $date);
|
|
|
|
|
2015-04-06 09:15:59 +02:00
|
|
|
/**
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
2015-04-05 10:36:28 +02:00
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2015-04-06 09:15:59 +02:00
|
|
|
public function getWithoutBudget(Carbon $start, Carbon $end);
|
2015-04-05 10:36:28 +02:00
|
|
|
|
|
|
|
/**
|
2015-04-06 09:15:59 +02:00
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
2015-04-05 10:36:28 +02:00
|
|
|
*
|
2015-04-06 09:15:59 +02:00
|
|
|
* @return mixed
|
2015-04-05 10:36:28 +02:00
|
|
|
*/
|
2015-04-06 09:15:59 +02:00
|
|
|
public function getWithoutBudgetSum(Carbon $start, Carbon $end);
|
2015-04-05 10:36:28 +02:00
|
|
|
|
2015-12-11 17:53:17 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Same as ::spentInPeriod but corrects journals for a set of accounts
|
|
|
|
*
|
|
|
|
* @param Budget $budget
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
* @param Collection $accounts
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2015-12-24 10:27:45 +01:00
|
|
|
public function balanceInPeriod(Budget $budget, Carbon $start, Carbon $end, Collection $accounts);
|
2015-12-11 17:53:17 +01:00
|
|
|
|
2015-02-22 15:40:13 +01:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return Budget
|
|
|
|
*/
|
|
|
|
public function store(array $data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Budget $budget
|
2015-02-23 21:19:16 +01:00
|
|
|
* @param array $data
|
2015-02-22 15:40:13 +01:00
|
|
|
*
|
|
|
|
* @return Budget
|
|
|
|
*/
|
|
|
|
public function update(Budget $budget, array $data);
|
|
|
|
|
|
|
|
/**
|
2015-04-06 09:15:59 +02:00
|
|
|
* @param Budget $budget
|
|
|
|
* @param Carbon $date
|
|
|
|
* @param $amount
|
2015-02-22 15:40:13 +01:00
|
|
|
*
|
2015-04-06 09:15:59 +02:00
|
|
|
* @return mixed
|
2015-02-22 15:40:13 +01:00
|
|
|
*/
|
2015-04-06 09:15:59 +02:00
|
|
|
public function updateLimitAmount(Budget $budget, Carbon $date, $amount);
|
2015-02-22 15:40:13 +01:00
|
|
|
|
2015-03-29 08:14:32 +02:00
|
|
|
}
|