|
|
@@ -570,7 +570,6 @@ class PurchaseOrderController extends BaseController
|
|
|
}
|
|
|
|
|
|
$ghsList = GhsClass::getAllByCondition(['ownShopId' => $this->shopId], null, 'id,name', 'id');
|
|
|
-print_r($ghsList);die;
|
|
|
$currentStartDate = date('Y-m-d', strtotime($start));
|
|
|
$currentEndDate = date('Y-m-d', strtotime($end));
|
|
|
$currentStartTime = $currentStartDate . ' 00:00:00';
|
|
|
@@ -579,7 +578,22 @@ print_r($ghsList);die;
|
|
|
$cgWhere = ['mainId' => $mainId, 'status' => 4];
|
|
|
$cgWhere['entryTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
$cgList = PurchaseOrderClass::getAllByCondition($cgWhere, null, '*');
|
|
|
-
|
|
|
+ $list = [];
|
|
|
+ if (!empty($cgList)) {
|
|
|
+ foreach ($cgList as $cgInfo) {
|
|
|
+ $actPrice = $cgInfo['actPrice'] ?? 0;
|
|
|
+ $ghsId = $cgInfo['ghsId'] ?? 0;
|
|
|
+ if (isset($list[$ghsId])) {
|
|
|
+ $list[$ghsId]['amount'] = bcadd($list[$ghsId]['amount'], $actPrice, 2);
|
|
|
+ $list[$ghsId]['num'] = bcadd($list[$ghsId]['num'], 1);
|
|
|
+ } else {
|
|
|
+ $name = $ghsList[$ghsId] && $ghsList[$ghsId]['name'] ? $ghsList[$ghsId]['name'] : '未命名';
|
|
|
+ $list[$ghsId] = ['name' => $name, 'amount' => $actPrice, 'num' => 1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list = array_values($list);
|
|
|
+ }
|
|
|
+ print_r($list);
|
|
|
}
|
|
|
|
|
|
}
|