dont include transfers in summary
This commit is contained in:
parent
dd0fd15493
commit
894c2cef1a
@ -45,7 +45,7 @@ class Transactions extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$transactions->each(function ($transaction) use (&$totals) {
|
$transactions->each(function ($transaction) use (&$totals) {
|
||||||
if ($transaction->isNotIncome() && $transaction->isNotExpense()) {
|
if (($transaction->isNotIncome() && $transaction->isNotExpense()) || $transaction->isTransfer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,9 +23,11 @@ class Transaction extends Model
|
|||||||
public const INCOME_TYPE = 'income';
|
public const INCOME_TYPE = 'income';
|
||||||
public const INCOME_SPLIT_TYPE = 'income-split';
|
public const INCOME_SPLIT_TYPE = 'income-split';
|
||||||
public const INCOME_RECURRING_TYPE = 'income-recurring';
|
public const INCOME_RECURRING_TYPE = 'income-recurring';
|
||||||
|
public const INCOME_TRANSFER_TYPE = 'income-transfer'; // TODO - convert transfer from category to type
|
||||||
public const EXPENSE_TYPE = 'expense';
|
public const EXPENSE_TYPE = 'expense';
|
||||||
public const EXPENSE_SPLIT_TYPE = 'expense-split';
|
public const EXPENSE_SPLIT_TYPE = 'expense-split';
|
||||||
public const EXPENSE_RECURRING_TYPE = 'expense-recurring';
|
public const EXPENSE_RECURRING_TYPE = 'expense-recurring';
|
||||||
|
public const EXPENSE_TRANSFER_TYPE = 'expense-transfer'; // TODO - convert transfer from category to type
|
||||||
|
|
||||||
protected $table = 'transactions';
|
protected $table = 'transactions';
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Traits;
|
|||||||
|
|
||||||
use App\Events\Banking\TransactionPrinting;
|
use App\Events\Banking\TransactionPrinting;
|
||||||
use App\Models\Banking\Transaction;
|
use App\Models\Banking\Transaction;
|
||||||
|
use App\Models\Setting\Category;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
trait Transactions
|
trait Transactions
|
||||||
@ -44,6 +45,18 @@ trait Transactions
|
|||||||
return ! $this->isRecurring();
|
return ! $this->isRecurring();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isTransfer(): bool
|
||||||
|
{
|
||||||
|
$category_id = $this->category_id ?? $this->transaction->category_id ?? $this->model->category_id ?? 0;
|
||||||
|
|
||||||
|
return $category_id == Category::transfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isNotTransfer(): bool
|
||||||
|
{
|
||||||
|
return ! $this->isTransfer();
|
||||||
|
}
|
||||||
|
|
||||||
public function getIncomeTypes($return = 'array')
|
public function getIncomeTypes($return = 'array')
|
||||||
{
|
{
|
||||||
return $this->getTransactionTypes('income', $return);
|
return $this->getTransactionTypes('income', $return);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user