mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
Merge pull request #480 from patricklucas/no_drafts_on_dashboard
Only show non-draft invoices on dashboard
This commit is contained in:
@ -58,6 +58,7 @@ class DashboardController extends Controller
|
|||||||
'invoice_date',
|
'invoice_date',
|
||||||
[$start->format('Y-m-d'), $end->format('Y-m-d')]
|
[$start->format('Y-m-d'), $end->format('Y-m-d')]
|
||||||
)
|
)
|
||||||
|
->where('status', '!=', Invoice::STATUS_DRAFT)
|
||||||
->whereCompany($request->header('company'))
|
->whereCompany($request->header('company'))
|
||||||
->sum('total')
|
->sum('total')
|
||||||
);
|
);
|
||||||
@ -94,6 +95,7 @@ class DashboardController extends Controller
|
|||||||
$start->subMonth()->endOfMonth();
|
$start->subMonth()->endOfMonth();
|
||||||
|
|
||||||
$salesTotal = Invoice::whereCompany($request->header('company'))
|
$salesTotal = Invoice::whereCompany($request->header('company'))
|
||||||
|
->where('status', '!=', Invoice::STATUS_DRAFT)
|
||||||
->whereBetween(
|
->whereBetween(
|
||||||
'invoice_date',
|
'invoice_date',
|
||||||
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
|
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
|
||||||
@ -121,11 +123,21 @@ class DashboardController extends Controller
|
|||||||
'netProfits' => $netProfits,
|
'netProfits' => $netProfits,
|
||||||
];
|
];
|
||||||
|
|
||||||
$customersCount = User::customer()->whereCompany($request->header('company'))->get()->count();
|
$customersCount = User::customer()->whereCompany($request->header('company'))->count();
|
||||||
$invoicesCount = Invoice::whereCompany($request->header('company'))->get()->count();
|
$invoicesCount = Invoice::whereCompany($request->header('company'))
|
||||||
$estimatesCount = Estimate::whereCompany($request->header('company'))->get()->count();
|
->where('status', '!=', Invoice::STATUS_DRAFT)
|
||||||
$totalDueAmount = Invoice::whereCompany($request->header('company'))->sum('due_amount');
|
->count();
|
||||||
$dueInvoices = Invoice::with('user')->whereCompany($request->header('company'))->where('due_amount', '>', 0)->take(5)->latest()->get();
|
$estimatesCount = Estimate::whereCompany($request->header('company'))->count();
|
||||||
|
$totalDueAmount = Invoice::whereCompany($request->header('company'))
|
||||||
|
->where('status', '!=', Invoice::STATUS_DRAFT)
|
||||||
|
->sum('due_amount');
|
||||||
|
$dueInvoices = Invoice::with('user')
|
||||||
|
->whereCompany($request->header('company'))
|
||||||
|
->where('status', '!=', Invoice::STATUS_DRAFT)
|
||||||
|
->where('due_amount', '>', 0)
|
||||||
|
->take(5)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
$estimates = Estimate::with('user')->whereCompany($request->header('company'))->take(5)->latest()->get();
|
$estimates = Estimate::with('user')->whereCompany($request->header('company'))->take(5)->latest()->get();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
Reference in New Issue
Block a user