2019-08-29 21:33:12 +02:00
|
|
|
<?php
|
2024-11-25 04:18:55 +01:00
|
|
|
|
2019-08-29 21:33:12 +02:00
|
|
|
/**
|
|
|
|
* OperationsRepositoryInterface.php
|
2020-02-16 14:00:57 +01:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org
|
2019-08-29 21:33:12 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2019-08-29 21:33:12 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
2019-08-29 21:33:12 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2019-08-29 21:33:12 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:37:26 +02:00
|
|
|
* GNU Affero General Public License for more details.
|
2019-08-29 21:33:12 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-08-29 21:33:12 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Budget;
|
|
|
|
|
2019-08-29 21:42:55 +02:00
|
|
|
use Carbon\Carbon;
|
2025-08-03 07:12:06 +02:00
|
|
|
use Deprecated;
|
2025-03-08 15:52:50 +01:00
|
|
|
use FireflyIII\Enums\UserRoleEnum;
|
2019-08-29 21:33:12 +02:00
|
|
|
use FireflyIII\Models\Budget;
|
2019-08-31 09:35:35 +02:00
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
2025-03-08 15:52:50 +01:00
|
|
|
use FireflyIII\Models\UserGroup;
|
|
|
|
use FireflyIII\User;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
2019-08-29 21:42:55 +02:00
|
|
|
use Illuminate\Support\Collection;
|
2019-08-29 21:33:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface OperationsRepositoryInterface
|
2025-03-08 15:52:50 +01:00
|
|
|
*
|
|
|
|
* @method setUserGroup(UserGroup $group)
|
|
|
|
* @method getUserGroup()
|
|
|
|
* @method getUser()
|
|
|
|
* @method checkUserGroupAccess(UserRoleEnum $role)
|
|
|
|
* @method setUser(null|Authenticatable|User $user)
|
|
|
|
* @method setUserGroupById(int $userGroupId)
|
2019-08-29 21:33:12 +02:00
|
|
|
*/
|
|
|
|
interface OperationsRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* A method that returns the amount of money budgeted per day for this budget,
|
|
|
|
* on average.
|
|
|
|
*/
|
|
|
|
public function budgetedPerDay(Budget $budget): string;
|
2021-08-20 20:49:42 +02:00
|
|
|
|
2025-06-14 10:18:58 +02:00
|
|
|
#[Deprecated]
|
2019-08-30 08:12:15 +02:00
|
|
|
public function getBudgetPeriodReport(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array;
|
|
|
|
|
2021-03-12 06:20:01 +01:00
|
|
|
/**
|
|
|
|
* This method returns a list of all the withdrawal transaction journals (as arrays) set in that period
|
|
|
|
* which have the specified budget set to them. It's grouped per currency, with as few details in the array
|
|
|
|
* as possible. Amounts are always negative.
|
|
|
|
*/
|
|
|
|
public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null): array;
|
|
|
|
|
2019-08-31 09:35:35 +02:00
|
|
|
/**
|
2025-01-03 15:53:10 +01:00
|
|
|
* @SuppressWarnings("PHPMD.ExcessiveParameterList")
|
2019-08-31 09:35:35 +02:00
|
|
|
*/
|
2022-10-30 14:24:28 +01:00
|
|
|
public function sumExpenses(
|
2023-06-21 12:34:58 +02:00
|
|
|
Carbon $start,
|
|
|
|
Carbon $end,
|
|
|
|
?Collection $accounts = null,
|
|
|
|
?Collection $budgets = null,
|
2025-06-20 05:59:44 +02:00
|
|
|
?TransactionCurrency $currency = null,
|
2025-08-01 06:12:36 +02:00
|
|
|
bool $convertToPrimary = false
|
2019-08-31 09:35:35 +02:00
|
|
|
): array;
|
2025-08-03 07:12:06 +02:00
|
|
|
|
2025-08-03 07:53:36 +02:00
|
|
|
public function sumCollectedExpenses(array $expenses, Carbon $start, Carbon $end, TransactionCurrency $transactionCurrency, bool $convertToPrimary = false): array;
|
2025-08-04 05:42:41 +02:00
|
|
|
|
2025-08-03 20:17:50 +02:00
|
|
|
public function sumCollectedExpensesByBudget(array $expenses, Budget $budget, bool $convertToPrimary = false): array;
|
2025-08-03 07:12:06 +02:00
|
|
|
|
|
|
|
public function collectExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null, ?TransactionCurrency $currency = null): array;
|
2020-05-30 07:33:06 +02:00
|
|
|
}
|