diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php
index cb0e05f60..5367d3b8a 100644
--- a/Application/Admin/Controller/OldCountController.class.php
+++ b/Application/Admin/Controller/OldCountController.class.php
@@ -10,6 +10,295 @@ namespace Admin\Controller;
class OldCountController extends \Think\Controller
{
+ public function setLackStatementInfo() {
+
+ $arrkey = [
+ 'A'=>'num',
+ 'B'=>'company_name',
+ 'C'=>'account',
+ 'D'=>'company_belong_str',
+ 'E'=>'company_relation_str',
+ 'F'=>'nickname',
+ 'G'=>'company_type',
+ 'H'=>'game_name',
+ 'I'=>'game_type_name',
+ 'J'=>'time',
+ 'K'=>'platform_amount',
+ 'L'=>'refund',
+ 'M'=>'ratio',
+ 'N'=>'increment_ratio',
+ 'O'=>'sum_money',
+ 'P'=>'reward',
+ 'Q'=>'fine',
+ 'R'=>'withhold',
+ 'S'=>'week_amount',
+ 'T'=>'sum_money_s',
+ 'U'=>'payee_name',
+ 'V'=>'bank_account',
+ 'W'=>'opening_bank',
+ 'X'=>'is_payment',
+ 'Y'=>'is_pay',
+ 'Z'=>'remark'
+ ];
+
+ 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('Excel2007');
+
+ //设置模板文件
+ $objPHPExcel = $objReader->load("Public/Admin/excel/set_info.xls");
+
+ $objWriter = new \PHPExcel_Writer_Excel5($objPHPExcel);
+ $currentSheet = $objPHPExcel->getSheet(0); //读取excel文件中的第一个工作表
+ $allColumn = 90; //取得最大的列号
+ $allRow = $currentSheet->getHighestRow(); //取得一共有多少行
+ $excelResult = []; //声明数组
+// dump($allColumn);die();
+ $startRow = 3;
+
+ for ($j = $startRow; $j <= $allRow; $j++) {
+ //从A列读取数据
+ for ($k = 65; $k <= $allColumn; $k++) {
+ // 读取单元格
+ $excelResult[$j][$arrkey[chr($k)]] = (string)$objPHPExcel->getActiveSheet()->getCell(chr($k)."$j")->getValue();
+ }
+ }
+
+ $handle_data = [];
+ $pool_data = [];
+// dump($excelResult);
+
+ foreach ($excelResult as $key => $value) {
+ $is_continue = 0;
+ $company_info = M("promote_company","tab_")->field("id company_id,company_type,bank_card,bank_cardname,bank_name,bank_address,ali_user,ali_account")->where(['company_name'=>$value['company_name']])->find();
+
+ if(!$company_info) {
+ continue;
+ }
+
+ $lack_data = M("company_lack_statement_info","tab_")
+ ->where([
+ 'company_id'=>$company_info['company_id']
+ ])
+ ->select();
+ $time = explode('-',$value['time']);
+ $game_data = M("game","tab_")->where(['relation_game_name'=>$value['game_name']])->find();
+
+ foreach ($lack_data as $lkey => $lvalue) {
+
+ $statement_info = json_decode($lvalue['statement_info'],true);
+// dump($statement_info);
+
+ foreach ($statement_info as $skey => $svalue) {
+
+
+
+ $game_list = $svalue['game_list'];
+ foreach ($game_list as $gkey => $gvalue) {
+// if($company_info['company_id'] == 73&&$gvalue['pay_amount']=='12.00' ) {
+// dump($svalue);
+// dump($gvalue['statement_begin_time'] == $time['0']);
+// dump($gvalue['statement_end_time'] == $time['1']);
+// dump($gvalue['relation_game_id'] == $game_data['relation_game_id']);
+// dump($gvalue['pay_amount'] == number_format($value['platform_amount'],2,'.',''));
+// }
+ //存在的游戏流水内部条件,如果存在不进行下列操作
+ if ($gvalue['statement_begin_time'] == $time['0']
+ &&$gvalue['statement_end_time'] == $time['1']
+ &&$gvalue['relation_game_id'] == $game_data['relation_game_id']
+ &&$gvalue['pay_amount'] == number_format($value['platform_amount'],2,'.','')) {
+
+ $is_continue = 1;
+
+ }
+
+ }
+
+ }
+
+ }
+ //已经存在的单子结算
+ if ($is_continue) {
+ continue;
+ }
+
+ $handle_data[$value['time'].$company_info['company_id']]['company_id'] = $company_info['company_id'];
+ $handle_data[$value['time'].$company_info['company_id']]['company_type'] = $company_info['company_type'];
+ $handle_data[$value['time'].$company_info['company_id']]['company_name'] = $value['company_name'];
+
+ $companyInfo = [
+ 'account'=>$value['account'],
+ 'company_relation_str'=>$value['company_relation_str'],
+ 'company_belong_str'=>$value['company_belong_str'],
+ 'company_type_str'=>$value['company_type'],
+ 'nickname'=>'nickname',
+ ];
+
+ $relation = M("company_relation","tab_")
+ ->where("(first_company_id = {$company_info['company_id']} and first_company_type!=3) or (second_company_id = {$company_info['company_id']} and second_company_type!=3)")
+ ->find();
+
+ if ($relation['is_payment'] == 1) {
+ $companyInfo['ali_user'] = $company_info['ali_user'];
+ $companyInfo['ali_account'] = $company_info['ali_account'];
+ } else {
+ $companyInfo['payee_name'] = $company_info['bank_address'];
+ $companyInfo['bank_account'] = $company_info['bank_card'];
+ $companyInfo['opening_bank'] = $company_info['bank_name'];
+ }
+
+ $handle_data[$value['time'].$company_info['company_id']]['statement_money'] += $value['sum_money']-$value['fine']+$value['reward']-$value['withhold'];
+ $handle_data[$value['time'].$company_info['company_id']]['pay_amount'] += $value['sum_money']-$value['fine']+$value['reward']-$value['withhold'];
+ $handle_data[$value['time'].$company_info['company_id']]['company_info'] = json_encode($companyInfo);
+ $handle_data[$value['time'].$company_info['company_id']]['platform_amount'] += $value['platform_amount'];
+ $handle_data[$value['time'].$company_info['company_id']]['fine'] += $value['fine'];
+ $handle_data[$value['time'].$company_info['company_id']]['reward'] += $value['reward'];
+
+
+ $handle_data[$value['time'].$company_info['company_id']]['statement_begin_time'] = strtotime(str_replace('.','-',$time['0']));
+ $handle_data[$value['time'].$company_info['company_id']]['statement_end_time'] = strtotime(str_replace('.','-',$time['1']))+86399;
+
+ $p_id = M("promote","tab_")->field("id")->where(['account'=>$value['account']])->find();
+
+ if ($handle_data[$value['time'].$company_info['company_id']]['statement_info']) {
+ $handle_data[$value['time'].$company_info['company_id']]['statement_info'][0]['game_list'][] =
+ [
+ 'pay_amount'=>$value['platform_amount'],
+ 'relation_game_id'=>$game_data['relation_game_id'],
+ 'game_name'=>$game_data['relation_game_name'],
+ 'p_id'=>$p_id['id'],
+ 'all_pay_amount'=>$value['platform_amount'],
+ 'game_type_name'=>$game_data['game_type_name'],
+ 'ratio'=>$value['ratio']*100,
+ 'sum_money'=>number_format($value['sum_money'],2,'.',''),
+ 'fax_ratio'=>0,
+ 'statement_begin_time'=>$time['0'],
+ 'statement_end_time'=>$time['1'],
+ 'fine'=>$value['fine'],
+ 'reward'=>$value['reward'],
+ 'statement_type'=>0,
+ 'refund'=>$value['refund'],
+ 'withhold'=>$value['withhold'],
+ 'increment_ratio'=>$value['increment_ratio']*100
+ ];
+ } else {
+ $handle_data[$value['time'].$company_info['company_id']]['statement_info'][] = [
+ "account"=>$value['account'],
+ "game_list"=>[
+ [
+ 'pay_amount'=>$value['platform_amount'],
+ 'relation_game_id'=>$game_data['relation_game_id'],
+ 'game_name'=>$game_data['relation_game_name'],
+ 'p_id'=>$p_id['id'],
+ 'all_pay_amount'=>$value['platform_amount'],
+ 'game_type_name'=>$game_data['game_type_name'],
+ 'ratio'=>$value['ratio']*100,
+ 'sum_money'=>number_format($value['sum_money'],2,'.',''),
+ 'fax_ratio'=>0,
+ 'statement_begin_time'=>$time['0'],
+ 'statement_end_time'=>$time['1'],
+ 'fine'=>$value['fine'],
+ 'reward'=>$value['reward'],
+ 'statement_type'=>0,
+ 'refund'=>$value['refund'],
+ 'withhold'=>$value['withhold'],
+ 'increment_ratio'=>$value['increment_ratio']*100
+ ]
+ ]
+ ];
+ }
+
+
+// $handle_data[$value['time'].$company_info['company_id']]['statement_info'] = $statement_info;
+// del_lack_ids
+
+ $company_statement_pool = M("company_statement_pool","tab_")
+ ->field("statement_num,del_lack_ids")
+ ->where([
+ 'statement_begin_time'=>$handle_data[$value['time'].$company_info['company_id']]['statement_begin_time'],
+ 'statement_end_time'=>$handle_data[$value['time'].$company_info['company_id']]['statement_end_time'],
+ 'company_type'=>2,
+ 'withdraw_type'=>['neq',3]
+ ])
+ ->find();
+
+ $handle_data[$value['time'].$company_info['company_id']]['statement_pool_num'] = $company_statement_pool['statement_num']?$company_statement_pool['statement_num']:"";
+ $handle_data[$value['time'].$company_info['company_id']]['is_payment'] = $relation['is_payment'];
+ $handle_data[$value['time'].$company_info['company_id']]['remark'] = $company_statement_pool['remark'];
+
+ }
+ $handle_data = array_values($handle_data);
+
+// dump($handle_data);
+
+ foreach ($handle_data as $key => $value) {
+
+ $value['statement_info'] = json_encode($value['statement_info']);
+ $lack_id = M("company_lack_statement_info","tab_")->add($value);
+ $pool_data[$value['statement_pool_num']]['del_lack_ids'][] = $lack_id;
+ }
+
+ $lack_data324 = M("company_lack_statement_info","tab_")
+ ->where([
+ 'id'=>324
+ ])
+ ->find();
+
+ $lack_data324['fine'] = 5000;
+ $lack_data324['statement_money'] = $lack_data324['statement_money']-5000;
+ $lack_data324['pay_amount'] = $lack_data324['pay_amount']-5000;
+ $statement_info324 = json_decode($lack_data324['statement_info'],true);
+ $statement_info324[0]['game_list'][0]['fine'] = 5000;
+ $lack_data324['statement_info'] = json_encode($statement_info324);
+ M("company_lack_statement_info","tab_")
+ ->where([
+ 'id'=>324
+ ])->save($lack_data324);
+
+ $lack_data334 = M("company_lack_statement_info","tab_")
+ ->where([
+ 'id'=>334
+ ])
+ ->find();
+ $lack_data334['fine'] = 2000;
+ $lack_data334['statement_money'] = $lack_data334['statement_money']-2000;
+ $lack_data334['pay_amount'] = $lack_data334['pay_amount']-2000;
+ $statement_info334 = json_decode($lack_data334['statement_info'],true);
+ $statement_info334[0]['game_list'][0]['fine'] = 2000;
+ $lack_data334['statement_info'] = json_encode($statement_info334);
+ M("company_lack_statement_info","tab_")
+ ->where([
+ 'id'=>334
+ ])->save($lack_data334);
+ echo "success";
+// foreach ($pool_data as $key => $value) {
+//
+// $pool_info = M("company_statement_pool","tab_")
+// ->where(['statement_num'=>$key])
+// ->find();
+//
+// $del_lack_ids = $pool_info['del_lack_ids'].','.implode(',',$value['del_lack_ids']);
+// M("company_statement_pool","tab_")
+// ->where(['statement_num'=>$key])
+// ->save(['del_lack_ids'=>$del_lack_ids]);
+//
+// }
+
+// M("company_lack_statement_info","tab_")->addAll($handle_data);
+
+// dump($handle_data);
+
+ }
+
public function updateStatementInfo() {
$data = M("company_statement_info","tab_")
diff --git a/Application/Payment/Controller/ExcelPaymentController.class.php b/Application/Payment/Controller/ExcelPaymentController.class.php
index 11398c273..67571effc 100644
--- a/Application/Payment/Controller/ExcelPaymentController.class.php
+++ b/Application/Payment/Controller/ExcelPaymentController.class.php
@@ -507,7 +507,7 @@ class ExcelPaymentController extends BaseController
])
->select();
- $check_company_statement_info = M("company_statement_info","tab_")
+ $check_company_statement_info = M("pay_statement_info","tab_")
->where([
'pay_status'=>1,
'company_name'=>$value['company_name'],
diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php
index 4c8890869..7d41b83df 100644
--- a/Application/Payment/Controller/PaymentController.class.php
+++ b/Application/Payment/Controller/PaymentController.class.php
@@ -277,7 +277,7 @@ class PaymentController extends BaseController
//周结算金额计算
for ($i=0;;$i++) {
if ($sv[$i]['sum_money']) {
- $game_data['week_amount'] += $sv[$i]['sum_money'];
+ $game_data['week_amount'] += $sv[$i]['sum_money']- $sv[$i]['withhold']+$sv[$i]['reward']-$sv[$i]['fine'];
$game_data['withhold_amount'] += $sv[$i]['withhold'];
$game_data['fine'] += $sv[$i]['fine'];
$game_data['reward'] += $sv[$i]['reward'];
@@ -440,10 +440,11 @@ class PaymentController extends BaseController
$v['statement_money'] .= "S{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
- $count['week_money'] += $val['sum_money'];
- $count['sum_money'] += $val['sum_money'];
+
}
}
+ $count['week_money'] += $va['week_amount'];
+ $count['sum_money'] += $va['week_amount'];
}
@@ -1133,7 +1134,7 @@ class PaymentController extends BaseController
$ids = $_REQUEST['ids'];
- $data = M("company_statement_info","tab_")
+ $data = M("pay_statement_info","tab_")
->field("id,statement_money,company_name,statement_begin_time,statement_end_time,pay_time")
->where(['id'=>['in',implode(',',$ids)]])
->select();
@@ -1153,7 +1154,7 @@ class PaymentController extends BaseController
])
->select();
- $check_company_statement_info = M("company_statement_info","tab_")
+ $check_company_statement_info = M("pay_statement_info","tab_")
->where([
'pay_status'=>1,
'company_name'=>$value['company_name'],
diff --git a/Application/Payment/View/Payment/viewPuPool.html b/Application/Payment/View/Payment/viewPuPool.html
index d12104789..fd1b0fa2f 100644
--- a/Application/Payment/View/Payment/viewPuPool.html
+++ b/Application/Payment/View/Payment/viewPuPool.html
@@ -106,10 +106,12 @@