|
|
@@ -22,6 +22,32 @@ class GhsClass extends BaseClass
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批发店采购:按 xhGhs 净 balance 汇总总待结(balance<0 部分之和,合并后模型)
|
|
|
+ */
|
|
|
+ public static function sumTotalOutstandingDebt($mainId, $delStatus = 0)
|
|
|
+ {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public static function groupBaseInfo($list)
|
|
|
{
|