Set default report sorting

This commit is contained in:
Hillel Coren 2017-03-31 09:01:07 +03:00
parent f3cf79ffee
commit 3f44620a1d
12 changed files with 18 additions and 3 deletions

View File

@ -23,7 +23,8 @@ class ActivityReport extends AbstractReport
$activities = Activity::scope() $activities = Activity::scope()
->with('client.contacts', 'user', 'invoice', 'payment', 'credit', 'task', 'expense', 'account') ->with('client.contacts', 'user', 'invoice', 'payment', 'credit', 'task', 'expense', 'account')
->whereRaw("DATE(created_at) >= \"{$startDate}\" and DATE(created_at) <= \"$endDate\""); ->whereRaw("DATE(created_at) >= \"{$startDate}\" and DATE(created_at) <= \"$endDate\"")
->orderBy('id', 'desc');
foreach ($activities->get() as $activity) { foreach ($activities->get() as $activity) {
$client = $activity->client; $client = $activity->client;

View File

@ -22,6 +22,7 @@ class AgingReport extends AbstractReport
$account = Auth::user()->account; $account = Auth::user()->account;
$clients = Client::scope() $clients = Client::scope()
->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) { ->with(['invoices' => function ($query) {

View File

@ -19,6 +19,7 @@ class ClientReport extends AbstractReport
$account = Auth::user()->account; $account = Auth::user()->account;
$clients = Client::scope() $clients = Client::scope()
->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) { ->with(['invoices' => function ($query) {

View File

@ -21,6 +21,7 @@ class ExpenseReport extends AbstractReport
$account = Auth::user()->account; $account = Auth::user()->account;
$expenses = Expense::scope() $expenses = Expense::scope()
->orderBy('expense_date', 'desc')
->withArchived() ->withArchived()
->with('client.contacts', 'vendor') ->with('client.contacts', 'vendor')
->where('expense_date', '>=', $this->startDate) ->where('expense_date', '>=', $this->startDate)

View File

@ -24,6 +24,7 @@ class InvoiceReport extends AbstractReport
$status = $this->options['invoice_status']; $status = $this->options['invoice_status'];
$clients = Client::scope() $clients = Client::scope()
->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) use ($status) { ->with(['invoices' => function ($query) use ($status) {

View File

@ -22,6 +22,7 @@ class PaymentReport extends AbstractReport
$account = Auth::user()->account; $account = Auth::user()->account;
$payments = Payment::scope() $payments = Payment::scope()
->orderBy('payment_date', 'desc')
->withArchived() ->withArchived()
->excludeFailed() ->excludeFailed()
->whereHas('client', function ($query) { ->whereHas('client', function ($query) {

View File

@ -24,6 +24,7 @@ class ProductReport extends AbstractReport
$status = $this->options['invoice_status']; $status = $this->options['invoice_status'];
$clients = Client::scope() $clients = Client::scope()
->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) use ($status) { ->with(['invoices' => function ($query) use ($status) {

View File

@ -21,6 +21,7 @@ class ProfitAndLossReport extends AbstractReport
$account = Auth::user()->account; $account = Auth::user()->account;
$payments = Payment::scope() $payments = Payment::scope()
->orderBy('payment_date', 'desc')
->with('client.contacts') ->with('client.contacts')
->withArchived() ->withArchived()
->excludeFailed() ->excludeFailed()
@ -43,6 +44,7 @@ class ProfitAndLossReport extends AbstractReport
} }
$expenses = Expense::scope() $expenses = Expense::scope()
->orderBy('expense_date', 'desc')
->with('client.contacts') ->with('client.contacts')
->withArchived() ->withArchived()
->where('expense_date', '>=', $this->startDate) ->where('expense_date', '>=', $this->startDate)

View File

@ -21,6 +21,7 @@ class QuoteReport extends AbstractReport
$status = $this->options['invoice_status']; $status = $this->options['invoice_status'];
$clients = Client::scope() $clients = Client::scope()
->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) use ($status) { ->with(['invoices' => function ($query) use ($status) {
@ -43,9 +44,9 @@ class QuoteReport extends AbstractReport
$account->formatMoney($invoice->amount, $client), $account->formatMoney($invoice->amount, $client),
$invoice->present()->status(), $invoice->present()->status(),
]; ];
}
$this->addToTotals($client->currency_id, 'amount', $invoice->amount); $this->addToTotals($client->currency_id, 'amount', $invoice->amount);
}
} }
} }
} }

View File

@ -18,6 +18,7 @@ class TaskReport extends AbstractReport
public function run() public function run()
{ {
$tasks = Task::scope() $tasks = Task::scope()
->orderBy('created_at', 'desc')
->with('client.contacts') ->with('client.contacts')
->withArchived() ->withArchived()
->dateRange($this->startDate, $this->endDate); ->dateRange($this->startDate, $this->endDate);

View File

@ -20,6 +20,7 @@ class TaxRateReport extends AbstractReport
$account = Auth::user()->account; $account = Auth::user()->account;
$clients = Client::scope() $clients = Client::scope()
->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) { ->with(['invoices' => function ($query) {

View File

@ -290,6 +290,9 @@
$(function(){ $(function(){
$(".tablesorter-data").tablesorter({ $(".tablesorter-data").tablesorter({
@if (! request()->group_when_sorted)
sortList: [[0,0]],
@endif
theme: 'bootstrap', theme: 'bootstrap',
widgets: ['zebra', 'uitheme', 'filter'{!! request()->group_when_sorted ? ", 'group'" : "" !!}, 'columnSelector'], widgets: ['zebra', 'uitheme', 'filter'{!! request()->group_when_sorted ? ", 'group'" : "" !!}, 'columnSelector'],
headerTemplate : '{content} {icon}', headerTemplate : '{content} {icon}',