1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
This commit is contained in:
Hillel Coren 2016-07-03 12:33:35 +03:00
parent 6dc0f93534
commit 32a2f6cdc7
4 changed files with 21 additions and 9 deletions

View File

@ -75,7 +75,7 @@ class ExpenseDatatable extends EntityDatatable
[
'expense_status_id',
function ($model) {
return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced);
return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced, $model->balance);
}
],
];
@ -115,11 +115,16 @@ class ExpenseDatatable extends EntityDatatable
}
private function getStatusLabel($invoiceId, $shouldBeInvoiced)
private function getStatusLabel($invoiceId, $shouldBeInvoiced, $balance)
{
if ($invoiceId) {
$label = trans('texts.invoiced');
$class = 'success';
if (floatval($balance)) {
$label = trans('texts.invoiced');
$class = 'default';
} else {
$label = trans('texts.paid');
$class = 'success';
}
} elseif ($shouldBeInvoiced) {
$label = trans('texts.pending');
$class = 'warning';

View File

@ -96,13 +96,18 @@ class TaskDatatable extends EntityDatatable
private function getStatusLabel($model)
{
if ($model->invoice_number) {
$class = 'success';
$label = trans('texts.invoiced');
if (floatval($model->balance)) {
$label = trans('texts.invoiced');
$class = 'default';
} else {
$class = 'success';
$label = trans('texts.paid');
}
} elseif ($model->is_running) {
$class = 'primary';
$label = trans('texts.running');
} else {
$class = 'default';
$class = 'warning';
$label = trans('texts.logged');
}

View File

@ -79,6 +79,7 @@ class ExpenseRepository extends BaseRepository
'expenses.user_id',
'invoices.public_id as invoice_public_id',
'invoices.user_id as invoice_user_id',
'invoices.balance',
'vendors.name as vendor_name',
'vendors.public_id as vendor_public_id',
'vendors.user_id as vendor_user_id',
@ -158,7 +159,7 @@ class ExpenseRepository extends BaseRepository
}
}
}
// prevent loading all of the documents if we don't have to
if ( ! $expense->wasRecentlyCreated) {
foreach ($expense->documents as $document){

View File

@ -38,6 +38,7 @@ class TaskRepository
'invoices.invoice_number',
'invoices.public_id as invoice_public_id',
'invoices.user_id as invoice_user_id',
'invoices.balance',
'tasks.is_running',
'tasks.time_log',
'tasks.created_at',
@ -89,7 +90,7 @@ class TaskRepository
} else {
$timeLog = [];
}
array_multisort($timeLog);
if (isset($data['action'])) {