|
|
@ -1159,23 +1159,12 @@ class CompanyStatementController extends ThinkController
|
|
|
|
// ||$value['statement_begin_time']<=$start_time && $value['statement_end_time'] >= $end_time)
|
|
|
|
// ||$value['statement_begin_time']<=$start_time && $value['statement_end_time'] >= $end_time)
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
$statementInfo = json_decode($value['statement_info'],true);;
|
|
|
|
$statementInfo = json_decode($value['statement_info'],true);;
|
|
|
|
if ($value['company_type'] == 2) {
|
|
|
|
if ($value['company_type'] == 2) {
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($statementInfo as $sk => $sv) {
|
|
|
|
foreach ($statementInfo as $sk => $sv) {
|
|
|
|
$statementInfos = $sv['game_list'];
|
|
|
|
$statementInfos = $sv['game_list'];
|
|
|
|
foreach ($statementInfos as $k => $v) {
|
|
|
|
foreach ($statementInfos as $k => $v) {
|
|
|
|
if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time
|
|
|
|
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time
|
|
|
|
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) {
|
|
|
|
|
|
|
|
if (in_array($v['relation_game_id'], $relation_game_data)) {
|
|
|
|
|
|
|
|
$this->ajaxReturn(['status' => 0, 'data' => [], 'msg' => "《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
foreach ($statementInfo as $k => $v) {
|
|
|
|
|
|
|
|
if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time
|
|
|
|
if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) {
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) {
|
|
|
@ -1185,6 +1174,17 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
foreach ($statementInfo as $k => $v) {
|
|
|
|
|
|
|
|
if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time
|
|
|
|
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time
|
|
|
|
|
|
|
|
||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) {
|
|
|
|
|
|
|
|
if (in_array($v['relation_game_id'], $relation_game_data)) {
|
|
|
|
|
|
|
|
$this->ajaxReturn(['status' => 0, 'data' => [], 'msg' => "《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
@ -1207,7 +1207,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
$radioMap['_string'] = "start_time < {$end_time}";
|
|
|
|
$radioMap['_string'] = "start_time < {$end_time}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$map['tab_spend.pay_status'] = 1;
|
|
|
|
$map['tab_spend.pay_status'] = 1;
|
|
|
|
$map['pay_way'] = ['egt',0];
|
|
|
|
// $map['pay_way'] = ['egt',0];
|
|
|
|
|
|
|
|
|
|
|
|
$data = M("spend","tab_")
|
|
|
|
$data = M("spend","tab_")
|
|
|
|
->field("pay_amount,relation_game_id,relation_game_name,payed_time")
|
|
|
|
->field("pay_amount,relation_game_id,relation_game_name,payed_time")
|
|
|
@ -1257,81 +1257,92 @@ class CompanyStatementController extends ThinkController
|
|
|
|
->where(['relation_game_id'=>['in',$rvalue]])
|
|
|
|
->where(['relation_game_id'=>['in',$rvalue]])
|
|
|
|
->find();
|
|
|
|
->find();
|
|
|
|
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $rvalue;
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $rvalue;
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $game_name['relation_game_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $game_name['relation_game_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$rvalue]['ratio']?$handleRadioMould[$rvalue]['ratio']:0;
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$rvalue]['ratio']?$handleRadioMould[$rvalue]['ratio']:0;
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$rvalue]['turnover_ratio'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$rvalue]['turnover_ratio'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($radioData as $key => $value) {
|
|
|
|
foreach ($relation_game_data as $rk => $rv) {
|
|
|
|
|
|
|
|
unset($radioMap['tab_company_game_ratio.relation_game_id']);
|
|
|
|
|
|
|
|
$radioMap['tab_company_game_ratio.relation_game_id'] = $rv;
|
|
|
|
|
|
|
|
$radioGameRatios = M("company_game_ratio","tab_")
|
|
|
|
|
|
|
|
->field("tab_company_game_ratio.*,game.relation_game_name")
|
|
|
|
|
|
|
|
->join("left join ({$game_data}) game on tab_company_game_ratio.relation_game_id=game.relation_game_id")
|
|
|
|
|
|
|
|
->where($radioMap)
|
|
|
|
|
|
|
|
->order("begin_time ASC")
|
|
|
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|
if (strtotime(I('time_start')) <= $value['begin_time']) {
|
|
|
|
foreach ($radioGameRatios as $key => $value) {
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = $value['begin_time'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = $value['end_time'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $value['ratio'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $value['turnover_ratio'];
|
|
|
|
|
|
|
|
$num++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果结算时间小于比例开始时间
|
|
|
|
|
|
|
|
if ($key == 0) {
|
|
|
|
|
|
|
|
if (strtotime(I('time_start')) < $value['begin_time']) {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = $value['begin_time']-1;
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (strtotime(I('time_start')) <= $value['begin_time']) {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = $value['begin_time'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = $value['end_time'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $value['ratio'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $value['turnover_ratio'];
|
|
|
|
|
|
|
|
$num++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果结算时间小于比例开始时间
|
|
|
|
|
|
|
|
if ($key == 0) {
|
|
|
|
|
|
|
|
if (strtotime(I('time_start')) < $value['begin_time']) {
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = $value['begin_time']-1;
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
|
|
|
|
|
|
|
|
|
|
|
|
if(!$radioData[$key+1]) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
|
|
|
|
if(!$radioData[$key+1]) {
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end'))-86399;
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end'))-86399;
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
|
|
|
|
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果结算时间中有时间段间隔
|
|
|
|
//如果结算时间中有时间段间隔
|
|
|
|
if ($radioData[$key+1]) {
|
|
|
|
if ($radioData[$key+1]) {
|
|
|
|
if ($radioData[$key+1]['begin_time'] != ($value['end_time']+1)) {
|
|
|
|
if ($radioData[$key+1]['begin_time'] != ($value['end_time']+1)&&$value['end_time']!=0) {
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
|
|
|
|
$handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = $radioData[$key+1]['begin_time'] - 1;
|
|
|
|
$handleData[$_REQUEST['company_id']]['end_time'][] = $radioData[$key+1]['begin_time'] - 1;
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$gameRatioMould['ratio']:0;
|
|
|
|
$handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$gameRatioMould['ratio']:0;
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
|
|
|
|
$handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// dump($handleData);die();
|
|
|
|
|
|
|
|
foreach ($handleData as $key => $value) {
|
|
|
|
foreach ($handleData as $key => $value) {
|
|
|
|
$handleData[$key]['row'] = 0;
|
|
|
|
$handleData[$key]['row'] = 0;
|
|
|
|
$timeArr = $value['begin_time'];
|
|
|
|
$timeArr = $value['begin_time'];
|
|
|
@ -1495,7 +1506,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
$amount_time['promote_id'] = '-1';
|
|
|
|
$amount_time['promote_id'] = '-1';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$amount_time['tab_spend.pay_status'] = 1;
|
|
|
|
$amount_time['tab_spend.pay_status'] = 1;
|
|
|
|
$amount_time['pay_way'] = ['egt',0];
|
|
|
|
// $amount_time['pay_way'] = ['egt',0];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($statement_info as $k => $v) {
|
|
|
|
foreach ($statement_info as $k => $v) {
|
|
|
|
|
|
|
|
|
|
|
|