diff --git a/app/Models/Service.php b/app/Models/Service.php index 6e25e4a..0acec54 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -307,6 +307,7 @@ class Service extends Model * Product of the service * * @return BelongsTo + * @deprecated use type->product */ public function product() { @@ -519,8 +520,17 @@ class Service extends Model break; // Two Yearly - // NOTE: price_recurr_strict ignored - case 5: $date = $this->getInvoiceNextAttribute()->addYear(2)->subDay(); break; + case 5: + if (!$this->product->price_recurr_strict) + $date = $this->getInvoiceNextAttribute()->addYear(2)->subDay(); + else { + $date = $this->getInvoiceNextAttribute()->addYear(2)->subDay()->endOfYear(); + + if ($date->clone()->addDay()->year % 2) { + $date = $date->subYear(); + } + } + break; // Three Yearly // NOTE: price_recurr_strict ignored @@ -1301,4 +1311,4 @@ class Service extends Model { return in_array($this->order_status,$this->inactive_status); } -} \ No newline at end of file +} diff --git a/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php b/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php index fdd0e3c..abfb36a 100644 --- a/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php +++ b/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php @@ -72,7 +72,8 @@ @elseif($o->wasCancelled()) Cancelled - {!! $o->date_end ? $o->date_end->format('Y-m-d') : $o->paid_to->format('Y-m-d').'*' !!} + + {!! $o->date_end ? $o->date_end->format('Y-m-d') : ($o->paid_to ? $o->paid_to->format('Y-m-d') : '').'*' !!} @endif @@ -83,4 +84,4 @@ *NOTE: Estimated Invoice does not include any setup, connection nor all current billing cycle usage charges. @endif - \ No newline at end of file +