Remove GA event codes.

This commit is contained in:
James Cole
2017-12-11 14:52:30 +01:00
parent d1c8e54798
commit f35aa6a035
23 changed files with 154 additions and 208 deletions

View File

@@ -90,8 +90,6 @@ class ReconcileController extends Controller
]; ];
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'edit-reconciliation');
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('reconcile.edit.fromUpdate')) { if (true !== session('reconcile.edit.fromUpdate')) {

View File

@@ -96,8 +96,6 @@ class AccountController extends Controller
$this->rememberPreviousUri('accounts.create.uri'); $this->rememberPreviousUri('accounts.create.uri');
} }
$request->session()->forget('accounts.create.fromStore'); $request->session()->forget('accounts.create.fromStore');
$request->session()->flash('gaEventCategory', 'accounts');
$request->session()->flash('gaEventAction', 'create-' . $what);
return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'currencySelectList', 'allCurrencies', 'roles')); return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'currencySelectList', 'allCurrencies', 'roles'));
} }
@@ -118,8 +116,6 @@ class AccountController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('accounts.delete.uri'); $this->rememberPreviousUri('accounts.delete.uri');
$request->session()->flash('gaEventCategory', 'accounts');
$request->session()->flash('gaEventAction', 'delete-' . $typeName);
return view('accounts.delete', compact('account', 'subTitle', 'accountList')); return view('accounts.delete', compact('account', 'subTitle', 'accountList'));
} }
@@ -198,8 +194,6 @@ class AccountController extends Controller
'currency_id' => $currency->id, 'currency_id' => $currency->id,
]; ];
$request->session()->flash('preFilled', $preFilled); $request->session()->flash('preFilled', $preFilled);
$request->session()->flash('gaEventCategory', 'accounts');
$request->session()->flash('gaEventAction', 'edit-' . $what);
return view( return view(
'accounts.edit', 'accounts.edit',

View File

@@ -70,8 +70,6 @@ class AttachmentController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('attachments.delete.uri'); $this->rememberPreviousUri('attachments.delete.uri');
$request->session()->flash('gaEventCategory', 'attachments');
$request->session()->flash('gaEventAction', 'delete-attachment');
return view('attachments.delete', compact('attachment', 'subTitle')); return view('attachments.delete', compact('attachment', 'subTitle'));
} }

View File

@@ -85,8 +85,6 @@ class BillController extends Controller
$this->rememberPreviousUri('bills.create.uri'); $this->rememberPreviousUri('bills.create.uri');
} }
$request->session()->forget('bills.create.fromStore'); $request->session()->forget('bills.create.fromStore');
$request->session()->flash('gaEventCategory', 'bills');
$request->session()->flash('gaEventAction', 'create');
return view('bills.create', compact('periods', 'subTitle')); return view('bills.create', compact('periods', 'subTitle'));
} }
@@ -101,8 +99,6 @@ class BillController extends Controller
{ {
// put previous url in session // put previous url in session
$this->rememberPreviousUri('bills.delete.uri'); $this->rememberPreviousUri('bills.delete.uri');
$request->session()->flash('gaEventCategory', 'bills');
$request->session()->flash('gaEventAction', 'delete');
$subTitle = trans('firefly.delete_bill', ['name' => $bill->name]); $subTitle = trans('firefly.delete_bill', ['name' => $bill->name]);
return view('bills.delete', compact('bill', 'subTitle')); return view('bills.delete', compact('bill', 'subTitle'));
@@ -162,8 +158,6 @@ class BillController extends Controller
$request->session()->flash('preFilled', $preFilled); $request->session()->flash('preFilled', $preFilled);
$request->session()->forget('bills.edit.fromUpdate'); $request->session()->forget('bills.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'bills');
$request->session()->flash('gaEventAction', 'edit');
return view('bills.edit', compact('subTitle', 'periods', 'bill')); return view('bills.edit', compact('subTitle', 'periods', 'bill'));
} }

View File

@@ -111,8 +111,6 @@ class BudgetController extends Controller
$this->rememberPreviousUri('budgets.create.uri'); $this->rememberPreviousUri('budgets.create.uri');
} }
$request->session()->forget('budgets.create.fromStore'); $request->session()->forget('budgets.create.fromStore');
$request->session()->flash('gaEventCategory', 'budgets');
$request->session()->flash('gaEventAction', 'create');
$subTitle = (string)trans('firefly.create_new_budget'); $subTitle = (string)trans('firefly.create_new_budget');
return view('budgets.create', compact('subTitle')); return view('budgets.create', compact('subTitle'));
@@ -130,8 +128,6 @@ class BudgetController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('budgets.delete.uri'); $this->rememberPreviousUri('budgets.delete.uri');
$request->session()->flash('gaEventCategory', 'budgets');
$request->session()->flash('gaEventAction', 'delete');
return view('budgets.delete', compact('budget', 'subTitle')); return view('budgets.delete', compact('budget', 'subTitle'));
} }
@@ -167,8 +163,6 @@ class BudgetController extends Controller
$this->rememberPreviousUri('budgets.edit.uri'); $this->rememberPreviousUri('budgets.edit.uri');
} }
$request->session()->forget('budgets.edit.fromUpdate'); $request->session()->forget('budgets.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'budgets');
$request->session()->flash('gaEventAction', 'edit');
return view('budgets.edit', compact('budget', 'subTitle')); return view('budgets.edit', compact('budget', 'subTitle'));
} }

View File

@@ -74,8 +74,6 @@ class CategoryController extends Controller
$this->rememberPreviousUri('categories.create.uri'); $this->rememberPreviousUri('categories.create.uri');
} }
$request->session()->forget('categories.create.fromStore'); $request->session()->forget('categories.create.fromStore');
$request->session()->flash('gaEventCategory', 'categories');
$request->session()->flash('gaEventAction', 'create');
$subTitle = trans('firefly.create_new_category'); $subTitle = trans('firefly.create_new_category');
return view('categories.create', compact('subTitle')); return view('categories.create', compact('subTitle'));
@@ -93,8 +91,6 @@ class CategoryController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('categories.delete.uri'); $this->rememberPreviousUri('categories.delete.uri');
$request->session()->flash('gaEventCategory', 'categories');
$request->session()->flash('gaEventAction', 'delete');
return view('categories.delete', compact('category', 'subTitle')); return view('categories.delete', compact('category', 'subTitle'));
} }
@@ -132,8 +128,6 @@ class CategoryController extends Controller
$this->rememberPreviousUri('categories.edit.uri'); $this->rememberPreviousUri('categories.edit.uri');
} }
$request->session()->forget('categories.edit.fromUpdate'); $request->session()->forget('categories.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'categories');
$request->session()->flash('gaEventAction', 'edit');
return view('categories.edit', compact('category', 'subTitle')); return view('categories.edit', compact('category', 'subTitle'));
} }

View File

@@ -83,8 +83,6 @@ class CurrencyController extends Controller
$this->rememberPreviousUri('currencies.create.uri'); $this->rememberPreviousUri('currencies.create.uri');
} }
$request->session()->forget('currencies.create.fromStore'); $request->session()->forget('currencies.create.fromStore');
$request->session()->flash('gaEventCategory', 'currency');
$request->session()->flash('gaEventAction', 'create');
return view('currencies.create', compact('subTitleIcon', 'subTitle')); return view('currencies.create', compact('subTitleIcon', 'subTitle'));
} }
@@ -131,8 +129,6 @@ class CurrencyController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('currencies.delete.uri'); $this->rememberPreviousUri('currencies.delete.uri');
$request->session()->flash('gaEventCategory', 'currency');
$request->session()->flash('gaEventAction', 'delete');
$subTitle = trans('form.delete_currency', ['name' => $currency->name]); $subTitle = trans('form.delete_currency', ['name' => $currency->name]);
return view('currencies.delete', compact('currency', 'subTitle')); return view('currencies.delete', compact('currency', 'subTitle'));
@@ -191,8 +187,6 @@ class CurrencyController extends Controller
$this->rememberPreviousUri('currencies.edit.uri'); $this->rememberPreviousUri('currencies.edit.uri');
} }
$request->session()->forget('currencies.edit.fromUpdate'); $request->session()->forget('currencies.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'currency');
$request->session()->flash('gaEventAction', 'edit');
return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon')); return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon'));
} }

View File

@@ -36,6 +36,7 @@ use Illuminate\Support\Collection;
use Log; use Log;
use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\RotatingFileHandler;
use Preferences; use Preferences;
use ReflectionException;
use Route as RouteFacade; use Route as RouteFacade;
use Session; use Session;
use View; use View;
@@ -171,7 +172,11 @@ class HomeController extends Controller
Log::debug('Call route:clear...'); Log::debug('Call route:clear...');
Artisan::call('route:clear'); Artisan::call('route:clear');
Log::debug('Call twig:clean...'); Log::debug('Call twig:clean...');
try {
Artisan::call('twig:clean'); Artisan::call('twig:clean');
} catch(ReflectionException $e) {
// dont care
}
Log::debug('Call view:clear...'); Log::debug('Call view:clear...');
Artisan::call('view:clear'); Artisan::call('view:clear');
Log::debug('Done! Redirecting...'); Log::debug('Done! Redirecting...');

View File

@@ -120,8 +120,6 @@ class PiggyBankController extends Controller
$this->rememberPreviousUri('piggy-banks.create.uri'); $this->rememberPreviousUri('piggy-banks.create.uri');
} }
Session::forget('piggy-banks.create.fromStore'); Session::forget('piggy-banks.create.fromStore');
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'create');
return view('piggy-banks.create', compact('accounts', 'subTitle', 'subTitleIcon')); return view('piggy-banks.create', compact('accounts', 'subTitle', 'subTitleIcon'));
} }
@@ -137,8 +135,6 @@ class PiggyBankController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('piggy-banks.delete.uri'); $this->rememberPreviousUri('piggy-banks.delete.uri');
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'delete');
return view('piggy-banks.delete', compact('piggyBank', 'subTitle')); return view('piggy-banks.delete', compact('piggyBank', 'subTitle'));
} }
@@ -188,8 +184,6 @@ class PiggyBankController extends Controller
'note' => null === $note ? '' : $note->text, 'note' => null === $note ? '' : $note->text,
]; ];
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'edit');
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('piggy-banks.edit.fromUpdate')) { if (true !== session('piggy-banks.edit.fromUpdate')) {

View File

@@ -241,9 +241,6 @@ class ProfileController extends Controller
Session::flush(); Session::flush();
$repository->destroy($user); $repository->destroy($user);
Session::flash('gaEventCategory', 'user');
Session::flash('gaEventAction', 'delete-account');
return redirect(route('index')); return redirect(route('index'));
} }

View File

@@ -43,7 +43,7 @@ class ExpenseController extends Controller
protected $accountRepository; protected $accountRepository;
/** /**
* * Constructor for ExpenseController
*/ */
public function __construct() public function __construct()
{ {
@@ -60,6 +60,8 @@ class ExpenseController extends Controller
} }
/** /**
* Generates the overview per budget.
*
* @param Collection $accounts * @param Collection $accounts
* @param Collection $expense * @param Collection $expense
* @param Carbon $start * @param Carbon $start
@@ -87,17 +89,17 @@ class ExpenseController extends Controller
} }
// now find spent / earned: // now find spent / earned:
$spent = $this->spentByBudget($accounts, $all, $start, $end); $spent = $this->spentByBudget($accounts, $all, $start, $end);
// do some merging to get the budget info ready. // join arrays somehow:
$together = []; $together = [];
foreach ($spent as $budgetId => $spentInfo) { foreach ($spent as $categoryId => $spentInfo) {
if (!isset($together[$budgetId])) { if (!isset($together[$categoryId])) {
$together[$budgetId]['spent'] = $spentInfo; $together[$categoryId]['spent'] = $spentInfo;
// get category info: $together[$categoryId]['budget'] = $spentInfo['name'];
$first = reset($spentInfo); $together[$categoryId]['grand_total'] = '0';
$together[$budgetId]['budget'] = $first['budget'];
} }
$together[$categoryId]['grand_total'] = bcadd($spentInfo['grand_total'], $together[$categoryId]['grand_total']);
} }
unset($spentInfo);
$result = view('reports.partials.exp-budgets', compact('together'))->render(); $result = view('reports.partials.exp-budgets', compact('together'))->render();
$cache->store($result); $cache->store($result);
@@ -105,6 +107,8 @@ class ExpenseController extends Controller
} }
/** /**
* Generates the overview per category (spent and earned).
*
* @param Collection $accounts * @param Collection $accounts
* @param Collection $expense * @param Collection $expense
* @param Carbon $start * @param Carbon $start
@@ -133,25 +137,24 @@ class ExpenseController extends Controller
// now find spent / earned: // now find spent / earned:
$spent = $this->spentByCategory($accounts, $all, $start, $end); $spent = $this->spentByCategory($accounts, $all, $start, $end);
$earned = $this->earnedByCategory($accounts, $all, $start, $end); $earned = $this->earnedByCategory($accounts, $all, $start, $end);
// join arrays somehow: // join arrays somehow:
$together = []; $together = [];
foreach ($spent as $categoryId => $spentInfo) { foreach ($spent as $categoryId => $spentInfo) {
if (!isset($together[$categoryId])) { if (!isset($together[$categoryId])) {
$together[$categoryId]['spent'] = $spentInfo; $together[$categoryId]['spent'] = $spentInfo;
// get category info: $together[$categoryId]['category'] = $spentInfo['name'];
$first = reset($spentInfo); $together[$categoryId]['grand_total'] = '0';
$together[$categoryId]['category'] = $first['category'];
} }
$together[$categoryId]['grand_total'] = bcadd($spentInfo['grand_total'], $together[$categoryId]['grand_total']);
} }
unset($spentInfo);
foreach ($earned as $categoryId => $earnedInfo) { foreach ($earned as $categoryId => $earnedInfo) {
if (!isset($together[$categoryId])) { if (!isset($together[$categoryId])) {
$together[$categoryId]['earned'] = $earnedInfo; $together[$categoryId]['earned'] = $earnedInfo;
// get category info: $together[$categoryId]['category'] = $earnedInfo['name'];
$first = reset($earnedInfo); $together[$categoryId]['grand_total'] = '0';
$together[$categoryId]['category'] = $first['category'];
} }
$together[$categoryId]['grand_total'] = bcadd($earnedInfo['grand_total'], $together[$categoryId]['grand_total']);
} }
$result = view('reports.partials.exp-categories', compact('together'))->render(); $result = view('reports.partials.exp-categories', compact('together'))->render();
@@ -161,6 +164,8 @@ class ExpenseController extends Controller
} }
/** /**
* Overview of spending
*
* @param Collection $accounts * @param Collection $accounts
* @param Collection $expense * @param Collection $expense
* @param Carbon $start * @param Carbon $start
@@ -234,7 +239,7 @@ class ExpenseController extends Controller
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
* *
* @return string * @return array
*/ */
protected function earnedByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array protected function earnedByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array
{ {
@@ -260,7 +265,12 @@ class ExpenseController extends Controller
// if not set, set to zero: // if not set, set to zero:
if (!isset($sum[$categoryId][$currencyId])) { if (!isset($sum[$categoryId][$currencyId])) {
$sum[$categoryId][$currencyId] = [
$sum[$categoryId] = [
'grand_total' => '0',
'name' => $categoryName,
'per_currency' => [
$currencyId => [
'sum' => '0', 'sum' => '0',
'category' => [ 'category' => [
'id' => $categoryId, 'id' => $categoryId,
@@ -270,11 +280,17 @@ class ExpenseController extends Controller
'symbol' => $transaction->transaction_currency_symbol, 'symbol' => $transaction->transaction_currency_symbol,
'dp' => $transaction->transaction_currency_dp, 'dp' => $transaction->transaction_currency_dp,
], ],
],
],
]; ];
} }
// add amount // add amount
$sum[$categoryId][$currencyId]['sum'] = bcadd($sum[$categoryId][$currencyId]['sum'], $transaction->transaction_amount); $sum[$categoryId]['per_currency'][$currencyId]['sum'] = bcadd(
$sum[$categoryId]['per_currency'][$currencyId]['sum'], $transaction->transaction_amount
);
$sum[$categoryId]['grand_total'] = bcadd($sum[$categoryId]['grand_total'], $transaction->transaction_amount);
} }
return $sum; return $sum;
@@ -287,14 +303,17 @@ class ExpenseController extends Controller
$collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($assets); $collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($assets);
$collector->setOpposingAccounts($opposing); $collector->setOpposingAccounts($opposing);
$set = $collector->getJournals(); $set = $collector->getJournals();
$sum = []; $sum = [
'grand_sum' => '0',
'per_currency' => [],
];
// loop to support multi currency // loop to support multi currency
foreach ($set as $transaction) { foreach ($set as $transaction) {
$currencyId = $transaction->transaction_currency_id; $currencyId = $transaction->transaction_currency_id;
// if not set, set to zero: // if not set, set to zero:
if (!isset($sum[$currencyId])) { if (!isset($sum['per_currency'][$currencyId])) {
$sum[$currencyId] = [ $sum['per_currency'][$currencyId] = [
'sum' => '0', 'sum' => '0',
'currency' => [ 'currency' => [
'symbol' => $transaction->transaction_currency_symbol, 'symbol' => $transaction->transaction_currency_symbol,
@@ -304,7 +323,8 @@ class ExpenseController extends Controller
} }
// add amount // add amount
$sum[$currencyId]['sum'] = bcadd($sum[$currencyId]['sum'], $transaction->transaction_amount); $sum['per_currency'][$currencyId]['sum'] = bcadd($sum['per_currency'][$currencyId]['sum'], $transaction->transaction_amount);
$sum['grand_sum'] = bcadd($sum['grand_sum'], $transaction->transaction_amount);
} }
return $sum; return $sum;
@@ -342,7 +362,12 @@ class ExpenseController extends Controller
// if not set, set to zero: // if not set, set to zero:
if (!isset($sum[$budgetId][$currencyId])) { if (!isset($sum[$budgetId][$currencyId])) {
$sum[$budgetId][$currencyId] = [
$sum[$budgetId] = [
'grand_total' => '0',
'name' => $budgetName,
'per_currency' => [
$currencyId => [
'sum' => '0', 'sum' => '0',
'budget' => [ 'budget' => [
'id' => $budgetId, 'id' => $budgetId,
@@ -352,11 +377,16 @@ class ExpenseController extends Controller
'symbol' => $transaction->transaction_currency_symbol, 'symbol' => $transaction->transaction_currency_symbol,
'dp' => $transaction->transaction_currency_dp, 'dp' => $transaction->transaction_currency_dp,
], ],
],
],
]; ];
} }
// add amount // add amount
$sum[$budgetId][$currencyId]['sum'] = bcadd($sum[$budgetId][$currencyId]['sum'], $transaction->transaction_amount); $sum[$budgetId]['per_currency'][$currencyId]['sum'] = bcadd(
$sum[$budgetId]['per_currency'][$currencyId]['sum'], $transaction->transaction_amount
);
$sum[$budgetId]['grand_total'] = bcadd($sum[$budgetId]['grand_total'], $transaction->transaction_amount);
} }
return $sum; return $sum;
@@ -368,7 +398,7 @@ class ExpenseController extends Controller
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
* *
* @return string * @return array
*/ */
protected function spentByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array protected function spentByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array
{ {
@@ -394,7 +424,12 @@ class ExpenseController extends Controller
// if not set, set to zero: // if not set, set to zero:
if (!isset($sum[$categoryId][$currencyId])) { if (!isset($sum[$categoryId][$currencyId])) {
$sum[$categoryId][$currencyId] = [
$sum[$categoryId] = [
'grand_total' => '0',
'name' => $categoryName,
'per_currency' => [
$currencyId => [
'sum' => '0', 'sum' => '0',
'category' => [ 'category' => [
'id' => $categoryId, 'id' => $categoryId,
@@ -404,11 +439,16 @@ class ExpenseController extends Controller
'symbol' => $transaction->transaction_currency_symbol, 'symbol' => $transaction->transaction_currency_symbol,
'dp' => $transaction->transaction_currency_dp, 'dp' => $transaction->transaction_currency_dp,
], ],
],
],
]; ];
} }
// add amount // add amount
$sum[$categoryId][$currencyId]['sum'] = bcadd($sum[$categoryId][$currencyId]['sum'], $transaction->transaction_amount); $sum[$categoryId]['per_currency'][$currencyId]['sum'] = bcadd(
$sum[$categoryId]['per_currency'][$currencyId]['sum'], $transaction->transaction_amount
);
$sum[$categoryId]['grand_total'] = bcadd($sum[$categoryId]['grand_total'], $transaction->transaction_amount);
} }
return $sum; return $sum;
@@ -420,7 +460,7 @@ class ExpenseController extends Controller
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
* *
* @return string * @return array
*/ */
protected function spentInPeriod(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array protected function spentInPeriod(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array
{ {
@@ -429,14 +469,17 @@ class ExpenseController extends Controller
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAccounts($assets); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAccounts($assets);
$collector->setOpposingAccounts($opposing); $collector->setOpposingAccounts($opposing);
$set = $collector->getJournals(); $set = $collector->getJournals();
$sum = []; $sum = [
'grand_sum' => '0',
'per_currency' => [],
];
// loop to support multi currency // loop to support multi currency
foreach ($set as $transaction) { foreach ($set as $transaction) {
$currencyId = $transaction->transaction_currency_id; $currencyId = $transaction->transaction_currency_id;
// if not set, set to zero: // if not set, set to zero:
if (!isset($sum[$currencyId])) { if (!isset($sum['per_currency'][$currencyId])) {
$sum[$currencyId] = [ $sum['per_currency'][$currencyId] = [
'sum' => '0', 'sum' => '0',
'currency' => [ 'currency' => [
'symbol' => $transaction->transaction_currency_symbol, 'symbol' => $transaction->transaction_currency_symbol,
@@ -446,7 +489,8 @@ class ExpenseController extends Controller
} }
// add amount // add amount
$sum[$currencyId]['sum'] = bcadd($sum[$currencyId]['sum'], $transaction->transaction_amount); $sum['per_currency'][$currencyId]['sum'] = bcadd($sum['per_currency'][$currencyId]['sum'], $transaction->transaction_amount);
$sum['grand_sum'] = bcadd($sum['grand_sum'], $transaction->transaction_amount);
} }
return $sum; return $sum;

View File

@@ -102,8 +102,6 @@ class RuleController extends Controller
$this->rememberPreviousUri('rules.create.uri'); $this->rememberPreviousUri('rules.create.uri');
} }
Session::forget('rules.create.fromStore'); Session::forget('rules.create.fromStore');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'create-rule');
return view( return view(
'rules.rule.create', 'rules.rule.create',
@@ -124,8 +122,6 @@ class RuleController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('rules.delete.uri'); $this->rememberPreviousUri('rules.delete.uri');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'delete-rule');
return view('rules.rule.delete', compact('rule', 'subTitle')); return view('rules.rule.delete', compact('rule', 'subTitle'));
} }
@@ -203,8 +199,6 @@ class RuleController extends Controller
$this->rememberPreviousUri('rules.edit.uri'); $this->rememberPreviousUri('rules.edit.uri');
} }
Session::forget('rules.edit.fromUpdate'); Session::forget('rules.edit.fromUpdate');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'edit-rule');
return view( return view(
'rules.rule.edit', 'rules.rule.edit',

View File

@@ -71,8 +71,6 @@ class RuleGroupController extends Controller
$this->rememberPreviousUri('rule-groups.create.uri'); $this->rememberPreviousUri('rule-groups.create.uri');
} }
Session::forget('rule-groups.create.fromStore'); Session::forget('rule-groups.create.fromStore');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'create-rule-group');
return view('rules.rule-group.create', compact('subTitleIcon', 'subTitle')); return view('rules.rule-group.create', compact('subTitleIcon', 'subTitle'));
} }
@@ -92,8 +90,6 @@ class RuleGroupController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('rule-groups.delete.uri'); $this->rememberPreviousUri('rule-groups.delete.uri');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'delete-rule-group');
return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle', 'ruleGroupList')); return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle', 'ruleGroupList'));
} }
@@ -145,8 +141,6 @@ class RuleGroupController extends Controller
$this->rememberPreviousUri('rule-groups.edit.uri'); $this->rememberPreviousUri('rule-groups.edit.uri');
} }
Session::forget('rule-groups.edit.fromUpdate'); Session::forget('rule-groups.edit.fromUpdate');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'edit-rule-group');
return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle')); return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle'));
} }

View File

@@ -88,8 +88,6 @@ class TagController extends Controller
$this->rememberPreviousUri('tags.create.uri'); $this->rememberPreviousUri('tags.create.uri');
} }
Session::forget('tags.create.fromStore'); Session::forget('tags.create.fromStore');
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'create');
return view('tags.create', compact('subTitle', 'subTitleIcon', 'apiKey')); return view('tags.create', compact('subTitle', 'subTitleIcon', 'apiKey'));
} }
@@ -107,8 +105,6 @@ class TagController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('tags.delete.uri'); $this->rememberPreviousUri('tags.delete.uri');
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'delete');
return view('tags.delete', compact('tag', 'subTitle')); return view('tags.delete', compact('tag', 'subTitle'));
} }
@@ -147,8 +143,6 @@ class TagController extends Controller
$this->rememberPreviousUri('tags.edit.uri'); $this->rememberPreviousUri('tags.edit.uri');
} }
Session::forget('tags.edit.fromUpdate'); Session::forget('tags.edit.fromUpdate');
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'edit');
return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'apiKey')); return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'apiKey'));
} }

View File

@@ -70,8 +70,6 @@ class MassController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('transactions.mass-delete.uri'); $this->rememberPreviousUri('transactions.mass-delete.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'mass-delete');
return view('transactions.mass-delete', compact('journals', 'subTitle')); return view('transactions.mass-delete', compact('journals', 'subTitle'));
} }
@@ -166,8 +164,6 @@ class MassController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('transactions.mass-edit.uri'); $this->rememberPreviousUri('transactions.mass-edit.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'mass-edit');
// collect some useful meta data for the mass edit: // collect some useful meta data for the mass edit:
$filtered->each( $filtered->each(

View File

@@ -173,8 +173,6 @@ class SingleController extends Controller
$this->rememberPreviousUri('transactions.create.uri'); $this->rememberPreviousUri('transactions.create.uri');
} }
Session::forget('transactions.create.fromStore'); Session::forget('transactions.create.fromStore');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'create-' . $what);
asort($piggies); asort($piggies);
@@ -205,8 +203,6 @@ class SingleController extends Controller
// put previous url in session // put previous url in session
$this->rememberPreviousUri('transactions.delete.uri'); $this->rememberPreviousUri('transactions.delete.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'delete-' . $what);
return view('transactions.single.delete', compact('journal', 'subTitle', 'what')); return view('transactions.single.delete', compact('journal', 'subTitle', 'what'));
} }
@@ -313,8 +309,6 @@ class SingleController extends Controller
} }
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'edit-' . $what);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('transactions.edit.fromUpdate')) { if (true !== session('transactions.edit.fromUpdate')) {

View File

@@ -116,8 +116,6 @@ class SplitController extends Controller
$accountArray[$account->id]['currency_id'] = intval($account->getMeta('currency_id')); $accountArray[$account->id]['currency_id'] = intval($account->getMeta('currency_id'));
} }
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('transactions.edit-split.fromUpdate')) { if (true !== session('transactions.edit-split.fromUpdate')) {

View File

@@ -215,16 +215,6 @@
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100}); ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100});
ga('send', 'pageview'); ga('send', 'pageview');
// send an event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %}
ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}');
{% endif %}
// send event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %}
ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}', '{{ Session.get('gaEventLabel') }}');
{% endif %}
</script> </script>
{% endif %} {% endif %}

View File

@@ -47,16 +47,6 @@
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100}); ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100});
ga('send', 'pageview'); ga('send', 'pageview');
// send an event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %}
ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}');
{% endif %}
// send event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %}
ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}', '{{ Session.get('gaEventLabel') }}');
{% endif %}
</script> </script>
{% endif %} {% endif %}
</body> </body>

View File

@@ -58,16 +58,6 @@
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100}); ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100});
ga('send', 'pageview'); ga('send', 'pageview');
// send an event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %}
ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}');
{% endif %}
// send event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %}
ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}', '{{ Session.get('gaEventLabel') }}');
{% endif %}
</script> </script>
{% endif %} {% endif %}
</body> </body>

View File

@@ -1,26 +1,25 @@
<table class="table table-hover sortable"> <table class="table table-hover sortable">
<thead> <thead>
<tr> <tr>
<th style="width:50%;" data-defaultsign="az">{{ 'budget'|_ }}</th> <th style="width:66%;" data-defaultsign="az">{{ 'category'|_ }}</th>
<th style="width:50%;text-align: right;" data-defaultsort="disabled">{{ 'spent'|_ }}</th> <th style="width:34%;" data-defaultsort="_19">{{ 'spent'|_ }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for budgetId, entry in together %} {% for budgetId, entry in together %}
<tr> <tr>
<td style="width:50%;" data-value="{% if entry.budget.name|length ==0 %}{{ 'no_budget_squared'|_ }}{% else %}{{ entry.budget.name }}{% endif %}"> <td data-value="{% if entry.budget == null %}zzzzzzzzzzz{% else %}{{ entry.budget }}{% endif %}">
{% if entry.budget == null %}
{% if entry.budget.name|length ==0 %}
<a href="{{ route('budgets.no-budget') }}">{{ 'no_budget_squared'|_ }}</a> <a href="{{ route('budgets.no-budget') }}">{{ 'no_budget_squared'|_ }}</a>
{% else %} {% else %}
<a href="{{ route('budgets.show', budgetId) }}">{{ entry.budget.name }}</a> <a href="{{ route('budgets.show', budgetId) }}">{{ entry.budget }}</a>
{% endif %} {% endif %}
</td> </td>
<td style="text-align: right;"> <td data-value="{{ entry.spent.grand_total }}">
{% if entry.spent|length ==0 %} {% if entry.spent.per_currency|length ==0 %}
{{ '0'|formatAmount }} {{ '0'|formatAmount }}
{% else %} {% else %}
{% for expense in entry.spent %} {% for expense in entry.spent.per_currency %}
{{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br /> {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br />
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -2,34 +2,35 @@
<thead> <thead>
<tr> <tr>
<th style="width:50%;" data-defaultsign="az">{{ 'category'|_ }}</th> <th style="width:50%;" data-defaultsign="az">{{ 'category'|_ }}</th>
<th style="width:25%;text-align: right;" data-defaultsort="disabled">{{ 'spent'|_ }}</th> <th style="width:25%;" data-defaultsort="_19">{{ 'spent'|_ }}</th>
<th style="width:25%;text-align: right;" data-defaultsort="disabled">{{ 'earned'|_ }}</th> <th style="width:25%;" data-defaultsort="_19">{{ 'earned'|_ }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for categoryId, entry in together %} {% for categoryId, entry in together %}
<tr> <tr>
<td style="width:50%;" data-value="{% if entry.category.name|length ==0 %}{{ 'noCategory'|_ }}{% else %}{{ entry.category.name }}{% endif %}"> <td data-value="{% if entry.category == null %}zzzzzzzzzzz{% else %}{{ entry.category }}{% endif %}">
{% if entry.category.name|length ==0 %} {% if entry.category == null %}
<a href="{{ route('categories.no-category') }}">{{ 'noCategory'|_ }}</a> <a href="{{ route('categories.no-category') }}">{{ 'noCategory'|_ }}</a>
{% else %} {% else %}
<a href="{{ route('categories.show', categoryId) }}">{{ entry.category.name }}</a> <a href="{{ route('categories.show', categoryId) }}">{{ entry.category }}</a>
{% endif %} {% endif %}
</td> </td>
<td style="text-align: right;"> <td data-value="{{ entry.spent.grand_total }}">
{% if entry.spent|length ==0 %} {% if entry.spent.per_currency|length ==0 %}
{{ '0'|formatAmount }} {{ '0'|formatAmount }}
{% else %} {% else %}
{% for expense in entry.spent %} {% for expense in entry.spent.per_currency %}
{{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br /> {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br />
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</td> </td>
<td style="text-align: right;"> <td data-value="{{ entry.earned.grand_total }}">
{% if entry.earned|length ==0 %} {% if entry.earned.per_currency|length ==0 %}
{{ '0'|formatAmount }} {{ '0'|formatAmount }}
{% else %} {% else %}
{% for income in entry.earned %} {% for income in entry.earned.per_currency %}
{{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br /> {{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br />
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,33 +1,33 @@
<table class="table table-hover sortable"> <table class="table table-hover sortable">
<thead> <thead>
<tr> <tr>
<th style="width:50%;" data-defaultsign="az">{{ 'name'|_ }}</th> <th style="width:50%;" data-defaultsign="az">{{ 'name'|_ }}</th>
<th style="width:25%;text-align:right;" class="hidden-xs" style="text-align: right;" data-defaultsort="disabled">{{ 'spent'|_ }}</th> <th style="width:25%;" class="hidden-xs" data-defaultsort="_19">{{ 'spent'|_ }}</th>
<th style="width:25%;text-align:right;" class="hidden-xs" style="text-align: right;" data-defaultsort="disabled">{{ 'earned'|_ }}</th> <th style="width:25%;" class="hidden-xs" data-defaultsort="_19">{{ 'earned'|_ }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for name, amounts in result %} {% for name, amounts in result %}
<tr> <tr>
<td>{{ name }}</td> <td data-value="{{ name }}">{{ name }}</td>
<td style="text-align: right;" > <td data-value="{{ amounts.spent.grand_sum }}">
{% if amounts.spent|length == 0%} {% if amounts.spent.per_currency|length == 0%}
{{ '0'|formatAmount }} {{ '0'|formatAmount }}
{% endif %} {% endif %}
{% for expense in amounts.spent %} {% for expense in amounts.spent.per_currency %}
{{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br /> {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br />
{% endfor %} {% endfor %}
</td> </td>
<td style="text-align: right;" > <td data-value="{{ amounts.earned.grand_sum }}">
{% if amounts.earned|length == 0 %} {% if amounts.earned.per_currency|length == 0%}
{{ '0'|formatAmount }} {{ '0'|formatAmount }}
{% endif %} {% endif %}
{% for income in amounts.earned %} {% for income in amounts.earned.per_currency %}
{{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br /> {{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br />
{% endfor %} {% endfor %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>