fixed #704
This commit is contained in:
parent
a702d1ccba
commit
09366fa243
@ -12,12 +12,13 @@ use App\Models\Income\InvoicePayment;
|
|||||||
use App\Models\Income\Revenue;
|
use App\Models\Income\Revenue;
|
||||||
use App\Models\Setting\Category;
|
use App\Models\Setting\Category;
|
||||||
use App\Traits\Currencies;
|
use App\Traits\Currencies;
|
||||||
|
use App\Traits\DateTime;
|
||||||
use Charts;
|
use Charts;
|
||||||
use Date;
|
use Date;
|
||||||
|
|
||||||
class Dashboard extends Controller
|
class Dashboard extends Controller
|
||||||
{
|
{
|
||||||
use Currencies;
|
use Currencies, DateTime;
|
||||||
|
|
||||||
public $today;
|
public $today;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ class Dashboard extends Controller
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->today = Date::today();
|
$this->today = Date::today();
|
||||||
$this->financial_start = $financial_start = Date::parse(setting('general.financial_start'))->format('Y-m-d');
|
$this->financial_start = $financial_start = $this->getFinancialStart()->format('Y-m-d');
|
||||||
|
|
||||||
list($total_incomes, $total_expenses, $total_profit) = $this->getTotals();
|
list($total_incomes, $total_expenses, $total_profit) = $this->getTotals();
|
||||||
|
|
||||||
|
@ -10,11 +10,14 @@ use App\Models\Expense\Payment;
|
|||||||
use App\Models\Expense\Vendor;
|
use App\Models\Expense\Vendor;
|
||||||
use App\Models\Setting\Category;
|
use App\Models\Setting\Category;
|
||||||
use App\Utilities\Recurring;
|
use App\Utilities\Recurring;
|
||||||
|
use App\Traits\DateTime;
|
||||||
use Charts;
|
use Charts;
|
||||||
use Date;
|
use Date;
|
||||||
|
|
||||||
class ExpenseSummary extends Controller
|
class ExpenseSummary extends Controller
|
||||||
{
|
{
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
@ -28,7 +31,7 @@ class ExpenseSummary extends Controller
|
|||||||
$year = request('year', Date::now()->year);
|
$year = request('year', Date::now()->year);
|
||||||
|
|
||||||
// check and assign year start
|
// check and assign year start
|
||||||
$financial_start = Date::parse(setting('general.financial_start'));
|
$financial_start = $this->getFinancialStart();
|
||||||
|
|
||||||
if ($financial_start->month != 1) {
|
if ($financial_start->month != 1) {
|
||||||
// check if a specific year is requested
|
// check if a specific year is requested
|
||||||
|
@ -14,11 +14,14 @@ use App\Models\Expense\Payment;
|
|||||||
use App\Models\Expense\Vendor;
|
use App\Models\Expense\Vendor;
|
||||||
use App\Models\Setting\Category;
|
use App\Models\Setting\Category;
|
||||||
use App\Utilities\Recurring;
|
use App\Utilities\Recurring;
|
||||||
|
use App\Traits\DateTime;
|
||||||
use Charts;
|
use Charts;
|
||||||
use Date;
|
use Date;
|
||||||
|
|
||||||
class IncomeExpenseSummary extends Controller
|
class IncomeExpenseSummary extends Controller
|
||||||
{
|
{
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
@ -32,19 +35,17 @@ class IncomeExpenseSummary extends Controller
|
|||||||
$year = request('year', Date::now()->year);
|
$year = request('year', Date::now()->year);
|
||||||
|
|
||||||
// check and assign year start
|
// check and assign year start
|
||||||
$financial_start = Date::parse(setting('general.financial_start'));
|
$financial_start = $this->getFinancialStart();
|
||||||
|
|
||||||
if ($financial_start->month != 1) {
|
if ($financial_start->month != 1) {
|
||||||
// check if a specific year is requested
|
// check if a specific year is requested
|
||||||
if (!is_null(request('year'))) {
|
if (!is_null(request('year'))) {
|
||||||
$financial_start->year = $year;
|
$financial_start->year = $year;
|
||||||
}
|
|
||||||
|
|
||||||
$year = [$financial_start->format('Y'), $financial_start->addYear()->format('Y')];
|
|
||||||
$financial_start->subYear()->subMonth();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$year = [$financial_start->format('Y'), $financial_start->addYear()->format('Y')];
|
||||||
|
$financial_start->subYear()->subMonth();
|
||||||
|
}
|
||||||
|
|
||||||
$categories_filter = request('categories');
|
$categories_filter = request('categories');
|
||||||
|
|
||||||
|
@ -10,11 +10,14 @@ use App\Models\Income\InvoicePayment;
|
|||||||
use App\Models\Income\Revenue;
|
use App\Models\Income\Revenue;
|
||||||
use App\Models\Setting\Category;
|
use App\Models\Setting\Category;
|
||||||
use App\Utilities\Recurring;
|
use App\Utilities\Recurring;
|
||||||
|
use App\Traits\DateTime;
|
||||||
use Charts;
|
use Charts;
|
||||||
use Date;
|
use Date;
|
||||||
|
|
||||||
class IncomeSummary extends Controller
|
class IncomeSummary extends Controller
|
||||||
{
|
{
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
@ -28,7 +31,7 @@ class IncomeSummary extends Controller
|
|||||||
$year = request('year', Date::now()->year);
|
$year = request('year', Date::now()->year);
|
||||||
|
|
||||||
// check and assign year start
|
// check and assign year start
|
||||||
$financial_start = Date::parse(setting('general.financial_start'));
|
$financial_start = $this->getFinancialStart();
|
||||||
|
|
||||||
if ($financial_start->month != 1) {
|
if ($financial_start->month != 1) {
|
||||||
// check if a specific year is requested
|
// check if a specific year is requested
|
||||||
|
@ -10,11 +10,14 @@ use App\Models\Expense\Bill;
|
|||||||
use App\Models\Expense\BillPayment;
|
use App\Models\Expense\BillPayment;
|
||||||
use App\Models\Expense\Payment;
|
use App\Models\Expense\Payment;
|
||||||
use App\Models\Setting\Category;
|
use App\Models\Setting\Category;
|
||||||
|
use App\Traits\DateTime;
|
||||||
use Charts;
|
use Charts;
|
||||||
use Date;
|
use Date;
|
||||||
|
|
||||||
class ProfitLoss extends Controller
|
class ProfitLoss extends Controller
|
||||||
{
|
{
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
@ -28,7 +31,7 @@ class ProfitLoss extends Controller
|
|||||||
$year = request('year', Date::now()->year);
|
$year = request('year', Date::now()->year);
|
||||||
|
|
||||||
// check and assign year start
|
// check and assign year start
|
||||||
$financial_start = Date::parse(setting('general.financial_start'));
|
$financial_start = $this->getFinancialStart();
|
||||||
|
|
||||||
if ($financial_start->month != 1) {
|
if ($financial_start->month != 1) {
|
||||||
// check if a specific year is requested
|
// check if a specific year is requested
|
||||||
|
@ -11,11 +11,12 @@ use App\Models\Income\InvoicePayment;
|
|||||||
use App\Models\Income\InvoiceTotal;
|
use App\Models\Income\InvoiceTotal;
|
||||||
use App\Models\Setting\Tax;
|
use App\Models\Setting\Tax;
|
||||||
use App\Traits\Currencies;
|
use App\Traits\Currencies;
|
||||||
|
use App\Traits\DateTime;
|
||||||
use Date;
|
use Date;
|
||||||
|
|
||||||
class TaxSummary extends Controller
|
class TaxSummary extends Controller
|
||||||
{
|
{
|
||||||
use Currencies;
|
use Currencies, DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
@ -30,7 +31,7 @@ class TaxSummary extends Controller
|
|||||||
$year = request('year', Date::now()->year);
|
$year = request('year', Date::now()->year);
|
||||||
|
|
||||||
// check and assign year start
|
// check and assign year start
|
||||||
$financial_start = Date::parse(setting('general.financial_start'));
|
$financial_start = $this->getFinancialStart();
|
||||||
|
|
||||||
if ($financial_start->month != 1) {
|
if ($financial_start->month != 1) {
|
||||||
// check if a specific year is requested
|
// check if a specific year is requested
|
||||||
|
@ -14,6 +14,7 @@ use App\Traits\DateTime;
|
|||||||
use App\Traits\Uploads;
|
use App\Traits\Uploads;
|
||||||
use App\Utilities\Installer;
|
use App\Utilities\Installer;
|
||||||
use App\Utilities\Modules;
|
use App\Utilities\Modules;
|
||||||
|
use Date;
|
||||||
|
|
||||||
class Settings extends Controller
|
class Settings extends Controller
|
||||||
{
|
{
|
||||||
@ -26,20 +27,15 @@ class Settings extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
/*$setting = Setting::all()->pluck('value', 'key');*/
|
|
||||||
$setting = Setting::all()->map(function ($s) {
|
$setting = Setting::all()->map(function ($s) {
|
||||||
$s->key = str_replace('general.', '', $s->key);
|
$s->key = str_replace('general.', '', $s->key);
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
})->pluck('value', 'key');
|
})->pluck('value', 'key');
|
||||||
|
|
||||||
$company_logo = $setting->pull('company_logo');
|
$setting->put('company_logo', Media::find($setting->pull('company_logo')));
|
||||||
|
$setting->put('invoice_logo', Media::find($setting->pull('invoice_logo')));
|
||||||
$setting['company_logo'] = Media::find($company_logo);
|
$setting->put('financial_start', $this->getFinancialStart()->format('d F'));
|
||||||
|
|
||||||
$invoice_logo = $setting->pull('invoice_logo');
|
|
||||||
|
|
||||||
$setting['invoice_logo'] = Media::find($invoice_logo);
|
|
||||||
|
|
||||||
$timezones = $this->getTimezones();
|
$timezones = $this->getTimezones();
|
||||||
|
|
||||||
@ -165,6 +161,11 @@ class Settings extends Controller
|
|||||||
$this->oneCompany($key, $value);
|
$this->oneCompany($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format financial year
|
||||||
|
if ($key == 'financial_start') {
|
||||||
|
$value = Date::parse($value)->format('d-m');
|
||||||
|
}
|
||||||
|
|
||||||
setting()->set('general.' . $key, $value);
|
setting()->set('general.' . $key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
app/Listeners/Updates/Version138.php
Normal file
33
app/Listeners/Updates/Version138.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners\Updates;
|
||||||
|
|
||||||
|
use App\Events\UpdateFinished;
|
||||||
|
use Date;
|
||||||
|
|
||||||
|
class Version138 extends Listener
|
||||||
|
{
|
||||||
|
const ALIAS = 'core';
|
||||||
|
|
||||||
|
const VERSION = '1.3.8';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(UpdateFinished $event)
|
||||||
|
{
|
||||||
|
// Check if should listen
|
||||||
|
if (!$this->check($event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-format financial start
|
||||||
|
$current_setting = setting('general.financial_start', Date::now()->startOfYear()->format('d F'));
|
||||||
|
|
||||||
|
setting(['general.financial_start' => Date::parse($current_setting)->format('d-m')]);
|
||||||
|
setting()->save();
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
'App\Listeners\Updates\Version130',
|
'App\Listeners\Updates\Version130',
|
||||||
'App\Listeners\Updates\Version132',
|
'App\Listeners\Updates\Version132',
|
||||||
'App\Listeners\Updates\Version135',
|
'App\Listeners\Updates\Version135',
|
||||||
|
'App\Listeners\Updates\Version138',
|
||||||
],
|
],
|
||||||
'Illuminate\Auth\Events\Login' => [
|
'Illuminate\Auth\Events\Login' => [
|
||||||
'App\Listeners\Auth\Login',
|
'App\Listeners\Auth\Login',
|
||||||
|
@ -31,7 +31,7 @@ trait DateTime
|
|||||||
$end = Date::parse($year . '-12-31')->format('Y-m-d');
|
$end = Date::parse($year . '-12-31')->format('Y-m-d');
|
||||||
|
|
||||||
// check if financial year has been customized
|
// check if financial year has been customized
|
||||||
$financial_start = Date::parse(setting('general.financial_start'));
|
$financial_start = $this->getFinancialStart();
|
||||||
|
|
||||||
if (Date::now()->startOfYear()->format('Y-m-d') !== $financial_start->format('Y-m-d')) {
|
if (Date::now()->startOfYear()->format('Y-m-d') !== $financial_start->format('Y-m-d')) {
|
||||||
if (!is_null(request('year'))) {
|
if (!is_null(request('year'))) {
|
||||||
@ -82,4 +82,16 @@ trait DateTime
|
|||||||
|
|
||||||
return $groups;
|
return $groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFinancialStart()
|
||||||
|
{
|
||||||
|
$now = Date::now()->startOfYear();
|
||||||
|
|
||||||
|
$setting = explode('-', setting('general.financial_start'));
|
||||||
|
|
||||||
|
$day = !empty($setting[0]) ? $setting[0] : $now->day;
|
||||||
|
$month = !empty($setting[1]) ? $setting[1] : $now->month;
|
||||||
|
|
||||||
|
return Date::create(null, $month, $day);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane tab-margin" id="localisation">
|
<div class="tab-pane tab-margin" id="localisation">
|
||||||
{{ Form::textGroup('financial_start', trans('settings.localisation.financial_start'), 'calendar-check-o', ['id' => 'financial_start', 'class' => 'form-control', 'data-inputmask' => '\'alias\': \'dd MM\'', 'data-mask' => '', 'autocomplete' => 'off']) }}
|
{{ Form::textGroup('financial_start', trans('settings.localisation.financial_start'), 'calendar-check-o', ['id' => 'financial_start', 'class' => 'form-control', 'data-inputmask' => '\'alias\': \'dd MM\'', 'data-mask' => '', 'autocomplete' => 'off'], $setting['financial_start']) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, null, []) }}
|
{{ Form::selectGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, null, []) }}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user