Fix rendering internal cost/revenue when in contract but not yet invoiced
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 41s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2025-05-18 23:38:48 +10:00
parent 3cd1f2e34a
commit 3ae588041f
2 changed files with 8 additions and 2 deletions

View File

@ -944,6 +944,9 @@ class Service extends Model implements IDs
{
$max = max($date,$this->getCancelDateAttribute())->clone();
if (! $this->getPaidToAttribute())
return $this->account->taxed($this->getContractTermAttribute()*$this->getBillingChargeNormalisedAttribute());
if ($this->getPaidToAttribute()->lessThan($max)) {
$d = $this->getPaidToAttribute()->diffInDays($max);
@ -981,6 +984,9 @@ class Service extends Model implements IDs
{
$max = max($date,$this->getCancelDateAttribute())->clone();
if (! $this->getInvoicedToAttribute())
return $this->account->taxed($this->getContractTermAttribute()*$this->getBillingChargeNormalisedAttribute());
if ($this->getInvoicedToAttribute()->lessThan($max)) {
$d = $this->getInvoicedToAttribute()->diffInDays($max);

View File

@ -130,8 +130,8 @@
<tr>
<th>Contract Left</th>
@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_cost_to($o->contract_end),2) }} (<small>{{ $o->invoiced_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>{{ $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