Browse Source

财务报表加订单状态过滤

sunhao 5 years ago
parent
commit
efa83963bf
1 changed files with 34 additions and 34 deletions
  1. 34 34
      app/Http/Controllers/Admin/StatisticsController.php

+ 34 - 34
app/Http/Controllers/Admin/StatisticsController.php

1733
             if($stime) $query->where('createTime', '>=', $stime);
1733
             if($stime) $query->where('createTime', '>=', $stime);
1734
             if($etime) $query->where('createTime', '<=', $etime. ' 23:59:59');
1734
             if($etime) $query->where('createTime', '<=', $etime. ' 23:59:59');
1735
 
1735
 
1736
-        })->where('is_del', 0)->count();
1736
+        })->where('is_del', 0)->where('status','>=',2)->count();
1737
         if ($count > 1) {
1737
         if ($count > 1) {
1738
             // 总页数
1738
             // 总页数
1739
             $pages = ceil($count/$pageSize);
1739
             $pages = ceil($count/$pageSize);
1747
             if($team_id) $query->where('team_id', $team_id);
1747
             if($team_id) $query->where('team_id', $team_id);
1748
             if($stime ) $query->where('createTime', '>=', $stime);
1748
             if($stime ) $query->where('createTime', '>=', $stime);
1749
             if($etime ) $query->where('createTime', '<=', $etime. ' 23:59:59');
1749
             if($etime ) $query->where('createTime', '<=', $etime. ' 23:59:59');
1750
-        })->where('is_del', 0)->orderBy('team_id', 'asc');
1750
+        })->where('is_del', 0)->where('status','>=',2)->orderBy('team_id', 'asc');
1751
 
1751
 
1752
         $result = $resultQuery->orderBy('createTime','desc')->offset($offset)->limit($pageSize)->get();
1752
         $result = $resultQuery->orderBy('createTime','desc')->offset($offset)->limit($pageSize)->get();
1753
         
1753
         
1805
         $teams = DB::table('teams')->lists('name', 'id');
1805
         $teams = DB::table('teams')->lists('name', 'id');
1806
 
1806
 
1807
         foreach($_data['data'] as $k=>&$v){
1807
         foreach($_data['data'] as $k=>&$v){
1808
-            $order_result = Order::select(DB::raw('team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where('is_del', 0)->where('createTime','>=', $v['date'])->where('createTime','<=', $v['date'].' 23:59:59')->where('team_id', $v['team_id'])->first();
1808
+            $order_result = Order::select(DB::raw('team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where('is_del', 0)->where('status','>=',2)->where('createTime','>=', $v['date'])->where('createTime','<=', $v['date'].' 23:59:59')->where('team_id', $v['team_id'])->first();
1809
 
1809
 
1810
             $v['order_count'] = isset($order_result->order_count) ? $order_result->order_count : '';
1810
             $v['order_count'] = isset($order_result->order_count) ? $order_result->order_count : '';
1811
             $v['receivedAmount'] = isset($order_result->receivedAmount) ? $order_result->receivedAmount : '';
1811
             $v['receivedAmount'] = isset($order_result->receivedAmount) ? $order_result->receivedAmount : '';
1819
                 $query->where('team_id', $team);
1819
                 $query->where('team_id', $team);
1820
                 $query->where('aftersale_time', '>=', $ctime);
1820
                 $query->where('aftersale_time', '>=', $ctime);
1821
                 $query->where('aftersale_time', '<=', $ctime.' 23:59:59');
1821
                 $query->where('aftersale_time', '<=', $ctime.' 23:59:59');
1822
-            })->where('is_del', 0)->where('aftersale_fee', '>', 0)->first();
1822
+            })->where('is_del', 0)->where('status','>=',2)->where('aftersale_fee', '>', 0)->first();
1823
             $v['aftersale_count'] = $aftersale_info->aftersale_count;
1823
             $v['aftersale_count'] = $aftersale_info->aftersale_count;
1824
             $v['aftersale_fee'] = $aftersale_info->aftersale_fee;
1824
             $v['aftersale_fee'] = $aftersale_info->aftersale_fee;
1825
             #退补
1825
             #退补
1826
             $refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where(function($query) use($team, $ctime){
1826
             $refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where(function($query) use($team, $ctime){
1827
                 $query->where('team_id', $team);
1827
                 $query->where('team_id', $team);
1828
                 $query->where('refund_time', '=', $ctime);
1828
                 $query->where('refund_time', '=', $ctime);
1829
-            })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1829
+            })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1830
             $v['refund_count'] = $refund_info->refund_count;
1830
             $v['refund_count'] = $refund_info->refund_count;
1831
             $v['refund_price'] = $refund_info->refund_price;
1831
             $v['refund_price'] = $refund_info->refund_price;
1832
             //wx退补
1832
             //wx退补
1833
             $wx_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 1)->where(function($query) use($team, $ctime){
1833
             $wx_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 1)->where(function($query) use($team, $ctime){
1834
                 $query->where('team_id', $team);
1834
                 $query->where('team_id', $team);
1835
                 $query->where('refund_time', '=', $ctime);
1835
                 $query->where('refund_time', '=', $ctime);
1836
-            })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1836
+            })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1837
             $v['wx_refund_count'] = $wx_refund_info->refund_count;
1837
             $v['wx_refund_count'] = $wx_refund_info->refund_count;
1838
             $v['wx_refund_price'] = $wx_refund_info->refund_price;
1838
             $v['wx_refund_price'] = $wx_refund_info->refund_price;
1839
             //付款码退补
1839
             //付款码退补
1840
             $zfm_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 2)->where(function($query) use($team, $ctime){
1840
             $zfm_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 2)->where(function($query) use($team, $ctime){
1841
                 $query->where('team_id', $team);
1841
                 $query->where('team_id', $team);
1842
                 $query->where('refund_time', '=', $ctime);
1842
                 $query->where('refund_time', '=', $ctime);
1843
-            })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1843
+            })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1844
             $v['zfm_refund_count'] = $zfm_refund_info->refund_count;
1844
             $v['zfm_refund_count'] = $zfm_refund_info->refund_count;
1845
             $v['zfm_refund_price'] = $zfm_refund_info->refund_price;
1845
             $v['zfm_refund_price'] = $zfm_refund_info->refund_price;
1846
 
1846
 
1848
             $send_info = Order::select(DB::raw('count(1) as send_count, sum(cost) as cost, sum(freight_cost) as freight_cost'))->where(function($query) use($team, $ctime){
1848
             $send_info = Order::select(DB::raw('count(1) as send_count, sum(cost) as cost, sum(freight_cost) as freight_cost'))->where(function($query) use($team, $ctime){
1849
                 $query->where('team_id', $team);
1849
                 $query->where('team_id', $team);
1850
                 $query->where('send_time', '=', $ctime);
1850
                 $query->where('send_time', '=', $ctime);
1851
-            })->where('is_del', 0)->where('logistics_id', '>', '')->first();
1851
+            })->where('is_del', 0)->where('status','>=',2)->where('logistics_id', '>', '')->first();
1852
             $v['send_count'] = $send_info->send_count;
1852
             $v['send_count'] = $send_info->send_count;
1853
             $v['cost'] = $send_info->cost;
1853
             $v['cost'] = $send_info->cost;
1854
             $v['freight_cost'] = $send_info->freight_cost;
1854
             $v['freight_cost'] = $send_info->freight_cost;
1890
             if($team_id) $query->where('team_id', $team_id);
1890
             if($team_id) $query->where('team_id', $team_id);
1891
             if($stime ) $query->where('createTime', '>=', $stime);
1891
             if($stime ) $query->where('createTime', '>=', $stime);
1892
             if($etime ) $query->where('createTime', '<=', $etime. ' 23:59:59');
1892
             if($etime ) $query->where('createTime', '<=', $etime. ' 23:59:59');
1893
-        })->where('is_del', 0)->orderBy('team_id', 'asc');
1893
+        })->where('is_del', 0)->where('status','>=',2)->orderBy('team_id', 'asc');
1894
 
1894
 
1895
         $result = $resultQuery->orderBy('createTime','desc')->get();
1895
         $result = $resultQuery->orderBy('createTime','desc')->get();
1896
         $result = json_decode(json_encode($result), true);
1896
         $result = json_decode(json_encode($result), true);
1919
         $result = $this->teamCtimePage_export($stime, $etime, $team_id);
1919
         $result = $this->teamCtimePage_export($stime, $etime, $team_id);
1920
 
1920
 
1921
         foreach($result as $k=>&$v){
1921
         foreach($result as $k=>&$v){
1922
-            $order_result = Order::select(DB::raw('team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where('is_del', 0)->where('createTime','>=', $v['date'])->where('createTime','<=', $v['date'].' 23:59:59')->where('team_id', $v['team_id'])->first();
1922
+            $order_result = Order::select(DB::raw('team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where('is_del', 0)->where('status','>=',2)->where('createTime','>=', $v['date'])->where('createTime','<=', $v['date'].' 23:59:59')->where('team_id', $v['team_id'])->first();
1923
 
1923
 
1924
             $v['order_count'] = isset($order_result->order_count) ? $order_result->order_count : '';
1924
             $v['order_count'] = isset($order_result->order_count) ? $order_result->order_count : '';
1925
             $v['receivedAmount'] = isset($order_result->receivedAmount) ? $order_result->receivedAmount : '';
1925
             $v['receivedAmount'] = isset($order_result->receivedAmount) ? $order_result->receivedAmount : '';
1933
                 $query->where('team_id', $team);
1933
                 $query->where('team_id', $team);
1934
                 $query->where('aftersale_time', '>=', $ctime);
1934
                 $query->where('aftersale_time', '>=', $ctime);
1935
                 $query->where('aftersale_time', '<=', $ctime.' 23:59:59');
1935
                 $query->where('aftersale_time', '<=', $ctime.' 23:59:59');
1936
-            })->where('is_del', 0)->where('aftersale_fee', '>', 0)->first();
1936
+            })->where('is_del', 0)->where('status','>=',2)->where('aftersale_fee', '>', 0)->first();
1937
             $v['aftersale_count'] = $aftersale_info->aftersale_count;
1937
             $v['aftersale_count'] = $aftersale_info->aftersale_count;
1938
             $v['aftersale_fee'] = $aftersale_info->aftersale_fee;
1938
             $v['aftersale_fee'] = $aftersale_info->aftersale_fee;
1939
             #退补
1939
             #退补
1940
             $refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where(function($query) use($team, $ctime){
1940
             $refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where(function($query) use($team, $ctime){
1941
                 $query->where('team_id', $team);
1941
                 $query->where('team_id', $team);
1942
                 $query->where('refund_time', '=', $ctime);
1942
                 $query->where('refund_time', '=', $ctime);
1943
-            })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1943
+            })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1944
             $v['refund_count'] = $refund_info->refund_count;
1944
             $v['refund_count'] = $refund_info->refund_count;
1945
             $v['refund_price'] = $refund_info->refund_price;
1945
             $v['refund_price'] = $refund_info->refund_price;
1946
             //wx退补
1946
             //wx退补
1947
             $wx_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 1)->where(function($query) use($team, $ctime){
1947
             $wx_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 1)->where(function($query) use($team, $ctime){
1948
                 $query->where('team_id', $team);
1948
                 $query->where('team_id', $team);
1949
                 $query->where('refund_time', '=', $ctime);
1949
                 $query->where('refund_time', '=', $ctime);
1950
-            })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1950
+            })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1951
             $v['wx_refund_count'] = $wx_refund_info->refund_count;
1951
             $v['wx_refund_count'] = $wx_refund_info->refund_count;
1952
             $v['wx_refund_price'] = $wx_refund_info->refund_price;
1952
             $v['wx_refund_price'] = $wx_refund_info->refund_price;
1953
             //付款码退补
1953
             //付款码退补
1954
             $zfm_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 2)->where(function($query) use($team, $ctime){
1954
             $zfm_refund_info = Order::select(DB::raw('count(1) as refund_count, sum(refund_price) as refund_price'))->where('refund_type', 2)->where(function($query) use($team, $ctime){
1955
                 $query->where('team_id', $team);
1955
                 $query->where('team_id', $team);
1956
                 $query->where('refund_time', '=', $ctime);
1956
                 $query->where('refund_time', '=', $ctime);
1957
-            })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1957
+            })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->first();
1958
             $v['zfm_refund_count'] = $zfm_refund_info->refund_count;
1958
             $v['zfm_refund_count'] = $zfm_refund_info->refund_count;
1959
             $v['zfm_refund_price'] = $zfm_refund_info->refund_price;
1959
             $v['zfm_refund_price'] = $zfm_refund_info->refund_price;
1960
 
1960
 
1962
             $send_info = Order::select(DB::raw('count(1) as send_count, sum(cost) as cost, sum(freight_cost) as freight_cost'))->where(function($query) use($team, $ctime){
1962
             $send_info = Order::select(DB::raw('count(1) as send_count, sum(cost) as cost, sum(freight_cost) as freight_cost'))->where(function($query) use($team, $ctime){
1963
                 $query->where('team_id', $team);
1963
                 $query->where('team_id', $team);
1964
                 $query->where('send_time', '=', $ctime);
1964
                 $query->where('send_time', '=', $ctime);
1965
-            })->where('is_del', 0)->where('logistics_id', '>', '')->first();
1965
+            })->where('is_del', 0)->where('status','>=',2)->where('logistics_id', '>', '')->first();
1966
             $v['send_count'] = $send_info->send_count;
1966
             $v['send_count'] = $send_info->send_count;
1967
             $v['cost'] = $send_info->cost;
1967
             $v['cost'] = $send_info->cost;
1968
             $v['freight_cost'] = $send_info->freight_cost;
1968
             $v['freight_cost'] = $send_info->freight_cost;
2008
             if($stime) $query->where('aftersale_time', '>=', $stime);
2008
             if($stime) $query->where('aftersale_time', '>=', $stime);
2009
             if($etime) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2009
             if($etime) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2010
 
2010
 
2011
-        })->where('is_del', 0)->where('aftersale_fee', '>', 0)->count();
2011
+        })->where('is_del', 0)->where('status','>=',2)->where('aftersale_fee', '>', 0)->count();
2012
         if ($count > 1) {
2012
         if ($count > 1) {
2013
             // 总页数
2013
             // 总页数
2014
             $pages = ceil($count/$pageSize);
2014
             $pages = ceil($count/$pageSize);
2023
             if($warehouse) $query->where('warehouse', $warehouse);
2023
             if($warehouse) $query->where('warehouse', $warehouse);
2024
             if($stime ) $query->where('aftersale_time', '>=', $stime);
2024
             if($stime ) $query->where('aftersale_time', '>=', $stime);
2025
             if($etime ) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2025
             if($etime ) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2026
-        })->where('is_del', 0)->where('aftersale_fee', '>', 0);
2026
+        })->where('is_del', 0)->where('status','>=',2)->where('aftersale_fee', '>', 0);
2027
 
2027
 
2028
         $result = $resultQuery->orderBy('aftersale_time','desc')->offset($offset)->limit($pageSize)->get();
2028
         $result = $resultQuery->orderBy('aftersale_time','desc')->offset($offset)->limit($pageSize)->get();
2029
         
2029
         
2082
             if($stime) $query->where('refund_time', '>=', $stime);
2082
             if($stime) $query->where('refund_time', '>=', $stime);
2083
             if($etime) $query->where('refund_time', '<=', $etime);
2083
             if($etime) $query->where('refund_time', '<=', $etime);
2084
 
2084
 
2085
-        })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1)->count();
2085
+        })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1)->count();
2086
         if ($count > 1) {
2086
         if ($count > 1) {
2087
             // 总页数
2087
             // 总页数
2088
             $pages = ceil($count/$pageSize);
2088
             $pages = ceil($count/$pageSize);
2097
             if($warehouse) $query->where('warehouse', $warehouse);
2097
             if($warehouse) $query->where('warehouse', $warehouse);
2098
             if($stime ) $query->where('refund_time', '>=', $stime);
2098
             if($stime ) $query->where('refund_time', '>=', $stime);
2099
             if($etime ) $query->where('refund_time', '<=', $etime);
2099
             if($etime ) $query->where('refund_time', '<=', $etime);
2100
-        })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1);
2100
+        })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1);
2101
 
2101
 
2102
         $result = $resultQuery->orderBy('refund_time','desc')->offset($offset)->limit($pageSize)->get();
2102
         $result = $resultQuery->orderBy('refund_time','desc')->offset($offset)->limit($pageSize)->get();
2103
         
2103
         
2163
             if($stime) $query->where('send_time', '>=', $stime);
2163
             if($stime) $query->where('send_time', '>=', $stime);
2164
             if($etime) $query->where('send_time', '<=', $etime);
2164
             if($etime) $query->where('send_time', '<=', $etime);
2165
 
2165
 
2166
-        })->where('is_del', 0)->where('logistics_id', '>', '')->count();
2166
+        })->where('is_del', 0)->where('status','>=',2)->where('logistics_id', '>', '')->count();
2167
         if ($count > 1) {
2167
         if ($count > 1) {
2168
             // 总页数
2168
             // 总页数
2169
             $pages = ceil($count/$pageSize);
2169
             $pages = ceil($count/$pageSize);
2178
             if($warehouse) $query->where('warehouse', $warehouse);
2178
             if($warehouse) $query->where('warehouse', $warehouse);
2179
             if($stime ) $query->where('send_time', '>=', $stime);
2179
             if($stime ) $query->where('send_time', '>=', $stime);
2180
             if($etime ) $query->where('send_time', '<=', $etime);
2180
             if($etime ) $query->where('send_time', '<=', $etime);
2181
-        })->where('is_del', 0)->where('logistics_id', '>', '');
2181
+        })->where('is_del', 0)->where('status','>=',2)->where('logistics_id', '>', '');
2182
 
2182
 
2183
         $result = $resultQuery->orderBy('send_time','desc')->offset($offset)->limit($pageSize)->get();
2183
         $result = $resultQuery->orderBy('send_time','desc')->offset($offset)->limit($pageSize)->get();
2184
         
2184
         
2228
             if($warehouse) $query->where('warehouse', $warehouse);
2228
             if($warehouse) $query->where('warehouse', $warehouse);
2229
             if($stime ) $query->where('aftersale_time', '>=', $stime);
2229
             if($stime ) $query->where('aftersale_time', '>=', $stime);
2230
             if($etime ) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2230
             if($etime ) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2231
-        })->where('is_del', 0)->where('aftersale_fee', '>', 0);
2231
+        })->where('is_del', 0)->where('status','>=',2)->where('aftersale_fee', '>', 0);
2232
 
2232
 
2233
         $result = $resultQuery->orderBy('aftersale_time','desc')->get();
2233
         $result = $resultQuery->orderBy('aftersale_time','desc')->get();
2234
         
2234
         
2269
             if($warehouse) $query->where('warehouse', $warehouse);
2269
             if($warehouse) $query->where('warehouse', $warehouse);
2270
             if($stime ) $query->where('refund_time', '>=', $stime);
2270
             if($stime ) $query->where('refund_time', '>=', $stime);
2271
             if($etime ) $query->where('refund_time', '<=', $etime);
2271
             if($etime ) $query->where('refund_time', '<=', $etime);
2272
-        })->where('is_del', 0)->where('refund_time', '>', '')->where('is_refund', 1);
2272
+        })->where('is_del', 0)->where('status','>=',2)->where('refund_time', '>', '')->where('is_refund', 1);
2273
 
2273
 
2274
         $result = $resultQuery->orderBy('refund_time','desc')->get();
2274
         $result = $resultQuery->orderBy('refund_time','desc')->get();
2275
         
2275
         
2317
             if($warehouse) $query->where('warehouse', $warehouse);
2317
             if($warehouse) $query->where('warehouse', $warehouse);
2318
             if($stime ) $query->where('send_time', '>=', $stime);
2318
             if($stime ) $query->where('send_time', '>=', $stime);
2319
             if($etime ) $query->where('send_time', '<=', $etime);
2319
             if($etime ) $query->where('send_time', '<=', $etime);
2320
-        })->where('is_del', 0)->where('logistics_id', '>', '');
2320
+        })->where('is_del', 0)->where('status','>=',2)->where('logistics_id', '>', '');
2321
 
2321
 
2322
         $result = $resultQuery->orderBy('send_time','desc')->get();
2322
         $result = $resultQuery->orderBy('send_time','desc')->get();
2323
         
2323
         
2371
             if($stime && $aftersale == 1) $query->where('aftersale_time', '>=', $stime);
2371
             if($stime && $aftersale == 1) $query->where('aftersale_time', '>=', $stime);
2372
             if($etime && $aftersale == 1) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2372
             if($etime && $aftersale == 1) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2373
             if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2373
             if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2374
-        })->where('is_del', 0)->groupBy('team_id')->groupBy('ctime')->get();
2374
+        })->where('is_del', 0)->where('status','>=',2)->groupBy('team_id')->groupBy('ctime')->get();
2375
         $count = count($count);
2375
         $count = count($count);
2376
 
2376
 
2377
         if ($count > 1) {
2377
         if ($count > 1) {
2389
                 if($stime) $query->where('aftersale_time', '>=', $stime);
2389
                 if($stime) $query->where('aftersale_time', '>=', $stime);
2390
                 if($etime) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2390
                 if($etime) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2391
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2391
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2392
-            })->where('is_del', 0)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('aftersale_time','desc')->offset($offset)->limit($pageSize)->get();
2392
+            })->where('is_del', 0)->where('status','>=',2)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('aftersale_time','desc')->offset($offset)->limit($pageSize)->get();
2393
         }else{
2393
         }else{
2394
             $result = Order::select(DB::raw('left(createTime, 10) as ctime, team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(aftersale_fee) as aftersale_fee, sum(refund_price) as refund_price, sum(cost) as cost, sum(freight_cost) as freight_cost, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where(function($query) use($team_id, $stime, $etime, $aftersale){
2394
             $result = Order::select(DB::raw('left(createTime, 10) as ctime, team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(aftersale_fee) as aftersale_fee, sum(refund_price) as refund_price, sum(cost) as cost, sum(freight_cost) as freight_cost, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where(function($query) use($team_id, $stime, $etime, $aftersale){
2395
                 if($team_id) $query->where('team_id', $team_id);
2395
                 if($team_id) $query->where('team_id', $team_id);
2396
                 if($stime) $query->where('createTime', '>=', $stime);
2396
                 if($stime) $query->where('createTime', '>=', $stime);
2397
                 if($etime) $query->where('createTime', '<=', $etime.' 23:59:59');
2397
                 if($etime) $query->where('createTime', '<=', $etime.' 23:59:59');
2398
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2398
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2399
-            })->where('is_del', 0)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('createTime','desc')->offset($offset)->limit($pageSize)->get();
2399
+            })->where('is_del', 0)->where('status','>=',2)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('createTime','desc')->offset($offset)->limit($pageSize)->get();
2400
         }
2400
         }
2401
         $result = json_decode(json_encode($result), true);
2401
         $result = json_decode(json_encode($result), true);
2402
         foreach($result as $k=>&$v){
2402
         foreach($result as $k=>&$v){
2438
             if($stime && $aftersale == 1) $query->where('aftersale_time', '>=', $stime);
2438
             if($stime && $aftersale == 1) $query->where('aftersale_time', '>=', $stime);
2439
             if($etime && $aftersale == 1) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2439
             if($etime && $aftersale == 1) $query->where('aftersale_time', '<=', $etime. ' 23:59:59');
2440
             if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2440
             if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2441
-        })->where('is_del', 0)->orderBy('team_id', 'asc');
2441
+        })->where('is_del', 0)->where('status','>=',2)->orderBy('team_id', 'asc');
2442
         if($aftersale == 1){
2442
         if($aftersale == 1){
2443
             $result = $resultQuery->orderBy('aftersale_time','desc')->get();
2443
             $result = $resultQuery->orderBy('aftersale_time','desc')->get();
2444
         }else{
2444
         }else{
2475
                 if($stime) $query->where('aftersale_time', '>=', $stime);
2475
                 if($stime) $query->where('aftersale_time', '>=', $stime);
2476
                 if($etime) $query->where('aftersale_time', '<=', $etime.' 23:59:59');
2476
                 if($etime) $query->where('aftersale_time', '<=', $etime.' 23:59:59');
2477
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2477
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2478
-            })->where('is_del', 0)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('aftersale_time','desc')->get();
2478
+            })->where('is_del', 0)->where('status','>=',2)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('aftersale_time','desc')->get();
2479
         }else{
2479
         }else{
2480
             $result = Order::select(DB::raw('left(createTime, 10) as ctime, team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(aftersale_fee) as aftersale_fee, sum(refund_price) as refund_price, sum(cost) as cost, sum(freight_cost) as freight_cost, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where(function($query) use($team_id, $stime, $etime, $aftersale){
2480
             $result = Order::select(DB::raw('left(createTime, 10) as ctime, team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(aftersale_fee) as aftersale_fee, sum(refund_price) as refund_price, sum(cost) as cost, sum(freight_cost) as freight_cost, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where(function($query) use($team_id, $stime, $etime, $aftersale){
2481
                 if($team_id) $query->where('team_id', $team_id);
2481
                 if($team_id) $query->where('team_id', $team_id);
2482
                 if($stime) $query->where('createTime', '>=', $stime);
2482
                 if($stime) $query->where('createTime', '>=', $stime);
2483
                 if($etime) $query->where('createTime', '<=', $etime.' 23:59:59');
2483
                 if($etime) $query->where('createTime', '<=', $etime.' 23:59:59');
2484
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2484
                 if($aftersale == 1) $query->where('aftersale_fee', '>', 0);
2485
-            })->where('is_del', 0)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('createTime','desc')->get();
2485
+            })->where('is_del', 0)->where('status','>=',2)->groupBy('team_id')->groupBy('ctime')->orderBy('team_id', 'asc')->orderBy('createTime','desc')->get();
2486
         }
2486
         }
2487
         $result = json_decode(json_encode($result), true);
2487
         $result = json_decode(json_encode($result), true);
2488
         foreach($result as $k=>&$v){
2488
         foreach($result as $k=>&$v){
3892
             if($stime) $query->where('send_time', '>=', $stime);
3892
             if($stime) $query->where('send_time', '>=', $stime);
3893
             if($etime) $query->where('send_time', '<=', $etime);
3893
             if($etime) $query->where('send_time', '<=', $etime);
3894
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3894
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3895
-        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->groupBy('warehouse')->groupBy('send_time')->get();      
3895
+        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->where('status','>=',2)->groupBy('warehouse')->groupBy('send_time')->get();      
3896
         $count = count($count);
3896
         $count = count($count);
3897
         if ($count > 1) {
3897
         if ($count > 1) {
3898
             // 总页数
3898
             // 总页数
3907
             if($stime) $query->where('send_time', '>=', $stime);
3907
             if($stime) $query->where('send_time', '>=', $stime);
3908
             if($etime) $query->where('send_time', '<=', $etime);
3908
             if($etime) $query->where('send_time', '<=', $etime);
3909
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3909
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3910
-        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->groupBy('warehouse')->groupBy('send_time')->orderBy('send_time', 'desc')->offset($offset)->limit($pageSize)->get();
3910
+        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->where('status','>=',2)->groupBy('warehouse')->groupBy('send_time')->orderBy('send_time', 'desc')->offset($offset)->limit($pageSize)->get();
3911
 
3911
 
3912
         $wareArr = array(
3912
         $wareArr = array(
3913
             0 => '其他',
3913
             0 => '其他',
3924
             if($stime) $query->where('send_time', '>=', $stime);
3924
             if($stime) $query->where('send_time', '>=', $stime);
3925
             if($etime) $query->where('send_time', '<=', $etime);
3925
             if($etime) $query->where('send_time', '<=', $etime);
3926
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3926
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3927
-        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->first();
3927
+        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->where('status','>=',2)->first();
3928
 
3928
 
3929
 
3929
 
3930
         return view('statistics/warehouseFinanceList', ['result'=>$result,
3930
         return view('statistics/warehouseFinanceList', ['result'=>$result,
3950
             if($stime) $query->where('send_time', '>=', $stime);
3950
             if($stime) $query->where('send_time', '>=', $stime);
3951
             if($etime) $query->where('send_time', '<=', $etime);
3951
             if($etime) $query->where('send_time', '<=', $etime);
3952
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3952
             if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3953
-        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->groupBy('warehouse')->groupBy('send_time')->orderBy('send_time', 'desc')->get();
3953
+        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->where('status','>=',2)->groupBy('warehouse')->groupBy('send_time')->orderBy('send_time', 'desc')->get();
3954
 
3954
 
3955
         $wareArr = array(
3955
         $wareArr = array(
3956
             0 => '其他',
3956
             0 => '其他',