Fix some missing date_* attributes for Service that have been missed
This commit is contained in:
@@ -36,6 +36,28 @@ class Payment extends Model implements IDs
|
||||
// Any balance below this we'll assume its all used.
|
||||
private const threshold = 0.05;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
/**
|
||||
* Payment Local ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLIDattribute(): string
|
||||
{
|
||||
return sprintf('%06s',$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment System ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSIDAttribute(): string
|
||||
{
|
||||
return sprintf('%02s-%04s#%s',$this->site_id,$this->account_id,$this->getLIDattribute());
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function account()
|
||||
@@ -81,6 +103,11 @@ class Payment extends Model implements IDs
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
/**
|
||||
* Work out the remaining amount from this payment that has not been allocated.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getBalanceAttribute(): float
|
||||
{
|
||||
$balance = $this->getTotalAttribute()-$this->items->sum('amount');
|
||||
@@ -89,25 +116,11 @@ class Payment extends Model implements IDs
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment Local ID
|
||||
* The total of the payment.
|
||||
*
|
||||
* @return string
|
||||
* @return float
|
||||
* @todo Change the DB column to total
|
||||
*/
|
||||
public function getLIDattribute(): string
|
||||
{
|
||||
return sprintf('%06s',$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment System ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSIDAttribute(): string
|
||||
{
|
||||
return sprintf('%02s-%04s#%s',$this->site_id,$this->account_id,$this->getLIDattribute());
|
||||
}
|
||||
|
||||
public function getTotalAttribute(): float
|
||||
{
|
||||
return sprintf('%3.2f',$this->total_amt);
|
||||
|
Reference in New Issue
Block a user