diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php
index 559bf379c..aa14a215c 100644
--- a/app/Http/Controllers/Banking/Accounts.php
+++ b/app/Http/Controllers/Banking/Accounts.php
@@ -10,6 +10,7 @@ use App\Jobs\Banking\UpdateAccount;
use App\Models\Banking\Account;
use App\Models\Banking\Transaction;
use App\Models\Banking\Transfer;
+use App\Utilities\Reports as Utility;
use App\Models\Setting\Currency;
class Accounts extends Controller
@@ -243,6 +244,23 @@ class Accounts extends Controller
return redirect()->route('transfers.create')->withInput($data);
}
+ public function seePerformance(Account $account)
+ {
+ $data['account_id'] = $account->id;
+
+ $report = Utility::getClassInstance('App\Reports\IncomeExpenseSummary');
+
+ if (empty($report) || empty($report->model)) {
+ $message = trans('accounts.create_report');
+
+ flash($message)->warning()->important();
+
+ return redirect()->route('reports.create');
+ }
+
+ return redirect()->route('reports.show', $report->model->id)->withInput($data);
+ }
+
public function currency()
{
$account_id = (int) request('account_id');
diff --git a/resources/lang/en-GB/accounts.php b/resources/lang/en-GB/accounts.php
index 98b9c65a4..c497e6a79 100644
--- a/resources/lang/en-GB/accounts.php
+++ b/resources/lang/en-GB/accounts.php
@@ -10,5 +10,7 @@ return [
'bank_phone' => 'Bank Phone',
'bank_address' => 'Bank Address',
'default_account' => 'Default Account',
+ 'see_performance' => 'See Performance',
+ 'create_report' => 'If you want to see account performance. You can create Income vs Expense report instance.',
];
diff --git a/resources/views/banking/accounts/show.blade.php b/resources/views/banking/accounts/show.blade.php
index e12529263..7fc7c784b 100644
--- a/resources/views/banking/accounts/show.blade.php
+++ b/resources/views/banking/accounts/show.blade.php
@@ -49,8 +49,8 @@
@stack('performance_button_start')
@can('read-banking-accounts')
-
- See Performance
+
+ {{ trans('accounts.see_performance') }}
@endcan
@stack('performance_button_end')
diff --git a/routes/admin.php b/routes/admin.php
index 86afc89df..39152ee28 100644
--- a/routes/admin.php
+++ b/routes/admin.php
@@ -131,6 +131,7 @@ Route::group(['prefix' => 'banking'], function () {
Route::get('accounts/{account}/create-revenue', 'Banking\Accounts@createRevenue')->name('accounts.create-revenue');
Route::get('accounts/{account}/create-payment', 'Banking\Accounts@createPayment')->name('accounts.create-payment');
Route::get('accounts/{account}/create-transfer', 'Banking\Accounts@createTransfer')->name('accounts.create-transfer');
+ Route::get('accounts/{account}/see-performance', 'Banking\Accounts@seePerformance')->name('accounts.see-performance');
Route::get('accounts/{account}/enable', 'Banking\Accounts@enable')->name('accounts.enable');
Route::get('accounts/{account}/disable', 'Banking\Accounts@disable')->name('accounts.disable');
Route::get('accounts/{account}/duplicate', 'Banking\Accounts@duplicate')->name('accounts.duplicate');