聚合结算单导出优化3

master
chenzhi 5 years ago
parent 2fc38b25b6
commit afd362d847

@ -174,27 +174,27 @@ class AggregateFinanceStatementController extends ThinkController
"partner"=>json_decode($cpCompany['second_party_info'],true)['partner'] "partner"=>json_decode($cpCompany['second_party_info'],true)['partner']
]]; ]];
$this->ajaxReturn(array("success"=>$data,"code"=>2000)); $this->ajaxReturn(array("success"=>$data,"code"=>2000));
} }
public function getCpCompanyInfo() public function getCpCompanyInfo()
{ {
$CompanyId = $_REQUEST['company_id']; $CompanyId = $_REQUEST['company_id'];
$company_type = $_REQUEST['company_type']; $company_type = $_REQUEST['company_type'];
if($company_type == 'pt'){ if($company_type == 'pt'){
$info = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("id = '{$CompanyId}'")->find(); $info = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("id = '{$CompanyId}'")->find();
}else{ }else{
$cpCompany = M("aggregate_statement","tab_")->field("id,second_party_info")->where("id={$CompanyId}")->find(); $cpCompany = M("aggregate_statement","tab_")->field("id,second_party_info")->where("id={$CompanyId}")->find();
$info = json_decode($cpCompany['second_party_info'],true); $info = json_decode($cpCompany['second_party_info'],true);
} }
$info['invoice_item'] = "信息技术服务费"; $info['invoice_item'] = "信息技术服务费";
$info['invoice_type'] = "增值税专用发票"; $info['invoice_type'] = "增值税专用发票";
if(empty($info)){ if(empty($info)){
$this->ajaxReturn(array("error"=>"no find","code"=>2000)); $this->ajaxReturn(array("error"=>"no find","code"=>2000));
}else{ }else{
$this->ajaxReturn(array("success"=>$info,"code"=>0)); $this->ajaxReturn(array("success"=>$info,"code"=>0));
} }
} }
public function editStatement(){ public function editStatement(){
if(!isset($_REQUEST['id'])) $this->error("参数错误"); if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id']; $id = $_REQUEST['id'];
$dbres = M("aggregate_statement","tab_")->where("id = '{$id}'")->find(); $dbres = M("aggregate_statement","tab_")->where("id = '{$id}'")->find();
@ -291,10 +291,8 @@ class AggregateFinanceStatementController extends ThinkController
Vendor("PHPExcel.PHPExcel"); Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel(); $objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel5'); $objReader = \PHPExcel_IOFactory::createReader('Excel5');
//设置模板文件 //设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/aggregate_stream.xls"); $objPHPExcel = $objReader->load("Public/Admin/excel/aggregate_stream.xls");
$statement_begin_time = date('Y.m.d', $data['begintime']);//对账开始时间 $statement_begin_time = date('Y.m.d', $data['begintime']);//对账开始时间
$statement_end_time = date('Y.m.d',$data['endtime']);//对账截止时间 $statement_end_time = date('Y.m.d',$data['endtime']);//对账截止时间
$objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['channel_name']} 》结算单 $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['channel_name']} 》结算单
@ -303,13 +301,10 @@ class AggregateFinanceStatementController extends ThinkController
if ($data['withdraw_type'] == '2') { if ($data['withdraw_type'] == '2') {
$objPHPExcel->getActiveSheet()->setCellValue('D2','补点比例'); $objPHPExcel->getActiveSheet()->setCellValue('D2','补点比例');
} }
$line = 3; $line = 3;
foreach ($data['statement_info'] as $key => $value) { foreach ($data['statement_info'] as $key => $value) {
$objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1); $objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1);
$objPHPExcel->getActiveSheet()->removeConditionalStyles(); $objPHPExcel->getActiveSheet()->removeConditionalStyles();
$objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['begintime'] . '-' . $value['endtime']); $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['begintime'] . '-' . $value['endtime']);
$product_name = $value['game_name']; $product_name = $value['game_name'];
$objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['ratio'] . '%'); $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['ratio'] . '%');
@ -326,11 +321,8 @@ class AggregateFinanceStatementController extends ThinkController
$objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getFont()->setBold(false); $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getFont()->setBold(false);
$line++; $line++;
} }
$objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $data['pay_money']);//合计-平台总额 $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $data['pay_money']);//合计-平台总额
$objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $data['ratio_money']);//合计-结算金额 $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $data['ratio_money']);//合计-结算金额
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), $big_all_sum_money);//大写支付结算金额 $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), $big_all_sum_money);//大写支付结算金额
//甲方信息 //甲方信息
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line+3), $data['first_party_info']['partner']);//甲方 $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+3), $data['first_party_info']['partner']);//甲方
@ -338,13 +330,11 @@ class AggregateFinanceStatementController extends ThinkController
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line+5), $data['first_party_info']['link_phone']);//联系电话 $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+5), $data['first_party_info']['link_phone']);//联系电话
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line+6), $data['second_party_info']['invoice_item']);//开票项目 $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+6), $data['second_party_info']['invoice_item']);//开票项目
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $data['second_party_info']['invoice_type']);//发票类型 $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $data['second_party_info']['invoice_type']);//发票类型
//乙方信息 //乙方信息
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+3), $data['second_party_info']['partner']);//乙方 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+3), $data['second_party_info']['partner']);//乙方
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+4), $data['second_party_info']['link_man']);//联系人 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+4), $data['second_party_info']['link_man']);//联系人
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址
// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $value['pay_amount']);//请汇入此账号
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['second_party_info']['payee_name']);//户名 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['second_party_info']['payee_name']);//户名
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['second_party_info']['bank_account']);//银行账号 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['second_party_info']['bank_account']);//银行账号
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['second_party_info']['opening_bank']);//开户行 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['second_party_info']['opening_bank']);//开户行

Loading…
Cancel
Save