|
@@ -20,7 +20,6 @@ class GoodsSalesController
|
|
|
$classify = $request->get('classify', '');
|
|
|
$categoryId = $request->get('category_id', '');
|
|
|
$goodsName = $request->get('goods_name', '');
|
|
|
- $premisesId = $request->get('premises_id', '');
|
|
|
$payType = $request->get('pay_type', '');
|
|
|
if (!empty($days)) {
|
|
|
$days[0] = strtotime($days[0]);
|
|
@@ -28,16 +27,27 @@ class GoodsSalesController
|
|
|
}
|
|
|
$searchGoodsIds = [];
|
|
|
if (!empty($classify)) {
|
|
|
- $searchGoodsIds = Goods::where('goods_classify', $classify)->pluck('goods_id')->toArray();
|
|
|
- } elseif (!empty($categoryId)) {
|
|
|
+ if ($classify == 'SERVICE') {
|
|
|
+ $classify = ['SERVICE', 'CHNMED', 'CHNNCD'];
|
|
|
+ } else {
|
|
|
+ $classify = [$classify];
|
|
|
+ }
|
|
|
+ $searchGoodsIds = Goods::whereIn('goods_classify', $classify)->pluck('goods_id')->toArray();
|
|
|
+ }
|
|
|
+ if (!empty($categoryId)) {
|
|
|
$categorySuperPath = SysCategory::where('category_id', $categoryId)->value('category_super_path');
|
|
|
- $searchCategoryIds = [];
|
|
|
- if (!empty($category)) {
|
|
|
- $searchCategoryIds = SysCategory::where('category_super_path', 'like', $categorySuperPath . '%')->pluck('category_id')->toArray();
|
|
|
+ if (empty($categorySuperPath)) {
|
|
|
+ $categorySuperPath = '#' . $categoryId . '#';
|
|
|
}
|
|
|
+ $searchCategoryIds = SysCategory::where('category_super_path', 'like', $categorySuperPath . '%')->pluck('category_id')->toArray();
|
|
|
$searchCategoryIds[] = $categoryId;
|
|
|
+ // 按产品分类筛出来的ID
|
|
|
+ $oldSearchGoodsIds = $searchGoodsIds;
|
|
|
|
|
|
$searchGoodsIds = Goods::whereIn('join_goods_category_id', $searchCategoryIds)->pluck('goods_id')->toArray();
|
|
|
+ if (!empty($oldSearchGoodsIds)){
|
|
|
+ $searchGoodsIds = array_intersect($searchGoodsIds,$oldSearchGoodsIds);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$dataInOuts = DataInout::where('data_inout_status', 'VALID')
|
|
@@ -56,18 +66,18 @@ class GoodsSalesController
|
|
|
$statistics = [
|
|
|
'total' => 0,
|
|
|
'amount' => 0,
|
|
|
- 'goods'=>['total' => 0,'amount' => 0],
|
|
|
- 'service'=>['total' => 0,'amount' => 0],
|
|
|
- 'chnmed'=>['total' => 0,'amount' => 0],
|
|
|
- 'chnncd'=>['total' => 0,'amount' => 0],
|
|
|
- 'package'=>['total' => 0,'amount' => 0],
|
|
|
- 'meals'=>['total' => 0,'amount' => 0],
|
|
|
- 'dishes'=>['total' => 0,'amount' => 0],
|
|
|
- 'vip'=>['total' => 0,'amount' => 0],
|
|
|
- 'recharge'=>['total' => 0,'amount' => 0],
|
|
|
- 'combine'=>['total' => 0,'amount' => 0],
|
|
|
- 'partner'=>['total' => 0,'amount' => 0],
|
|
|
- 'referrer'=>['total' => 0,'amount' => 0],
|
|
|
+ 'goods' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'service' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'chnmed' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'chnncd' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'package' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'meals' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'dishes' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'vip' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'recharge' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'combine' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'partner' => ['total' => 0, 'amount' => 0],
|
|
|
+ 'referrer' => ['total' => 0, 'amount' => 0],
|
|
|
];
|
|
|
foreach ($dataInOuts as $dataInOut) {
|
|
|
if (empty($dataInOut['join_data_inout_object_json'])) {
|
|
@@ -100,12 +110,12 @@ class GoodsSalesController
|
|
|
$goods[$goodKey]['order_sheet_pay'] += $good['order_sheet_pay'];
|
|
|
}
|
|
|
|
|
|
- $statistics['total'] = round($good['order_sheet_num'] + $statistics['total'],2);
|
|
|
- $statistics['amount'] = round($good['order_sheet_pay'] + $statistics['amount'],2);
|
|
|
+ $statistics['total'] = round($good['order_sheet_num'] + $statistics['total'], 2);
|
|
|
+ $statistics['amount'] = round($good['order_sheet_pay'] + $statistics['amount'], 2);
|
|
|
|
|
|
$orderClassify = strtolower($order['classify']);
|
|
|
- $statistics[$orderClassify]['total'] = $good['order_sheet_num'] + $statistics[$orderClassify]['total'];
|
|
|
- $statistics[$orderClassify]['amount'] = $good['order_sheet_pay'] + $statistics[$orderClassify]['amount'];
|
|
|
+ $statistics[$orderClassify]['total'] = round($good['order_sheet_num'] + $statistics[$orderClassify]['total'], 2);
|
|
|
+ $statistics[$orderClassify]['amount'] = round($good['order_sheet_pay'] + $statistics[$orderClassify]['amount'], 2);
|
|
|
}
|
|
|
}
|
|
|
}
|