diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index 4db9c689c..7538924b9 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -611,6 +611,96 @@ class AggregateFinanceStatementController extends ThinkController $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+8), $first_data);//户名 // $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['pay_company']['payee_name']);//户名 // $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['pay_company']['bank_account']);//银行账号 +// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['pay_company']['opening_bank']);//开户行 + if($data['withdraw_type'] == 1){ + $m = date('Y.m', $data['begintime']); + $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$m}"; + }else{ + $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}"; + } + 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'); + } + public function excelDownStreamPersonTemplate($data,$big_all_sum_money) { + + 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 : '
'); + + date_default_timezone_set('Asia/Shanghai'); + Vendor("PHPExcel.PHPExcel"); + $objPHPExcel = new \PHPExcel(); + $objReader = \PHPExcel_IOFactory::createReader('Excel5'); + //设置模板文件 + $objPHPExcel = $objReader->load("Public/Admin/excel/aggregate_stream.xls"); + $statement_begin_time = date('Y.m.d', $data['begintime']);//对账开始时间 + $statement_end_time = date('Y.m.d',$data['endtime']);//对账截止时间 + + $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true); + $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['channel_name']} 》结算单\n({$statement_begin_time}-{$statement_end_time})"); + if ($data['withdraw_type'] == '2') { + $objPHPExcel->getActiveSheet()->setCellValue('D2','补点比例'); + } + $line = 3; + foreach ($data['statement_info'] as $key => $value) { + $objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1); + $objPHPExcel->getActiveSheet()->removeConditionalStyles(); + $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['begintime'] . '-' . $value['endtime']); + $product_name = $value['game_name']; + $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['ratio'] . '%'); + $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['fax_ratio'] . '%'); + $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['money']); + $objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $product_name); + $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['ratio_money']); + + $objPHPExcel->getActiveSheet()->getStyle('A'.$line)->getFont()->setBold(false); + $objPHPExcel->getActiveSheet()->getStyle('B'.$line)->getFont()->setBold(false); + $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getFont()->setBold(false); + $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getFont()->setBold(false); + $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getFont()->setBold(false); + $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getFont()->setBold(false); + $line++; + } + $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $data['pay_money']);//合计-平台总额 + $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $data['ratio_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+4), $data['first_party_info']['link_man']);//联系人 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+5), $data['first_party_info']['link_phone']);//联系电话 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+6), $data['first_party_info']['address']);//邮寄地址 +// $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+4), $data['second_party_info']['link_man']);//联系人 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址 + + //开票信息 +// $invoice_data = "发票类型:".$data['second_party_info']['invoice_type']; +// $invoice_data .= "\n发票抬头:".$data['second_party_info']['partner']; +// $invoice_data .= "\n纳税人识别号:".$data['second_party_info']['company_tax_no']; +// +// $invoice_data .= "\n开户银行:".$data['second_party_info']['opening_bank']; +// $invoice_data .= "\n开户账号:".$data['second_party_info']['payee_name']; +// $invoice_data .= "\n开票内容:".$data['second_party_info']['invoice_item']; +// $invoice_data .= "\n注册地址及电话:".$data['second_party_info']['register_address'].",".$data['second_party_info']['register_phone']; +// +// $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $invoice_data);//乙方 + + $first_data = "户名:{$data['pay_company']['payee_name']}"; + $first_data .= "\n账号:{$data['pay_company']['bank_account']}"; + $first_data .= "\n开户行:{$data['pay_company']['opening_bank']}"; + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $first_data);//户名 +// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['pay_company']['payee_name']);//户名 +// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['pay_company']['bank_account']);//银行账号 // $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['pay_company']['opening_bank']);//开户行 if($data['withdraw_type'] == 1){ $m = date('Y.m', $data['begintime']); diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index e6bc5ed65..98feeb66e 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -1145,23 +1145,40 @@ class CompanyStatementController extends ThinkController foreach ($check_add as $key => $value) { - if ($value['statement_end_time'] >= $start_time && $value['statement_end_time']<=$end_time - ||$value['statement_begin_time']>=$start_time && $value['statement_begin_time']<=$end_time - ||$value['statement_begin_time']>=$start_time && $value['statement_end_time'] <= $end_time) - { +// if ($value['statement_end_time'] >= $start_time && $value['statement_end_time']<=$end_time +// ||$value['statement_begin_time']>=$start_time && $value['statement_begin_time']<=$end_time +// ||$value['statement_begin_time']<=$start_time && $value['statement_end_time'] >= $end_time) +// { $statementInfo = json_decode($value['statement_info'],true);; if ($value['company_type'] == 2) { - $statementInfo = $statementInfo['game_list']; - } - foreach ($statementInfo as $k => $v) { - if (in_array($v['relation_game_id'],$relation_game_data)) { - $this->ajaxReturn(['status'=>0,'data'=>[],'msg'=>"《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]); + foreach ($statementInfo as $sk => $sv) { + $statementInfos = $sv['game_list']; + foreach ($statementInfos as $k => $v) { + if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time + ||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time + ||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) { + if (in_array($v['relation_game_id'], $relation_game_data)) { + $this->ajaxReturn(['status' => 0, 'data' => [], 'msg' => "《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]); + } + } + } + } + } else { + foreach ($statementInfo as $k => $v) { + if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time + ||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time + ||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) { + if (in_array($v['relation_game_id'], $relation_game_data)) { + $this->ajaxReturn(['status' => 0, 'data' => [], 'msg' => "《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]); + } + } } } - } + +// } } @@ -1181,7 +1198,7 @@ class CompanyStatementController extends ThinkController $radioMap['_string'] = "start_time < {$end_time}"; } $map['tab_spend.pay_status'] = 1; - $map['pay_way'] = ['egt',1]; + $map['pay_way'] = ['egt',0]; $data = M("spend","tab_") ->field("pay_amount,relation_game_id,relation_game_name,payed_time") diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 516b47bb0..4ecf1027c 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -1388,6 +1388,29 @@ class FinanceController extends ThinkController $cashStatistics[$value['pay_way']]['balance'] += $value['pay_amount'];//别表的平台币充值 } + $testOrderData = M('test_order', 'tab_') + ->where([ + 'pay_way'=>['egt',1], + 'pay_time'=>$time + ]) + ->field('pay_way,sum(pay_amount) as pay_amount') + ->group("pay_way") + ->select(); + foreach ($testOrderData as $key => $value) { + + if ($value['pay_way'] == NULL&&$value['pay_amount'] == NULL) { + continue; + } + + if (!array_key_exists($value['pay_way'], $cashStatistics)) { + $cashStatistics[$value['pay_way']] = $value; + $cashStatistics[$value['pay_way']]['pay_type'] = getPayType($value['pay_way']);//充值方式文字影视 + $cashStatistics[$value['pay_way']]['pay_amount'] = '0.00'; + $cashStatistics[$value['pay_way']]['balance'] = 0;//别表的平台币充值 + } + $cashStatistics[$value['pay_way']]['balance'] += $value['pay_amount'];//别表的平台币充值 + } + foreach ($cashStatistics as $key => $value) { $cashStatistics[$key]['pay_rate'] = ''; $cashStatistics[$key]['total'] = $value['pay_amount'] + $value['balance'];//添加列表合计 diff --git a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html index 624cab528..3a0cc3dc3 100644 --- a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html +++ b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html @@ -260,6 +260,7 @@ layer.msg("正在提交请勿重复提交..."); return; } + var is_zero = 0; layer.load(2); is_submit = 0; var time_start = $("#time_start").val(); @@ -293,7 +294,11 @@ sec_data['statement_begin_time'] = $(cval).next().find('.begin_time').text(); sec_data['statement_end_time'] = $(cval).next().find('.end_time').text(); statement_info.push(sec_data); - + if (sec_data['increment_ratio']<=0||sec_data['pay_amount']<=0) { + is_zero = 1; + layer.closeAll("loading"); + return; + } var _append = $(cval).parent(); var row = $(cval).attr('rowspan'); for (var i=0;i= get_time.find('.begin_time').text()&&data[item]['begin_time'][item_sec] <= get_time.find('.end_time').text()) + || (data[item]['end_time'][item_sec] >= get_time.find('.begin_time').text()&&data[item]['end_time'][item_sec] <= get_time.find('.end_time').text()) + ||(data[item]['begin_time'][item_sec]<=get_time.find('.begin_time').text()&&data[item]['end_time'][item_sec]>=get_time.find('.end_time').text()))) { begin_time.push(get_time.find('.begin_time').text()); end_time.push(get_time.find('.end_time').text()); @@ -448,6 +466,7 @@ get_time = get_time.next(); } + for (var time in begin_time) { if ((begin_time[time]>=time_start && begin_time[time]<=time_end) || (end_time[time]>=time_start && end_time[time]<=time_end)||(begin_time[time]<=time_start && end_time[time] >= time_end)) { @@ -551,18 +570,21 @@ function complementChange() { $(".complement").off("change"); $('.complement').change(function() { - //获取总流水 var pay_amount = parseFloat($(this).parent().prev().prev().text()); //计算最终分配比率 var ratio = parseFloat($(this).val()); + if (ratio<0) { + $(this).val(0); + ratio = 0; + } + if (ratio>100) { $(this).val(100); ratio = 100; } - //最终的分配金额 var withdraw_amount = ((pay_amount * ratio)/100).toFixed(2); diff --git a/Application/Admin/View/Finance/payTypeStatistics.html b/Application/Admin/View/Finance/payTypeStatistics.html index a4ec034f3..0febbec2f 100644 --- a/Application/Admin/View/Finance/payTypeStatistics.html +++ b/Application/Admin/View/Finance/payTypeStatistics.html @@ -71,12 +71,12 @@ diff --git a/Application/Admin/View/PayChannel/index.html b/Application/Admin/View/PayChannel/index.html index b702c54b0..b45ad9642 100644 --- a/Application/Admin/View/PayChannel/index.html +++ b/Application/Admin/View/PayChannel/index.html @@ -70,12 +70,12 @@ @@ -252,7 +252,7 @@ 平台币直充总金额(2019.12.18号以前的无法对应游戏记录不显示在列表中,此项也不计入充值方式统计){$coinSum}0.00 - + 支付渠道 @@ -260,7 +260,7 @@ - + 支付渠道占比 diff --git a/Application/Admin/View/PayMerchant/index.html b/Application/Admin/View/PayMerchant/index.html index ce401e232..8b28cb7e4 100644 --- a/Application/Admin/View/PayMerchant/index.html +++ b/Application/Admin/View/PayMerchant/index.html @@ -70,12 +70,12 @@ diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index b81a44233..fd917bb7f 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -4537,7 +4537,7 @@ public function iosDetailExcelInfo($id,$map) { $begin = $defaultBegin; $end = $defaultEnd; if ($time != '') { - if (strpos($time, $delimiter) == -1) { + if (strpos($time, $delimiter) === false) { $begin = strtotime($time . ' 00:00:00'); $end = strtotime($time . ' 23:59:59'); } else { diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 5ce3deb40..90c411456 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2014,7 +2014,7 @@ class QueryController extends BaseController $begin = $defaultBegin; $end = $defaultEnd; if ($time != '') { - if (strpos($time, $delimiter) == -1) { + if (strpos($time, $delimiter) === false) { $begin = strtotime($time . ' 00:00:00'); $end = strtotime($time . ' 23:59:59'); } else {