Add cost/price/supplierid to service, update service report to show supplerid and overridden costs (if any)

This commit is contained in:
2025-05-16 20:36:27 +10:00
parent 8d72c1ceb5
commit b33c052995
8 changed files with 78 additions and 43 deletions

View File

@@ -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());
}
/**