mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-19 08:00:19 +00:00
Some code cleanup.
This commit is contained in:
@@ -361,7 +361,6 @@ class GoogleChartController extends BaseController
|
|||||||
$end->endOfYear();
|
$end->endOfYear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$spent = $budgetRepository->spentInMonth($budget, $start);
|
$spent = $budgetRepository->spentInMonth($budget, $start);
|
||||||
$repetition = $budgetRepository->repetitionOnStartingOnDate($budget, $start);
|
$repetition = $budgetRepository->repetitionOnStartingOnDate($budget, $start);
|
||||||
|
|||||||
@@ -313,6 +313,8 @@ class PiggyBankController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
|
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
@@ -327,7 +329,6 @@ class PiggyBankController extends BaseController
|
|||||||
$data['user_id'] = Auth::user()->id;
|
$data['user_id'] = Auth::user()->id;
|
||||||
$data['repeats'] = 0;
|
$data['repeats'] = 0;
|
||||||
|
|
||||||
// always validate:
|
|
||||||
$messages = $this->_repository->validate($data);
|
$messages = $this->_repository->validate($data);
|
||||||
|
|
||||||
Session::flash('warnings', $messages['warnings']);
|
Session::flash('warnings', $messages['warnings']);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class ReportController extends BaseController
|
|||||||
$mainTitleIcon = 'fa-line-chart';
|
$mainTitleIcon = 'fa-line-chart';
|
||||||
|
|
||||||
$balances = $this->_repository->yearBalanceReport($date);
|
$balances = $this->_repository->yearBalanceReport($date);
|
||||||
$groupedIncomes = $this->_repository->revenueGroupedByAccount($date, $end, 15);
|
$groupedIncomes = $this->_repository->revenueGroupedByAccount($date, $end);
|
||||||
$groupedExpenses = $this->_repository->expensesGroupedByAccount($date, $end, 15);
|
$groupedExpenses = $this->_repository->expensesGroupedByAccount($date, $end, 15);
|
||||||
|
|
||||||
return View::make(
|
return View::make(
|
||||||
|
|||||||
@@ -242,7 +242,6 @@ class TransactionController extends BaseController
|
|||||||
public function store($what)
|
public function store($what)
|
||||||
{
|
{
|
||||||
$data = Input::except('_token');
|
$data = Input::except('_token');
|
||||||
|
|
||||||
$transactionType = $this->_repository->getJournalType($what);
|
$transactionType = $this->_repository->getJournalType($what);
|
||||||
$transactionCurrency = $this->_repository->getJournalCurrencyById(intval($data['amount_currency_id']));
|
$transactionCurrency = $this->_repository->getJournalCurrencyById(intval($data['amount_currency_id']));
|
||||||
$data['transaction_type_id'] = $transactionType->id;
|
$data['transaction_type_id'] = $transactionType->id;
|
||||||
@@ -284,6 +283,8 @@ class TransactionController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
|
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -36,17 +36,12 @@ class ChangesForV325 extends Migration
|
|||||||
try {
|
try {
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'budget_limits', function (Blueprint $table) {
|
'budget_limits', function (Blueprint $table) {
|
||||||
//$table->dropIndex('unique_ci_combo');
|
|
||||||
$table->dropUnique('unique_ci_combi');
|
$table->dropUnique('unique_ci_combi');
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (QueryException $e) {
|
|
||||||
// don't care.
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
// don't care.
|
// don't care.
|
||||||
} catch (\Exception $e) {
|
|
||||||
// don't care either.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow journal descriptions to be encrypted.
|
// allow journal descriptions to be encrypted.
|
||||||
@@ -58,12 +53,8 @@ class ChangesForV325 extends Migration
|
|||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
DB::update('ALTER TABLE `transaction_journals` MODIFY `description` VARCHAR(1024)');
|
DB::update('ALTER TABLE `transaction_journals` MODIFY `description` VARCHAR(1024)');
|
||||||
} catch (QueryException $e) {
|
|
||||||
// don't care.
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
// don't care.
|
// don't care.
|
||||||
} catch (\Exception $e) {
|
|
||||||
// don't care either.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
$this->call('TransactionCurrencySeeder');
|
$this->call('TransactionCurrencySeeder');
|
||||||
$this->call('TransactionTypeSeeder');
|
$this->call('TransactionTypeSeeder');
|
||||||
|
|
||||||
if (App::environment() == 'testing') {
|
if (App::environment() == 'testing' || App::environment() == 'homestead') {
|
||||||
$this->call('TestDataSeeder');
|
$this->call('TestDataSeeder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,96 +66,49 @@ class TestDataSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
User::create(['email' => 'reset@example.com', 'password' => 'functional', 'reset' => 'okokokokokokokokokokokokokokokok', 'remember_token' => null]);
|
$this->createUsers();
|
||||||
User::create(['email' => 'functional@example.com', 'password' => 'functional', 'reset' => null, 'remember_token' => null]);
|
$this->createAssetAccounts();
|
||||||
|
$this->createBudgets();
|
||||||
$user = User::create(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james', 'reset' => null, 'remember_token' => null]);
|
$this->createCategories();
|
||||||
Log::debug('Created users.');
|
$this->createPiggyBanks();
|
||||||
// create initial accounts and various other stuff:
|
$this->createReminders();
|
||||||
$this->createAssetAccounts($user);
|
$this->createRecurringTransactions();
|
||||||
$this->createBudgets($user);
|
$this->createBills();
|
||||||
$this->createCategories($user);
|
$this->createExpenseAccounts();
|
||||||
$this->createPiggyBanks($user);
|
$this->createRevenueAccounts();
|
||||||
$this->createReminders($user);
|
|
||||||
$this->createRecurringTransactions($user);
|
|
||||||
$this->createBills($user);
|
|
||||||
$this->createExpenseAccounts($user);
|
|
||||||
$this->createRevenueAccounts($user);
|
|
||||||
|
|
||||||
// get some objects from the database:
|
|
||||||
$checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first();
|
|
||||||
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
|
||||||
$landLord = Account::whereName('Land lord')->orderBy('id', 'DESC')->first();
|
|
||||||
$utilities = Account::whereName('Utilities company')->orderBy('id', 'DESC')->first();
|
|
||||||
$television = Account::whereName('TV company')->orderBy('id', 'DESC')->first();
|
|
||||||
$phone = Account::whereName('Phone agency')->orderBy('id', 'DESC')->first();
|
|
||||||
$employer = Account::whereName('Employer')->orderBy('id', 'DESC')->first();
|
|
||||||
|
|
||||||
|
|
||||||
$bills = Budget::whereName('Bills')->orderBy('id', 'DESC')->first();
|
|
||||||
$groceries = Budget::whereName('Groceries')->orderBy('id', 'DESC')->first();
|
|
||||||
|
|
||||||
$house = Category::whereName('House')->orderBy('id', 'DESC')->first();
|
|
||||||
|
|
||||||
|
|
||||||
$withdrawal = TransactionType::whereType('Withdrawal')->first();
|
|
||||||
$deposit = TransactionType::whereType('Deposit')->first();
|
|
||||||
$transfer = TransactionType::whereType('Transfer')->first();
|
|
||||||
|
|
||||||
$euro = TransactionCurrency::whereCode('EUR')->first();
|
|
||||||
|
|
||||||
$rentBill = Bill::where('name', 'Rent')->first();
|
|
||||||
|
|
||||||
|
|
||||||
$current = clone $this->_yearAgoStartOfMonth;
|
$current = clone $this->_yearAgoStartOfMonth;
|
||||||
while ($current <= $this->_startOfMonth) {
|
while ($current <= $this->_startOfMonth) {
|
||||||
$cur = $current->format('Y-m-d');
|
|
||||||
$formatted = $current->format('F Y');
|
|
||||||
Log::debug('Now at: ' . $cur);
|
|
||||||
|
|
||||||
// create expenses for rent, utilities, TV, phone on the 1st of the month.
|
// create expenses for rent, utilities, TV, phone on the 1st of the month.
|
||||||
|
$this->createMonthlyExpenses(clone $current);
|
||||||
$this->createTransaction($checking, $landLord, 800, $withdrawal, 'Rent for ' . $formatted, $cur, $euro, $bills, $house, $rentBill);
|
$this->createGroceries(clone $current);
|
||||||
$this->createTransaction($checking, $utilities, 150, $withdrawal, 'Utilities for ' . $formatted, $cur, $euro, $bills, $house);
|
|
||||||
$this->createTransaction($checking, $television, 50, $withdrawal, 'TV for ' . $formatted, $cur, $euro, $bills, $house);
|
|
||||||
$this->createTransaction($checking, $phone, 50, $withdrawal, 'Phone bill for ' . $formatted, $cur, $euro, $bills, $house);
|
|
||||||
|
|
||||||
// two transactions. One without a budget, one without a category.
|
|
||||||
$this->createTransaction($checking, $phone, 10, $withdrawal, 'Extra charges on phone bill for ' . $formatted, $cur, $euro, null, $house);
|
|
||||||
$this->createTransaction($checking, $television, 5, $withdrawal, 'Extra charges on TV bill for ' . $formatted, $cur, $euro, $bills, null);
|
|
||||||
|
|
||||||
// income from job:
|
|
||||||
$this->createTransaction($employer, $checking, rand(3500, 4000), $deposit, 'Salary for ' . $formatted, $cur, $euro);
|
|
||||||
$this->createTransaction($checking, $savings, 2000, $transfer, 'Salary to savings account in ' . $formatted, $cur, $euro);
|
|
||||||
|
|
||||||
$this->createGroceries($current);
|
|
||||||
$this->createBigExpense(clone $current);
|
$this->createBigExpense(clone $current);
|
||||||
|
|
||||||
echo 'Created test-content for ' . $current->format('F Y') . "\n";
|
echo 'Created test-content for ' . $current->format('F Y') . "\n";
|
||||||
$current->addMonth();
|
$current->addMonth();
|
||||||
}
|
}
|
||||||
|
$this->createPiggyBankEvent();
|
||||||
|
|
||||||
|
|
||||||
// piggy bank event
|
|
||||||
// add money to this piggy bank
|
|
||||||
// create a piggy bank event to match:
|
|
||||||
$piggyBank = PiggyBank::whereName('New camera')->orderBy('id', 'DESC')->first();
|
|
||||||
$intoPiggy = $this->createTransaction($checking, $savings, 100, $transfer, 'Money for piggy', $this->yaeom, $euro, $groceries, $house);
|
|
||||||
PiggyBankEvent::create(
|
|
||||||
[
|
|
||||||
'piggy_bank_id' => $piggyBank->id,
|
|
||||||
'transaction_journal_id' => $intoPiggy->id,
|
|
||||||
'date' => $this->yaeom,
|
|
||||||
'amount' => 100
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createAssetAccounts(User $user)
|
public function createUsers()
|
||||||
{
|
{
|
||||||
|
User::create(['email' => 'reset@example.com', 'password' => 'functional', 'reset' => 'okokokokokokokokokokokokokokokok', 'remember_token' => null]);
|
||||||
|
User::create(['email' => 'functional@example.com', 'password' => 'functional', 'reset' => null, 'remember_token' => null]);
|
||||||
|
User::create(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james', 'reset' => null, 'remember_token' => null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function createAssetAccounts()
|
||||||
|
{
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
$assetType = AccountType::whereType('Asset account')->first();
|
$assetType = AccountType::whereType('Asset account')->first();
|
||||||
$ibType = AccountType::whereType('Initial balance account')->first();
|
$ibType = AccountType::whereType('Initial balance account')->first();
|
||||||
$obType = TransactionType::whereType('Opening balance')->first();
|
$obType = TransactionType::whereType('Opening balance')->first();
|
||||||
@@ -170,74 +123,64 @@ class TestDataSeeder extends Seeder
|
|||||||
$acc_e = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Savings account initial balance', 'active' => 0]);
|
$acc_e = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Savings account initial balance', 'active' => 0]);
|
||||||
$acc_f = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Delete me initial balance', 'active' => 0]);
|
$acc_f = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Delete me initial balance', 'active' => 0]);
|
||||||
|
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $acc_d, 'to' => $acc_a, 'amount' => 4000, 'transactionType' => $obType, 'description' => 'Initial Balance for Checking account',
|
||||||
|
'date' => $this->yasom, 'transactionCurrency' => $euro]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $acc_e, 'to' => $acc_b, 'amount' => 10000, 'transactionType' => $obType, 'description' => 'Initial Balance for Savings account',
|
||||||
|
'date' => $this->yasom, 'transactionCurrency' => $euro]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $acc_f, 'to' => $acc_c, 'amount' => 100, 'transactionType' => $obType, 'description' => 'Initial Balance for Delete me',
|
||||||
|
'date' => $this->yasom, 'transactionCurrency' => $euro]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$this->createTransaction($acc_d, $acc_a, 4000, $obType, 'Initial Balance for Checking account', $this->yasom, $euro);
|
|
||||||
$this->createTransaction($acc_e, $acc_b, 10000, $obType, 'Initial Balance for Savings account', $this->yasom, $euro);
|
|
||||||
$this->createTransaction($acc_f, $acc_c, 100, $obType, 'Initial Balance for Delete me', $this->yasom, $euro);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SuppressWarnings(PHPMD.ShortVariable)
|
* @param array $data
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
|
|
||||||
*
|
|
||||||
* @param Account $from
|
|
||||||
* @param Account $to
|
|
||||||
* @param $amount
|
|
||||||
* @param TransactionType $type
|
|
||||||
* @param $description
|
|
||||||
* @param $date
|
|
||||||
* @param TransactionCurrency $currency
|
|
||||||
*
|
|
||||||
* @param Budget $budget
|
|
||||||
* @param Category $category
|
|
||||||
* @param Bill $bill
|
|
||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
public function createTransaction(
|
public function createJournal(array $data)
|
||||||
Account $from, Account $to, $amount, TransactionType $type, $description, $date, TransactionCurrency $currency, Budget $budget = null,
|
{
|
||||||
Category $category = null, Bill $bill = null
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
) {
|
$billID = isset($data['bill']) ? $data['bill']->id : null;
|
||||||
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
|
||||||
|
|
||||||
$billID = is_null($bill) ? null : $bill->id;
|
|
||||||
Log::debug('String length of encrypted description ("' . $description . '") is: ' . strlen(Crypt::encrypt($description)));
|
|
||||||
|
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
$journal = TransactionJournal::create(
|
$journal = TransactionJournal::create(
|
||||||
[
|
[
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'transaction_type_id' => $type->id,
|
'transaction_type_id' => $data['transactionType']->id,
|
||||||
'transaction_currency_id' => $currency->id,
|
'transaction_currency_id' => $data['transactionCurrency']->id,
|
||||||
'bill_id' => $billID,
|
'bill_id' => $billID,
|
||||||
'description' => $description,
|
'description' => $data['description'],
|
||||||
'completed' => 1,
|
'completed' => 1,
|
||||||
'date' => $date
|
'date' => $data['date']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
//Log::debug('Journal valid: ' . Steam::boolString($journal->isValid()));
|
|
||||||
//Log::debug('Journal errors: ' . json_encode($journal->getErrors()));
|
|
||||||
//Log::debug('Journal created: ' . json_encode($journal));
|
|
||||||
|
|
||||||
|
Transaction::create(['account_id' => $data['from']->id, 'transaction_journal_id' => $journal->id, 'amount' => $data['amount'] * -1]);
|
||||||
|
Transaction::create(['account_id' => $data['to']->id, 'transaction_journal_id' => $journal->id, 'amount' => $data['amount']]);
|
||||||
|
|
||||||
Transaction::create(['account_id' => $from->id, 'transaction_journal_id' => $journal->id, 'amount' => $amount * -1]);
|
if (isset($data['budget'])) {
|
||||||
Transaction::create(['account_id' => $to->id, 'transaction_journal_id' => $journal->id, 'amount' => $amount]);
|
$journal->budgets()->save($data['budget']);
|
||||||
|
|
||||||
if (!is_null($budget)) {
|
|
||||||
$journal->budgets()->save($budget);
|
|
||||||
}
|
}
|
||||||
if (!is_null($category)) {
|
if (isset($data['category'])) {
|
||||||
$journal->categories()->save($category);
|
$journal->categories()->save($data['category']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createBudgets(User $user)
|
public function createBudgets()
|
||||||
{
|
{
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
|
|
||||||
$groceries = Budget::create(['user_id' => $user->id, 'name' => 'Groceries']);
|
$groceries = Budget::create(['user_id' => $user->id, 'name' => 'Groceries']);
|
||||||
$bills = Budget::create(['user_id' => $user->id, 'name' => 'Bills']);
|
$bills = Budget::create(['user_id' => $user->id, 'name' => 'Bills']);
|
||||||
@@ -260,10 +203,11 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createCategories(User $user)
|
public function createCategories()
|
||||||
{
|
{
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
Category::create(['user_id' => $user->id, 'name' => 'DailyGroceries']);
|
Category::create(['user_id' => $user->id, 'name' => 'DailyGroceries']);
|
||||||
Category::create(['user_id' => $user->id, 'name' => 'Lunch']);
|
Category::create(['user_id' => $user->id, 'name' => 'Lunch']);
|
||||||
Category::create(['user_id' => $user->id, 'name' => 'House']);
|
Category::create(['user_id' => $user->id, 'name' => 'House']);
|
||||||
@@ -272,9 +216,9 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createPiggyBanks(User $user)
|
public function createPiggyBanks()
|
||||||
{
|
{
|
||||||
// account
|
// account
|
||||||
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
||||||
@@ -355,10 +299,11 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createReminders(User $user)
|
public function createReminders()
|
||||||
{
|
{
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
// for weekly piggy bank (clothes)
|
// for weekly piggy bank (clothes)
|
||||||
$nextWeek = clone $this->_startOfMonth;
|
$nextWeek = clone $this->_startOfMonth;
|
||||||
$piggyBank = PiggyBank::whereName('New clothes')->orderBy('id', 'DESC')->first();
|
$piggyBank = PiggyBank::whereName('New clothes')->orderBy('id', 'DESC')->first();
|
||||||
@@ -378,12 +323,13 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createRecurringTransactions(User $user)
|
public function createRecurringTransactions()
|
||||||
{
|
{
|
||||||
// account
|
// account
|
||||||
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
|
|
||||||
$recurring = PiggyBank::create(
|
$recurring = PiggyBank::create(
|
||||||
[
|
[
|
||||||
@@ -413,10 +359,11 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createBills($user)
|
public function createBills()
|
||||||
{
|
{
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
// bill
|
// bill
|
||||||
Bill::create(
|
Bill::create(
|
||||||
['user_id' => $user->id, 'name' => 'Rent', 'match' => 'rent,landlord', 'amount_min' => 700, 'amount_max' => 900, 'date' => $this->som,
|
['user_id' => $user->id, 'name' => 'Rent', 'match' => 'rent,landlord', 'amount_min' => 700, 'amount_max' => 900, 'date' => $this->som,
|
||||||
@@ -455,11 +402,12 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createExpenseAccounts($user)
|
public function createExpenseAccounts()
|
||||||
{
|
{
|
||||||
//// create expenses for rent, utilities, water, TV, phone on the 1st of the month.
|
//// create expenses for rent, utilities, water, TV, phone on the 1st of the month.
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
$expenseType = AccountType::whereType('Expense account')->first();
|
$expenseType = AccountType::whereType('Expense account')->first();
|
||||||
|
|
||||||
Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Land lord', 'active' => 1]);
|
Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Land lord', 'active' => 1]);
|
||||||
@@ -477,10 +425,11 @@ class TestDataSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $user
|
*
|
||||||
*/
|
*/
|
||||||
public function createRevenueAccounts($user)
|
public function createRevenueAccounts()
|
||||||
{
|
{
|
||||||
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
$revenueType = AccountType::whereType('Revenue account')->first();
|
$revenueType = AccountType::whereType('Revenue account')->first();
|
||||||
|
|
||||||
Account::create(['user_id' => $user->id, 'account_type_id' => $revenueType->id, 'name' => 'Employer', 'active' => 1]);
|
Account::create(['user_id' => $user->id, 'account_type_id' => $revenueType->id, 'name' => 'Employer', 'active' => 1]);
|
||||||
@@ -489,6 +438,68 @@ class TestDataSeeder extends Seeder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*/
|
||||||
|
public function createMonthlyExpenses(Carbon $date)
|
||||||
|
{
|
||||||
|
// get some objects from the database:
|
||||||
|
$checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first();
|
||||||
|
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
||||||
|
$landLord = Account::whereName('Land lord')->orderBy('id', 'DESC')->first();
|
||||||
|
$utilities = Account::whereName('Utilities company')->orderBy('id', 'DESC')->first();
|
||||||
|
$television = Account::whereName('TV company')->orderBy('id', 'DESC')->first();
|
||||||
|
$phone = Account::whereName('Phone agency')->orderBy('id', 'DESC')->first();
|
||||||
|
$employer = Account::whereName('Employer')->orderBy('id', 'DESC')->first();
|
||||||
|
$bills = Budget::whereName('Bills')->orderBy('id', 'DESC')->first();
|
||||||
|
$house = Category::whereName('House')->orderBy('id', 'DESC')->first();
|
||||||
|
$withdrawal = TransactionType::whereType('Withdrawal')->first();
|
||||||
|
$deposit = TransactionType::whereType('Deposit')->first();
|
||||||
|
$transfer = TransactionType::whereType('Transfer')->first();
|
||||||
|
$euro = TransactionCurrency::whereCode('EUR')->first();
|
||||||
|
$rentBill = Bill::where('name', 'Rent')->first();
|
||||||
|
$cur = $date->format('Y-m-d');
|
||||||
|
$formatted = $date->format('F Y');
|
||||||
|
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $landLord, 'amount' => 800, 'transactionType' => $withdrawal, 'description' => 'Rent for ' . $formatted,
|
||||||
|
'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house, 'bill' => $rentBill]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $utilities, 'amount' => 150, 'transactionType' => $withdrawal, 'description' => 'Utilities for ' . $formatted,
|
||||||
|
'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house,]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $television, 'amount' => 50, 'transactionType' => $withdrawal, 'description' => 'TV for ' . $formatted,
|
||||||
|
'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house,]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $phone, 'amount' => 50, 'transactionType' => $withdrawal, 'description' => 'Phone bill for ' . $formatted,
|
||||||
|
'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house,]
|
||||||
|
);
|
||||||
|
|
||||||
|
// two transactions. One without a budget, one without a category.
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $phone, 'amount' => 10, 'transactionType' => $withdrawal,
|
||||||
|
'description' => 'Extra charges on phone bill for ' . $formatted, 'date' => $cur, 'transactionCurrency' => $euro, 'category' => $house]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $television, 'amount' => 5, 'transactionType' => $withdrawal,
|
||||||
|
'description' => 'Extra charges on TV bill for ' . $formatted, 'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills]
|
||||||
|
);
|
||||||
|
|
||||||
|
// income from job:
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $employer, 'to' => $checking, 'amount' => rand(3500, 4000), 'transactionType' => $deposit, 'description' => 'Salary for ' . $formatted,
|
||||||
|
'date' => $cur, 'transactionCurrency' => $euro]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $savings, 'amount' => 2000, 'transactionType' => $transfer,
|
||||||
|
'description' => 'Salary to savings account in ' . $formatted, 'date' => $cur, 'transactionCurrency' => $euro]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*/
|
*/
|
||||||
@@ -516,8 +527,14 @@ class TestDataSeeder extends Seeder
|
|||||||
$mFormat = $mStart->format('Y-m-d');
|
$mFormat = $mStart->format('Y-m-d');
|
||||||
$shop = $shops[rand(0, 1)];
|
$shop = $shops[rand(0, 1)];
|
||||||
|
|
||||||
$this->createTransaction($checking, $shop, (rand(500, 1000) / 100), $withdrawal, 'Groceries', $mFormat, $euro, $groceries, $daily);
|
$this->createJournal(
|
||||||
$this->createTransaction($checking, $lunchHouse, (rand(200, 600) / 100), $withdrawal, 'Lunch', $mFormat, $euro, $groceries, $lunch);
|
['from' => $checking, 'to' => $shop, 'amount' => (rand(500, 1000) / 100), 'transactionType' => $withdrawal, 'description' => 'Groceries',
|
||||||
|
'date' => $mFormat, 'transactionCurrency' => $euro, 'category' => $daily, 'budget' => $groceries]
|
||||||
|
);
|
||||||
|
$this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $lunchHouse, 'amount' => (rand(200, 600) / 100), 'transactionType' => $withdrawal, 'description' => 'Lunch',
|
||||||
|
'date' => $mFormat, 'transactionCurrency' => $euro, 'category' => $lunch, 'budget' => $groceries]
|
||||||
|
);
|
||||||
|
|
||||||
$mStart->addDay();
|
$mStart->addDay();
|
||||||
}
|
}
|
||||||
@@ -534,19 +551,21 @@ class TestDataSeeder extends Seeder
|
|||||||
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
||||||
$buyMore = Account::whereName('Buy More')->orderBy('id', 'DESC')->first();
|
$buyMore = Account::whereName('Buy More')->orderBy('id', 'DESC')->first();
|
||||||
$withdrawal = TransactionType::whereType('Withdrawal')->first();
|
$withdrawal = TransactionType::whereType('Withdrawal')->first();
|
||||||
$transfer = TransactionType::whereType('Transfer')->first();
|
|
||||||
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||||
|
|
||||||
|
|
||||||
// create some big expenses, move some money around.
|
// create some big expenses, move some money around.
|
||||||
$amount = rand(500, 2000);
|
$amount = rand(500, 2000);
|
||||||
$one = $this->createTransaction(
|
|
||||||
$savings, $checking, $amount, $transfer, 'Money for big expense in ' . $date->format('F Y'), $date->format('Y-m-d'), $dollar
|
$one = $this->createJournal(
|
||||||
|
['from' => $savings, 'to' => $checking, 'amount' => $amount, 'transactionType' => $withdrawal,
|
||||||
|
'description' => 'Money for big expense in ' . $date->format('F Y'), 'date' => $date->format('Y-m-d'), 'transactionCurrency' => $dollar]
|
||||||
);
|
);
|
||||||
$two = $this->createTransaction(
|
$two = $this->createJournal(
|
||||||
$checking, $buyMore, $amount, $withdrawal, 'Big expense in ' . $date->format('F Y'), $date->format('Y-m-d'), $dollar
|
['from' => $checking, 'to' => $buyMore, 'amount' => $amount, 'transactionType' => $withdrawal,
|
||||||
|
'description' => 'Big expense in ' . $date->format('F Y'), 'date' => $date->format('Y-m-d'), 'transactionCurrency' => $dollar]
|
||||||
);
|
);
|
||||||
$group = TransactionGroup::create(
|
$group = TransactionGroup::create(
|
||||||
[
|
[
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'relation' => 'balance'
|
'relation' => 'balance'
|
||||||
@@ -557,5 +576,34 @@ class TestDataSeeder extends Seeder
|
|||||||
$group->save();
|
$group->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected function createPiggyBankEvent()
|
||||||
|
{
|
||||||
|
// piggy bank event
|
||||||
|
// add money to this piggy bank
|
||||||
|
// create a piggy bank event to match:
|
||||||
|
$checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first();
|
||||||
|
$savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first();
|
||||||
|
$transfer = TransactionType::whereType('Transfer')->first();
|
||||||
|
$euro = TransactionCurrency::whereCode('EUR')->first();
|
||||||
|
$groceries = Budget::whereName('Groceries')->orderBy('id', 'DESC')->first();
|
||||||
|
$house = Category::whereName('House')->orderBy('id', 'DESC')->first();
|
||||||
|
$piggyBank = PiggyBank::whereName('New camera')->orderBy('id', 'DESC')->first();
|
||||||
|
$intoPiggy = $this->createJournal(
|
||||||
|
['from' => $checking, 'to' => $savings, 'amount' => 100, 'transactionType' => $transfer, 'description' => 'Money for piggy',
|
||||||
|
'date' => $this->yaeom, 'transactionCurrency' => $euro, 'category' => $house, 'budget' => $groceries]
|
||||||
|
);
|
||||||
|
PiggyBankEvent::create(
|
||||||
|
[
|
||||||
|
'piggy_bank_id' => $piggyBank->id,
|
||||||
|
'transaction_journal_id' => $intoPiggy->id,
|
||||||
|
'date' => $this->yaeom,
|
||||||
|
'amount' => 100
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -97,37 +97,43 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte
|
|||||||
*/
|
*/
|
||||||
public function storeInitialBalance(\Account $account, array $data)
|
public function storeInitialBalance(\Account $account, array $data)
|
||||||
{
|
{
|
||||||
|
|
||||||
// make opposing a revenue / expense account depending on bla bla.
|
|
||||||
$balance = floatval($data['openingBalance']);
|
|
||||||
$date = new Carbon($data['openingBalanceDate']);
|
|
||||||
/** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $journals */
|
|
||||||
$journals = \App::make('FireflyIII\Database\TransactionJournal\TransactionJournal');
|
|
||||||
|
|
||||||
/** @var \FireflyIII\Database\TransactionType\TransactionType $typeRepository */
|
/** @var \FireflyIII\Database\TransactionType\TransactionType $typeRepository */
|
||||||
$typeRepository = \App::make('FireflyIII\Database\TransactionType\TransactionType');
|
$typeRepository = \App::make('FireflyIII\Database\TransactionType\TransactionType');
|
||||||
|
|
||||||
|
/** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $journals */
|
||||||
|
$journals = \App::make('FireflyIII\Database\TransactionJournal\TransactionJournal');
|
||||||
|
|
||||||
|
// some initial variables:
|
||||||
|
$balance = floatval($data['openingBalance']);
|
||||||
|
$date = new Carbon($data['openingBalanceDate']);
|
||||||
|
|
||||||
|
// some dynamic variables:
|
||||||
if ($balance < 0) {
|
if ($balance < 0) {
|
||||||
// to is expense account.
|
$opposingType = 'expense';
|
||||||
$opposingData = ['name' => $account->name . ' Initial Balance Account', 'active' => 1, 'what' => 'expense'];
|
$transactionType = $typeRepository->findByWhat('withdrawal');
|
||||||
$toAccount = $this->store($opposingData);
|
$toAccount = $this->store(['name' => $account->name . ' Initial Balance Account', 'active' => 1, 'what' => $opposingType]);
|
||||||
$fromAccount = $account;
|
$fromAccount = $account;
|
||||||
$type = $typeRepository->findByWhat('withdrawal');
|
|
||||||
} else {
|
} else {
|
||||||
// from is revenue account.
|
$opposingType = 'revenue';
|
||||||
$opposingData = ['name' => $account->name . ' Initial Balance Account', 'active' => 1, 'what' => 'revenue'];
|
$transactionType = $typeRepository->findByWhat('deposit');
|
||||||
$fromAccount = $this->store($opposingData);
|
$fromAccount = $this->store(['name' => $account->name . ' Initial Balance Account', 'active' => 1, 'what' => $opposingType]);
|
||||||
$toAccount = $account;
|
$toAccount = $account;
|
||||||
$type = $typeRepository->findByWhat('deposit');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// data for transaction journal:
|
// data for transaction journal:
|
||||||
$balance = $balance < 0 ? $balance * -1 : $balance;
|
$balance = $balance < 0 ? $balance * -1 : $balance;
|
||||||
$currency = $journals->getJournalCurrencyById(intval($data['balance_currency_id']));
|
$currency = $journals->getJournalCurrencyById(intval($data['balance_currency_id']));
|
||||||
|
$opening = [
|
||||||
$opening = ['transaction_type_id' => $type->id, 'transaction_currency_id' => $currency->id, 'amount' => $balance, 'from' => $fromAccount,
|
'transaction_type_id' => $transactionType->id,
|
||||||
'completed' => 0, 'what' => 'opening', 'to' => $toAccount, 'date' => $date,
|
'transaction_currency_id' => $currency->id,
|
||||||
'description' => 'Opening balance for new account ' . $account->name,];
|
'amount' => $balance,
|
||||||
|
'from' => $fromAccount,
|
||||||
|
'completed' => 0,
|
||||||
|
'what' => 'opening',
|
||||||
|
'to' => $toAccount,
|
||||||
|
'date' => $date,
|
||||||
|
'description' => 'Opening balance for new account ' . $account->name
|
||||||
|
];
|
||||||
|
|
||||||
$validation = $journals->validate($opening);
|
$validation = $journals->validate($opening);
|
||||||
if ($validation['errors']->count() == 0) {
|
if ($validation['errors']->count() == 0) {
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ class PiggyBankShared
|
|||||||
/**
|
/**
|
||||||
* @param array $ids
|
* @param array $ids
|
||||||
*
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
* @throws NotImplementedException
|
* @throws NotImplementedException
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -108,7 +110,6 @@ class PiggyBankShared
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return \Eloquent
|
* @return \Eloquent
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
*/
|
||||||
public function store(array $data)
|
public function store(array $data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Form
|
|||||||
$options['step'] = 'any';
|
$options['step'] = 'any';
|
||||||
$options['min'] = '0.01';
|
$options['min'] = '0.01';
|
||||||
$defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency();
|
$defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency();
|
||||||
$currencies = \TransactionCurrency::orderBy('code','ASC')->get();
|
$currencies = \TransactionCurrency::orderBy('code', 'ASC')->get();
|
||||||
$html = \View::make('form.amount', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
$html = \View::make('form.amount', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
@@ -141,8 +141,9 @@ class Form
|
|||||||
$value = self::fillFieldValue($name, $value);
|
$value = self::fillFieldValue($name, $value);
|
||||||
$options['step'] = 'any';
|
$options['step'] = 'any';
|
||||||
$defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency();
|
$defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency();
|
||||||
$currencies = \TransactionCurrency::orderBy('code','ASC')->get();
|
$currencies = \TransactionCurrency::orderBy('code', 'ASC')->get();
|
||||||
$html = \View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
$html = \View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ class Related implements RelatedInterface
|
|||||||
/** @var Collection $collection */
|
/** @var Collection $collection */
|
||||||
$collection = $this->getUser()->transactionjournals()
|
$collection = $this->getUser()->transactionjournals()
|
||||||
->withRelevantData()
|
->withRelevantData()
|
||||||
->before($end)
|
->before($end)->after($start)->where('encrypted', 0)
|
||||||
->where('encrypted', 0)
|
|
||||||
->after($start)
|
|
||||||
->whereNotIn('id', $exclude)
|
->whereNotIn('id', $exclude)
|
||||||
->where('description', 'LIKE', '%' . $query . '%')
|
->where('description', 'LIKE', '%' . $query . '%')
|
||||||
->get();
|
->get();
|
||||||
@@ -70,9 +68,8 @@ class Related implements RelatedInterface
|
|||||||
/** @var Collection $encryptedCollection */
|
/** @var Collection $encryptedCollection */
|
||||||
$encryptedCollection = $this->getUser()->transactionjournals()
|
$encryptedCollection = $this->getUser()->transactionjournals()
|
||||||
->withRelevantData()
|
->withRelevantData()
|
||||||
->before($end)
|
->before($end)->after($start)
|
||||||
->where('encrypted', 1)
|
->where('encrypted', 1)
|
||||||
->after($start)
|
|
||||||
->whereNotIn('id', $exclude)
|
->whereNotIn('id', $exclude)
|
||||||
->get();
|
->get();
|
||||||
$encrypted = $encryptedCollection->filter(
|
$encrypted = $encryptedCollection->filter(
|
||||||
@@ -81,11 +78,11 @@ class Related implements RelatedInterface
|
|||||||
if ($strPos !== false) {
|
if ($strPos !== false) {
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$collected = $collection->merge($encrypted);
|
|
||||||
|
|
||||||
|
return $collection->merge($encrypted);
|
||||||
return $collected;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,13 +364,12 @@ class Report implements ReportInterface
|
|||||||
*
|
*
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param int $limit
|
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function revenueGroupedByAccount(Carbon $start, Carbon $end, $limit = 15)
|
public function revenueGroupedByAccount(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
return $this->_queries->journalsByRevenueAccount($start, $end, $limit);
|
return $this->_queries->journalsByRevenueAccount($start, $end);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,11 +94,10 @@ interface ReportInterface
|
|||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param int $limit
|
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function revenueGroupedByAccount(Carbon $start, Carbon $end, $limit = 15);
|
public function revenueGroupedByAccount(Carbon $start, Carbon $end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
|
|||||||
@@ -404,11 +404,10 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*
|
*
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param int $limit
|
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function journalsByRevenueAccount(Carbon $start, Carbon $end, $limit = 15)
|
public function journalsByRevenueAccount(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
return \TransactionJournal::
|
return \TransactionJournal::
|
||||||
leftJoin(
|
leftJoin(
|
||||||
|
|||||||
@@ -127,4 +127,5 @@ App::down(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
require app_path() . '/filters.php';
|
require app_path() . '/filters.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user