|
|
@@ -50,22 +50,8 @@ class GhsClass extends BaseClass
|
|
|
if (empty($mainId)) {
|
|
|
return '0.00';
|
|
|
}
|
|
|
- $rows = self::getAllByCondition(
|
|
|
- ['ownMainId' => $mainId, 'delStatus' => $delStatus],
|
|
|
- null,
|
|
|
- 'balance,debtAmount,balanceMerged',
|
|
|
- null,
|
|
|
- true
|
|
|
- );
|
|
|
- if (empty($rows)) {
|
|
|
- return '0.00';
|
|
|
- }
|
|
|
- $total = '0.00';
|
|
|
- foreach ($rows as $row) {
|
|
|
- $attrs = is_array($row) ? $row : $row->getAttributes();
|
|
|
- $total = bcadd($total, AccountMoneyClass::getOutstandingDebt($attrs), 2);
|
|
|
- }
|
|
|
- return $total;
|
|
|
+ $sum = self::sum(['ownMainId' => $mainId, 'delStatus' => $delStatus], 'balance');
|
|
|
+ return bcadd($sum ?: '0', '0', 2);
|
|
|
}
|
|
|
|
|
|
|