2.28号功能提交

master
zhengyongxing 4 years ago
parent c2bfcd39b6
commit 4425750972

@ -3143,3 +3143,39 @@ function getOrderHtml($field, $orderField, $orderType)
return '<img src="/Public/Admin/images/paixu.png" width="13px">';
}
}
function array_repeat($array,$keyid="id",$desc=false)
{
$array = array_values($array);
//倒叙排列数
if($desc)
{
$array = array_rsort($array,true);
}
//提取需要判断的项目变成一维数组
$a = array_column($array,$keyid);
//去除一维数组重复值
$a = array_unique($a);
//提取二维数组项目值
foreach($array[0] AS $key=>$value)
{
$akey[] = $key;
}
//重新拼接二维数组
foreach($akey AS $key=>$value)
{
$b = array_column($array,$value);
foreach($a AS $key2=>$value2)
{
$c[$key2][$value] = $b[$key2];
}
}
if($desc)
{
$c = array_rsort($c,true);
}
return $c;
}

@ -128,6 +128,12 @@ return array(
"tab_market_altogether",
"tab_cmd_tasks",
"tab_operation_log",
"sys_action_log"
"sys_action_log",
"tab_partner",
"tab_promote_company",
"tab_game",
"tab_reward_detail",
"tab_reward_record",
"tab_promote"
]
);

@ -228,6 +228,8 @@ class CompanyStatementController extends ThinkController
$this->assign('_page', $page);
}
$this->assign("IS_SUBSITE",IS_SUBSITE);
$this->assign('data',$data);
$this->assign('count',$count);
$this->assign('CompanyType',$this->CompanyType);
@ -417,6 +419,503 @@ class CompanyStatementController extends ThinkController
));
}
public function checkWmStatement() {
$ids = $_POST['id'];
if (!$ids) {
$this->ajaxReturn(["status"=>1]);
}
$count = SM("company_statement","tab_")
->where("id in({$ids})")
->group("company_type,withdraw_type")
->select();
if (count($count)>1) {
$this->ajaxReturn(["status"=>0,"msg"=>""]);
} else {
$this->ajaxReturn(["status"=>1]);
}
}
public function poolWmStatement() {
$ids = $_GET['id'];
$data = SM("company_statement","tab_")
->where("id in({$ids})")
->select();
$list = [];
$amount_data = [];
$company_data = SM("promote_company","tab_")->where(["status"=>1,"company_type"=>$data[0]['company_type']])->select();
//游戏数据整合
foreach ($data as $key => $value) {
$promote_data = SM("promote","tab_")->field("id")->where(['company_id'=>$value['company_id']])->select();
$promote_ids = array_column($promote_data,"id");
$statement_info = json_decode($value['statement_info'],true);
// dump($statement_info);
if ($value['company_type'] == 1) {
$list = array_merge($list,$statement_info);
foreach ($statement_info as $k => $v) {
$statement_begin_time = strtotime(str_replace(".", "-", $v['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $v['statement_end_time'])) + 86399;
if (!$amount_data['statement_begin_time'] || $amount_data['statement_begin_time'] > $v['statement_begin_time']) {
$amount_data['statement_begin_time'] = $v['statement_begin_time'];
}
if (!$amount_data['statement_end_time'] || $amount_data['statement_end_time'] < $v['statement_end_time']) {
$amount_data['statement_end_time'] = $v['statement_end_time'];
}
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids],
'fgame_name' => ['like', "%{$v['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($v['game_name'] != '罚款' && $v['game_name'] != '奖励') {
$amount_data['pay_amount'] += $v["pay_amount"];
}
if ($v['game_name'] == '罚款') {
$amount_data['sum_money'] -= $v["sum_money"];
} else {
$amount_data['sum_money'] += $v["sum_money"];
}
$amount_data['user_newcount'] += count($user_data);
}
} elseif($value['company_type'] == 2) {
foreach ($statement_info as $k => $v) {
$game_list = $v["game_list"];
$list = array_merge($list,$game_list);
foreach ($game_list as $gk=>$gv) {
$statement_begin_time = strtotime(str_replace(".", "-", $gv['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $gv['statement_end_time'])) + 86399;
if (!$amount_data['statement_begin_time'] || $amount_data['statement_begin_time'] > $gv['statement_begin_time']) {
$amount_data['statement_begin_time'] = $gv['statement_begin_time'];
}
if (!$amount_data['statement_end_time'] || $amount_data['statement_end_time'] < $gv['statement_end_time']) {
$amount_data['statement_end_time'] = $gv['statement_end_time'];
}
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids],
'fgame_name' => ['like', "%{$gv['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($gv['game_name'] != '罚款' && $gv['game_name'] != '奖励') {
$amount_data['pay_amount'] += $gv["pay_amount"];
}
if ($gv['game_name'] == '罚款') {
$amount_data['sum_money'] -= $gv["sum_money"];
} else {
$amount_data['sum_money'] += $gv["sum_money"];
}
$amount_data['user_newcount'] += count($user_data);
}
}
}
}
$list = array_repeat($list,"game_name");
$this->assign("company_data",$company_data);
$this->assign("row",count($list));
$this->assign("data",$list);
$this->assign("amount_data",$amount_data);
$this->assign("js_amount_data",json_encode($amount_data));
$this->assign("js_data",json_encode($list));
$this->display();
}
//子系统列表
public function showCpStatementList() {
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map['company_belong'] = 9;
if ($_REQUEST["year"]) {
$start = strtotime($_REQUEST["year"]."-01-01");
$end = strtotime(date("Y-m-t",strtotime($_REQUEST["year"]."-12"))) + 86399;
$map["statement_begin_time"] = ["between",[$start,$end]];
}
$data = SM("company_statement","tab_")
->field("id,company_id,company_name,sum(statement_money) statement_money,sum(platform_amount) platform_amount")
->where($map)
->group("company_id")
->page($page, $row)
->select();
$count = SM("company_statement","tab_")
->field("id")
->where($map)
->group("company_id")
->select();
$count = count($count);
$page = set_pagination($count, $row,$params);
if($page) {
$this->assign('_page', $page);
}
A("FinancialSummary")->getYearList();
$this->assign("data",$data);
$this->display();
}
//上游公司
public function showCpStatementView() {
$company_id = explode(",",$_REQUEST["company_id"]);
$time = $_REQUEST["time"];
$assign_data = [];
$sum = [];
foreach ($company_id as $ckey => $cvalue) {
$use_data = [
"01"=>["time"=>"01"],
"02"=>["time"=>"02"],
"03"=>["time"=>"03"],
"04"=>["time"=>"04"],
"05"=>["time"=>"05"],
"06"=>["time"=>"06"],
"07"=>["time"=>"07"],
"08"=>["time"=>"08"],
"09"=>["time"=>"09"],
"10"=>["time"=>"10"],
"11"=>["time"=>"11"],
"12"=>["time"=>"12"],
];
$map["company_id"] = $cvalue;
$map['company_belong'] = 9;
$data = SM("company_statement","tab_")
->field("id,company_id,company_name,FROM_UNIXTIME(statement_begin_time,'%m') time,statement_money,platform_amount,statement_info")
->where($map)
->select();
$row = 0;
foreach($data as $key => $value) {
$data[$key]['statement_info'] = json_decode($value['statement_info'],true);
$statement_info = $data[$key]['statement_info'];
$data[$key]['row'] = count($data[$key]['statement_info']);
$row += $data[$key]['row'];
foreach ($statement_info as $k => $v) {
$statement_info[$k]['sum_amount'] = $v["platform_money"] + $v["aggregate_money"] ;
$real_statement_amount
= number_format($v['platform_money']*(1-$v['promote_ratio']/100)*($v['ratio']/100)*(1-$v["fax_ratio"]/100),2,'.','');;
$statement_info[$k]['other_amount'] = number_format($v["sum_money"] - $real_statement_amount,2,'.','');
$sum[$ckey]["ratio"] += $v["ratio"];
$sum[$ckey]["promote_ratio"] += $v["promote_ratio"];
$sum[$ckey]["fax_ratio"] += $v["fax_ratio"];
$statement_info[$k]['ratio'] = $v["ratio"]."%";
$statement_info[$k]['promote_ratio'] = $v["promote_ratio"]."%";
$statement_info[$k]['fax_ratio'] = $v["fax_ratio"]."%";
$sum[$ckey]["platform_money"] += $v["platform_money"];
$sum[$ckey]["aggregate_money"] += $v["aggregate_money"];
$sum[$ckey]["sum_amount"] += $statement_info[$k]["sum_amount"];
$sum[$ckey]["other_amount"] += $statement_info[$k]["other_amount"];
if ($v["statement_type"] == 2) {
$sum[$ckey]["sum_money"] -= $v["sum_money"];
} else {
$sum[$ckey]["sum_money"] += $v["sum_money"];
}
}
$data[$key]["statement_info"] = $statement_info;
$use_data[$value['time']] = $data[$key];
}
$sum[$ckey]["ratio"] = number_format($sum[$ckey]["ratio"]/$row,2,'.','')."%";
$sum[$ckey]["promote_ratio"] = number_format($sum[$ckey]["promote_ratio"]/$row,2,'.','')."%";
$sum[$ckey]["fax_ratio"] = number_format($sum[$ckey]["fax_ratio"]/$row,2,'.','')."%";
$assign_data[] = array_values($use_data);
}
$is_export= false;
if (isset($_REQUEST['is_export']) && $_REQUEST['is_export']==1){
$is_export = true;
}
$this->assign("title","联运结算单汇总上游导出");
$this->assign("is_export",$is_export);
$this->assign("sum",$sum);
$this->assign("time",$time);
$this->assign("data",$assign_data);
$this->display();
}
public function checkCompanyData() {
$statement_id = $_REQUEST["statement_id"];
$company_id = $_REQUEST["company_id"];
$begin_time = strtotime(str_replace(".","-",$_REQUEST["begin_time"]));
$end_time = strtotime(str_replace(".","-",$_REQUEST["end_time"]))+86399;
if (!$company_id) {
$data = [];
} else {
$data = SM("company_statement","tab_")
->where("statement_begin_time>={$begin_time} and statement_end_time<={$end_time} and company_id={$company_id} and id not in({$statement_id}) and (verify_status=1 or verify_status=-2)")
->select();
}
$list = [];
$amount_data = json_decode($_REQUEST["amount_data"],true);
//游戏数据整合
foreach ($data as $key => $value) {
$promote_data = SM("promote", "tab_")->field("id")->where(['company_id' => $value['company_id']])->select();
$promote_ids = array_column($promote_data, "id");
$statement_info = json_decode($value['statement_info'], true);
if ($value['company_type'] == 1) {
$list = array_merge($list, $statement_info);
foreach ($statement_info as $k => $v) {
$statement_begin_time = strtotime(str_replace(".", "-", $v['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $v['statement_end_time'])) + 86399;
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids?$promote_ids:0],
'fgame_name' => ['like', "%{$v['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($v['game_name'] != '罚款' && $v['game_name'] != '奖励') {
$amount_data['pay_amount'] += $v["pay_amount"];
}
if ($v['game_name'] == '罚款') {
$amount_data['sum_money'] -= $v["sum_money"];
} else {
$amount_data['sum_money'] += $v["sum_money"];
}
$amount_data['user_newcount'] += count($user_data);
}
} elseif($value['company_type'] == 2) {
foreach ($statement_info as $k => $v) {
$game_list = $v["game_list"];
$list = array_merge($list, $game_list);
foreach ($game_list as $gk=>$gv) {
$statement_begin_time = strtotime(str_replace(".", "-", $gv['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $gv['statement_end_time'])) + 86399;
if (!$amount_data['statement_begin_time'] || $amount_data['statement_begin_time'] > $gv['statement_begin_time']) {
$amount_data['statement_begin_time'] = $gv['statement_begin_time'];
}
if (!$amount_data['statement_end_time'] || $amount_data['statement_end_time'] < $gv['statement_end_time']) {
$amount_data['statement_end_time'] = $gv['statement_end_time'];
}
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids?$promote_ids:0],
'fgame_name' => ['like', "%{$gv['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($gv['game_name'] != '罚款' && $gv['game_name'] != '奖励') {
$amount_data['pay_amount'] += floatval($gv["pay_amount"]);
}
if ($gv['game_name'] == '罚款') {
$amount_data['sum_money'] -= floatval($gv["sum_money"]);
} else {
$amount_data['sum_money'] += floatval($gv["sum_money"]);
}
$amount_data['user_newcount'] += count($user_data);
}
}
}
}
if ($list) {
$list = array_repeat($list,"game_name");
}
$amount_data['pay_amount'] = number_format($amount_data['pay_amount'],2,'.','');
$amount_data['sum_money'] = number_format($amount_data['sum_money'],2,'.','');
$this->ajaxReturn(['list'=>$list,'amount_data'=>$amount_data,"row"=>count($list),"status"=>1,"other_id"=>implode(",",array_column($data,"id"))]);
}
public function saveCompanyData() {
$list = array_merge(json_decode($_POST['list'],true),json_decode($_POST['other_list'],true));
$amount_data = json_decode($_POST['amount_data'],true);
$company_id = $_POST["company_id"];
$company_data = M("company_relation","tab_")->where("(first_company_id={$company_id} and first_company_type=2) or (second_company_id = {$company_id} and second_company_type=2)")->find();
$promote_company = [];
$partner = [];
if ($company_data['first_company_type'] == 2) {
$promote_company = M("promote_company","tab_")->where(['id'=>$company_data['first_company_id']])->find();
$partner = M("company_info","tab_")->where(['id'=>$company_data['second_company_id']])->find();
}else if($company_data['second_company_type'] == 2) {
$promote_company = M("promote_company","tab_")->where(['id'=>$company_data['second_company_id']])->find();
$partner = M("company_info","tab_")->where(['id'=>$company_data['first_company_id']])->find();
}
$company_info['id']=$promote_company['id'];
$company_info['partner']=$promote_company['company_name'];
$company_info['link_man']=$promote_company['settlement_contact'];
$company_info['phone']=$promote_company['contact_phone'];
$company_info['address']=$promote_company['address'];
$company_info['bank_card']=$promote_company['bank_card'];
$company_info['bank_cardname']=$promote_company['bank_cardname'];
$company_info['bank_name']=$promote_company['bank_name'];
$company_info['bank_address']=$promote_company['bank_address'];
$company_info['ali_user']=$promote_company['ali_user'];
$company_info['ali_account']=$promote_company['ali_account'];
$company_info['is_payment'] = $company_data['is_payment'];
$partner_info['id'] = $partner['id'];
$partner_info['partner'] = $partner['partner'];
$partner_info['link_man'] = $partner['link_man'];
$partner_info['link_phone'] = $partner['link_phone'];
$partner_info['invoice_type'] = $partner['invoice_type'];
$partner_info['invoice_item'] = $partner['invoice_item'];
$partner_info['address'] = $partner['address'];
if ($company_data['first_company_type'] == 2) {
$first_company_info = $company_info;
$second_company_info = $partner_info;
}else if($company_data['second_company_type'] == 2) {
$first_company_info = $partner_info;
$second_company_info = $company_info;
}
$save['company_id'] = $company_id;
$save['company_name'] = $promote_company["company_name"];
$save['statement_info'] = json_encode($list);
$save['first_party_info'] = json_encode($first_company_info);
$save['second_party_info'] = json_encode($second_company_info);
$save['statement_begin_time'] = strtotime(str_replace(".", "-", $amount_data['statement_begin_time']));
$save['statement_end_time'] = strtotime(str_replace(".", "-", $amount_data['statement_end_time'])) + 86399;
$save['pay_amount'] = $amount_data['pay_amount'];
$save['sum_money'] = $amount_data['sum_money']-($amount_data['sum_money']*$_POST['fax_ratio']/100);
$save['user_newcount'] = $amount_data['user_newcount'];
$save['fax_ratio'] = $_POST['fax_ratio'];
$is_success = SM("new_company_statement_info","tab_")->add($save);
$pool['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
$pool['statement_ids'] = $_POST['id'].','.$_POST['other_id'];
$pool['withdraw_type'] = 1;
$pool['wm_statement_ids'] = $is_success;
$pool['statement_begin_time'] = strtotime(str_replace(".", "-", $amount_data['statement_begin_time']));
$pool['statement_end_time'] = strtotime(str_replace(".", "-", $amount_data['statement_end_time'])) + 86399;
$pool['statement_money'] = $save['sum_money'];
$pool['pay_amount'] = $save['pay_amount'];
$pool['platform_amount'] = $save['pay_amount'];
$pool['company_type'] = 2;
$pool['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]);
SM("company_statement_pool","tab_")->add($pool);
if ($_POST['other_id']) {
$statement_id = $_POST['id'].','.$_POST['other_id'];
} else {
$statement_id = $_POST['id'];
}
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$statement_id})")->select();
foreach ($dbres as $k => $v) {
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log']['pool_user']=$this->admininfo["username"];
$v['verify_log']['pool_time']=date("Y.m.d H:i:s");
$v['verify_log']['pool_num']=$pool['statement_num'];
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=2;
$v['op_time']=time();
SM("company_statement","tab_")->save($v);
}
if ($is_success) {
$this->ajaxReturn(['status'=>1,'msg'=>'操作成功']);
} else {
$this->ajaxReturn(['status'=>0,'msg'=>'操作失败']);
}
}
//审批通过
public function adminAgree(){
$this->setVerifyStatus(0,1,"admin");

@ -184,7 +184,12 @@ class CompanyStatementPoolController extends ThinkController
$v["payment"] = '--';
}
$v['oplist'] = $this->OpAuth($v);
// $v['oplist'] = $this->OpAuth($v);
if (IS_SUBSITE) {
$v['oplist'] = $this->OpWmAuth($v);
} else {
$v['oplist'] = $this->OpAuth($v);
}
}
// dump($data);die();
$count = $this->DBModel->field("count(id) count,SUM(statement_money) as statement_money,SUM(lack_statement_money) lack_statement_money")->where($map)->find();
@ -212,6 +217,7 @@ class CompanyStatementPoolController extends ThinkController
$this->error('参数错误');
}
$id = $_REQUEST['id'];
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
@ -220,7 +226,7 @@ class CompanyStatementPoolController extends ThinkController
$infolist = SM("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select();
//获取母单
$pool_info = SM("company_statement_pool","tab_")
->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time,verify_log')->where("id={$id}")->find();
->field('wm_statement_ids,statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time,verify_log')->where("id={$id}")->find();
if(!empty($pool_info['create_lack_ids'])){
$l_ids = $pool_info['create_lack_ids'];
$lack_info = SM("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select();
@ -258,6 +264,12 @@ class CompanyStatementPoolController extends ThinkController
$pool_info["verify"] = '--';
}
if(true) {
$this->viewWmStatement($pool_info['wm_statement_ids'],$is_export);
die();
}
if(isset($pool_info['verify_log']['payment_user'])){
if($pool_info['verify_status'] == -2){
@ -296,6 +308,133 @@ class CompanyStatementPoolController extends ThinkController
}
public function exportWmStatement($wm_statement_ids = 0) {
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel2007');
//设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/wmStatement.xlsx");
$data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find();
$list = json_decode($data['statement_info'],true);
$statement_begin_time = date("Y-m-d",$data['statement_begin_time']);
$statement_end_time = date("Y-m-d",$data['statement_end_time']);
$amount_data['pay_amount'] = $data['pay_amount'];
$amount_data['user_newcount'] = $data['user_newcount'];
$amount_data['fax_ratio'] = $data['fax_ratio'];
$amount_data['sum_money'] = $data['sum_money'];
$first_party_info = json_decode($data['first_party_info'],true);
$second_party_info = json_decode($data['second_party_info'],true);
$objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单\n{$statement_begin_time}-{$statement_end_time}");
$line = 3;
foreach ($list as $key => $value) {
$objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1);
$objPHPExcel->getActiveSheet()->removeConditionalStyles();
$objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['statement_begin_time'].'-'.$value['statement_end_time']);
$objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $value['game_name']);
$line++;
}
$objPHPExcel->getActiveSheet()->setCellValue('C3', $amount_data['pay_amount']);
$objPHPExcel->getActiveSheet()->setCellValue('D3', $amount_data['user_newcount']);
$objPHPExcel->getActiveSheet()->setCellValue('E3', $amount_data['fax_ratio'])."%";
$objPHPExcel->getActiveSheet()->setCellValue('F3', $amount_data['sum_money']);
$tline = $line-1;
$objPHPExcel->getActiveSheet()->mergeCells("C3:C{$tline}")->mergeCells("D3:D{$tline}")->mergeCells("E3:E{$tline}")->mergeCells("F3:F{$tline}");
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line), convertAmountToCn($amount_data['sum_money']));
//甲方信息
$objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+3), $first_party_info['partner']);//甲方
$objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+4), $first_party_info['link_man']);//联系人
$objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+5), $first_party_info['link_phone']."\t");//联系电话
$objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+6), $first_party_info['invoice_item']);//开票项目
$objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+7), $first_party_info['invoice_type']);//发票类型
$objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+8), $first_party_info['address']);//发票类型
//乙方信息
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+3), $second_party_info['partner']);//乙方
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+4), $second_party_info['link_man']);//联系人
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+5), $second_party_info['phone']."\t");//联系电话
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+6), $second_party_info['address']);//邮寄地址
if ($second_party_info['is_payment'] != 1) {
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+8), $second_party_info['bank_address']);//户名
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+9), $second_party_info['bank_card']."\t");//银行账号
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+10), $second_party_info['bank_name']);//开户行
} else {
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+8), $second_party_info['ali_user']);//户名
$objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+9), $second_party_info['ali_account']."\t");//银行账号
}
$fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}";
// dd($fileName);
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
public function viewWmStatement($wm_statement_ids = '',$is_export=0) {
if (!$wm_statement_ids) {
$this->error('参数错误');
}
if ($is_export) {
$this->exportWmStatement($wm_statement_ids);
}
$data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find();
$list = json_decode($data['statement_info'],true);
$statement_begin_time = date("Y-m-d",$data['statement_begin_time']);
$statement_end_time = date("Y-m-d",$data['statement_end_time']);
$amount_data['pay_amount'] = $data['pay_amount'];
$amount_data['user_newcount'] = $data['user_newcount'];
$amount_data['fax_ratio'] = $data['fax_ratio'];
$amount_data['sum_money'] = $data['sum_money'];
$first_party_info = json_decode($data['first_party_info'],true);
$second_party_info = json_decode($data['second_party_info'],true);
$this->assign("list",$list);
$this->assign("row",count($list));
$this->assign("company_name",$data['company_name']);
$this->assign("statement_begin_time",$statement_begin_time);
$this->assign("statement_end_time",$statement_end_time);
$this->assign("amount_data",$amount_data);
$this->assign("first_party_info",$first_party_info);
$this->assign("second_party_info",$second_party_info);
$this->display("poolWmStatement");
}
//查看
public function viewUnPaymentPool()
{
@ -310,7 +449,7 @@ class CompanyStatementPoolController extends ThinkController
//获取基本信息
$infolist = SM("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}' and pay_status!=1")->select();
//获取母单
$pool_info = SM("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time')->where("id={$id}")->find();
$pool_info = SM("company_statement_pool","tab_")->field('wm_statement_ids,statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time')->where("id={$id}")->find();
// if(!empty($pool_info['create_lack_ids'])){
// $l_ids = $pool_info['create_lack_ids'];
// $lack_info = SM("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select();
@ -323,6 +462,7 @@ class CompanyStatementPoolController extends ThinkController
$this->assign("title",$statement_num);
$this->assign("pool_status",$pool_info['verify_status']);
$this->assign("is_payment",$pool_info['is_payment']);
if($infolist[0]['company_type'] == 3){
//上游
$this->viewCpPool($infolist,$is_export);
@ -335,7 +475,6 @@ class CompanyStatementPoolController extends ThinkController
}
public function editPool() {
if(!isset($_REQUEST['id'])){
$this->error('参数错误');
@ -1880,9 +2019,14 @@ class CompanyStatementPoolController extends ThinkController
public function cancelPool(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
//获取基础信息
$db_res = $this->DBModel->where("id='{$id}'")->find();
if (IS_SUBSITE) {
$this->cancelWmCompanyPool($db_res);
}
$is_qz = (substr($db_res['statement_num'],0,2) == "QZ" ? true :false); //强制汇总的都允许回退
if($is_qz){
//强制汇总回退
@ -1913,6 +2057,52 @@ class CompanyStatementPoolController extends ThinkController
}
}
public function cancelWmCompanyPool($info)
{
if(in_array($info['verify_status'],[3,4])) return;//有打款就不允许回退
$sids = $info['statement_ids'];
$wm_statement_ids = $info['wm_statement_ids'];
SM()->startTrans();//事务
//删除info
$infores = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->delete();
if($infores === false){
SM()->rollback();
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
}
//删除自己
$poolres = $this->DBModel->where("id = {$info['id']}")->delete();
if($poolres === false){
SM()->rollback();
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
}
//修改结算单信息
$sids = array_filter(explode(",",$sids));
$st_res = SM("company_statement","tab_")->field("id,verify_status,verify_log")->where(["id"=>['in',$sids]])->select();
foreach($st_res as $k=>&$v){
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log']['pool_user']=$this->admininfo["username"];
$v['verify_log']['pool_time']=date("Y.m.d H:i:s");
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=-2;
$stres = SM("company_statement","tab_")->save($v);
if($stres === false){
SM()->rollback();
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
}
}
SM()->commit();
$this->ajaxReturn(array(
'status' => 1,
"info"=>"撤销汇总成功"
));
}
/**
* 重算 先全删再进行二次生成
*/
@ -2041,7 +2231,103 @@ class CompanyStatementPoolController extends ThinkController
));
}
public function OpWmAuth($info)
{
$id = $info['id'];
$img = $info['ext_file'];
$remark = $info['remark'];
$create_lack_ids = $info['create_lack_ids'];
$is_qz = (substr($info['statement_num'],0,2) == "QZ" ? true :false); //强制汇总的都允许回退
//原始列表
$opBtn = [
"viewPool"=>"<a class='confirm viewPool' data-id='{$id}'>查看</a>",
"editPool"=>"<a class='confirm editPool' data-id='{$id}'>编辑</a>",
"editSpecialPuPool"=>"<a class='confirm editSpecialPuPool' data-id='{$id}'>编辑</a>",
"addRemark"=>"<a class='confirm addRemark' data-id='{$id}'>新增备注</a>",
"editRemark"=>"<a class='confirm editRemark' data-remark='{$remark}' data-id='{$id}'>修改备注</a>",
"viewRemark"=>"<a class='confirm viewRemark' data-remark='{$remark}' data-id='{$id}'>查看备注</a>",
"uploadVoucher"=>"<a class='confirm uploadVoucher' data-id='{$id}'>上传凭证</a>",
"viewVoucher"=>"<a class='confirm viewVoucher' data-img='{$img}' data-id='{$id}'>查看凭证</a>",
"editVoucher"=>" <a class='confirm editVoucher' data-id='{$id}'>编辑凭证</a>",
"setUlPayment"=>"<a class='confirm setUlPayment' data-id='{$id}'>线下打款</a>",
"setPayment"=>"<a class='confirm setPayment' data-id='{$id}'>打款信息确认</a>",
"editPayment"=>"<a class='confirm editPayment' data-id='{$id}'>打款信息编辑</a>",
"viewPayment"=>"<a class='confirm viewPayment' data-id='{$id}'>打款详情</a>",
'reCount'=>"<a class='confirm reCount' data-id='{$id}'>重算</a>",
'cancelPool'=>"<a class='confirm cancelPool' data-id='{$id}'>撤销汇总</a>",
];
//操作对应菜单
$optist = [];
switch ($info['verify_status']) {
case '-2':
case '-1':
case '0':
$optist = ["viewPool","cancelPool"];
break;
case '1':
$optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","editPayment","setUlPayment"];
break;
case '2':
$optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher"];
break;
case '3':
$optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","viewPayment"];
break;
case '4':
$optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","viewPayment"];
break;
case '5':
$optist = ["viewPool","cancelPool"];
break;
case '6':
$optist = ["viewPool","cancelPool"];
break;
default:
break;
}
if(empty($info['ext_file'])){
//未上传凭证
$optist = array_diff($optist, ["viewVoucher", "editVoucher"]);
}else{
$optist = array_diff($optist, ["uploadVoucher"]);
}
if($info['is_payment'] == 1){
$optist = array_diff($optist, ["setUlPayment"]);
}else{
$optist = array_diff($optist, ["setPayment","editPayment","viewPayment"]);
}
if(empty($info['remark'])){
//未上传备注
$optist = array_diff($optist, ["editRemark", "viewRemark"]);
}else{
$optist = array_diff($optist, ["addRemark"]);
}
//
$resarr = [];
foreach ($optist as $k => $v) {
if(IS_ROOT){
$resarr[] = $opBtn[$v];
}else{
if(in_array($v,$this->OpAuthList)){
$resarr[] = $opBtn[$v];
}
}
}
return $resarr;
}
public function OpAuth($info)
{

@ -247,9 +247,9 @@ class StatementMangementController extends ThinkController
public function rewardManageList($row = 10, $p = 1)
{
$companys[1] = array_column(M('partner', 'tab_')->field('id, partner as name')->select(), 'name', 'id');
$companys[2] = array_column(M('promote_company', 'tab_')->field('id, company_name as name')->select(), 'name', 'id');
$games = array_column(M('game', 'tab_')->field('relation_game_id, relation_game_name, partner_id')->group('relation_game_id')->select(), null, 'relation_game_id');
$companys[1] = array_column(SM('partner', 'tab_')->field('id, partner as name')->select(), 'name', 'id');
$companys[2] = array_column(SM('promote_company', 'tab_')->field('id, company_name as name')->select(), 'name', 'id');
$games = array_column(SM('game', 'tab_')->field('relation_game_id, relation_game_name, partner_id')->group('relation_game_id')->select(), null, 'relation_game_id');
$map = ' 1=1 ';
$params = $_GET;
@ -323,7 +323,7 @@ class StatementMangementController extends ThinkController
$map .= " and rd.promote_account like ('%{$params['detail_promote_account_input']}%') ";
}
$result = M('reward_record', 'tab_')->alias('r')
$result = SM('reward_record', 'tab_')->alias('r')
->field('r.id')
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')
->where($map)
@ -344,7 +344,7 @@ class StatementMangementController extends ThinkController
$map = '1<>1';
}
$list = M('reward_record', 'tab_')->alias('r')
$list = SM('reward_record', 'tab_')->alias('r')
->field('
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,
rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount
@ -400,9 +400,14 @@ class StatementMangementController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
if(IS_SUBSITE) {
$this->assign("IS_SUBSITE",true);
}
// ksort($record);
$this->assign('list', $record);
$this->assign('promoters', array_column(M('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id'));
$this->assign('promoters', array_column(SM('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id'));
$this->checkListOrCountAuthRestMap($map,[]);
@ -509,7 +514,7 @@ class StatementMangementController extends ThinkController
//dd($settlment_info);
// 更新结算信息
if ($id) {
M('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
SM('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
}
if (!empty($settlment_info[RewardModel::REWARD_TYPE_REWARD]) && !empty($settlment_info[RewardModel::REWARD_TYPE_PUNISH])) {
$data['reward_type'] = RewardModel::REWARD_TYPE_ALL;
@ -529,14 +534,14 @@ class StatementMangementController extends ThinkController
return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
}
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->save($data);
$upt = SM('reward_record', 'tab_')->where(['id'=>$id])->save($data);
if ($upt === false) {
$this->error('保存失败');
} else {
foreach ($settlmentSet as $item) {
M('reward_detail', 'tab_')->add($item);
SM('reward_detail', 'tab_')->add($item);
}
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$data['company_id']])->find();
$companyName = SM('partner','tab_')->field('partner')->where(['id'=>$data['company_id']])->find();
addOperationLog(['op_type'=>1,'key'=>$companyName['partner'].'/'.(($data['reward_type']==1)?'奖励':'惩罚').'/'.$data['money'],'op_name'=>'修改奖惩记录','url'=>U('Query/settlement'),'menu'=>'推广员-结算单管理-奖罚记录管理-修改奖惩记录']);
$this->success('保存成功', U('StatementMangement/rewardManageList'));
@ -550,38 +555,38 @@ class StatementMangementController extends ThinkController
$data['create_time'] = time();
$data['creater_id'] = is_login();
$ins = M('reward_record', 'tab_')->add($data);
$ins = SM('reward_record', 'tab_')->add($data);
$record_id = M('reward_record', 'tab_')->getLastInsID();
$record_id = SM('reward_record', 'tab_')->getLastInsID();
foreach ($settlmentSet as $item) {
$item['record_id'] = $record_id;
M('reward_detail', 'tab_')->add($item);
SM('reward_detail', 'tab_')->add($item);
}
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$data['company_id']])->find();
$companyName = SM('partner','tab_')->field('partner')->where(['id'=>$data['company_id']])->find();
addOperationLog(['op_type'=>0,'key'=>$companyName['partner'].'/'.(($data['reward_type']==1)?'奖励':'惩罚').'/'.$data['money'],'op_name'=>'新增奖惩记录','url'=>U('Query/settlement'),'menu'=>'推广员-结算单管理-奖罚记录管理-新增奖惩记录']);
return $ins ? $this->success('新增成功', U('StatementMangement/rewardManageList')) : $this->error('新增失败');
}
} else {
$games = M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select();
$games = SM('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select();
$this->assign('games', $games);
if ($id) {
if (I('delete')) {
$rewardRecordData = M('reward_record', 'tab_')->where(['id'=>$id])->find();
$rewardRecordData = SM('reward_record', 'tab_')->where(['id'=>$id])->find();
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->delete();
$upt = SM('reward_record', 'tab_')->where(['id'=>$id])->delete();
M('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
SM('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$rewardRecordData['company_id']])->find();
$companyName = SM('partner','tab_')->field('partner')->where(['id'=>$rewardRecordData['company_id']])->find();
addOperationLog(['op_type'=>2,'key'=>$companyName['partner'].'/'.(($rewardRecordData['reward_type']==1)?'奖励':'惩罚').'/'.$rewardRecordData['money'],'op_name'=>'删除奖惩记录','url'=>U('StatementMangement/rewardManageList'),'menu'=>'推广员-结算单管理-奖罚记录管理']);
return $upt ? $this->success('删除成功') : $this->error('删除失败');
} else {
$data = M('reward_record', 'tab_')->where(['id'=>$id])->find();
$data = SM('reward_record', 'tab_')->where(['id'=>$id])->find();
if (!$data) return $this->error("未找到该记录");
$data['confirm_time'] = $data['confirm_time'] ? date('Y-m-d', $data['confirm_time']) : '';
$data['accounts'] = json_decode($data['accounts'], true) ?: [];
@ -592,15 +597,15 @@ class StatementMangementController extends ThinkController
$data['reward_time'] = strtotime(date('Y-m-01'));
}
$details = M('reward_detail', 'tab_')->where(['record_id'=>$id])->select();
$details = SM('reward_detail', 'tab_')->where(['record_id'=>$id])->select();
// 根据type 来合并
foreach ($details as $item) {
$item['info'] = $item;
if (empty($item['company_name']) && $item['company_id']) {
if ($item['company_type'] == RewardModel::COMPANY_TYPE_PARTNER) {
$item['company_name'] = M('partner', 'tab_')->where(['id'=>$item['company_id']])->getField('partner');
$item['company_name'] = SM('partner', 'tab_')->where(['id'=>$item['company_id']])->getField('partner');
} else {
$item['company_name'] = M('promote_company', 'tab_')->where(['id'=>$item['company_id']])->getField('company_name');
$item['company_name'] = SM('promote_company', 'tab_')->where(['id'=>$item['company_id']])->getField('company_name');
}
}
$tmp[$item['type']][] = $item;
@ -613,7 +618,7 @@ class StatementMangementController extends ThinkController
$this->assign('details', $tmp);
$this->assign('data', $data);
$this->assign('promoters', M('promote', 'tab_')->where(['level'=>1])->field('id, nickname')->select());
$this->assign('promoters', SM('promote', 'tab_')->where(['level'=>1])->field('id, nickname')->select());
$this->assign('rewardTypes', RewardModel::$rewardTypes);
$this->assign('settlementTypes', RewardModel::$settlementTypes);
$this->assign('companyTypes', RewardModel::$companyTypes);
@ -679,24 +684,24 @@ class StatementMangementController extends ThinkController
public function rewardManageDetail($id=0)
{
$games = M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select();
$games = SM('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select();
$this->assign('games', $games);
if ($id) {
if (I('delete')) {
$rewardRecordData = M('reward_record', 'tab_')->where(['id'=>$id])->find();
$rewardRecordData = SM('reward_record', 'tab_')->where(['id'=>$id])->find();
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->delete();
$upt = SM('reward_record', 'tab_')->where(['id'=>$id])->delete();
M('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
SM('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$rewardRecordData['company_id']])->find();
$companyName = SM('partner','tab_')->field('partner')->where(['id'=>$rewardRecordData['company_id']])->find();
addOperationLog(['op_type'=>2,'key'=>$companyName['partner'].'/'.(($rewardRecordData['reward_type']==1)?'奖励':'惩罚').'/'.$rewardRecordData['money'],'op_name'=>'删除奖惩记录','url'=>U('StatementMangement/rewardManageList'),'menu'=>'推广员-结算单管理-奖罚记录管理']);
return $upt ? $this->success('删除成功') : $this->error('删除失败');
} else {
$data = M('reward_record', 'tab_')->where(['id'=>$id])->find();
$data = SM('reward_record', 'tab_')->where(['id'=>$id])->find();
if (!$data) return $this->error("未找到该记录");
$data['confirm_time'] = $data['confirm_time'] ? date('Y-m-d', $data['confirm_time']) : '';
$data['accounts'] = json_decode($data['accounts'], true) ?: [];
@ -707,15 +712,15 @@ class StatementMangementController extends ThinkController
$data['reward_time'] = strtotime(date('Y-m-01'));
}
$details = M('reward_detail', 'tab_')->where(['record_id'=>$id])->select();
$details = SM('reward_detail', 'tab_')->where(['record_id'=>$id])->select();
// 根据type 来合并
foreach ($details as $item) {
$item['info'] = $item;
if (empty($item['company_name']) && $item['company_id']) {
if ($item['company_type'] == RewardModel::COMPANY_TYPE_PARTNER) {
$item['company_name'] = M('partner', 'tab_')->where(['id'=>$item['company_id']])->getField('partner');
$item['company_name'] = SM('partner', 'tab_')->where(['id'=>$item['company_id']])->getField('partner');
} else {
$item['company_name'] = M('promote_company', 'tab_')->where(['id'=>$item['company_id']])->getField('company_name');
$item['company_name'] = SM('promote_company', 'tab_')->where(['id'=>$item['company_id']])->getField('company_name');
}
}
$tmp[$item['type']][] = $item;
@ -728,21 +733,207 @@ class StatementMangementController extends ThinkController
$this->assign('details', $tmp);
$this->assign('data', $data);
$this->assign('promoters', M('promote', 'tab_')->where(['level'=>1])->field('id, nickname')->select());
$this->assign('promoters', SM('promote', 'tab_')->where(['level'=>1])->field('id, nickname')->select());
$this->assign('rewardTypes', RewardModel::$rewardTypes);
$this->assign('settlementTypes', RewardModel::$settlementTypes);
$this->assign('companyTypes', RewardModel::$companyTypes);
$this->display('rewardManagerDetail');
}
public function addreward() {
$batch = date('Ymd') . date('His') . sp_random_num(3);
$this->assign("batch", $batch);
$this->meta_title = 'EXCEL导入';
$this->display();
}
public function loopAdd()
{
Vendor('PHPExcel.PHPExcel');
$p = $_REQUEST;
// $batch = $p['batch'];
$checkarr = $p['checkarr'];
//循环获取添加
if (count($checkarr) < 1) {
$this->ajaxReturn(["status" => 0, "msg" => "没有数据"]);
}
$reward_type = [
"无"=>0,
"奖励"=>1,
"惩罚"=>2,
"双向"=>3
];
$company_type = [
"无"=>0,
"上游公司"=>1,
"下游公司"=>2,
"内部公司"=>3
];
$type = [
"无"=>0,
"奖励方"=>1,
"惩罚方"=>2
];
$settlement_type = [
"线下结算"=>1,
"线上结算"=>2
];
$all_record = [];
$all_detail = [];
$record = [];
$detail = [];
$md5 = '';
foreach ($checkarr as $k => $v) {
if ($v['game_name']) {
$record = [];
$detail = [];
$game_data = SM("game","tab_")->field("relation_game_id")->where(['relation_game_name'=>$v['game_name']])->find();
$record["reward_type"] = $reward_type[$v['reward_type']];
$record["accounts"] = json_encode([]);
$record["relation_game_id"] = $game_data["relation_game_id"]?$game_data["relation_game_id"]:0;
$record["content"] = $v["content"];
$record["reward_time"] = strtotime(gmdate("Y-m-d", \PHPExcel_Shared_Date::ExcelToPHP($v["reward_time"])));
$record["confirm_time"] = strtotime(gmdate("Y-m-d", \PHPExcel_Shared_Date::ExcelToPHP($v["confirm_time"])));
$record["settlement_time"] = strtotime(gmdate("Y-m-d", \PHPExcel_Shared_Date::ExcelToPHP($v["settlement_time"])));
$record["create_time"] = time();
$record["creater_id"] = $_SESSION['onethink_admin']['user_auth']['uid'];
$md5 = md5($record["relation_game_id"].$record["content"].$record["create_time"].$record["confirm_time"].$record["reward_time"].$record["settlement_time"]);
$all_record[$md5] = $record;
if ($v["company_name"]!="无") {
$company_data = SM("promote_company","tab_")->field("id")->where(['company_name'=>$v["company_name"]])->find();
$detail["company_type"] = $company_type[$v["company_type"]]?$company_type[$v["company_type"]]:0;
$detail["type"] = $type[$v["type"]]?$type[$v["type"]]:0;
$detail["company_id"] = $company_data["id"]?$company_data["id"]:0;
$detail["company_name"] = $v["company_name"]?$v["company_name"]:'';
$detail["promote_account"] = $v["promote_account"]?$v["promote_account"]:'';
$detail["settlement_type"] = $settlement_type[$v["settlement_type"]]?$settlement_type[$v["settlement_type"]]:0;
$detail["amount"] = abs($v["amount"])?abs($v["amount"]):0;
$detail["confirm_time"] = $record["confirm_time"];
$all_detail[$md5][] = $detail;
}
$detail = [];
if ($v["company_name_1"]!="无") {
$company_data = SM("promote_company","tab_")->field("id")->where(['company_name'=>$v["company_name_1"]])->find();
$detail["company_type"] = $company_type[$v["company_type_1"]]?$company_type[$v["company_type_1"]]:0;
$detail["type"] = $type[$v["type_1"]]?$type[$v["type_1"]]:0;
$detail["company_id"] = $company_data["id"]?$company_data["id"]:0;
$detail["company_name"] = $v["company_name_1"]?$v["company_name_1"]:'';
$detail["promote_account"] = $v["promote_account_1"]?$v["promote_account_1"]:'';
$detail["settlement_type"] = $settlement_type[$v["settlement_type_1"]]?$settlement_type[$v["settlement_type_1"]]:0;
$detail["amount"] = abs($v["amount_1"])?abs($v["amount_1"]):0;
$detail["confirm_time"] = $record["confirm_time"];
$all_detail[$md5][] = $detail;
}
} else {
$detail = [];
if ($v["company_name"]!="无") {
$company_data = SM("promote_company","tab_")->field("id")->where(['company_name'=>$v["company_name"]])->find();
$detail["company_type"] = $company_type[$v["company_type"]]?$company_type[$v["company_type"]]:0;
$detail["type"] = $type[$v["type"]]?$type[$v["type"]]:0;
$detail["company_id"] = $company_data["id"]?$company_data["id"]:0;
$detail["company_name"] = $v["company_name"]?$v["company_name"]:'';
$detail["promote_account"] = $v["promote_account"]?$v["promote_account"]:'';
$detail["settlement_type"] = $settlement_type[$v["settlement_type"]]?$settlement_type[$v["settlement_type"]]:0;
$detail["amount"] = abs($v["amount"])?abs($v["amount"]):0;
$detail["confirm_time"] = $record["confirm_time"];
$all_detail[$md5][] = $detail;
}
$detail = [];
if ($v["company_name_1"]!="无") {
$company_data = SM("promote_company","tab_")->field("id")->where(['company_name'=>$v["company_name_1"]])->find();
$detail["company_type"] = $company_type[$v["company_type_1"]];
$detail["type"] = $type[$v["type_1"]]?$type[$v["type_1"]]:0;
$detail["company_id"] = $company_data["id"]?$company_data["id"]:0;
$detail["company_name"] = $v["company_name_1"]?$v["company_name_1"]:'';
$detail["promote_account"] = $v["promote_account_1"]?$v["promote_account_1"]:'';
$detail["settlement_type"] = $settlement_type[$v["settlement_type_1"]]?$settlement_type[$v["settlement_type_1"]]:0;
$detail["amount"] = abs($v["amount_1"])?abs($v["amount_1"]):0;
$detail["confirm_time"] = $record["confirm_time"];
$all_detail[$md5][] = $detail;
}
}
}
// dump($all_record);
foreach ($all_record as $key => $value) {
$insert_id = SM("reward_record","tab_")->add($value);
foreach ($all_detail[$key] as $k => $v) {
$all_detail[$key][$k]['record_id'] = $insert_id;
}
$is_success = SM("reward_detail","tab_")->addAll($all_detail[$key]);
}
$this->ajaxReturn(["status" => 1, "msg" => "导入成功"]);
}
//模板导出
public function download()
{
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel2007');
//设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/rewardOrfina.xlsx");
$fileName = "奖惩导入";
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
public function getCompanys($type=1)
{
if ($type == 1) {
$data = M('partner', 'tab_')->field('id, partner as name')->select();
$data = SM('partner', 'tab_')->field('id, partner as name')->select();
} elseif ($type == 0) {
$data = [];
} else {
$data = M('promote_company', 'tab_')->field('id, company_name as name')->select();
$data = SM('promote_company', 'tab_')->field('id, company_name as name')->select();
}
return $this->success($data, '', true);
}

@ -475,6 +475,7 @@
}else if(id=="pool"){
var opname = "发起汇总";
var opurl = "{:U('pool_splice')}";
var opst ="[审批通过,汇总撤销]";
var status = [1,-2];
}else if(id=="updateStatement"){
@ -516,6 +517,7 @@
return;
}
text = text.join(",");
// console.log(text);
if(flag){
layer.confirm(opname+"仅会对"+opst+"的申请进行处理,选择中包含其他的状态的申请将被忽略,点击取消停止操作",{title:false}, function(index){
@ -538,6 +540,12 @@
}
function _doAgreeApply(){
var IS_SUBSITE = "{$IS_SUBSITE}";
if (id=="pool" && IS_SUBSITE) {
_poolWmStatement();
return;
}
//执行
layer.load(2);
$.ajax({
@ -560,6 +568,41 @@
}
});
}
function _poolWmStatement() {
layer.load(2);
$.ajax({
type: 'post',
url: "{:U('checkWmStatement')}",
data:{id:text},
success: function(data) {
if(data.status == 0) {
layer.msg("不同类型的结算单不能放在一起汇总");
layer.closeAll("loading");
} else {
var url = "{:U('poolWmStatement')}"+"&id="+text;
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content: url
});
layer.closeAll("loading");
return;
}
},
error:function(){
layer.closeAll("loading");
layer.alert("网络错误或超时");
return false;
}
});
}
})
$("#launch").on("click",function(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {

@ -0,0 +1,275 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 0px 150px;
width: 960px;
margin: auto;
}
.tabcon1711 table{
width: 480px;
}
table{
margin: auto;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
</style>
<body>
<div style="height: 20px"></div>
<div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
<div class="tab-content tabcon1711" >
<div class="input-list input-list-game search_label_rehab" style="margin-left: 375px;">
<select name="promote_company" id="promote_company" class="select_gallery">
<option>请选择下游公司</option>
<foreach name="company_data" item="company_data">
<option value="{$company_data['id']}" data-company_name="{$company_data['company_name']}">{$company_data['company_name']}</option>
</foreach>
</select>
</div>
</div>
</div><span style="line-height: 20px; margin-left: 15px">结算单</span>
<div style="margin-top: 20px;width: 100%;line-height: 20px;font-weight: 600;text-align: center;" class="time"
data-begin="{$amount_data['statement_begin_time']}" data-end="{$amount_data['statement_end_time']}">({$amount_data['statement_begin_time']}-{$amount_data['statement_end_time']})</div>
<div class="data_list box_mt" style="margin-top: 10px;">
<div >
<table>
<!-- 表头 -->
<thead>
<tr>
<th>结算月份</th>
<th>合作产品名称</th>
<th>月累计用户充值流水</th>
<th>月新增用户数</th>
<th>税费费率</th>
<th>结算金额(元)</th>
</tr>
</thead>
<tbody >
<tr>
<td>{$data[0]['statement_begin_time']}-{$data[0]['statement_end_time']}</td>
<td>{$data[0]['game_name']}</td>
<td rowspan="{$row}" class="pay_amount">{$amount_data['pay_amount']}</td>
<td rowspan="{$row}" class="user_newcount">{$amount_data['user_newcount']}</td>
<td rowspan="{$row}" class="parent_fax_ratio"><input class="fax_ratio" type="text" class="txt" name="fax_ratio" value="0" placeholder="" style="width: 25px">%</td>
<td rowspan="{$row}" class="sum_money">{$amount_data['sum_money']}</td>
</tr>
<foreach name="data" item="it" key="key">
<if condition="$key neq 0">
<tr>
<td>{$it['statement_begin_time']}-{$it['statement_end_time']}</td>
<td>{$it['game_name']}</td>
</tr>
</if>
</foreach>
</tbody>
</table>
<div class="tab-content tabcon1711">
<div class="form-item cf">
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.parent.reload();" style="float: right">
返回
</a>
<button class="submit_btn" id="submit_btn" style="float: right">
保存
</button>
</div>
</div>
</div>
</div>
</body>
<script>
$(".select_gallery").select2();
$(function () {
var sum_amount = parseFloat($(".sum_money").text());
var row = 0;
var amount_datas;
var other_list;
var list = '{$js_data}';
var company_id;
var other_id;
$(".submit_btn").click(function () {
var id = "{$_GET['id']}";
if (!company_id) {
layer.msg("请选择汇总公司");
return;
}
var fax_ratio = $(".fax_ratio").val();
layer.load(2);
$.ajax({
type: 'post',
url: "{:U('saveCompanyData')}",
data:{list:list,other_list:other_list,company_id:company_id,amount_data:amount_datas,fax_ratio:fax_ratio,id:id,other_id:other_id},
success: function(data) {
layer.msg(data.msg);
if(data.status == 1) {
setTimeout(function(){
layer.close(2);
window.parent.reload();
},3000);
}
layer.closeAll("loading");
},
error:function(){
layer.closeAll("loading");
layer.alert("网络错误或超时");
return false;
}
});
});
$("#promote_company").change(function () {
var begin = $(".time").data("begin");
var end = $(".time").data("end");
company_id = $(this).val();
if (company_id == "请选择下游公司") {
company_id = '';
}
var id = "{$_GET['id']}";
var amount_data = '{$js_amount_data}';
$(".other_append").remove();
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))-row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))-row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))-row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))-row);
$.ajax({
type: 'post',
url: "{:U('checkCompanyData')}",
data:{begin_time:begin,end_time:end,company_id:company_id,statement_id:id,amount_data:amount_data},
success: function(data) {
if (data.status==1) {
for (var key in data.list) {
var tr = "<tr class='other_append'>" +
"<td>"+data.list[key]['statement_begin_time']+"-"+data.list[key]['statement_end_time']+"</td>" +
"<td>"+data.list[key]['game_name']+"</td>" +
"</tr>";
$("tbody").append(tr);
}
row = data.row;
$(".pay_amount").text(data.amount_data['pay_amount']);
$(".user_newcount").text(data.amount_data['user_newcount']);
// $(".fax_ratio").text(data.amount_data['pay_amount']);
$(".sum_money").text(data.amount_data['sum_money']);
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))+row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))+row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))+row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))+row);
sum_amount = data.amount_data['sum_money'];
amount_datas = JSON.stringify(data.amount_data);
other_list = JSON.stringify(data.list);
other_id = data.other_id;
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
$(".fax_ratio").blur(function() {
var fax_ratio = parseFloat($(this).val());
var pay_amount = parseFloat($(".pay_amount").text());
var sum_money = 0;
var fax_amount = sum_amount * (fax_ratio/100);
sum_money = sum_amount-fax_amount;
$(".sum_money").text(sum_money.toFixed(2));
});
});
</script>
</html>

@ -0,0 +1,379 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
/* .data_list table td{
line-height: 2;
} */
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">结算汇总-上游</h3>
<p class="description_text" id="order_url"></p>
</div>
<div class="cf top_nav_list" style="height: 38px;">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom: 0">
<div class="input-list input-list-resway search_label_rehab">
<select id="year" name="year" class="select_gallery" style="width:150px;">
<volist name="YearList" id="vo">
<option value="{$vo.value}" <if condition="I('year') && $vo.value eq I('year')">selected
</if> >{$vo.name}</option>
</volist>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('showCpStatementList','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class='butn' id='export'>批量导出</a>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>合作公司</th>
<th>结算金额</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" value="{$data['company_id']}" name="ids[]"></td>
<td>{$data.company_name}</td>
<td>{$data.statement_money}</td>
<td>
<a url="{:U('showCpStatementView')}" data-company_name="{$data['company_name']}" data-company_id="{$data['company_id']}" class="view">查看</a>
</td>
</tr>
</volist>
</notemtpy>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<!-- <a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a> -->
</if>
{$_page|default=''}
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<script type="text/javascript">
</script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('showCpStatementList')}");
function reload() {
window.location.reload();
}
$(function(){
var company_id = "{$_GET['company_id']??0}";
$("#company_type").on("change",function(){
var val = $(this).find("option:selected").val();
var type = 0;
if(val == 3){
type = 1
}else{
type = 2;
}
var url = "{:U('Ajax/getCompanyList')}"+"&company_type="+type;
$.get(url,function(data){
var company = data;
var companystr = '<option value="">请选择合作公司</option>';
for (var i in company) {
if(company[i].id == company_id){
companystr += "<option value='" + company[i].id + "' selected='selected'>" + company[i].name + "</option>"
}else{
companystr += "<option value='" + company[i].id + "'>" + company[i].name + "</option>"
}
}
$("#company_id").html(companystr);
$("#company_id").select2();
})
})
$("#company_type").change();
$(".viewStatement").click(function () {
var id = $(this).data("id");
var url = "{:U('viewStatement')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$("#pool").on("click",function(){
var id = $(this).attr("id");
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length > 40){
layer.msg("<font style='color:white'>" + '为保证效率暂不支持超过40条的批量操作' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要汇总的操作'+"</font>");
return;
}
text = text.join(",");
if(confirm){
layer.confirm('【警告】汇总后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
_doAgreeApply();
});
}else{
_doAgreeApply();
}
function _doAgreeApply(){
//执行
$.ajax({
type: "POST",
url: "{:U('pool')}",
dataType: 'json',
async: false,
data: {ids:text},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
}
})
$("#export").click(function () {
var time = $("#year").val();
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length > 20){
layer.msg("<font style='color:white'>" + '暂不支持超过20条的批量导出' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的公司' + "</font>");
return;
}
var url ="{:U('showCpStatementView')}"+"&is_export=1&company_id="+text.join(",")+"&time="+time;
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel)
});
$(".view").click(function () {
var company_id = $(this).data("company_id");
var time = $("#year").val();
var url = "{:U('showCpStatementView')}"+"&company_id="+company_id+"&time="+time;
var company_name = $(this).data("company_name");
layer.open({
type: 2,
title: company_name,
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$("#search").click(function(){
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
})
</script>
</block>

@ -0,0 +1,280 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 10px 150px 10px;
/* width: 960px; */
margin: auto;
}
/* .tabcon1711 table{
width: 480px;
} */
table{
margin: auto;
}
tr{
border-bottom: dotted 1px #c7c7c7;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
#statementShow td{
line-height: 1.5;
padding: 8px 0;
}
</style>
<body>
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<table id="exporttable">
<!-- 表头 -->
<thead>
<tr>
<th>结算时间</th>
<th>产品</th>
<th>联运流水</th>
<th>聚合流水</th>
<th>流水合计</th>
<th>结算比例</th>
<th>渠道费率</th>
<th>税费费率</th>
<th>其他</th>
<th>结算金额</th>
</tr>
</thead>
<tbody id="statementShow">
<if condition = "empty($data)">
<tr>
<td colspan="50" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<foreach name="data" item="first_data" key="index" >
<foreach name="first_data" item="data">
<tr>
<td rowspan="{$data['row']}">{$time}年{$data["time"]}月</td>
<if condition="$data['statement_info'][0]['statement_type'] gt 0">
<td>{$data['statement_info'][0]['game_name']|default="--"}</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td><if condition="$data['statement_info'][0]['statement_type'] eq 2">-</if>{$data['statement_info'][0]['sum_money']|default="--"}</td>
<else/>
<td>{$data['statement_info'][0]['game_name']|default="--"}</td>
<td>{$data['statement_info'][0]['platform_money']|default="--"}</td>
<td>{$data['statement_info'][0]['aggregate_money']|default="--"}</td>
<td>{$data['statement_info'][0]['sum_amount']|default="--"}</td>
<td>{$data['statement_info'][0]['ratio']|default="--"}</td>
<td>{$data['statement_info'][0]['promote_ratio']|default="--"}</td>
<td>{$data['statement_info'][0]['fax_ratio']|default="--"}</td>
<td>{$data['statement_info'][0]['other_amount']|default="--"}</td>
<td>{$data['statement_info'][0]['sum_money']|default="--"}</td>
</if>
</tr>
<foreach name="data['statement_info']" item="statement_info" key="skey">
<if condition="$skey gt 0">
<if condition="$statement_info['statement_type'] gt 0">
<td>{$statement_info['game_name']|default="--"}</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td><if condition="$statement_info['statement_type'] eq 2">-</if>{$statement_info['sum_money']|default="--"}</td>
<else/>
<tr>
<td>{$statement_info['game_name']|default="--"}</td>
<td>{$statement_info['platform_money']|default="--"}</td>
<td>{$statement_info['aggregate_money']|default="--"}</td>
<td>{$statement_info['sum_amount']|default="--"}</td>
<td>{$statement_info['ratio']|default="--"}</td>
<td>{$statement_info['promote_ratio']|default="--"}</td>
<td>{$statement_info['fax_ratio']|default="--"}</td>
<td>{$statement_info['other_amount']|default="--"}</td>
<td>{$statement_info['sum_money']|default="--"}</td>
</tr>
</if>
</if>
</foreach>
</foreach>
<tr>
<td>小计</td>
<td>--</td>
<td>{$sum[$index]['platform_money']}</td>
<td>{$sum[$index]['aggregate_money']}</td>
<td>{$sum[$index]['sum_amount']}</td>
<td>{$sum[$index]['ratio']}</td>
<td>{$sum[$index]['promote_ratio']}</td>
<td>{$sum[$index]['fax_ratio']}</td>
<td>{$sum[$index]['other_amount']}</td>
<td>{$sum[$index]['sum_money']}</td>
</tr>
</foreach>
</tbody>
</table>
</div>
</div>
</body>
<script>
<if condition="$is_export">
$(function(){
$("#exporttable").table2excel({
filename: "{$title}.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
});
</if>
$(".no_statement").on("click",function(){
var id = $(this).data('id');
$.ajax({
type: "POST",
url: "{:U('cancelStatement')}",
dataType: 'json',
async: false,
data: {id:id},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
$(".refund").on("blur",function () {
caculate_sum_money(this);
});
$(".ratio").on("blur",function () {
caculate_sum_money(this);
});
$(".increment_ratio").on("blur",function () {
caculate_sum_money(this);
});
function caculate_sum_money(_this) {
var pay_money = $(_this).parent().parent().find(".pay_amount").text();
var ratio = $(_this).parent().parent().find(".ratio").val();
if (!ratio || ratio < 0) {
ratio = 0;
$(_this).parent().parent().find(".ratio").val(ratio);
} else if (ratio > 100) {
ratio = 100;
$(_this).parent().parent().find(".ratio").val(ratio);
}
var refund = $(_this).parent().parent().find(".refund").val();
if (!refund || refund < 0) {
refund = 0;
$(_this).parent().parent().find(".refund").val(refund);
}
var increment_ratio = $(_this).parent().parent().find(".increment_ratio").val();
if (!increment_ratio || increment_ratio < 0) {
increment_ratio = 0;
$(_this).parent().parent().find(".increment_ratio").val(increment_ratio);
} else if(increment_ratio > 100) {
increment_ratio = 100;
$(_this).parent().parent().find(".increment_ratio").val(increment_ratio);
}
pay_money = parseFloat(pay_money) - parseFloat(refund);
var value = parseFloat(pay_money)*(parseFloat(ratio)/100) + parseFloat(pay_money)*(parseFloat(increment_ratio)/100);
$(_this).parent().parent().find(".sum_money_span").text(value.toFixed(2));
$(_this).parent().parent().find(".sum_money").val(value.toFixed(2));
}
</script>
</html>

@ -543,7 +543,19 @@
cancelPoolAjax(url,{id:id});
});
});
//撤销汇总
$(".cancelWmPool,.reCount").on("click",function(){
var id = $(this).data('id');
var url = "{:U('cancelWmPool')}";
layer.confirm("撤销汇总/重算都是不可逆操作,请慎重选择",{title:false}, function(index){
layer.close(index);
cancelPoolAjax(url,{id:id});
});
})
//线下打款
$(".setUlPayment").on("click",function(){
var id = $(this).data('id');

@ -0,0 +1,396 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 0px 150px;
width: 960px;
margin: auto;
}
.tabcon1711 table{
width: 480px;
}
table{
margin: auto;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
</style>
<body>
<div style="height: 20px"></div>
<div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
<div class="tab-content tabcon1711" >
<div class="input-list input-list-game search_label_rehab" style="margin-left: 375px;">
《{$company_name}》结算单
</div>
</div>
</div>
<div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
<div class="tab-content tabcon1711">
<div class="input-list input-list-game search_label_rehab" style="margin-left: 375px;">
<div style="margin-top: -20px;width: 100%;line-height: 20px;font-weight: 600;text-align: center;margin-bottom: 10px;margin-left: 30px;" class="time">({$statement_begin_time}-{$statement_end_time})</div>
</div>
</div>
</div>
<div class="data_list box_mt" style="margin-top: 10px;">
<div >
<table>
<!-- 表头 -->
<thead>
<tr>
<th>结算月份</th>
<th>合作产品名称</th>
<th>月累计用户充值流水</th>
<th>月新增用户数</th>
<th>税费费率</th>
<th>结算金额(元)</th>
</tr>
</thead>
<tbody >
<tr>
<td>{$list[0]['statement_begin_time']}-{$list[0]['statement_end_time']}</td>
<td>{$list[0]['game_name']}</td>
<td rowspan="{$row}" class="pay_amount">{$amount_data['pay_amount']}</td>
<td rowspan="{$row}" class="user_newcount">{$amount_data['user_newcount']}</td>
<td rowspan="{$row}" class="parent_fax_ratio">{$amount_data['fax_ratio']}%</td>
<td rowspan="{$row}" class="sum_money">{$amount_data['sum_money']}</td>
</tr>
<foreach name="list" item="it" key="key">
<if condition="$key neq 0">
<tr>
<td>{$it['statement_begin_time']}-{$it['statement_end_time']}</td>
<td>{$it['game_name']}</td>
</tr>
</if>
</foreach>
<tr>
<td>支付金额</td>
<td colspan="5">{:convertAmountToCn($amount_data['sum_money'])}</td>
</tr>
<tr>
<td>备注</td>
<td colspan="5">结算金额按每月双方实际核定结算指标为准</td>
</tr>
<if condition="$first_party_info['invoice_item']">
<tr>
<td>甲方</td>
<td colspan="2">{$first_party_info['partner']}</td>
<td>乙方</td>
<td colspan="2">{$second_party_info['partner']}</td>
</tr>
<tr>
<td>联系人</td>
<td colspan="2">{$first_party_info['link_man']}</td>
<td>联系人</td>
<td colspan="2">{$second_party_info['link_man']}</td>
</tr>
<tr>
<td>联系电话</td>
<td colspan="2">{$first_party_info['link_phone']}</td>
<td>联系电话</td>
<td colspan="2">{$second_party_info['phone']}</td>
</tr>
<tr>
<td>开票内容</td>
<td colspan="2">{$first_party_info['invoice_item']}</td>
<td>邮寄地址</td>
<td colspan="2">{$second_party_info['address']}</td>
</tr>
<tr>
<td>发票类型</td>
<td colspan="2">{$first_party_info['invoice_type']}</td>
<td>请汇入此账号</td>
<td colspan="2"></td>
</tr>
<tr>
<td>邮寄地址</td>
<td colspan="2">{$first_party_info['address']}</td>
<td>户名</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$second_party_info['ali_user']}</td>
<else/>
<td colspan="2">{$second_party_info['bank_address']}</td>
</if>
</tr>
<tr>
<td></td>
<td colspan="2"></td>
<td>账号</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$second_party_info['ali_account']}</td>
<else/>
<td colspan="2">{$second_party_info['bank_card']}</td>
</if>
</tr>
<if condition="$second_party_info['is_payment'] neq 1">
<tr>
<td></td>
<td colspan="2"></td>
<td>开户行</td>
<td colspan="2">{$second_party_info['bank_name']}</td>
</tr>
</if>
<else/>
<tr>
<td>甲方</td>
<td colspan="2">{$first_party_info['partner']}</td>
<td>乙方</td>
<td colspan="2">{$second_party_info['partner']}</td>
</tr>
<tr>
<td>联系人</td>
<td colspan="2">{$first_party_info['link_man']}</td>
<td>联系人</td>
<td colspan="2">{$second_party_info['link_man']}</td>
</tr>
<tr>
<td>联系电话</td>
<td colspan="2">{$first_party_info['link_phone']}</td>
<td>联系电话</td>
<td colspan="2">{$second_party_info['phone']}</td>
</tr>
<tr>
<td>邮寄地址</td>
<td colspan="2">{$first_party_info['address']}</td>
<td>开票内容</td>
<td colspan="2">{$second_party_info['invoice_item']}</td>
</tr>
<tr>
<td>请汇入此账号</td>
<td colspan="2"></td>
<td>发票类型</td>
<td colspan="2">{$second_party_info['invoice_type']}</td>
</tr>
<tr>
<td>户名</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$first_party_info['ali_user']}</td>
<else/>
<td colspan="2">{$first_party_info['bank_address']}</td>
</if>
<td>邮寄地址</td>
<td colspan="2">{$second_party_info['address']}</td>
</tr>
<tr>
<td>账号</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$first_party_info['ali_account']}</td>
<else/>
<td colspan="2">{$first_party_info['bank_card']}</td>
</if>
<td></td>
<td colspan="2"></td>
</tr>
<if condition="$second_party_info['is_payment'] neq 1">
<tr>
<td>开户行</td>
<td colspan="2">{$first_party_info['bank_name']}</td>
<td></td>
<td colspan="2"></td>
</tr>
</if>
</if>
</tbody>
</table>
</div>
</div>
</body>
<script>
$(".select_gallery").select2();
$(function () {
var sum_amount = parseFloat($(".sum_money").text());
var row = 0;
var amount_datas;
var other_list;
var list = '{$js_data}';
var company_id;
var other_id;
$(".submit_btn").click(function () {
var id = "{$_GET['id']}";
if (!company_id) {
layer.msg("请选择汇总公司");
return;
}
var fax_ratio = $(".fax_ratio").val();
layer.load(2);
$.ajax({
type: 'post',
url: "{:U('saveCompanyData')}",
data:{list:list,other_list:other_list,company_id:company_id,amount_data:amount_datas,fax_ratio:fax_ratio,id:id,other_id:other_id},
success: function(data) {
layer.msg(data.msg);
if(data.status == 1) {
setTimeout(function(){
layer.close(2);
window.parent.reload();
},3000);
}
layer.closeAll("loading");
},
error:function(){
layer.closeAll("loading");
layer.alert("网络错误或超时");
return false;
}
});
});
$("#promote_company").change(function () {
var begin = $(".time").data("begin");
var end = $(".time").data("end");
company_id = $(this).val();
if (company_id == "请选择下游公司") {
company_id = '';
}
var id = "{$_GET['id']}";
var amount_data = '{$js_amount_data}';
$(".other_append").remove();
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))-row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))-row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))-row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))-row);
$.ajax({
type: 'post',
url: "{:U('checkCompanyData')}",
data:{begin_time:begin,end_time:end,company_id:company_id,statement_id:id,amount_data:amount_data},
success: function(data) {
if (data.status==1) {
for (var key in data.list) {
var tr = "<tr class='other_append'>" +
"<td>"+data.list[key]['statement_begin_time']+"-"+data.list[key]['statement_end_time']+"</td>" +
"<td>"+data.list[key]['game_name']+"</td>" +
"</tr>";
$("tbody").append(tr);
}
row = data.row;
$(".pay_amount").text(data.amount_data['pay_amount']);
$(".user_newcount").text(data.amount_data['user_newcount']);
// $(".fax_ratio").text(data.amount_data['pay_amount']);
$(".sum_money").text(data.amount_data['sum_money']);
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))+row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))+row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))+row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))+row);
sum_amount = data.amount_data['sum_money'];
amount_datas = JSON.stringify(data.amount_data);
other_list = JSON.stringify(data.list);
other_id = data.other_id;
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
$(".fax_ratio").blur(function() {
var fax_ratio = parseFloat($(this).val());
var pay_amount = parseFloat($(".pay_amount").text());
var sum_money = 0;
var fax_amount = sum_amount * (fax_ratio/100);
sum_money = sum_amount-fax_amount;
$(".sum_money").text(sum_money.toFixed(2));
});
});
</script>
</html>

@ -0,0 +1,467 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
a:link ,a:visited,a:hover,a:active { text-decoration: none;}
.select2-results__option[aria-selected] {font-size:12px;}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
.data_list table td{
line-height: 2;
}
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
.main-place .question_content:before{
right: 20px;
left: auto;
}
.tabcon1711 td:first-child {
width: auto;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">新增excel导入</h3>
<p class="description_text">说明:奖惩绩效数据</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap" style="display: flex;">
<div class="tab-content tabcon1711" style="min-width:700px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">本次批次号:</td>
<td class="r">
<div class="input-list" id="batch" style="margin-left: 0;line-height: 30px;font-size: 16px;">
</div>
<span class="notice-text" style="margin-left: 20px;">用于检索使用</span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>文件上传:</td>
<td class="r">
<div class="input-list" style="margin-left: 0;">
<input type="file" id="fileinput" name="file">
</div>
<span class="notice-text" style="margin-left: 0;">暂只支持.xls .xlsx 格式文件</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn" id="submit_btn">
保存
</button>
<a class="submit_btn " alt="下载模板" title="下载模板" href="{:U('download')}">
下载模板
</a>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
返回
</a>
</div>
</div>
</div>
<div style="margin-top: 60px;" id="firle">
<div style="width: 100%;height: 45px;font-size: 16px;">
文件格式参考:<span style="color: #777;font-size: 12px;margin-left: 20px;">请严格按此格式,文件的第一行必须是字段名,且字段名不允许修改</span>
</div>
<style>
#firle td,#firle th{
padding: 10px 5px;
}
</style>
<table id="cktable" style="width: 100%;margin: 0;padding: 0;text-align: center;border: 1px solid #777;" border="1px">
<thead>
<tr>
<th>序号</th>
<th>游戏名</th>
<th>游戏合作方</th>
<th>奖惩时间</th>
<th>结算时间</th>
<th>奖惩确认时间</th>
<th>时间说明</th>
<th>奖惩性质</th>
<th>奖惩类型</th>
<th>结算公司类型</th>
<th>结算方</th>
<th>会长账号</th>
<th>奖惩金额</th>
<th>结算方式</th>
<th>奖惩类型</th>
<th>结算公司类型</th>
<th>结算方</th>
<th>会长账号</th>
<th>奖惩金额</th>
<th>结算方式</th>
<th>添加人</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>九天仙尘</td>
<td>广州乐牛软件科技有限公司</td>
<td>2021-01-01</td>
<td>2021-01-01</td>
<td>2021-01-01</td>
<td>私聊非自己的玩家并发微信给玩家存在换端的嫌疑违反平台规则罚款1500元</td>
<td>双向</td>
<td>惩罚方</td>
<td>下游公司</td>
<td>南昌醉游网络科技有限公司</td>
<td>ncsywl</td>
<td>-1501</td>
<td>线上结算</td>
<td>奖励方</td>
<td>下游公司</td>
<td>万盟天下科技</td>
<td>kefuguanlian</td>
<td>1500</td>
<td>线上结算</td>
<td>wmtxhh</td>
</tr>
</tbody>
</table>
</div>
<div style="width: 100vw;height: 100vh;padding: 0;position: absolute;top: 0;z-index: 9999;display: none;" id="creat_msg">
<div class="layui-layer layui-layer-dialog layui-layer-border layui-layer-msg layui-layer-hui"
type="dialog" times="1" showtime="50000" contype="string" style="z-index: 19891015; top:30%; left:30%;">
<div class="layui-layer-content" style="padding: 15px 0 5px;font-size: 20px;font-weight: 600;">执行进度</div>
<div id="tip_msg" class="layui-layer-content">开始时间与结束时间都不允许为空</div>
<div class="layui-layer-content" style="padding: 5px 10px 15px;font-size: 10px;color: #BBB;">TIP:未执行完成之前请勿刷新或关闭此页面</div>
<span class="layui-layer-setwin"></span>
</div>
</div>
</block>
<block name="script">
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript" src="__STATIC__/xlsx.core.min.js" charset="UTF-8"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('MarketPercentage/marketStaffSettle')}');
var MSG={
showmsg:function(str){
$("#creat_msg").show();
$("#tip_msg").html(str);
},
hidemsg:function(){
$("#creat_msg").hide();
$("#tip_msg").html('');
}
}
var COMPARE={
publiucAjax:function(url,senddata,callback){
$.ajax({
type: 'post',
url: url,
data:senddata,
success: function(data) {
if(data.status == 1){
callback();
}else{
MSG.hidemsg();
layer.alert(data.msg);
return false;
}
},
error:function(){
MSG.hidemsg();
layer.alert("网络错误或超时");
return false;
}
});
},
//循环比较
loopCheck:function(page,callback){
if(page > sendDefaultData.check_page){
MSG.showmsg("添加成功,执行跳转中");
callback();
return;
}
var senddata = {
statement_begin_time:sendDefaultData.begin_time,
statement_end_time:sendDefaultData.end_time,
batch:sendDefaultData.batch,
checkarr:sendDefaultData.filedata.splice(0,check_size)
}
COMPARE.publiucAjax("{:U('loopAdd')}",senddata,function(data){
var checkok = page*check_size > sendDefaultData.filedata_count ? sendDefaultData.filedata_count : page*check_size;
MSG.showmsg("数据插入 ["+checkok+"/"+sendDefaultData.filedata_count+"] ......");
page++;
COMPARE.loopCheck(page,callback)
});
},
checkData:function(callback){
MSG.showmsg("数据校验中...");
var d = sendDefaultData.filedata;
for (const key in d) {
var c = d[key].company_info;
}
callback();
}
}
</script>
<script type="text/javascript">
var isfile = false;
var rABS = false; //是否将文件读取为二进制字符串
var check_size = 999;//每次验证的数量
var batch = '{$batch}';
var sendDefaultData = {
"filedata_count": 0,
"check_page":0,
"filedata":[],
"pay_way":-1,
"batch":batch
}
$("#batch").html(batch);
$(function () {
$("#submit_btn").on("click", function () {
//获取文件
if (!isfile) {
layer.msg('excel文件不能为空');
return false;
}
//执行
readFileInput(function () {
if(sendDefaultData.filedata_count == 0){
MSG.hidemsg();
layer.msg('excel内容不能为空');
return false;
}
//获取需要循环的次数
sendDefaultData.check_page = Math.ceil(sendDefaultData.filedata_count/check_size);
COMPARE.checkData(function(){
COMPARE.loopCheck(1,function(){
setTimeout(function(){
window.location.href="{:U('rewardManageList')}";
},1500);
})
});
})
})
$("#fileinput").change(function () {
var p = $(this).val();
var ext = p.substr(p.lastIndexOf(".")).toLowerCase();
if (ext != ".xls" && ext != ".xlsx") {
layer.msg("文件仅支持excel文件格式");
$(this).val('');
p = '';
}
if (p != '') {
isfile = true;
} else {
isfile = false;
}
})
});
function readFileInput(callback) {
MSG.showmsg("读取excle中。。。");
var wb;//读取完成的数据
var f = $("#fileinput")[0].files[0];
var reader = new FileReader();
if (rABS) {
reader.readAsArrayBuffer(f);
} else {
reader.readAsBinaryString(f);
}
reader.onload = function (e) {
MSG.showmsg("文件读取完成,添加命令初始化。。。");
var data = e.target.result;
if (rABS) {
wb = XLSX.read(btoa(fixdata(data)), {
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
// console.log(wb);
try {
var filedata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
sendDefaultData.filedata = resetCount(filedata);
sendDefaultData.filedata_count = sendDefaultData.filedata.length;
callback();
} catch (error) {
MSG.hidemsg();
isfile = false;
layer.msg('excel内容不符或不能为空');
return false;
}
// document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
};
}
function resetCount(fdata){
var titleKey={
"序号": "sort",
"游戏名": "game_name",
"游戏合作方": "partner",
"奖惩时间":"reward_time",
"结算时间":"settlement_time",
"奖惩确认时间":"confirm_time",
"事件说明":"content",
"奖惩性质":"reward_type",
"奖惩类型":"type",
"结算公司类型":"company_type",
"结算方":"company_name",
"会长账号":"promote_account",
"奖惩金额":"amount",
"结算方式":"settlement_type",
"奖惩类型_1":"type_1",
"结算公司类型_1":"company_type_1",
"结算方_1":"company_name_1",
"会长账号_1":"promote_account_1",
"奖惩金额_1":"amount_1",
"结算方式_1":"settlement_type_1",
"添加人":"creater_id",
};
var data = [];
//临时公司
var temp ={};
for (let index = 0; index < fdata.length; index++) {
const e = fdata[index];
//全量公司
if (e.hasOwnProperty("序号")) {
for (const k in e) {
temp[titleKey[k]] = e[k];
console.log(e[k]);
}
data.push(temp);//上次的走掉
temp ={};//重置
}
}
data.push(temp);//最后一次
return data;
}
function getNowDate(){
var da = new Date();
var trade =da.getFullYear();
var mt =da.getMonth() + 1 >10 ? da.getMonth() + 1 : "0"+(da.getMonth() + 1);
var dt =da.getDate() >=10 ? da.getDate() : "0"+da.getDate();
var dh =da.getHours() >=10 ? da.getHours() : "0"+da.getHours();
var dm =da.getMinutes() >=10 ? da.getMinutes() : "0"+da.getMinutes();
var ds =da.getSeconds() >=10 ? da.getSeconds() : "0"+da.getSeconds();
var dms =(Array(3).join(0) + da.getMilliseconds()).slice(-3);
return trade+=""+mt+""+dt+""+dh+""+dm+""+ds+''+dms;
}
function fixdata(data) { //文件流转BinaryString
var o = "",
l = 0,
w = 10240;
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
return o;
}
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
</script>
</block>

@ -164,6 +164,14 @@
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<if condition="$IS_SUBSITE eq true">
<a class='butn' id='coefficient_in_check' href="{:U('addreward')}" style='background-color: #3C95C8;'>奖惩导入</a>
</if>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">

@ -2792,3 +2792,6 @@ ADD COLUMN `leave_time` int(11) NOT NULL DEFAULT 0 COMMENT '离职时间' AFTER
ALTER TABLE `tab_company_statement_info`
ADD COLUMN `is_reward_fine_split` tinyint(255) NULL DEFAULT 0 COMMENT '是否是奖罚分离生成 0 否 1 是' AFTER `pay_check_time`;
ALTER TABLE `platform_wm`.`tab_company_statement_pool`
ADD COLUMN `wm_statement_ids` int(11) NOT NULL DEFAULT 0 COMMENT '子系统财务结算单id' AFTER `remark`;
Loading…
Cancel
Save