Fix rendering internal cost/revenue when in contract but not yet invoiced
This commit is contained in:
parent
3cd1f2e34a
commit
3ae588041f
@ -944,6 +944,9 @@ class Service extends Model implements IDs
|
|||||||
{
|
{
|
||||||
$max = max($date,$this->getCancelDateAttribute())->clone();
|
$max = max($date,$this->getCancelDateAttribute())->clone();
|
||||||
|
|
||||||
|
if (! $this->getPaidToAttribute())
|
||||||
|
return $this->account->taxed($this->getContractTermAttribute()*$this->getBillingChargeNormalisedAttribute());
|
||||||
|
|
||||||
if ($this->getPaidToAttribute()->lessThan($max)) {
|
if ($this->getPaidToAttribute()->lessThan($max)) {
|
||||||
$d = $this->getPaidToAttribute()->diffInDays($max);
|
$d = $this->getPaidToAttribute()->diffInDays($max);
|
||||||
|
|
||||||
@ -981,6 +984,9 @@ class Service extends Model implements IDs
|
|||||||
{
|
{
|
||||||
$max = max($date,$this->getCancelDateAttribute())->clone();
|
$max = max($date,$this->getCancelDateAttribute())->clone();
|
||||||
|
|
||||||
|
if (! $this->getInvoicedToAttribute())
|
||||||
|
return $this->account->taxed($this->getContractTermAttribute()*$this->getBillingChargeNormalisedAttribute());
|
||||||
|
|
||||||
if ($this->getInvoicedToAttribute()->lessThan($max)) {
|
if ($this->getInvoicedToAttribute()->lessThan($max)) {
|
||||||
$d = $this->getInvoicedToAttribute()->diffInDays($max);
|
$d = $this->getInvoicedToAttribute()->diffInDays($max);
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Contract Left</th>
|
<th>Contract Left</th>
|
||||||
@if($o->isContract())
|
@if($o->isContract())
|
||||||
<td>${{ number_format($o->billing_charge_to($o->contract_end),2) }} (<small>{{ $o->paid_to->format('Y-m-d') }}</small>)</td>
|
<td>${{ number_format($o->billing_charge_to($o->contract_end),2) }} (<small>{{ $o->paid_to?->format('Y-m-d') }}</small>)</td>
|
||||||
<td>${{ number_format($o->billing_cost_to($o->contract_end),2) }} (<small>{{ $o->invoiced_to->format('Y-m-d') }}</small>)</td>
|
<td>${{ number_format($o->billing_cost_to($o->contract_end),2) }} (<small>{{ $o->invoiced_to?->format('Y-m-d') }}</small>)</td>
|
||||||
<td>{{ $o->contract_end->format('Y-m-d') }}<br><small>({{ $o->contract_end->diffForHumans(now(),CarbonInterface::DIFF_RELATIVE_TO_OTHER,FALSE,2) }} today)</small></td>
|
<td>{{ $o->contract_end->format('Y-m-d') }}<br><small>({{ $o->contract_end->diffForHumans(now(),CarbonInterface::DIFF_RELATIVE_TO_OTHER,FALSE,2) }} today)</small></td>
|
||||||
|
|
||||||
@else
|
@else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user