|
@@ -4562,7 +4562,7 @@ class StatisticsController extends Controller
|
4562
|
4562
|
if($page<=0){
|
4563
|
4563
|
$page = 1;
|
4564
|
4564
|
}
|
4565
|
|
-
|
|
4565
|
+ $_start = '2019-09-04';
|
4566
|
4566
|
$data = array();
|
4567
|
4567
|
if($page == 1){
|
4568
|
4568
|
$pageSize = $pageSize - 1;
|
|
@@ -4571,9 +4571,9 @@ class StatisticsController extends Controller
|
4571
|
4571
|
$idate = date('Y-m-d');
|
4572
|
4572
|
$data['idate'] = $idate;
|
4573
|
4573
|
//总投入
|
4574
|
|
- $data['throw_cost'] = CustTotal::where('is_del',0)->sum('total_cost');
|
|
4574
|
+ $data['throw_cost'] = CustTotal::where('is_del',0)->where('dtime','>=',$_start)->sum('total_cost');
|
4575
|
4575
|
//订单信息
|
4576
|
|
- $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)->first();
|
|
4576
|
+ $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('createTime','>=',$_start)->where('is_del',0)->first();
|
4577
|
4577
|
$data['goods_cost'] = $order->goods_cost;
|
4578
|
4578
|
$data['freight_cost'] = $order->freight_cost;
|
4579
|
4579
|
$data['aftersale_cost'] = $order->aftersale_cost;
|
|
@@ -4582,7 +4582,7 @@ class StatisticsController extends Controller
|
4582
|
4582
|
$data['order_amount'] = $order->order_amount;
|
4583
|
4583
|
$data['cust_count'] = $order->cust_count;
|
4584
|
4584
|
//加粉
|
4585
|
|
- $data['fan_count'] = CustDetail::where('is_del',0)->sum('fan_add');
|
|
4585
|
+ $data['fan_count'] = CustDetail::where('is_del',0)->where('dtime','>=',$_start)->sum('fan_add');
|
4586
|
4586
|
//毛利 = 总销售额-总商品成本-总运费-总售后
|
4587
|
4587
|
$data['profit'] = $order->order_amount - $order->goods_cost - $order->freight_cost - $order->aftersale_cost - $data['throw_cost'] + $order->refund_fee;
|
4588
|
4588
|
}else{
|
|
@@ -4616,15 +4616,15 @@ class StatisticsController extends Controller
|
4616
|
4616
|
* 每日累计汇总数据导出
|
4617
|
4617
|
*/
|
4618
|
4618
|
public function dayGrandTotal_export(Request $request){
|
4619
|
|
-
|
|
4619
|
+ $_start = '2019-09-04';
|
4620
|
4620
|
$data = array();
|
4621
|
4621
|
//今日数据实时计算
|
4622
|
4622
|
$idate = date('Y-m-d');
|
4623
|
4623
|
$data['idate'] = $idate;
|
4624
|
4624
|
//总投入
|
4625
|
|
- $data['throw_cost'] = CustTotal::where('is_del',0)->sum('total_cost');
|
|
4625
|
+ $data['throw_cost'] = CustTotal::where('is_del',0)->where('dtime','>=',$_start)->sum('total_cost');
|
4626
|
4626
|
//订单信息
|
4627
|
|
- $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)->first();
|
|
4627
|
+ $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('createTime','>=',$_start)->where('is_del',0)->first();
|
4628
|
4628
|
$data['goods_cost'] = $order->goods_cost;
|
4629
|
4629
|
$data['freight_cost'] = $order->freight_cost;
|
4630
|
4630
|
$data['aftersale_cost'] = $order->aftersale_cost;
|
|
@@ -4633,7 +4633,7 @@ class StatisticsController extends Controller
|
4633
|
4633
|
$data['order_amount'] = $order->order_amount;
|
4634
|
4634
|
$data['cust_count'] = $order->cust_count;
|
4635
|
4635
|
//加粉
|
4636
|
|
- $data['fan_count'] = CustDetail::where('is_del',0)->sum('fan_add');
|
|
4636
|
+ $data['fan_count'] = CustDetail::where('is_del',0)->where('dtime','>=',$_start)->sum('fan_add');
|
4637
|
4637
|
//毛利 = 总销售额-总商品成本-总运费-总售后
|
4638
|
4638
|
$data['profit'] = $order->order_amount - $order->goods_cost - $order->freight_cost - $order->aftersale_cost - $data['throw_cost'] + $order->refund_fee;
|
4639
|
4639
|
|