This commit is contained in:
denisdulici
2018-12-31 14:41:17 +03:00
parent a702d1ccba
commit 09366fa243
11 changed files with 85 additions and 26 deletions

View File

@ -12,12 +12,13 @@ use App\Models\Income\InvoicePayment;
use App\Models\Income\Revenue;
use App\Models\Setting\Category;
use App\Traits\Currencies;
use App\Traits\DateTime;
use Charts;
use Date;
class Dashboard extends Controller
{
use Currencies;
use Currencies, DateTime;
public $today;
@ -36,7 +37,7 @@ class Dashboard extends Controller
public function index()
{
$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();

View File

@ -10,11 +10,14 @@ use App\Models\Expense\Payment;
use App\Models\Expense\Vendor;
use App\Models\Setting\Category;
use App\Utilities\Recurring;
use App\Traits\DateTime;
use Charts;
use Date;
class ExpenseSummary extends Controller
{
use DateTime;
/**
* Display a listing of the resource.
*
@ -28,7 +31,7 @@ class ExpenseSummary extends Controller
$year = request('year', Date::now()->year);
// check and assign year start
$financial_start = Date::parse(setting('general.financial_start'));
$financial_start = $this->getFinancialStart();
if ($financial_start->month != 1) {
// check if a specific year is requested

View File

@ -14,11 +14,14 @@ use App\Models\Expense\Payment;
use App\Models\Expense\Vendor;
use App\Models\Setting\Category;
use App\Utilities\Recurring;
use App\Traits\DateTime;
use Charts;
use Date;
class IncomeExpenseSummary extends Controller
{
use DateTime;
/**
* Display a listing of the resource.
*
@ -32,19 +35,17 @@ class IncomeExpenseSummary extends Controller
$year = request('year', Date::now()->year);
// check and assign year start
$financial_start = Date::parse(setting('general.financial_start'));
$financial_start = $this->getFinancialStart();
if ($financial_start->month != 1) {
// check if a specific year is requested
if (!is_null(request('year'))) {
$financial_start->year = $year;
}
$year = [$financial_start->format('Y'), $financial_start->addYear()->format('Y')];
$financial_start->subYear()->subMonth();
// check if a specific year is requested
if (!is_null(request('year'))) {
$financial_start->year = $year;
}
$year = [$financial_start->format('Y'), $financial_start->addYear()->format('Y')];
$financial_start->subYear()->subMonth();
}
$categories_filter = request('categories');

View File

@ -10,11 +10,14 @@ use App\Models\Income\InvoicePayment;
use App\Models\Income\Revenue;
use App\Models\Setting\Category;
use App\Utilities\Recurring;
use App\Traits\DateTime;
use Charts;
use Date;
class IncomeSummary extends Controller
{
use DateTime;
/**
* Display a listing of the resource.
*
@ -28,7 +31,7 @@ class IncomeSummary extends Controller
$year = request('year', Date::now()->year);
// check and assign year start
$financial_start = Date::parse(setting('general.financial_start'));
$financial_start = $this->getFinancialStart();
if ($financial_start->month != 1) {
// check if a specific year is requested

View File

@ -10,11 +10,14 @@ use App\Models\Expense\Bill;
use App\Models\Expense\BillPayment;
use App\Models\Expense\Payment;
use App\Models\Setting\Category;
use App\Traits\DateTime;
use Charts;
use Date;
class ProfitLoss extends Controller
{
use DateTime;
/**
* Display a listing of the resource.
*
@ -28,7 +31,7 @@ class ProfitLoss extends Controller
$year = request('year', Date::now()->year);
// check and assign year start
$financial_start = Date::parse(setting('general.financial_start'));
$financial_start = $this->getFinancialStart();
if ($financial_start->month != 1) {
// check if a specific year is requested

View File

@ -11,11 +11,12 @@ use App\Models\Income\InvoicePayment;
use App\Models\Income\InvoiceTotal;
use App\Models\Setting\Tax;
use App\Traits\Currencies;
use App\Traits\DateTime;
use Date;
class TaxSummary extends Controller
{
use Currencies;
use Currencies, DateTime;
/**
* Display a listing of the resource.
@ -30,7 +31,7 @@ class TaxSummary extends Controller
$year = request('year', Date::now()->year);
// check and assign year start
$financial_start = Date::parse(setting('general.financial_start'));
$financial_start = $this->getFinancialStart();
if ($financial_start->month != 1) {
// check if a specific year is requested

View File

@ -14,6 +14,7 @@ use App\Traits\DateTime;
use App\Traits\Uploads;
use App\Utilities\Installer;
use App\Utilities\Modules;
use Date;
class Settings extends Controller
{
@ -26,20 +27,15 @@ class Settings extends Controller
*/
public function edit()
{
/*$setting = Setting::all()->pluck('value', 'key');*/
$setting = Setting::all()->map(function ($s) {
$s->key = str_replace('general.', '', $s->key);
return $s;
})->pluck('value', 'key');
$company_logo = $setting->pull('company_logo');
$setting['company_logo'] = Media::find($company_logo);
$invoice_logo = $setting->pull('invoice_logo');
$setting['invoice_logo'] = Media::find($invoice_logo);
$setting->put('company_logo', Media::find($setting->pull('company_logo')));
$setting->put('invoice_logo', Media::find($setting->pull('invoice_logo')));
$setting->put('financial_start', $this->getFinancialStart()->format('d F'));
$timezones = $this->getTimezones();
@ -165,6 +161,11 @@ class Settings extends Controller
$this->oneCompany($key, $value);
}
// Format financial year
if ($key == 'financial_start') {
$value = Date::parse($value)->format('d-m');
}
setting()->set('general.' . $key, $value);
}