Ver Código Fonte

库存成本修改冻结库存逻辑

shensong 5 anos atrás
pai
commit
877e0a51ea

+ 6 - 1
app/Console/Commands/SyncMjWarehouse.php

@@ -64,7 +64,12 @@ class SyncMjWarehouse extends Command {
64 64
             if($cost){
65 65
                 $quantity = $cost->is_weigh == 1 ? $sku['quantity']/2 : $sku['quantity']; //对应规格数量
66 66
                 //实际库存=库存-冻结
67
-                $real_quantity = $sku['quantity'] - $sku['fi'];
67
+                if(isset($sku['fi']) && ($sku['fi'] < 0)){
68
+                    $real_quantity = $sku['quantity'];
69
+                } else {
70
+                    $real_quantity = $sku['quantity'] - $sku['fi'];
71
+                }
72
+
68 73
                 $real_quantity = $cost->is_weigh == 1 ? $real_quantity/2 : $real_quantity; //对应规格数量
69 74
                 $up['quantity'] = $quantity;
70 75
                 $up['totalCost'] = isset($sku['totalCost']) ? $sku['totalCost'] : 0;

+ 22 - 8
app/Http/Controllers/Admin/CustomerDepositController.php

@@ -956,11 +956,11 @@ class CustomerDepositController extends Controller
956 956
             $page = 1;
957 957
         }
958 958
         $offset = ($page-1) * $pageSize;
959
-        $count = CustomerVip::select(DB::raw('sum(`price`) as total_price,count(1) as number'),'team_id','pay_date')
959
+        $count = CustomerVip::select(DB::raw('sum(`price`) as total_price,count(1) as number'),'team_id','pay_date','payment_type')
960 960
             ->where(function($query) use($date,$team_id){
961 961
                 if($date) $query->where('pay_date',$date);
962 962
                 if($team_id != 0) $query->where('team_id',$team_id);
963
-            })->where('is_del',0)->groupBy('pay_date','team_id')->get();
963
+            })->where('is_del',0)->groupBy('pay_date','team_id','payment_type')->get();
964 964
         $count = count($count);
965 965
         if ($count > 1) {
966 966
             // 总页数
@@ -969,17 +969,24 @@ class CustomerDepositController extends Controller
969 969
             // 总页数
970 970
             $pages = 1;
971 971
         }
972
-        $list = CustomerVip::select(DB::raw('sum(`price`) as total_price,count(1) as number'),'team_id','pay_date')
972
+        $list = CustomerVip::select(DB::raw('sum(`price`) as total_price,count(1) as number'),'team_id','pay_date','payment_type')
973 973
             ->where(function($query) use($date,$team_id){
974 974
                 if($date) $query->where('pay_date',$date);
975 975
                 if($team_id) $query->where('team_id',$team_id);
976
-            })->where('is_del',0)->groupBy('pay_date','team_id')->orderBy('pay_date','desc')->offset($offset)->limit($pageSize)->get();
976
+            })->where('is_del',0)->groupBy('pay_date','team_id','payment_type')->orderBy('pay_date','desc')->offset($offset)->limit($pageSize)->get();
977 977
         $result = json_decode(json_encode($list),true);
978 978
 
979 979
         $result = array_map(function($value){
980 980
             $item = $value;
981 981
             $team = DB::table('teams')->where('id',$item['team_id'])->first();
982 982
             $item['team_name'] = $team->name;
983
+            if($item['payment_type'] == 1){
984
+                $item['payment'] = '微信支付';
985
+            } else if($item['payment_type'] == 3){
986
+                $item['payment'] = '个体户支付';
987
+            } else {
988
+                $item['payment'] = '';
989
+            }
983 990
             return $item;
984 991
         },$result);
985 992
 
@@ -1007,22 +1014,29 @@ class CustomerDepositController extends Controller
1007 1014
     public function membershipReportExport(Request $request){
1008 1015
         $date = $request->input('date');
1009 1016
         $team_id = $request->input('team_id');
1010
-        $list = CustomerVip::select(DB::raw('sum(`price`) as total_price,count(1) as number'),'team_id','pay_date')
1017
+        $list = CustomerVip::select(DB::raw('sum(`price`) as total_price,count(1) as number'),'team_id','pay_date','payment_type')
1011 1018
             ->where(function($query) use($date,$team_id){
1012 1019
                 if($date) $query->where('pay_date',$date);
1013 1020
                 if($team_id) $query->where('team_id',$team_id);
1014
-            })->where('is_del',0)->groupBy('pay_date','team_id')->orderBy('pay_date','desc')->get();
1021
+            })->where('is_del',0)->groupBy('pay_date','team_id','payment_type')->orderBy('pay_date','desc')->get();
1015 1022
         $list = json_decode(json_encode($list),true);
1016 1023
 
1017 1024
         $result = array_map(function($value){
1018 1025
             $item = $value;
1019 1026
             $team = DB::table('teams')->where('id',$item['team_id'])->first();
1020 1027
             $item['team_name'] = $team->name;
1028
+            if($item['payment_type'] == 1){
1029
+                $item['payment'] = '微信支付';
1030
+            } else if($item['payment_type'] == 3){
1031
+                $item['payment'] = '个体户支付';
1032
+            } else {
1033
+                $item['payment'] = '';
1034
+            }
1021 1035
             return $item;
1022 1036
         },$list);
1023 1037
 
1024
-        $indexKey = ['pay_date','team_name','number','total_price'];
1025
-        $title = ['日期', '团队', '新增会员数', '充值金额'];
1038
+        $indexKey = ['pay_date','team_name','number','total_price','payment'];
1039
+        $title = ['日期', '团队', '新增会员数', '充值金额','充值方式'];
1026 1040
         $filename = 'customer_export_'.date('Y-m-d_H').'.xlsx';
1027 1041
         return Order::export_excel($result, $filename, $indexKey, $title);
1028 1042
     }

+ 2 - 0
resources/views/customer/vipCustomerReport.blade.php

@@ -30,6 +30,7 @@
30 30
                     <th width="10%">团队</th>
31 31
                     <th width="10%">新增会员数</th>
32 32
                     <th width="10%">充值金额</th>
33
+                    <th width="10%">充值方式</th>
33 34
                 </tr>
34 35
                 </thead>
35 36
                 <tbody>
@@ -40,6 +41,7 @@
40 41
                             <td class="text-c">{{$a['team_name']}}</td>
41 42
                             <td class="text-c">{{$a['number']}}</td>
42 43
                             <td class="text-c">{{$a['total_price']}}</td>
44
+                            <td class="text-c">{{$a['payment']}}</td>
43 45
                         </tr>
44 46
                     @endforeach
45 47
                 @endif