Work on product costing (broadband) and reporting
This commit is contained in:
@@ -301,6 +301,22 @@ class Service extends Model
|
||||
return $this->addTax(is_null($this->price) ? $this->product->price($this->recur_schedule) : $this->price);
|
||||
}
|
||||
|
||||
public function getBillingMonthlyPriceAttribute(): float
|
||||
{
|
||||
$d = 0;
|
||||
switch ($this->recur_schedule) {
|
||||
case 0: $d = 12/52; break;
|
||||
case 1: $d = 1; break;
|
||||
case 2: $d = 3; break;
|
||||
case 3: $d = 6; break;
|
||||
case 4: $d = 12; break;
|
||||
case 5: $d = 24; break;
|
||||
case 6: $d = 36; break;
|
||||
}
|
||||
|
||||
return number_format($this->getBillingPriceAttribute()/$d,2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the service billing period
|
||||
*
|
||||
|
Reference in New Issue
Block a user