上游查看及导出

master
chenzhi 5 years ago
parent eeec8b13f2
commit 427d6457fc

@ -491,7 +491,6 @@ class CompanyStatementController extends ThinkController
$StatementInfo = M("company_statement_info","tab_");
$company_info = $va['company_info'];
if($k == "up" || $k=="ups"){
$company_type = 1;
foreach ($va['statement_info'] as $key => &$value) {
if($company_info['pay_type'] == 2){
$value["ratio"] = $value["second_ratio"];
@ -501,15 +500,11 @@ class CompanyStatementController extends ThinkController
unset($value["first_ratio"]);
unset($value["second_ratio"]);
}
}else{
//下游
$company_type = 2;
}
$adddata=[
"pool_id"=>$pool_id,
"company_id"=>$company_info['id'],
"company_type"=>$company_type,
"company_type"=>$v['company_type'],
"company_name"=>$company_info['partner'],
"ali_user"=>$company_info['ali_user'],
"ali_account"=>$company_info['ali_account'],
@ -551,8 +546,8 @@ class CompanyStatementController extends ThinkController
if(isset($savedata['company_list'][$v['company_id']])){
//存在游戏合并
$a = &$savedata['company_list'][$v['company_id']];
$a['fine'] = $fine;
$a['reward'] = $reward;
$a['fine'] += $fine;
$a['reward'] += $reward;
$a['statement_info'] = array_merge($a['statement_info'],$v['statement_info']);
// dump($a['statement_info']);
$a['platform_amount'] += $v['platform_amount'];

@ -170,70 +170,103 @@ class CompanyStatementPoolController extends ThinkController
$this->error('参数错误');
}
$id = $_REQUEST['id'];
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
$Poolres = M("company_statement_pool","tab_")->where("id = '{$id}'")->find();
//获取基本信息
$infolist = M("company_statement_info","tab_")->where("pool_id = '{$id}'")->select();
if($infolist[0]['company_type'] == 1){
if($infolist[0]['company_type'] == 3){
//上游
$line = 2;
//获取平台名
$p_id = array_column($infolist,'company_id');
$map['id'] = ['in',$p_id];
$pl = M("Partner","tab_")->field("id,matche_platform")->where($map)->select();
$Partner = [];
foreach($pl as $k=>$v){
$Partner[$v['id']] = $v['matche_platform'];
}
unset($pl);
}else{
$line = 1;
}
$count = [];
//初始值
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_info'],true);
$v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
$cline = $line+1;
// if($v['fine'] > 0) $v['fine'] = 0-$v['fine'];
$v['statement_money_exp'] = "=";
foreach($v['statement_info'] as $ke=>&$va){
$line ++;
if($infolist[0]['company_type'] == 1){
if($infolist[0]['company_type'] == 3){
$va['sum_money_exp'] = "=F{$line}*G{$line}";
$v['statement_money_exp'] .= "K{$line}+";
$va['company_ratio'] = 100-$va['ratio'];
}
if($is_export){
$va['d_statement_money'] = $va['sum_money_exp'];
}else{
$va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2);
}
$count['platform_amount'] += $va['pay_amount'];
$count['platform_amount2'] += $va['pay_amount'];
$count['platform_amount_exp'] .= "E{$line}+";
$count['platform_amount_exp2'] .= "F{$line}+";
$count['d_statement_money'] += $va['d_statement_money'];
$count['d_statement_money_exp'] .= "K{$line}+";
}
}
if($infolist[0]['company_type'] == 1){
if($infolist[0]['company_type'] == 3){
//上游
$v['matche_platform'] = $Partner[$v['company_id']];
$v['statement_money_exp'] .= "M{$cline}-L{$cline}";
}
if($is_export){
$v['statement_money'] = $v['statement_money_exp'];
}
//统计
$count['fine'] += $v['fine'];
$count['fine_exp'] .= "L{$cline}+";
$count['reward'] += $v['reward'];
$count['reward_exp'] .= "M{$cline}+";
$count['statement_money'] += $v['statement_money'];
$count['statement_money_exp'] .= "N{$cline}+";
}
$v['statement_count'] = count($v['statement_info']);
}
// dd($infolist);
if($infolist[0]['company_type'] == 3){
//上游
if($is_export){
$count["d_statement_money"] = "=".trim($count["d_statement_money_exp"],"+");
$count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+");
$count["platform_amount2"] = "=".trim($count["platform_amount_exp2"],"+");
$count["fine"] = "=".trim($count["fine_exp"],"+");
$count["reward"] = "=".trim($count["reward_exp"],"+");
$count["statement_money"] = "=".trim($count["statement_money_exp"],"+");
}
// $dbres = $this->DBModel->where("id='{$id}'")->find();
// $first_party_info = json_decode($dbres['first_party_info'],true);
// $second_party_info = json_decode($dbres['second_party_info'],true);
// $statement_info = json_decode($dbres['statement_info'],true);
}
// if($dbres['pay_type'] == 2){
// $company = $second_party_info['partner'];
// $pyinfo = $second_party_info;
// $fkf_pyinfo = $first_party_info;
// }else{
// $company = $first_party_info['partner'];
// $pyinfo = $first_party_info;
// $fkf_pyinfo = $second_party_info;
// }
// $senddata = array(
// "company"=>$company,
// "payinfo"=>$pyinfo,
// "fkf_payinfo"=>$fkf_pyinfo,
// "first_part_company"=>$first_party_info['partner'],
// "second_part_company"=>$second_party_info['partner'],
// "pay_type"=>$dbres['pay_type'],
// "withdraw_type"=>$dbres['withdraw_type'],//2补丁
// "first_party_info"=>$first_party_info,
// "second_party_info"=>$second_party_info,
// "statement_info"=>$statement_info,
// "statement_count"=>array("pay_amount"=>$dbres['pay_amount'],"statement_money"=>$dbres['statement_money'],"big_ratio_money"=>convertAmountToCn($dbres['statement_money']))
// );
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
// if($dbres["company_belong"] == 9){
// //上游

@ -18,6 +18,7 @@
<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 {
@ -91,7 +92,7 @@
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<table>
<table id="exporttable">
<!-- 表头 -->
<thead>
<tr>
@ -123,7 +124,7 @@
<foreach name="data" item="com">
<tr>
<td rowspan="{$com.statement_count}">{$com.company_name}</td>
<td rowspan="{$com.statement_count}">{$com.company_name}</td>
<td rowspan="{$com.statement_count}">{$com.matche_platform}</td>
<td rowspan="{$com.statement_count}">{$com.statement_begin_time} ~ {$com.statement_end_time}</td>
<td>{$com['statement_info'][0]['game_name']}</td>
@ -133,7 +134,7 @@
<td>{$com['statement_info'][0]['company_ratio']}%</td>
<td>{$com['statement_info'][0]['promote_ratio']}%</td>
<td>{$com['statement_info'][0]['fax_ratio']}%</td>
<td>{$com['statement_info'][0]['sum_money']}</td>
<td>{$com['statement_info'][0]['d_statement_money']}</td>
<td rowspan="{$com.statement_count}">{$com.fine}</td>
<td rowspan="{$com.statement_count}">{$com.reward}</td>
@ -150,12 +151,26 @@
<td>{$it['company_ratio']}%</td>
<td>{$it['promote_ratio']}%</td>
<td>{$it['fax_ratio']}%</td>
<td>{$it['sum_money']}</td>
<td>{$it['d_statement_money']}</td>
</tr>
</if>
</foreach>
</foreach>
<tr>
<td colspan=4 >合计:</td>
<td>{$count.platform_amount}</td>
<td>{$count.platform_amount2}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{$count.d_statement_money}</td>
<td>{$count.fine}</td>
<td>{$count.reward}</td>
<td>{$count.statement_money}</td>
<td></td>
</tr>
@ -163,57 +178,15 @@
</table>
</div>
</div>
<if condition="$data['payinfo']">
<div id="partpatinfo" style="display: flex;margin: auto;">
<div class="tab-content tabcon1711" id="skf_payinfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">收款方名称:</td>
<td class="r">
<input type="text" class="txt" name="" disabled="disabled" placeholder="" value="{$data.payinfo.payee_name}">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt" name="" value="{$data.payinfo.bank_account}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt" name="password" value="{$data.payinfo.opening_bank}" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-content tabcon1711" id="fkf_payinfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">付款方名称:</td>
<td class="r">
<input type="text" class="txt" name="" disabled="disabled" placeholder="" value="{$data.fkf_payinfo.payee_name}">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt" name="" value="{$data.fkf_payinfo.bank_account}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt" name="password" value="{$data.fkf_payinfo.opening_bank}" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</if>
</body>
<script>
<if condition="$is_export">
$(function(){
$("#exporttable").table2excel({
filename: "上游结算汇总.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
});
</if>
</script>
</html>

@ -1927,7 +1927,7 @@ CREATE TABLE `tab_company_statement_info` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`pool_id` int(11) NOT NULL COMMENT '汇总单id',
`company_id` int(11) DEFAULT '0' COMMENT '对账公司id',
`company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '1上游cp,2联运下游',
`company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质: 1-下游公司 2-下游个人 3上游公司',
`company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '对账公司名称',
`ali_user` varchar(64) NOT NULL DEFAULT '' COMMENT '支付宝真实名称',
`ali_account` varchar(128) NOT NULL DEFAULT '' COMMENT '支付宝登陆账号',

Loading…
Cancel
Save