维护客户业务统计

This commit is contained in:
wanyongkang
2020-11-23 17:00:11 +08:00
parent 9f654db2aa
commit ce48d318e8

View File

@@ -2,9 +2,9 @@
namespace app\manager\controller; namespace app\manager\controller;
use app\manager\model\Manager;
use app\manager\model\ProductOrder; use app\manager\model\ProductOrder;
use app\manager\model\User; use app\manager\model\User;
use app\manager\model\Manager;
use fastphp\base\Controller; use fastphp\base\Controller;
class SellInfo extends Controller class SellInfo extends Controller
@@ -34,7 +34,6 @@ class SellInfo extends Controller
$time_where_today = ''; $time_where_today = '';
$time_where2_today = ''; $time_where2_today = '';
$date1 = date("Y-m-01", time()); $date1 = date("Y-m-01", time());
$date2 = date("Y-m-d H:i:s", time()); $date2 = date("Y-m-d H:i:s", time());
$flag = date("d", time()) == date("t", time()); $flag = date("d", time()) == date("t", time());
@@ -48,7 +47,6 @@ class SellInfo extends Controller
$date4 = date("Y-m-t 23:59:59", strtotime($_GET['sell_month'] . " -1 month")); $date4 = date("Y-m-t 23:59:59", strtotime($_GET['sell_month'] . " -1 month"));
} }
//本月 //本月
$time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' "; $time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
$time_where2 .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' "; $time_where2 .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' ";
@@ -95,7 +93,7 @@ class SellInfo extends Controller
$cost_percent = ($all_cost_num ? round($user_cost_num / $all_cost_num * 100, 2) : 0); $cost_percent = ($all_cost_num ? round($user_cost_num / $all_cost_num * 100, 2) : 0);
$cost_register = ($user_register_count ? round($user_register_cost_count / $user_register_count * 100, 2) : 0); $cost_register = ($user_register_count ? round($user_register_cost_count / $user_register_count * 100, 2) : 0);
$cost_old_user = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($all_cost_num - $user_register_count) * 100, 2) : 0); $cost_old_user = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($all_cost_num - $user_register_count) * 100, 2) : 0);
$com_cost = ($user_cost - $user_last_month_cost); $com_cost = round(($user_cost - $user_last_month_cost), 2);
$com_percent = ($user_last_month_cost ? round(($user_cost - $user_last_month_cost) / $user_last_month_cost * 100, 2) : 0); $com_percent = ($user_last_month_cost ? round(($user_cost - $user_last_month_cost) / $user_last_month_cost * 100, 2) : 0);
$today_new_user = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list); $today_new_user = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list);
$refund = ($refund_cost_data ? $refund_cost_data['money'] : 0); $refund = ($refund_cost_data ? $refund_cost_data['money'] : 0);
@@ -146,7 +144,6 @@ class SellInfo extends Controller
$time_where2_today = ''; $time_where2_today = '';
$data = []; $data = [];
$date1 = date("Y-m-01", time()); $date1 = date("Y-m-01", time());
$date2 = date("Y-m-d H:i:s", time()); $date2 = date("Y-m-d H:i:s", time());
$flag = date("d", time()) == date("t", time()); $flag = date("d", time()) == date("t", time());
@@ -160,7 +157,6 @@ class SellInfo extends Controller
$date4 = date("Y-m-t 23:59:59", strtotime($_GET['sell_month'] . " -1 month")); $date4 = date("Y-m-t 23:59:59", strtotime($_GET['sell_month'] . " -1 month"));
} }
//本月 //本月
$time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' "; $time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
$time_where2 .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' "; $time_where2 .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' ";
@@ -205,9 +201,9 @@ class SellInfo extends Controller
$data['sell_percent'] = ($all_cost ? round($user_cost / $all_cost * 100, 2) : 0) . '%'; $data['sell_percent'] = ($all_cost ? round($user_cost / $all_cost * 100, 2) : 0) . '%';
$data['cost_percent'] = ($all_cost_num ? round($user_cost_num / $all_cost_num * 100, 2) : 0) . '%'; $data['cost_percent'] = ($all_cost_num ? round($user_cost_num / $all_cost_num * 100, 2) : 0) . '%';
$data['cost_register'] = ($user_register_count?round($user_register_cost_count / $user_register_count * 100, 2):0); $data['cost_register'] = ($user_register_count ? round($user_register_cost_count / $user_register_count * 100, 2) : 0) . '%';
$data['cost_old_user'] = (($all_cost_num - $user_register_count)?round(($user_cost_num - $user_register_cost_count) / ($all_cost_num - $user_register_count) * 100, 2):0); $data['cost_old_user'] = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($all_cost_num - $user_register_count) * 100, 2) : 0) . '%';
$data['com_cost'] = ($user_cost - $user_last_month_cost); $data['com_cost'] = round(($user_cost - $user_last_month_cost), 2);
$data['com_percent'] = ($user_last_month_cost ? round(($user_cost - $user_last_month_cost) / $user_last_month_cost * 100, 2) : 0) . '%'; $data['com_percent'] = ($user_last_month_cost ? round(($user_cost - $user_last_month_cost) / $user_last_month_cost * 100, 2) : 0) . '%';
$data['today_new_user'] = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list); $data['today_new_user'] = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list);
$data['refund'] = ($refund_cost_data ? $refund_cost_data['money'] : 0); $data['refund'] = ($refund_cost_data ? $refund_cost_data['money'] : 0);