diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php
index f07037142b22..2c9d38196155 100644
--- a/app/controllers/DashboardController.php
+++ b/app/controllers/DashboardController.php
@@ -5,10 +5,10 @@ class DashboardController extends \BaseController {
public function index()
{
// total_income, billed_clients, invoice_sent and active_clients
- $select = DB::raw('SUM(DISTINCT clients.paid_to_date) total_income,
- COUNT(DISTINCT CASE WHEN invoices.id IS NOT NULL THEN clients.id ELSE null END) billed_clients,
+ $select = DB::raw('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,
- COUNT(DISTINCT clients.id) active_clients');
+ COUNT(DISTINCT clients.id) active_clients,
+ AVG(invoices.amount) as invoice_avg');
$metrics = DB::table('accounts')
->select($select)
@@ -19,27 +19,35 @@ class DashboardController extends \BaseController {
->groupBy('accounts.id')
->first();
- $invoiceAvg = DB::table('invoices')
- ->where('invoices.account_id', '=', Auth::user()->account_id)
- ->where('invoices.deleted_at', '=', null)
- ->avg('amount');
+ $select = DB::raw('SUM(clients.paid_to_date) value');
+
+ $totalIncome = DB::table('accounts')
+ ->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)
->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();
- $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();
$data = [
- 'totalIncome' => Utils::formatMoney($metrics->total_income, Session::get(SESSION_CURRENCY)),
+ 'totalIncome' => Utils::formatMoney($totalIncome->value, Session::get(SESSION_CURRENCY)),
'billedClients' => $metrics->billed_clients,
'invoicesSent' => $metrics->invoices_sent,
'activeClients' => $metrics->active_clients,
- 'invoiceAvg' => Utils::formatMoney($invoiceAvg, Session::get(SESSION_CURRENCY)),
+ 'invoiceAvg' => Utils::formatMoney($metrics->invoice_avg, Session::get(SESSION_CURRENCY)),
'activities' => $activities,
'pastDue' => $pastDue,
'upcoming' => $upcoming
diff --git a/app/views/credits/edit.blade.php b/app/views/credits/edit.blade.php
index 938ddad253f7..b55a2038b191 100755
--- a/app/views/credits/edit.blade.php
+++ b/app/views/credits/edit.blade.php
@@ -18,7 +18,7 @@
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
{{ 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('') }}
{{-- Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
{{ Former::textarea('private_notes') }}
diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php
index af3e090458c1..dbc224c04f30 100755
--- a/app/views/invoices/edit.blade.php
+++ b/app/views/invoices/edit.blade.php
@@ -62,13 +62,17 @@
- {{ Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
- {{ Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
+ {{ Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")
+ ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
+ {{ Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")
+ ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
{{ 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('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
+ {{ Former::text('start_date')->data_bind("datePicker: start_date, valueUpdate: 'afterkeydown'")
+ ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
+ {{ Former::text('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'")
+ ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
@if ($invoice && $invoice->recurring_invoice_id)
@@ -76,7 +80,7 @@
@else
- {{ Former::checkbox('recurring')->text('Enable |
Learn more')->data_bind("checked: is_recurring")
+ {{ Former::checkbox('recurring')->text('Enable
Learn more')->data_bind("checked: is_recurring")
->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
@endif
@@ -92,7 +96,7 @@
@@ -118,7 +122,7 @@
-
+ |
|
@@ -137,10 +141,10 @@
|
|
-
-
+ |
+
|
-
+ |
|
diff --git a/app/views/payments/edit.blade.php b/app/views/payments/edit.blade.php
index 581640f76d5f..e8f446fed65e 100755
--- a/app/views/payments/edit.blade.php
+++ b/app/views/payments/edit.blade.php
@@ -22,7 +22,7 @@
{{ Former::text('amount') }}
{{ Former::select('payment_type_id')->addOption('','')->label('Payment type')
->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('') }}
{{-- Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
diff --git a/composer.json b/composer.json
index 45ea6213565d..3b02729eb5f1 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,7 @@
"intervention/image": "dev-master",
"webpatser/laravel-countries": "dev-master",
"anahkiasen/rocketeer": "dev-develop",
- "codeception/codeception": "dev-master",
+ "codeception/codeception": "dev-master"
},
"autoload": {
"classmap": [
diff --git a/public/css/style.css b/public/css/style.css
index 42a92554ce73..da3c7fe6d27a 100755
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -172,41 +172,24 @@ table.dataTable tr.even td.sorting_3 { background-color: white; }
New/edit invoice page
************************************************/
-
-/*
-table.invoice-table tbody tr:hover {
- background-color: #FFFFFF !important;
-}
-*/
-
-.invoice-table td {
- padding: 2px !important;
+.invoice-table td.hide-border,
+.invoice-table th.hide-border {
+ border-style: none !important;
}
-.invoice-table td input,
-.invoice-table td textarea {
- border: none !important;
- width: 100%;
+.invoice-table .line-total {
+ padding-top: 6px;
}
.invoice-table th {
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 {
vertical-align: middle !important;
}
-.invoice-table tfoot tr {
- height: 30px;
-}
-
-.fa-bars {
+.fa-sort {
cursor: move !important;
}