Work on product costing (broadband) and reporting

This commit is contained in:
Deon George
2020-02-18 22:35:20 +11:00
parent f8d998d935
commit 910edfd89f
19 changed files with 762 additions and 45 deletions

View File

@@ -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
*