|
|
@@ -31,8 +31,35 @@ class StatController extends BaseController
|
|
|
$end = date("Y-m-d 23:59:59", strtotime($period['endTime']));
|
|
|
$where['entryTime'] = ['between', [$start, $end]];
|
|
|
}
|
|
|
- $cgList = PurchaseOrderClass::getAllByCondition($where, null, '*');
|
|
|
- util::success(['list' => $cgList]);
|
|
|
+ $cgList = PurchaseOrderClass::getAllByCondition($where, 'entryTime ASC', '*', null, true);
|
|
|
+ $packingCharge = 0;
|
|
|
+ $shortCharge = 0;
|
|
|
+ $longCharge = 0;
|
|
|
+ $pickCharge = 0;
|
|
|
+ $localCharge = 0;
|
|
|
+ if (!empty($cgList)) {
|
|
|
+ foreach ($cgList as $cg) {
|
|
|
+ $pack = $cg->packingCharge ?? 0;
|
|
|
+ $short = $cg->shortCharge ?? 0;
|
|
|
+ $long = $cg->longCharge ?? 0;
|
|
|
+ $pick = $cg->pickCharge ?? 0;
|
|
|
+ $local = $cg->localCharge ?? 0;
|
|
|
+ $packingCharge = bcadd($packingCharge, $pack, 2);
|
|
|
+ $shortCharge = bcadd($shortCharge, $short, 2);
|
|
|
+ $longCharge = bcadd($longCharge, $long, 2);
|
|
|
+ $pickCharge = bcadd($pickCharge, $pick, 2);
|
|
|
+ $localCharge = bcadd($localCharge, $local, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $total = [
|
|
|
+ 'packingCharge' => $packingCharge,
|
|
|
+ 'shortCharge' => $shortCharge,
|
|
|
+ 'longCharge' => $longCharge,
|
|
|
+ 'pickCharge' => $pickCharge,
|
|
|
+ 'localCharge' => $localCharge,
|
|
|
+ 'num' => count($cgList)
|
|
|
+ ];
|
|
|
+ util::success(['list' => $cgList, 'total' => $total]);
|
|
|
}
|
|
|
|
|
|
public function actionProfit()
|