Commit 19d1a826 authored by zhuwei's avatar zhuwei

周报-店长

parent a7fcad58
......@@ -215,8 +215,8 @@ class Statement extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$params = array(
"agent_id" => 5739,//5739 总监 5740店长
"type" => 0,//0 日报 1 周报
"agent_id" => 5775,//5739 总监 5740店长
"type" => 1,//0 日报 1 周报
);
if (!isset($params["agent_id"]) || !isset($params["type"]) ) {
......@@ -234,28 +234,24 @@ class Statement extends Basic
$store_id = $agent_result[0]["store_id"];
$district_id = $agent_result[0]["district_id"];
if ($agent_result[0]["level"] == 10) {
// 业务员 Clerk
if ($agent_result[0]["level"] == 10)
{// 业务员 Clerk
$agent_level = 0;
$result = $this->service_->selectStatementForClerk($params["agent_id"], $agent_level, $store_id,$district_id);
} elseif ($agent_result[0]["level"] == 20) {
// 1店长
} elseif ($agent_result[0]["level"] == 20)
{// 1店长
$agent_level = 1;
if($params["type"] == 0 ){
// 日报
if($params["type"] == 0 )
{// 日报
$result = $this->service_->selectStatementForStoreWithDay($params["agent_id"], $agent_level, $store_id,$district_id);
}else{
//todo 周报
}else{// 周报
$result = $this->service_->selectStatementForStoreWithWeek($params["agent_id"], $agent_level, $store_id,$district_id);
}
} else {
//todo 2总监
} else {//todo 2总监
$agent_level = 2;
if($params["type"] == 0 ){
//todo 日报
if($params["type"] == 0 ){//todo 日报
}else{
//todo 周报
}else{//todo 周报
}
}
......
......@@ -648,7 +648,98 @@ class StatementService
$result["bargain_sum_by_self"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
/**查询店长旗下业务员数据**/
$result["store_list"] = $agent_res['store_list'] ;
$result["store_list"] = $agent_res['store_list'];
$result["store_list_num"] = $agent_res['store_list_num'];
return $result;
}
/**
* 查询店长门店周报数据
* @param $agent_id
* @param $agent_level
* @param $store_id
* @param $district_id
* @return mixed user 朱伟
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=698
*/
public function selectStatementForStoreWithWeek($agent_id, $agent_level, $store_id, $district_id)
{
$agent_res = $this->getAgentIDsByDistrictId($store_id,$agent_level);
$conditions['agent_id'] = array( "in", $agent_res['agent_ids'] );
// 本月-业绩
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$result["performance_for_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 本月-成交单数
$performanceSum = $this->bargainModel->getAddBargainNumV2($conditions, 3);//1表示业绩 2表示实收
$result["bargain_sum_for_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$start_time = date("Y-m-d", strtotime("-7 day"));
$end_time = date("Y-m-d", time());
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// 房源
$result["house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源
$result["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions);
// 带看 (报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$result["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
/**查询店长个人数据**/
#店长个人带看(报备)
$start_time = date("Y-m-d", strtotime("-7 day"));
$end_time = date("Y-m-d", time());
$conditions['agent_id'] = $agent_id;
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["follow_up_num_by_self"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 房源
$result["house_num_by_self"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源
$result["user_num_by_self"] = $this->userModel->getAddUserNumByAgentId($conditions);
#店长个人 成交单数
$performanceSum = $this->bargainModel->getAddBargainNumV2($conditions, 3);//1表示业绩 2表示实收
$result["bargain_sum_by_self"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
/**查询店长旗下业务员数据**/
foreach ($agent_res['store_list'] as $k => $v) {
$conditions['agent_id'] = $v["id"];
// 房源
$agent_res['store_list'][$k]["house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源
$agent_res['store_list'][$k]["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions);
// 带看
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$agent_res['store_list'][$k]["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$agent_res['store_list'][$k]["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
}
$result["store_list"] = $agent_res['store_list'];
$result["store_list_num"] = $agent_res['store_list_num'];
return $result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment