Add cost/price/supplierid to service, update service report to show supplerid and overridden costs (if any)
This commit is contained in:
@@ -955,13 +955,14 @@ class Service extends Model implements IDs
|
||||
|
||||
/**
|
||||
* The amount we are charged for the client to have this service
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function billing_cost(): float
|
||||
{
|
||||
return is_null($this->cost)
|
||||
? $this->product->getBaseCostAttribute()
|
||||
: $this->cost;
|
||||
: $this->cost*Invoice::billing_change($this->product->type->billing_interval,$this->product->billing_interval);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1127,7 +1128,7 @@ class Service extends Model implements IDs
|
||||
|
||||
public function isContract(): bool
|
||||
{
|
||||
return $this->getContractEndAttribute()->greaterThan(Carbon::now());
|
||||
return $this->getContractEndAttribute() && $this->getContractEndAttribute()->greaterThan(Carbon::now());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -57,16 +57,6 @@ class Broadband extends Type implements ServiceUsage
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
/**
|
||||
* @deprecated use $o->service_name;
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getNameAttribute()
|
||||
{
|
||||
abort(500,'deprecated - use $o->service_name');
|
||||
return $this->service_number ?: $this->service_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of technology used to provide this Internet Service
|
||||
*
|
||||
@@ -104,15 +94,14 @@ class Broadband extends Type implements ServiceUsage
|
||||
/* METHODS */
|
||||
|
||||
/**
|
||||
* Return the suppliers offering that this service is providing
|
||||
* Return the supplier's offering that this service is providing
|
||||
*
|
||||
* @return SupplierType
|
||||
* @todo This column provided_adsl_plan_id should either be deprecated or renamed.
|
||||
*/
|
||||
public function supplied(): SupplierType
|
||||
{
|
||||
return $this->provided_adsl_plan_id
|
||||
? SupplierBroadband::findOrFail($this->provided_adsl_plan_id)
|
||||
return $this->provided_supplier_broadband_id
|
||||
? SupplierBroadband::findOrFail($this->provided_supplier_broadband_id)
|
||||
: $this->service->offering->supplied;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user