Deprecate price_overriden
This commit is contained in:
parent
a32e8e9d05
commit
fe4bc3acef
@ -442,9 +442,7 @@ class ServiceController extends Controller
|
||||
|
||||
$o->suspend_billing = ($request->suspend_billing == 'on');
|
||||
$o->external_billing = ($request->external_billing == 'on');
|
||||
// @todo Cant have both price and price_override - show an exception. (price_override shows a discount, whereas price shows the price)
|
||||
$o->price = $request->price ?: NULL;
|
||||
$o->price_override = $request->price_override ?: NULL;
|
||||
|
||||
// Also update our service start_at date.
|
||||
// @todo We may want to make start_at/stop_at dynamic values calculated by the type records
|
||||
|
@ -41,7 +41,6 @@ use App\Traits\SiteID;
|
||||
* + billed_to : When this service has been billed to // @todo rename all references to invoice_to
|
||||
* + category : The type of service this is, eg: broadband, phone
|
||||
* + category_name : The type of service this is, eg: Broadband, Telephone (in human friendly)
|
||||
* + isChargedOverride : Has the price been overridden?
|
||||
* + contract_term : The term that this service must be active
|
||||
* + contract_end : The date that the contract ends for this service
|
||||
* + name : Service short name with service address
|
||||
@ -51,10 +50,13 @@ use App\Traits\SiteID;
|
||||
* + sid : System ID for service
|
||||
* + supplied : The model of the supplier's product used for this service.
|
||||
*
|
||||
* Methods:
|
||||
* + isChargeOverriden : Has the price been overridden?
|
||||
* + isPending : Is this a pending active service
|
||||
*
|
||||
* @package App\Models
|
||||
* @todo "Billing Start Date" = "connection date" for sub types??
|
||||
* @todo Add min_charge
|
||||
* @todo deprecate price_override, and if price < what would be billed, show it striked through, otherwise show it as if it was the price
|
||||
* @todo Add charge_orig : The original chargeable price
|
||||
*/
|
||||
class Service extends Model implements IDs
|
||||
{
|
||||
@ -1216,6 +1218,15 @@ class Service extends Model implements IDs
|
||||
return ! ($this->external_billing || $this->suspend_billing || ($this->price === 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the price for this service been override
|
||||
* @return bool
|
||||
*/
|
||||
public function isChargeOverriden(): bool
|
||||
{
|
||||
return ! is_null($this->price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should this service be invoiced soon
|
||||
*
|
||||
@ -1239,11 +1250,6 @@ class Service extends Model implements IDs
|
||||
AND ! in_array($this->order_status,array_merge(self::INACTIVE_STATUS,['INACTIVE']));
|
||||
}
|
||||
|
||||
public function isChargeOverriden(): bool
|
||||
{
|
||||
return (! is_null($this->price)) || (! is_null($this->price_override));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a collection of invoice_item objects that will be billed for the next invoice
|
||||
*
|
||||
@ -1299,7 +1305,7 @@ class Service extends Model implements IDs
|
||||
$o->product_id = $this->product_id;
|
||||
$o->item_type = 0;
|
||||
$o->price_base = is_null($this->price)
|
||||
? (is_null($this->price_override) ? $this->product->getBaseChargeAttribute($this->recur_schedule,$this->account->group) : $this->price_override)
|
||||
? (is_null($this->price) ? $this->product->getBaseChargeAttribute($this->recur_schedule,$this->account->group) : $this->price)
|
||||
: $this->price; // @todo change to a method in this class
|
||||
$o->recur_schedule = $this->recur_schedule;
|
||||
$o->start_at = $this->invoice_next;
|
||||
|
@ -52,7 +52,6 @@ class ServiceFactory extends Factory
|
||||
'suspend_billing' => FALSE,
|
||||
'external_billing' => FALSE,
|
||||
'price' => 100,
|
||||
// 'price_override',
|
||||
// 'taxable',
|
||||
// 'queue',
|
||||
'invoice_last_at' => Carbon::createFromFormat('Y-m-d','2021-01-01'),
|
||||
|
@ -121,7 +121,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control @error('broadband.price_override') is-invalid @enderror" id="price" name="broadband[price]" value="{{ $o->price }}">
|
||||
<input type="text" class="form-control @error('broadband.price') is-invalid @enderror" id="price" name="broadband[price]" value="{{ $o->price }}">
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('broadband.price')
|
||||
{{ $message }}
|
||||
|
@ -45,6 +45,14 @@
|
||||
<th>Billed</th>
|
||||
<td>{{ $o->billing_interval_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Amount</th>
|
||||
@if($o->isChargeOverriden())
|
||||
<td>@if ($o->billing_charge < $o->charge_orig)<del>${{ number_format($o->charge_orig,2) }}</del> @endif${{ number_format($o->billing_charge,2) }}</td>
|
||||
@else
|
||||
<td>${{ number_format($o->billing_charge,2) }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
@if($o->active AND $o->invoice_to)
|
||||
<tr>
|
||||
<th>Invoiced To</th>
|
||||
|
@ -68,18 +68,6 @@
|
||||
'value'=>$o->recur_schedule ?? '',
|
||||
])
|
||||
</div>
|
||||
|
||||
<!-- Price Override -->
|
||||
<div class="col-12 col-sm-9 col-md-12 col-xl-3">
|
||||
@include('adminlte::widget.form_text',[
|
||||
'label'=>'Override Price',
|
||||
'icon'=>'fas fa-dollar-sign',
|
||||
'id'=>'price_override',
|
||||
'old'=>'price_override',
|
||||
'name'=>'price_override',
|
||||
'value'=>$o->price_override ?? '',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
Loading…
Reference in New Issue
Block a user