|
|
@@ -30,29 +30,31 @@ class StatKindController extends BaseController
|
|
|
|
|
|
$mainId = $this->mainId;
|
|
|
|
|
|
- $list = KindClass::getAllByCondition(['mainId' => $mainId, 'flower' => 1, 'delStatus' => 0, 'status' => 1], null, '*', 'id');
|
|
|
+ $kindList = KindClass::getAllByCondition(['mainId' => $mainId, 'flower' => 1, 'delStatus' => 0, 'status' => 1], null, '*', 'id');
|
|
|
+
|
|
|
+ $arr = [];
|
|
|
|
|
|
$where = ['mainId' => $mainId, 'status' => 1];
|
|
|
$where['finishTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
$workList = WorkClass::getAllByCondition($where, null, '*', null, true);
|
|
|
if (!empty($workList)) {
|
|
|
foreach ($workList as $work) {
|
|
|
- $workSn = $work->workSn ?? '';
|
|
|
+ $kindId = $work->kindId ?? 0;
|
|
|
+ if (empty($kindId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $kindName = $kindList[$kindId]['name'] ?? '';
|
|
|
+ $num = $work->num ?? 0;
|
|
|
+ if (isset($arr[$kindId]['makeNum'])) {
|
|
|
+ $arr[$kindId]['makeNum'] = bcadd($arr[$kindId]['makeNum'], $num);
|
|
|
+ } else {
|
|
|
+ $arr[$kindId]['makeNum'] = $num;
|
|
|
+ $arr[$kindId]['name'] = $kindName;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- $contain = $get['contain'] ?? 0;
|
|
|
- $incomeList = \bizGhs\stat\classes\StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
|
|
|
- $totalIncome = 0;
|
|
|
- if (!empty($incomeList)) {
|
|
|
- foreach ($incomeList as $item) {
|
|
|
- $amount = $item['amount'] ?? 0;
|
|
|
- $totalIncome = bcadd($totalIncome, $amount, 2);
|
|
|
- $totalIncome = floatval($totalIncome);
|
|
|
- }
|
|
|
- }
|
|
|
- util::success(['list' => $incomeList, 'totalIncome' => $totalIncome]);
|
|
|
+ //util::success(['list' => $incomeList, 'totalIncome' => $totalIncome]);
|
|
|
}
|
|
|
|
|
|
}
|