mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
bug fixes
This commit is contained in:
parent
a3f988fa8d
commit
cb898dd9b2
@ -5,10 +5,10 @@ class DashboardController extends \BaseController {
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
// total_income, billed_clients, invoice_sent and active_clients
|
// total_income, billed_clients, invoice_sent and active_clients
|
||||||
$select = DB::raw('SUM(DISTINCT clients.paid_to_date) total_income,
|
$select = DB::raw('COUNT(DISTINCT CASE WHEN invoices.id IS NOT NULL THEN clients.id ELSE null END) billed_clients,
|
||||||
COUNT(DISTINCT CASE WHEN invoices.id IS NOT NULL THEN clients.id ELSE null END) billed_clients,
|
|
||||||
SUM(CASE WHEN invoices.invoice_status_id >= '.INVOICE_STATUS_SENT.' THEN 1 ELSE 0 END) invoices_sent,
|
SUM(CASE WHEN invoices.invoice_status_id >= '.INVOICE_STATUS_SENT.' THEN 1 ELSE 0 END) invoices_sent,
|
||||||
COUNT(DISTINCT clients.id) active_clients');
|
COUNT(DISTINCT clients.id) active_clients,
|
||||||
|
AVG(invoices.amount) as invoice_avg');
|
||||||
|
|
||||||
$metrics = DB::table('accounts')
|
$metrics = DB::table('accounts')
|
||||||
->select($select)
|
->select($select)
|
||||||
@ -19,27 +19,35 @@ class DashboardController extends \BaseController {
|
|||||||
->groupBy('accounts.id')
|
->groupBy('accounts.id')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$invoiceAvg = DB::table('invoices')
|
$select = DB::raw('SUM(clients.paid_to_date) value');
|
||||||
->where('invoices.account_id', '=', Auth::user()->account_id)
|
|
||||||
->where('invoices.deleted_at', '=', null)
|
$totalIncome = DB::table('accounts')
|
||||||
->avg('amount');
|
->select($select)
|
||||||
|
->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')
|
||||||
|
->where('accounts.id', '=', Auth::user()->account_id)
|
||||||
|
->where('clients.deleted_at', '=', null)
|
||||||
|
->groupBy('accounts.id')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
|
||||||
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
|
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
|
||||||
->orderBy('created_at', 'desc')->take(6)->get();
|
->orderBy('created_at', 'desc')->take(6)->get();
|
||||||
|
|
||||||
$pastDue = Invoice::scope()->where('due_date', '<', date('Y-m-d'))
|
$pastDue = Invoice::scope()
|
||||||
|
->where('due_date', '<', date('Y-m-d'))
|
||||||
|
->where('balance', '>', 0)
|
||||||
->orderBy('due_date', 'asc')->take(6)->get();
|
->orderBy('due_date', 'asc')->take(6)->get();
|
||||||
|
|
||||||
$upcoming = Invoice::scope()->where('due_date', '>', date('Y-m-d'))
|
$upcoming = Invoice::scope()
|
||||||
|
->where('due_date', '>', date('Y-m-d'))
|
||||||
|
->where('balance', '>', 0)
|
||||||
->orderBy('due_date', 'asc')->take(6)->get();
|
->orderBy('due_date', 'asc')->take(6)->get();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'totalIncome' => Utils::formatMoney($metrics->total_income, Session::get(SESSION_CURRENCY)),
|
'totalIncome' => Utils::formatMoney($totalIncome->value, Session::get(SESSION_CURRENCY)),
|
||||||
'billedClients' => $metrics->billed_clients,
|
'billedClients' => $metrics->billed_clients,
|
||||||
'invoicesSent' => $metrics->invoices_sent,
|
'invoicesSent' => $metrics->invoices_sent,
|
||||||
'activeClients' => $metrics->active_clients,
|
'activeClients' => $metrics->active_clients,
|
||||||
'invoiceAvg' => Utils::formatMoney($invoiceAvg, Session::get(SESSION_CURRENCY)),
|
'invoiceAvg' => Utils::formatMoney($metrics->invoice_avg, Session::get(SESSION_CURRENCY)),
|
||||||
'activities' => $activities,
|
'activities' => $activities,
|
||||||
'pastDue' => $pastDue,
|
'pastDue' => $pastDue,
|
||||||
'upcoming' => $upcoming
|
'upcoming' => $upcoming
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
||||||
{{ Former::text('amount') }}
|
{{ Former::text('amount') }}
|
||||||
{{ Former::text('credit_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
{{ Former::text('credit_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||||
{{-- Former::select('currency_id')->addOption('','')->label('Currency')
|
{{-- Former::select('currency_id')->addOption('','')->label('Currency')
|
||||||
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
|
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
|
||||||
{{ Former::textarea('private_notes') }}
|
{{ Former::textarea('private_notes') }}
|
||||||
|
@ -62,13 +62,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4" id="col_2">
|
<div class="col-md-4" id="col_2">
|
||||||
<div data-bind="visible: !is_recurring()">
|
<div data-bind="visible: !is_recurring()">
|
||||||
{{ Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
{{ Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")
|
||||||
{{ Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||||
|
{{ Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")
|
||||||
|
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="visible: is_recurring" style="display: none">
|
<div data-bind="visible: is_recurring" style="display: none">
|
||||||
{{ Former::select('frequency_id')->label('How often')->options($frequencies)->data_bind("value: frequency_id") }}
|
{{ Former::select('frequency_id')->label('How often')->options($frequencies)->data_bind("value: frequency_id") }}
|
||||||
{{ Former::text('start_date')->data_bind("datePicker: start_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
{{ Former::text('start_date')->data_bind("datePicker: start_date, valueUpdate: 'afterkeydown'")
|
||||||
{{ Former::text('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||||
|
{{ Former::text('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'")
|
||||||
|
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||||
</div>
|
</div>
|
||||||
@if ($invoice && $invoice->recurring_invoice_id)
|
@if ($invoice && $invoice->recurring_invoice_id)
|
||||||
<div class="pull-right" style="padding-top: 6px">
|
<div class="pull-right" style="padding-top: 6px">
|
||||||
@ -76,7 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<div data-bind="visible: invoice_status_id() < CONSTS.INVOICE_STATUS_SENT">
|
<div data-bind="visible: invoice_status_id() < CONSTS.INVOICE_STATUS_SENT">
|
||||||
{{ Former::checkbox('recurring')->text('Enable | <a href="#" onclick="showLearnMore()">Learn more</a>')->data_bind("checked: is_recurring")
|
{{ Former::checkbox('recurring')->text('Enable <a href="#" onclick="showLearnMore()"><i class="glyphicon glyphicon-question-sign"></i> Learn more</a>')->data_bind("checked: is_recurring")
|
||||||
->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
|
->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@ -92,7 +96,7 @@
|
|||||||
<div class="form-group" style="margin-bottom: 8px">
|
<div class="form-group" style="margin-bottom: 8px">
|
||||||
<label for="recurring" class="control-label col-lg-4 col-sm-4">Taxes</label>
|
<label for="recurring" class="control-label col-lg-4 col-sm-4">Taxes</label>
|
||||||
<div class="col-lg-8 col-sm-8" style="padding-top: 7px">
|
<div class="col-lg-8 col-sm-8" style="padding-top: 7px">
|
||||||
<a href="#" data-bind="click: $root.showTaxesForm">Manage rates</a>
|
<a href="#" data-bind="click: $root.showTaxesForm"><i class="glyphicon glyphicon-list-alt"></i> Manage rates</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -118,7 +122,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="sortable: { data: invoice_items, afterMove: onDragged }">
|
<tbody data-bind="sortable: { data: invoice_items, afterMove: onDragged }">
|
||||||
<tr data-bind="event: { mouseover: showActions, mouseout: hideActions }" class="sortable-row">
|
<tr data-bind="event: { mouseover: showActions, mouseout: hideActions }" class="sortable-row">
|
||||||
<td style="min-width:20px;" class="hide-border td-icon">
|
<td style="min-width:32px;" class="hide-border td-icon">
|
||||||
<i style="display:none" data-bind="visible: actionsVisible() && $parent.invoice_items().length > 1" class="fa fa-sort"></i>
|
<i style="display:none" data-bind="visible: actionsVisible() && $parent.invoice_items().length > 1" class="fa fa-sort"></i>
|
||||||
</td>
|
</td>
|
||||||
<td style="min-width:160px">
|
<td style="min-width:160px">
|
||||||
@ -137,10 +141,10 @@
|
|||||||
<td style="display:none" style="min-width:120px; vertical-align:middle" data-bind="visible: $root.invoice_item_taxes.show">
|
<td style="display:none" style="min-width:120px; vertical-align:middle" data-bind="visible: $root.invoice_item_taxes.show">
|
||||||
<select class="form-control" style="width:100%" data-bind="value: tax, options: $root.tax_rates, optionsText: 'displayName'"></select>
|
<select class="form-control" style="width:100%" data-bind="value: tax, options: $root.tax_rates, optionsText: 'displayName'"></select>
|
||||||
</td>
|
</td>
|
||||||
<td style="min-width:120px;text-align: right;padding-top:9px !important">
|
<td style="min-width:120px;text-align: right;padding-top:9px !important">
|
||||||
<span data-bind="text: totals.total"></span>
|
<div class="line-total" data-bind="text: totals.total"></div>
|
||||||
</td>
|
</td>
|
||||||
<td style="min-width:20px; cursor:pointer" class="hide-border td-icon">
|
<td style="min-width:32px; cursor:pointer" class="hide-border td-icon">
|
||||||
<i style="display:none" data-bind="click: $parent.removeItem, visible: actionsVisible() && $parent.invoice_items().length > 1" class="fa fa-minus-circle" title="Remove item"/>
|
<i style="display:none" data-bind="click: $parent.removeItem, visible: actionsVisible() && $parent.invoice_items().length > 1" class="fa fa-minus-circle" title="Remove item"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
{{ Former::text('amount') }}
|
{{ Former::text('amount') }}
|
||||||
{{ Former::select('payment_type_id')->addOption('','')->label('Payment type')
|
{{ Former::select('payment_type_id')->addOption('','')->label('Payment type')
|
||||||
->fromQuery($paymentTypes, 'name', 'id') }}
|
->fromQuery($paymentTypes, 'name', 'id') }}
|
||||||
{{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
{{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||||
{{-- Former::select('currency_id')->addOption('','')->label('Currency')
|
{{-- Former::select('currency_id')->addOption('','')->label('Currency')
|
||||||
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
|
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"intervention/image": "dev-master",
|
"intervention/image": "dev-master",
|
||||||
"webpatser/laravel-countries": "dev-master",
|
"webpatser/laravel-countries": "dev-master",
|
||||||
"anahkiasen/rocketeer": "dev-develop",
|
"anahkiasen/rocketeer": "dev-develop",
|
||||||
"codeception/codeception": "dev-master",
|
"codeception/codeception": "dev-master"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
|
@ -172,41 +172,24 @@ table.dataTable tr.even td.sorting_3 { background-color: white; }
|
|||||||
New/edit invoice page
|
New/edit invoice page
|
||||||
************************************************/
|
************************************************/
|
||||||
|
|
||||||
|
.invoice-table td.hide-border,
|
||||||
/*
|
.invoice-table th.hide-border {
|
||||||
table.invoice-table tbody tr:hover {
|
border-style: none !important;
|
||||||
background-color: #FFFFFF !important;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
.invoice-table td {
|
|
||||||
padding: 2px !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.invoice-table td input,
|
.invoice-table .line-total {
|
||||||
.invoice-table td textarea {
|
padding-top: 6px;
|
||||||
border: none !important;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.invoice-table th {
|
.invoice-table th {
|
||||||
border-top: 1px solid #ddd !important;
|
border-top: 1px solid #ddd !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invoice-table td.hide-border,
|
|
||||||
.invoice-table th.hide-border {
|
|
||||||
border-style: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.invoice-table td.td-icon {
|
.invoice-table td.td-icon {
|
||||||
vertical-align: middle !important;
|
vertical-align: middle !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invoice-table tfoot tr {
|
.fa-sort {
|
||||||
height: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fa-bars {
|
|
||||||
cursor: move !important;
|
cursor: move !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user