Commit 31d15431 authored by zhuwei's avatar zhuwei

getPerformanceInfoExcel

parent b8ed9268
......@@ -178,26 +178,9 @@ class Performance extends Basic
$export = new ExportExcelUntil();
$data = Session::get('excelPerformance');
/**
* {
["agent_id"] => int(5739)
["store_id"] => int(3742)
["district_id"] => int(16)
["performance_total"] => string(8) "22231.20"
["bargain_sum_total"] => string(2) "17"
["paylog_total"] => string(1) "7"
["march_in_num_total"] => string(1) "7"
["look_at_num_total"] => string(2) "20"
["add_house_num_total"] => string(2) "63"
["add_user_num_total"] => string(2) "40"
["index_"] => int(1)
["name"] => string(10) "总测试1"
["img"] => string(82) "https://localhost/static/user_header/20180615/6528100f422ffa6f7d1cb1293c1eaaed.jpg"
["store_name"] => string(6) "大大"
["district_name"] => string(9) "测试郭"
["team_num"] => int(7)
if(!$data){
return $this->response("101","Session读取失败");
}
*/
foreach ($data['data'] as $key => $v) {
$e_data_old['index_'] = $v['index_'];
if($data['type'] == 3){
......
......@@ -10,7 +10,9 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil;
use app\model\OBargainModel;
use think\Session;
class PerformanceInfo extends Basic
{
......@@ -98,6 +100,105 @@ class PerformanceInfo extends Basic
}
/**
* 导出分佣提成明细表
*
* @return string
*/
public function getPerformanceInfoExcel()
{
$where['Obargain.status'] = ['neq',30];
/*开始结束时间*/
if (($this->params['create_time_start'] != NULL) && ($this->params['create_time_end'] != NULL)) {
$where['Obargain.create_time'] = ['between time', [$this->params['create_time_start']. ' 00:00:00', $this->params['create_time_end'] . ' 23:59:59']];
}
if ($this->params['shop_type'] != NULL) {
$where['Houses.shop_type'] = $this->params['shop_type'];
}
//todo 成交类型
if ($this->params['trade_type'] != NULL) {
$where['Obargain.trade_type'] = $this->params['trade_type'];
}
//todo 商铺地址
if ($this->params['landmark'] != NULL) {
$where['Houses.landmark'] = ['like', '%'.$this->params['landmark'].'%'];
}
//todo 商铺编号
if ($this->params['house_id'] != NULL) {
$where['Houses.id'] = $this->params['house_id'];
}
//todo 部门
if ($this->params['district_id'] != NULL) {
$where['District.id'] = $this->params['district_id'] ;
}
//todo 门店
if ($this->params['store_id'] != NULL) {
$where['Store.id'] = $this->params['store_id'] ;
}
//todo 姓名
if ($this->params['name'] != NULL) {
$where['Agent.name'] = ['like', '%'.$this->params['name'].'%'];
}
//todo 手机号
if ($this->params['phone'] != NULL) {
$where['Agent.phone'] = ['like', '%'.$this->params['phone'].'%'];
}
$field = 'Obargain.create_time,';
$field .= 'Obargain.trade_type,';
$field .= 'Houses.landmark,';
$field .= 'Oorder.house_id,';
$field .= 'Agent.name,';
$field .= 'Agent.phone,';
$field .= 'Store.store_name,';
$field .= 'District.district_name,';
$field .= 'Obargain.scale,';
$field .= 'Obargain.scale_fee,';
$field .= 'Obargain.practical_fee';
$return = $this->oBargainModel->performancelInfoExcel($where,$field);
if(!$return){
return $this->response("101","Session读取失败");
}
$export = new ExportExcelUntil();
foreach ($return as $key => $v) {
$e_data_old['create_time'] = $v['performance_total'];//提交时间
switch ($v['trade_type']) {//成交类型;
case 10:
$e_data_old['trade_type'] = "出租";
case 20:
$e_data_old['trade_type'] = "增佣";
case 30:
$e_data_old['trade_type'] = "代理";
default:
$e_data_old['trade_type'] = "好处费";
}
$e_data_old['landmark'] = $v['landmark'];//商铺地址
$e_data_old['id'] = $v['id'];//商铺编号
$e_data_old['name_phone'] = $v['name'].'-'.$v['phone'];//分佣提成方
$e_data_old['district_name'] = $v['district_name'].'-'.$v['store_name'];//所属部门
$e_data_old['scale'] = $v['scale'];//分佣比例
$e_data_old['scale_fee'] = $v['scale_fee'];//应收佣金
$e_data_old['practical_fee'] = $v['practical_fee'];//实收佣金
$e_data_new[]=$e_data_old;
}
$title = [ '提交时间', '成交类型', '商铺地址', '商铺编号', '分佣提成方', '所属部门门店', '分佣比例', '应收佣金', '实收佣金' ];
$export->exportTable('业绩明细', $e_data_new, 10, '业绩明细表', $title);
return '';
}
}
\ No newline at end of file
......@@ -1298,6 +1298,24 @@ class OBargainModel extends Model
return $result;
}
public function performancelInfoExcel($where, $filed)
{
$result = $this->db_
->field($filed)
->alias("Obargain")
->join("o_report Oreport", "Obargain.report_id = Oreport.id", "left")
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
->join('a_store Store', 'Agent.store_id = Store.id', 'left')
->join('a_district District', 'Agent.district_id = District.id', 'left')
->where($where)
->order("Obargain.create_time desc")
->select();
// echo $this->db_->getLastSql();
return $result;
}
/**
* @param $where
* @param $filed
......
......@@ -247,6 +247,7 @@ Route::group('index', [
'deleteReceiptImg' => [ 'index/Collection/deleteReceiptImg', [ 'method' => 'post|get' ] ],//删除收款图片
'receiptImgList' => [ 'index/Collection/receiptImgList', [ 'method' => 'post|get' ] ],//收款列表-收款图片列表
'performanceInfo' => [ 'index/PerformanceInfo/performanceInfo', [ 'method' => 'post|get' ] ],//业绩明细
'getPerformanceInfoExcel' => [ 'index/PerformanceInfo/getPerformanceInfoExcel', [ 'method' => 'post|get' ] ],//业绩明细
'getTaxesById' => [ 'index/Finance/getTaxesById', [ 'method' => 'POST|GET' ] ], //财务结单
......
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