市场专员业绩管理代码提交

master
zhengyongxing 4 years ago
parent acc45f5911
commit 06bd0bf848

@ -128,8 +128,8 @@ class MarketPercentageController extends ThinkController
// dump(getMarketAdmin());die();
$data = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,
sum(if(develop_type = 1, pay_amount, 0)) performance_revenue,sum(if(develop_type = 2, pay_amount, 0)) appraisal_bonuses")
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,admin_id,
sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses")
->join("left join sys_auth_group_access access on admin_id=access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
->join("left join sys_member member on access.uid=member.uid");
@ -140,15 +140,12 @@ class MarketPercentageController extends ThinkController
->order("pay_time DESC")
->select();
} else {
$data = $data->page($p, $row)
->where($map)
$data = $data->where($map)
->group("admin_id,pay_time")
->order("pay_time DESC")
->select();
}
// var_dump($data);die();
$count = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage")
@ -165,7 +162,7 @@ class MarketPercentageController extends ThinkController
}
$this->checkListOrCountAuthRestMap($map,[]);
// dump($data);die();
$wait_amount = [];
foreach ($data as $key => $value) {
@ -179,6 +176,9 @@ class MarketPercentageController extends ThinkController
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
$data[$key]['start_time'] = date("Y-m-1",strtotime($value['pay_time']));
$data[$key]['end_time'] = date("Y-m-t",strtotime($value['pay_time']));
$market_percentage = json_decode($value['market_percentage'],true);
// $data[$key]['performance_revenue'] = number_format($market_percentage['performance_revenue'], 2, '.', '');
// $data[$key]['appraisal_bonuses'] = number_format($market_percentage['appraisal_bonuses'], 2, '.', '');
@ -198,9 +198,68 @@ class MarketPercentageController extends ThinkController
//应发金额
$data[$key]['extend_commission'] =
number_format($data[$key]['performance_commission'] * ($market_percentage['performance_monthly_ratio']/100)+
$data[$key]['performance_commission'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
$data[$key]['achievement_bonus'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
$month = date("m",strtotime($value['pay_time']));
$yes = date("Y",strtotime($value['pay_time']));
if ($market_percentage['time'] == 1) {
if ($month == '07') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'];
} elseif($month == '10') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
} elseif($month == '04') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
} elseif($month == '01') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'];
}
} elseif($market_percentage['time'] == 2) {
if ($month == '07') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'] +
$wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
} elseif($month == '01') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
$wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
}
} elseif($market_percentage['time'] == 3) {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'01'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'02'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'03'] +
$wait_amount[$value['admin_id'].($yes-1).'-'.'04'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'05'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'06'] +
$wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
$wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
}
//待发金额
$data[$key]['wait_commission'] = number_format($data[$key]['commission'] - $data[$key]['extend_commission'], 2, '.', '');
$wait_amount[$value['admin_id'].$value['pay_time']] = $data[$key]['wait_commission'];
if ($market_percentage['remain_time'] == 1) {
if ($month == '07') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
} elseif($month == '10') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'];
} elseif($month == '04') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'];
} elseif($month == '01') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
}
} elseif($market_percentage['remain_time'] == 2) {
// if ($month == '07') {
// $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'] +
// $wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
// } elseif($month == '01') {
// $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
// $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
// }
} elseif($market_percentage['remain_time'] == 3) {
// $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'01'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'02'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'03'] +
// $wait_amount[$value['admin_id'].($yes-1).'-'.'04'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'05'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'06'] +
// $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
// $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
}
}
if ($_REQUEST['export']) {
@ -219,6 +278,10 @@ class MarketPercentageController extends ThinkController
data2csv($data,'市场结算管理',$title);
}
$arraypage = $p;
$size = $row;//每页显示的记录数
$data = array_slice($data, ($arraypage - 1) * $size, $size);
$this->assign("list_data",$data);
$this->display();
@ -240,7 +303,7 @@ class MarketPercentageController extends ThinkController
$data = M("settleup_marketorder","tab_")
->field("tab_settleup_marketorder.id,pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,nickname,admin_id,
sum(if(develop_type = 1, pay_amount, 0)) performance_revenue,sum(if(develop_type = 2, pay_amount, 0)) appraisal_bonuses")
sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses")
->join("left join sys_auth_group_access access on admin_id=access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
->join("left join sys_member member on access.uid=member.uid");
@ -321,7 +384,7 @@ class MarketPercentageController extends ThinkController
//应发金额
$data[$key]['extend_commission'] =
number_format($data[$key]['performance_commission'] * ($market_percentage['performance_monthly_ratio']/100)+
$data[$key]['performance_commission'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
$data[$key]['achievement_bonus'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
$sum['extend_commission'] += $data[$key]['extend_commission'];
//待发金额
$data[$key]['wait_commission'] = number_format($data[$key]['commission'] - $data[$key]['extend_commission'], 2, '.', '');

@ -453,6 +453,7 @@ class TimingController extends AdminController {
->join("left join tab_promote promote on spend.promote_id = promote.id")
->join("left join tab_promote_company company on promote.company_id = company.id")
->join("left join ({$data}) auth on auth.uid=admin_id")
->where(['develop_type'=>['egt',1]])
->select();
// dump($promote_data);die();

@ -68,7 +68,7 @@
<td class="r table_radio">
<select name="time" class="select_gallery" id="time" style="text-align: center">
<option value="0" <if condition="$data['time'] eq '0'">selected</if>>月</option>
<option value="1" <if condition="$data['time'] eq '1'">selected</if>>季</option>
<option value="1" <if condition="$data['time'] eq '1'">selected</if>></option>
<option value="2" <if condition="$data['time'] eq '2'">selected</if>>半年</option>
<option value="3" <if condition="$data['time'] eq '3'">selected</if>>一年</option>
</select>
@ -108,7 +108,7 @@
<td class="r table_radio">
<select name="remain_time" class="select_gallery" id="remain_time">
<option value="0" <if condition="$data.remain_time eq '0'">selected</if>>月</option>
<option value="1" <if condition="$data.remain_time eq '1'">selected</if>>季</option>
<option value="1" <if condition="$data.remain_time eq '1'">selected</if>></option>
<option value="2" <if condition="$data.remain_time eq '2'">selected</if>>半年</option>
<option value="3" <if condition="$data.remain_time eq '3'">selected</if>>一年</option>
</select>

@ -98,9 +98,9 @@
<th>维护总流水</th>
<th >业绩提成</th>
<th >绩效考核奖金</th>
<th><a href="{:U('FinancePromote/index')}" >当月总提成</a></th>
<th><a href="{:U('MarketPercentage/personMarketStaffSettle')}" >应发金额</a></th>
<th><a href="{:U('MarketPercentage/showBonusList')}" >待发金额</a></th>
<th>当月总提成</th>
<th>应发金额</th>
<th>待发金额</th>
</tr>
</thead>
@ -122,9 +122,9 @@
<td>{$data['appraisal_bonuses']|default='0.00'}</td>
<td>{$data['performance_commission']|default='0.00'}</td>
<td>{$data['achievement_bonus']|default='0.00'}</td>
<td>{$data['commission']|default='0.00'}</td>
<td>{$data['extend_commission']|default='0.00'}</td>
<td>{$data['wait_commission']|default='0.00'}</td>
<td><a href="{:U('FinancePromote/index',array('time_start'=>$data['start_time'],'time_end'=>$data['end_time']))}" >{$data['commission']|default='0.00'}</a></td>
<td><a href="{:U('MarketPercentage/personMarketStaffSettle',array('pay_time'=>$data['pay_time']))}" >{$data['extend_commission']|default='0.00'}</a></td>
<td><a href="{:U('MarketPercentage/showBonusList',array('pay_time'=>$data['pay_time'],'real_name'=>$data['real_name'],'level'=>$data['group_id']))}" >{$data['wait_commission']|default='0.00'}</a></td>
</tr>
</volist>
</notemtpy>

Loading…
Cancel
Save