|
@@ -25,6 +25,7 @@ class DayGrandTotal extends Command {
|
25
|
25
|
|
26
|
26
|
|
27
|
27
|
public function dayGrandTotal(){
|
|
28
|
+ $_start = '2019-09-04';
|
28
|
29
|
$_end = date('Y-m-d');
|
29
|
30
|
$data = array();
|
30
|
31
|
$idate = date('Y-m-d', strtotime('-1 day'));
|
|
@@ -36,9 +37,9 @@ class DayGrandTotal extends Command {
|
36
|
37
|
}
|
37
|
38
|
$data['idate'] = $idate;
|
38
|
39
|
//总投入
|
39
|
|
- $data['throw_cost'] = CustTotal::where('is_del',0)->where('dtime','<',$_end)->sum('total_cost');
|
|
40
|
+ $data['throw_cost'] = CustTotal::where('is_del',0)->where('dtime','<',$_end)->where('dtime','>=',$_start)->sum('total_cost');
|
40
|
41
|
//订单信息
|
41
|
|
- $order = Order::select(DB::raw('sum(cost) as goods_cost, sum(freight_cost) as freight_cost, sum(aftersale_fee) as aftersale_cost, count(1) as order_count, sum(receivedAmount) as order_amount, count(distinct(receiverMobile)) as cust_count, sum(refund_price) as refund_fee'))->where('is_del',0)->where('createTime','<',$_end)->where('cost', '>', 0)->first();
|
|
42
|
+ $order = Order::select(DB::raw('sum(cost) as goods_cost, sum(freight_cost) as freight_cost, sum(aftersale_fee) as aftersale_cost, count(1) as order_count, sum(receivedAmount) as order_amount, count(distinct(receiverMobile)) as cust_count, sum(refund_price) as refund_fee'))->where('is_del',0)->where('createTime','<',$_end)->where('createTime','>=',$_start)->where('cost', '>', 0)->first();
|
42
|
43
|
$data['goods_cost'] = $order->goods_cost;
|
43
|
44
|
$data['freight_cost'] = $order->freight_cost;
|
44
|
45
|
$data['aftersale_cost'] = $order->aftersale_cost;
|
|
@@ -47,7 +48,7 @@ class DayGrandTotal extends Command {
|
47
|
48
|
$data['order_amount'] = $order->order_amount;
|
48
|
49
|
$data['cust_count'] = $order->cust_count;
|
49
|
50
|
//加粉
|
50
|
|
- $data['fan_count'] = CustDetail::where('is_del',0)->where('dtime','<',$_end)->sum('fan_add');
|
|
51
|
+ $data['fan_count'] = CustDetail::where('is_del',0)->where('dtime','<',$_end)->where('dtime','>=',$_start)->sum('fan_add');
|
51
|
52
|
//毛利 = 总销售额-总商品成本-总运费-总售后
|
52
|
53
|
$data['profit'] = $order->order_amount - $order->goods_cost - $order->freight_cost - $order->aftersale_cost - $data['throw_cost'] + $order->refund_fee;
|
53
|
54
|
|