diff --git a/app/Ninja/Datatables/RecurringInvoiceDatatable.php b/app/Ninja/Datatables/RecurringInvoiceDatatable.php index a4e976ef0a..341eff8017 100644 --- a/app/Ninja/Datatables/RecurringInvoiceDatatable.php +++ b/app/Ninja/Datatables/RecurringInvoiceDatatable.php @@ -3,6 +3,7 @@ namespace App\Ninja\Datatables; use Auth; +use Carbon; use URL; use Utils; use App\Models\Invoice; @@ -84,6 +85,8 @@ class RecurringInvoiceDatatable extends EntityDatatable if ($model->invoice_status_id == INVOICE_STATUS_SENT) { if (! $model->last_sent_date_sql || $model->last_sent_date_sql == '0000-00-00') { $label = trans('texts.pending'); + } elseif ($model->end_date_sql && Carbon::parse($model->end_date_sql)->isPast()) { + $label = trans('texts.status_completed'); } else { $label = trans('texts.active'); } diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index eb6bc962cd..41d10259c9 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -76,7 +76,7 @@ @if ($invoice->is_recurring && $invoice->isSent()) @if (! $invoice->last_sent_date || $invoice->last_sent_date == '0000-00-00') {!! $invoice->present()->statusLabel(trans('texts.pending')) !!} - @elseif ($invoice->end_date && Carbon::parse($invoice->end_date)->isPast()) + @elseif ($invoice->end_date && Carbon::parse(Utils::toSqlDate($invoice->end_date))->isPast()) {!! $invoice->present()->statusLabel(trans('texts.status_completed')) !!} @else {!! $invoice->present()->statusLabel(trans('texts.active')) !!}