Merge branch 'feature/aggregate_finance' of wmtx/platform into release

聚合财务结算单
master
廖金灵 5 years ago committed by Gogs
commit ff5b2e3483

@ -0,0 +1,229 @@
<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 后台总览聚合
* @author cz
*/
class AggregateFinanceSetController extends Controller {
public $apihost;
public $token = "LYHTQDJS";
public function _initialize(){
$apihost = M("Kv")->field("value")->where("`key` = 'aggregate_finance_api'")->find();
if(empty($apihost)){
echo "请先设置请求接口aggregate_finance_api的值".PHP_EOL;die;
}
$this->apihost = $apihost['value'];
}
public function setFreeDateCount($begin,$end='')
{
if($end == '') $end = $begin;
//判断日期格式
$patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/";
if (!preg_match($patten, $begin)) {
die("开始时间格式错误");
}
if (!preg_match($patten, $end)) {
die("结束时间格式错误");
}
if(strtotime($end) < strtotime($begin)){
die("结束时间不能比开始时间小");
}
if(strtotime($end)+86399-24*3600 > time()){
die("结束时间不能大于当前");
}
$starttime = $begin?strtotime($begin):mktime(0,0,0,date('m'),date('d'),date('Y'));
$endtime = $end?strtotime($end)+86399:$starttime+86399;
$datelist = get_date_list($starttime,$endtime,1);
$countdate = count($datelist);
for($i=0;$i<$countdate;$i++){
$this->setDailyCount($datelist[$i]);
}
}
public function setDailyCount($stime="now")
{
if($stime=="now"){
$stime=time();
}else{
$stime = strtotime($stime);
}
$nowdate = date("Y-m-d",$stime);
$w = (int)date("w",$stime);
$d = (int)date("d",$stime);
if($w == 1 || $d == 1){
if($w == 1){
echo $nowdate.":".PHP_EOL;
echo "--周结begin".PHP_EOL;
$this->setWeekCount($stime);
}
if($d == 1){
echo $nowdate.":".PHP_EOL;
echo "--月结&补点begin".PHP_EOL;
$this->setMonthCount($stime);
}
}else{
echo $nowdate."非周一和月初,无需任何处理".PHP_EOL;
}
}
public function setWeekCount($stime)//进行周结
{
$begintime = mktime(0,0,0,date('m',$stime),date('d',$stime)-7,date('Y',$stime));
$endtime = mktime(0,0,0,date('m',$stime),date('d',$stime),date('Y',$stime))-1;
$this->getAndSaveData(0,$begintime,$endtime);
}
public function setMonthCount($stime)//进行周结
{
$thismonth = date('m',$stime);
$thisyear = date('Y',$stime);
if ($thismonth == 1) {
$lastmonth = 12;
$lastyear = $thisyear - 1;
} else {
$lastmonth = $thismonth - 1;
$lastyear = $thisyear;
}
$lastStartDay = $lastyear . '-' . $lastmonth . '-1';
$lastEndDay = $lastyear . '-' . $lastmonth . '-' . date('t', strtotime($lastStartDay));
$begintime = strtotime($lastStartDay);//上个月的月初时间戳
$endtime = strtotime($lastEndDay)+24*3600-1;//上个月的月末时间戳
//普通月结
$this->getAndSaveData(1,$begintime,$endtime);
//补点
$this->getAndSaveData(2,$begintime,$endtime);
}
protected function getAndSaveData($type,$begintime,$endtime)
{
$sign = md5($begintime.$endtime.$type.$this->token);
$arr = [
"begintime"=>$begintime,
"endtime"=>$endtime,
"type"=>$type,
"sign"=>$sign
];
$dataurl .= $this->apihost."&".http_build_query($arr);
$html = file_get_contents($dataurl);
$rsp = json_decode($html,true);
if($rsp['code'] != 1){
echo $rsp['error'].PHP_EOL;die;
}
//成功插入
$Aggregate = M("aggregate_statement","tab_");
$begintimestr = date("Y-m-d",$begintime);
$endtimestr = date("Y-m-d",$endtime);
if($rsp['count'] > 0){
//插入数据
foreach ($rsp['data'] as $k => $v) {
foreach ($v["game_list"] as $ke => &$va) {
$va['begintime'] = $begintimestr;
$va['endtime'] = $endtimestr;
$va['fax_ratio'] = 0;
}
$v["statement_info"] = json_encode($v["game_list"],JSON_UNESCAPED_UNICODE);
unset($v["game_list"]);
$v['begintime'] = $begintime;
$v['endtime'] = $endtime;
$v['create_time'] = time();
$v['admin_name'] = "system";
$v['admin_id'] = 0;
$v['second_party_info'] = json_encode([
"partner"=>$v['channel_name']
],JSON_UNESCAPED_UNICODE);
$Aggregate->add($v);
}
}
if($type == 0){
echo "----周结统计ok".PHP_EOL;
}elseif($type == 1){
echo "----月结统计ok".PHP_EOL;
}elseif($type == 2){
echo "----补点统计ok".PHP_EOL;
}
}
public function updateAggregateFinanceData($id)
{
//获取基础信息
$Aggregate = M("aggregate_statement","tab_");
$info = $Aggregate->where("id='{$id}'")->find();
$sign = md5($info['begintime'].$info['endtime'].$info['withdraw_type'].$this->token);
$arr = [
"begintime"=>$info['begintime'],
"endtime"=>$info['endtime'],
"type"=>$info['withdraw_type'],
"sign"=>$sign,
"channel_id"=>$info['channel_id']
];
$dataurl .= $this->apihost."&".http_build_query($arr);
$html = file_get_contents($dataurl);
$rsp = json_decode($html,true);
if($rsp['code'] != 1){
echo $rsp['error'].PHP_EOL;die;
}
//更新信息
$begintimestr = date("Y-m-d",$info['begintime']);
$endtimestr = date("Y-m-d",$info['endtime']);
if($rsp['count'] > 0){
//插入数据
foreach ($rsp['data'] as $k => $v) {
foreach ($v["game_list"] as $ke => &$va) {
$va['begintime'] = $begintimestr;
$va['endtime'] = $endtimestr;
$va['fax_ratio'] = 0;
}
$v["statement_info"] = json_encode($v["game_list"],JSON_UNESCAPED_UNICODE);
unset($v["game_list"]);
$v['create_time'] = time();
$v['admin_name'] = $_SESSION['onethink_admin']['user_auth']['username'];
$v['admin_id'] = $_SESSION['onethink_admin']['user_auth']['uid'];
$v['verify_status'] = 0;
$first_party_info = json_decode($info['first_party_info'], 1);
if($first_party_info['partner'] == $info['channel_name']){
$v['second_party_info'] = $info['first_party_info'];
$v['first_party_info'] = $info['second_party_info'];
$v['pay_type'] =0;
}
$res = $Aggregate->where("id='{$id}'")->save($v);
if(empty($res)){
return false;
}
}
}else{
$savedata = [
"create_time"=>time(),
"admin_name"=>$_SESSION['onethink_admin']['user_auth']['username'],
"admin_id"=>$_SESSION['onethink_admin']['user_auth']['uid'],
"verify_status"=>0,
"statement_info"=>json_encode([],JSON_UNESCAPED_UNICODE),
"ratio_money"=>0,
"pay_money"=>0
];
$first_party_info = json_decode($info['first_party_info'], 1);
if($first_party_info['partner'] == $info['channel_name']){
$savedata['second_party_info'] = $info['first_party_info'];
$savedata['first_party_info'] = $info['second_party_info'];
$savedata['pay_type'] =0;
}
$res = $Aggregate->where("id='{$id}'")->save($savedata);
if(empty($res)){
return false;
}
}
return true;
}
}

@ -0,0 +1,729 @@
<?php
namespace Admin\Controller;
/**
* 聚合下游结算
* @author 王贺
*/
class AggregateFinanceStatementController extends ThinkController
{
public $verify_status = [
"-1"=>"审核拒绝",
"0"=>"未申请开票",
"1"=>"申请开票",
"2"=>"审核同意",
"3"=>"已开票",
"4"=>"已上传凭证",
"5"=>"已到账"
];
public $admininfo;
public $OpAuthList=[];
//TODO:
public function _initialize()
{
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
parent::_initialize();
}
public function lists() {
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
//权限
if(!IS_ROOT){
$this->getAuth();
}
//分页
$page = intval(I('get.p', 0));
$page = $page ? $page : 1; //默认显示第一页数据
$row = intval(I('row', 0));
$row = empty($row) ? 10 : $row;//每页条数
$map = [];
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(begintime BETWEEN {$time_start} AND {$time_end}) OR (endtime BETWEEN {$time_start} AND {$time_end})";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$map["_string"] = "(begintime >= {$time_start} ) OR (endtime >= {$time_start})";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(begintime <= {$time_end} ) OR (endtime <= {$time_end})";
}
if (isset($_REQUEST['time_start2']) && isset($_REQUEST['time_end2'])) {
$map['create_time'] = ['between', [strtotime($_REQUEST['time_start2']), strtotime($_REQUEST['time_end2']) + 86399]];
} elseif (isset($_REQUEST['time_start2'])) {
$map['create_time'] = ['EGT', strtotime($_REQUEST['time_start2'])];
} elseif (isset($_REQUEST['time_end2'])) {
$map['create_time'] = ['ELT', strtotime($_REQUEST['time_end2']) + 86399];
}
if ($_REQUEST['verify_status']) {
$map['verify_status'] = $_REQUEST['verify_status'];
}
if ($_REQUEST['channel_id']) {
$map['channel_id'] = $_REQUEST['channel_id'];
}
$typeflag = false;
if (isset($_REQUEST['withdraw_type'])) {
if($_REQUEST['withdraw_type'] == 1){
$typeflag = 1;//月结
$map["withdraw_type"] = 1;
}else{
$typeflag = 2;//周结
$map["withdraw_type"] = ["in",[0,2]];
}
}
if (isset($_REQUEST['withdraw_type2'])) {
if($_REQUEST['withdraw_type2'] == 2){
if($typeflag == 1){ //月结的补点找不到
$map['withdraw_type'] = 999;
}else{ //周结的补点就是补点
$map['withdraw_type'] = 2;
}
}else{
if($typeflag == 1){//月结的正常=月结
$map['withdraw_type'] = 1;
}elseif($typeflag == 2){//周结的正常=周结
$map['withdraw_type'] = 0;
}else{//没选的正常是 非补点
$map['withdraw_type'] = ["in",[0,1]];
}
}
}
$data = M("aggregate_statement","tab_")
->where($map)
->order("create_time Desc")->page($page,$row)->select();
foreach($data as $key => $value) {
$data[$key]['verify_status_str'] = $this->verify_status[$value['verify_status']];
$data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
$data[$key]['begintime'] = date('Y-m-d',$value['begintime']);
$data[$key]['endtime'] = date('Y-m-d',$value['endtime']);
$data[$key]['withdraw_type_1'] = ($value['withdraw_type'] == 1 ? "月结" :"周结");
$data[$key]['withdraw_type_2'] = ($value['withdraw_type'] == 2 ? "补点" :"正常结算");
$data[$key]['oplist'] = $this->OpAuth($value);
}
$count = M("aggregate_statement","tab_")->field("count(id) count,SUM(ratio_money) ratio_money,SUM(pay_money) pay_money")->where($map)->find();
//分页
$parameter['p'] = $page;
$parameter['row'] = $row;
$page = set_pagination($count['count'], $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
//
$this->assign('menubtn',$this->menuAuth());
$this->assign('data',$data);
$this->assign('total',$count['ratio_money']);
$this->assign('pay_money',$count['pay_money']);
$this->assign('channel',$this->getAggChannel());
$this->assign('verify_status',$this->verify_status);
$this->display();
}
//获取所有下游渠道
public function getAggChannel()
{
return M("aggregate_statement","tab_")->field("channel_id,channel_name")->group("channel_id")->select();
}
//申请开票
public function createStatement(){
if (isset($_REQUEST['id'])){
$id = $_REQUEST['id'];
}else{
$this->error("参数错误");
}
$info = M("aggregate_statement","tab_")->field("statement_info,pay_money,ratio_money")->where("id={$id}")->find();
$statement_info = json_decode($info['statement_info'],true);
$this->assign('data',$statement_info);
$this->assign('data_count',["pay_money"=>$info['pay_money'],"ratio_money"=>$info['ratio_money']]);
$this->assign('id',$id);
$this->display();
}
public function doAddStatement(){
$first_partner_type = $_REQUEST['first_partner_type'];
$second_party_info = $_REQUEST['second_party_info'];
$statement_info = $_REQUEST['statement_info'];
$admininfo = $_SESSION['onethink_admin']['user_auth'];
$data_count = $_REQUEST['statement_count'];
if(!isset($_REQUEST['statement_id'])){
$this->error("参数错误");
}
//拼凑数据
$adddata = array(
"pay_money"=>$data_count['pay_money'],
"ratio_money"=>$data_count['ratio_money'],
"pay_type"=>$_REQUEST['statement_type'] == 0 ? 1 :0,
"first_party_info"=>json_encode($_REQUEST['first_party_info'],JSON_UNESCAPED_UNICODE),
"second_party_info"=>json_encode($_REQUEST['second_party_info'],JSON_UNESCAPED_UNICODE),
"statement_info"=>json_encode($statement_info,JSON_UNESCAPED_UNICODE),
"admin_name"=>$admininfo['username'],
"admin_id"=>$admininfo['uid'],
"verify_status"=>1,
"create_time"=>time()
);
$id = $_REQUEST['statement_id'];
$res = M("aggregate_statement","tab_")->where("id = '{$id}'")->save($adddata);
if($res !== false){
$this->doAddOperationLog($id,"申请开票");
$this->ajaxReturn(array("success"=>"ok","code"=>0));
}else{
$this->ajaxReturn(array("error"=>"database error","code"=>2000));
}
}
//获取公司信息
public function getCompanyList()
{
$id = $_REQUEST['id'];
$cpCompany = M("aggregate_statement","tab_")->field("id,second_party_info")->where("id={$id}")->find();
$data = array();
$data['ptCompany']= M("CompanyInfo","tab_")->field('id,partner')->select();
$data['cpCompany']= [[
"id"=> $cpCompany['id'],
"partner"=>json_decode($cpCompany['second_party_info'],true)['partner']
]];
$this->ajaxReturn(array("success"=>$data,"code"=>2000));
}
public function getCpCompanyInfo()
{
$CompanyId = $_REQUEST['company_id'];
$company_type = $_REQUEST['company_type'];
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();
}else{
$cpCompany = M("aggregate_statement","tab_")->field("id,second_party_info")->where("id={$CompanyId}")->find();
$info = json_decode($cpCompany['second_party_info'],true);
}
$info['invoice_item'] = "信息技术服务费";
$info['invoice_type'] = "增值税专用发票";
if(empty($info)){
$this->ajaxReturn(array("error"=>"no find","code"=>2000));
}else{
$this->ajaxReturn(array("success"=>$info,"code"=>0));
}
}
public function editStatement(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$dbres = M("aggregate_statement","tab_")->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['company_name'] == $first_party_info['partner']){
// $first_partner_type=0;
// }else{
// $first_partner_type=1;
// }
// $fine = array_pop($statement_info);
$senddata = array(
// "first_partner_type"=>1,
"statement_id"=>$dbres['id'],
"first_part_company"=>$first_party_info['partner'],
"second_part_company"=>$second_party_info['partner'],
"statement_type"=>$dbres['pay_type'] == 0 ? 1 :0,
"first_party_info"=>$first_party_info,
"second_party_info"=>$second_party_info,
"statement_info"=>$statement_info,
"statement_count"=>array("pay_money"=>$dbres['pay_money'],"ratio_money"=>$dbres['ratio_money'])
);
$this->assign("data",$senddata);
if($dbres['pay_type'] == 0){
$this->assign("company",$second_party_info['partner']);
}else{
$this->assign("company",$first_party_info['partner']);
}
$this->assign("company_id",$dbres['company_id']);
$this->assign("company_name",$dbres['company_name']);
$this->assign("id",$dbres['id']);
$this->display();
}
//查看发票信息
public function viewStatement(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$dbres = M("aggregate_statement","tab_")->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'] == 0){
$company = $second_party_info['partner'];
$pyinfo = $second_party_info;
}else{
$company = $first_party_info['partner'];
$pyinfo = $first_party_info;
}
$senddata = array(
"company"=>$company,
"payinfo"=>$pyinfo,
"first_part_company"=>$first_party_info['partner'],
"second_part_company"=>$second_party_info['partner'],
"statement_type"=>$dbres['pay_type'],
"first_party_info"=>$first_party_info,
"second_party_info"=>$second_party_info,
"statement_info"=>$statement_info,
"statement_count"=>array("pay_money"=>$dbres['pay_money'],"ratio_money"=>$dbres['ratio_money'],"big_ratio_money"=>convertAmountToCn($dbres['ratio_money']))
);
$this->assign("data",$senddata);
$this->display();
}
//上传凭证
public function uploadVoucher()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$this->assign("id",$id);
$this->display();
}
//修改凭证
public function editVoucher()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$info = M("aggregate_statement","tab_")->field("id,verify_status,ext_field")->where("id = '{$id}'")->find();
$this->assign("id",$id);
$this->assign("ext_field",$info['ext_field']);
$this->display();
}
//保存凭证
public function saveVoucher()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$path = '/Uploads/';
$upload = new \Think\Upload();// 实例化上传类
$upload->maxSize = 0 ;// 设置附件上传大小
$upload->exts = array('jpg', 'gif', 'png', 'jpeg');;// 设置附件上传类型
$upload->rootPath = '.'.$path; // 设置附件上传根目录
$upload->savePath = ''; // 设置附件上传(子)目录
// 上传文件
$info = $upload->upload();
if(!$info) {// 上传错误提示错误信息
$msg = $upload->getError();
$array= array('status' => 0, 'info' => $msg);
}else{// 上传成功
//
$pf = $path.$info['file']['savepath'].$info['file']['savename'];
$save = [
"ext_field"=>$pf,
];
//获取旧值,存在删除
$info = M("aggregate_statement","tab_")->field("id,verify_status,ext_field")->where("id = '{$id}'")->find();
if(!empty($info['ext_field'])){
unlink("./".$info['ext_field']);
}
//如果是开票状态就改状态
if($info["verify_status"] == 3){
$save['verify_status'] = 4;
$save['create_time'] = time();
$save["admin_name"]=$this->admininfo["username"];
$save["admin_id"]=$this->admininfo["uid"];
}
M("aggregate_statement","tab_")->where("id = '{$id}'")->save($save);
$this->doAddOperationLog($id,"上传凭证");
$array=array(
'status' => 1,
"info"=>"上传成功",
"file_path"=>$pf,
);
}
$this->ajaxReturn($array);
}
//删除凭证
public function delVoucher(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$info = M("aggregate_statement","tab_")->field("id,ext_field,verify_status")->where("id = '{$id}'")->find();
if(!empty($info['ext_field'])){
unlink("./".$info['ext_field']);
}
$save = [
"ext_field"=>'',
];
//如果是已上传凭证状态就回退到审核通过
if($info["verify_status"] == 4){
$save['verify_status'] = 3;
$save['create_time'] = time();
$save["admin_name"]=$this->admininfo["username"];
$save["admin_id"]=$this->admininfo["uid"];
}
M("aggregate_statement","tab_")->where("id = '{$id}'")->save($save);
$this->doAddOperationLog($id,"删除凭证");
$this->ajaxReturn(array(
'status' => 1,
'info' => "删除成功"
));
}
//新增备注
public function saveRemark(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$remark = $_REQUEST['remark'];
M("aggregate_statement","tab_")->where("id = '{$id}'")->save(['remark'=>$remark]);
$this->doAddOperationLog($id,"新增备注");
$this->ajaxReturn(array(
'status' => 1,
'info' => "操作成功"
));
}
//审批通过
public function agreeApply(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$savedata = ["verify_status"=>2,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata);
$ids = explode(",",$ids);
foreach($ids as $k=>$v){
$this->doAddOperationLog($v,"审批通过");
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"审批通过成功"
));
}
//审核拒绝
public function refuseApply(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$savedata = ["verify_status"=>-1,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata);
$ids = explode(",",$ids);
foreach($ids as $k=>$v){
$this->doAddOperationLog($v,"审批拒绝");
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"审批拒绝成功"
));
}
//已开票
public function Invoiced(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$savedata = ["verify_status"=>3,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata);
$ids = explode(",",$ids);
foreach($ids as $k=>$v){
$this->doAddOperationLog($v,"已开票");
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"已开票成功"
));
}
//已到账
public function Received(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$savedata = ["verify_status"=>5,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata);
$ids = explode(",",$ids);
foreach($ids as $k=>$v){
$this->doAddOperationLog($id,"已到账");
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"已到账成功"
));
}
//重算金额
public function updateStatement()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = explode(",",$_REQUEST['ids']);
foreach ($ids as $k => $v) {
$res = A("AggregateFinanceSet")->updateAggregateFinanceData($v);
if(!$res){
$this->ajaxReturn(array(
'status' => 0,
"info"=>"重算结算金额失败"
));
}else{
$this->doAddOperationLog($v,"重算结算金额");
}
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"算结算金额成功"
));
}
//撤销审核
public function cancelVerify(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$savedata = ["verify_status"=>1,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
M("aggregate_statement","tab_")->where("id ='{$id}'")->save($savedata);
$this->doAddOperationLog($id,"撤销审核");
$this->ajaxReturn(array(
'status' => 1,
"info"=>"撤销审核成功"
));
}
//撤销申请
public function cancelApply(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$data = M("aggregate_statement","tab_")->where("id = '{$id}'")->find();
$savedata = ["verify_status"=>0,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
$first_party_info = json_decode($data['first_party_info'], 1);
if($first_party_info['partner'] == $data['channel_name']){
$savedata['second_party_info'] = $data['first_party_info'];
$savedata['first_party_info'] = $data['second_party_info'];
$savedata['pay_type'] =0;
}
M("aggregate_statement","tab_")->where("id ='{$id}'")->save($savedata);
$this->doAddOperationLog($id,"撤销申请");
$this->ajaxReturn(array(
'status' => 1,
"info"=>"撤销申请成功"
));
}
//导出
public function export()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$data = M("aggregate_statement","tab_")->where("id = '{$id}'")->find();
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
$data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录
//收款方
$big_pay_money = convertAmountToCn($data['ratio_money']);//大写
$data['receive_company'] = $data['pay_type'] ? $data['first_party_info'] : $data['second_party_info'];
$data['pay_company'] = $data['pay_type'] ? $data['second_party_info'] : $data['first_party_info'];
$this->doAddOperationLog($id,"导出");
$this->excelDownStreamTemplate($data,$big_pay_money);
}
public function excelDownStreamTemplate($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 : '<br />');
date_default_timezone_set('Europe/London');
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()->setCellValue('A1', "《 {$data['channel_name']} 》结算单
{$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['second_party_info']['invoice_item']);//开票项目
$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']);//邮寄地址
$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+10), $data['second_party_info']['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 getAuth()
{
$group = $_SESSION['onethink_admin']['user_group_id'];
//获取全部权限列表
$ruleList = M("AuthGroup")->field("rules")->where("id='{$group}'")->find()['rules'];
//获取所有含有规则的数据
$authlist = M("AuthRule")->field('name')->where("name like 'Admin/AggregateFinanceStatement%' AND id in ($ruleList)")->select();
$Auth = [];
foreach ($authlist as $k => $v) {
$a = str_replace("Admin/AggregateFinanceStatement/","",$v['name']);
$Auth[] = $a;
}
$this->OpAuthList = $Auth;
}
public function OpAuth($info)
{
$id = $info['id'];
$img = $info['ext_field'];
$remark = $info['remark'];
//原始列表
$opBtn = [
"viewStatement"=>"<a class='confirm viewStatement' data-id='{$id}'>查看</a>",
"createStatement"=>"<a class='confirm createStatement' data-id='{$id}'>申请开票</a>",
"editStatement"=>"<a class='confirm editStatement' 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>",
"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>",
"cancelVerify"=>"<a class='confirm cancelVerify' data-id='{$id}' style='color: red;'>撤销审核</a>",
"cancelApply"=>"<a class='confirm cancelApply' data-id='{$id}' style='color: red;'>撤销申请</a>",
];
//操作对应菜单
$optist = [];
switch ($info['verify_status']) {
case '-1':
$optist = ["viewStatement","cancelVerify","addRemark","viewRemark","editRemark"];
break;
case '0':
$optist = ["viewStatement","createStatement"];
break;
case '1':
$optist = ["viewStatement","editStatement","cancelApply"];
break;
case '2':
$optist = ["viewStatement","cancelVerify","addRemark","viewRemark","editRemark"];
break;
case '3':
$optist = ["viewStatement","uploadVoucher","viewVoucher","editVoucher","addRemark","viewRemark","editRemark"];
break;
case '4':
$optist = ["viewStatement","viewVoucher","editVoucher","addRemark","viewRemark","editRemark"];
break;
case '5':
$optist = ["viewStatement","uploadVoucher","viewVoucher","editVoucher","addRemark","viewRemark","editRemark"];
break;
default:
break;
}
//判断凭证和备注
if(empty($info['ext_field'])){
//未上传凭证
$optist = array_diff($optist, ["viewVoucher", "editVoucher"]);
}else{
$optist = array_diff($optist, ["uploadVoucher"]);
}
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 menuAuth()
{
$optist = ['agreeApply',"refuseApply","Invoiced","Received","updateStatement","export"];
$mentBtn = [
"agreeApply"=>"<a class='butn' id='agreeApply'>审批通过</a>",
"refuseApply"=>"<a class='butn' id='refuseApply' style='background-color: red;'>审批拒绝</a>",
"Invoiced"=>"<a class='butn' id='Invoiced'>已开票</a>",
"Received"=>"<a class='butn' id='Received'>已到账</a>",
"updateStatement"=>"<a class='butn' id='updateStatement' style='width: 150px;background-color:green;'>重算结算金额</a>",
"export"=>"<a class='butn' id='export'>批量导出</a>"
];
$resarr = [];
foreach ($optist as $k => $v) {
if(IS_ROOT){
$resarr[] = $mentBtn[$v];
}else{
if(in_array($v,$this->OpAuthList)){
$resarr[] = $mentBtn[$v];
}
}
}
return $resarr;
}
//操作日志
public function doAddOperationLog($id,$op_name)
{
$d= M("aggregate_statement","tab_")->where("id = '{$id}'")->find();
$first_party_info = json_decode($d['first_party_info'],true);
$second_party_info = json_decode($d['second_party_info'],true);
$statement_begin_time = date('Y.m.d', $d['begintime']);//对账开始时间
$statement_end_time = date('Y.m.d',$d['endtime']);//对账截止时间
$menu = "财务-结算管理-聚合渠道结算单管理";
if($d['withdraw_type'] == 1){
$m = date('Y.m', $d['begintime']);
$key = "{$second_party_info['partner']}&{$first_party_info['partner']}【{$m} 月结】";
}elseif($d['withdraw_type'] == 0){
$key ="{$second_party_info['partner']}&{$first_party_info['partner']}【{$statement_begin_time}-{$statement_end_time} 周结 正常结算】";
}else{
$key ="{$second_party_info['partner']}&{$first_party_info['partner']}【{$statement_begin_time}-{$statement_end_time} 周结 补点】";
}
addOperationLog(['op_type'=>1,'key'=>$key,"op_name"=>$op_name,'url'=>U(CONTROLLER_NAME.'/lists',$GetData),'menu'=>$menu]);
}
}

@ -0,0 +1,896 @@
<!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="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div style="display: flex;margin: auto;">
<div class="tab-content tabcon1711" id="firstPartBaseInfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">甲方类型:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="first_partner_type" name="first_partner_type" class="select_gallery">
<option value="">请选择甲方公司类型</option>
<option value="0">合作公司</option>
<option value="1">平台归属公司</option>
</select>
</div>
</td>
</tr>
<tr>
<td class="l">甲方:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="first_partner_id" name="partner_id" class="select_gallery">
<option value="">请选择合作公司</option>
</select>
</div>
</td>
</tr>
<tbody id="first_part_bser_info_show">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt" name="link_man" value="" disabled="disabled" placeholder="请先选择甲方公司">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt" name="link_phone" value="" disabled="disabled" placeholder="请先选择甲方公司">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt" name="address" value="" disabled="disabled" placeholder="请先选择甲方公司">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt" name="company_tax_no" disabled="disabled" value="" placeholder="请先选择甲方公司">
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
<div class="tab-content tabcon1711" id="secondPartBaseInfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"></td>
<td class="r"></td>
</tr>
<tr>
<td class="l">乙方:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="second_partner_id" name="partner_id" class="select_gallery">
<option value="">请选择合作公司</option>
</select>
</div>
</td>
</tr>
<tbody id="second_part_bser_info_show">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt" name="link_man" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt" name="link_phone" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt" name="address" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt" name="company_tax_no" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
</div>
<div style="padding: 30px 0px 10px;display: block;height:30px;">
<div class="input-list input-list-server search_label_rehab">
<p style="font-size: 20px;font-weight: 600;">支付给:</p>
</div>
<div class="input-list input-list-server search_label_rehab" style="margin-left: 20px;">
<select id="statement_type" name="statement_type" class="select_gallery" style="width: 215px;">
<option value="">请选择合作公司</option>
</select>
</div>
</div>
<!-- <div class="search_list" style="display: block;line-height: 30px;height: 10px;">
<div class="input-list input-list-server search_label_rehab">
<p>请选择需要生成结算订单的月份:</p>
</div>
<div class="input-list" style="margin-left: 20px;">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}"
placeholder="开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}"
placeholder="结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list" style="margin-left: 30px;">
<a class="sch-btn" href="javascript:;" id="getSpendStatement" style="width: 100px;">生成</a>
</div>
</div> -->
<!-- <div style="font-size: 12px;color:#777;">仅当选择时间为每月的1号至当月的最后一天才满足月结梯度分成比例,否则默认比例为最低分成比例。</div> -->
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th style="border-right: solid 1px #b6cad2;">结算时间</th>
<th style="border-right: solid 1px #b6cad2;">产品</th>
<th style="border-right: solid 1px #b6cad2;">平台总额</th>
<th style="border-right: solid 1px #b6cad2;">分成比例</th>
<th style="border-right: solid 1px #b6cad2;">税费费率</th>
<th >结算金额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="statementInit" class="">
<tr style="height: 100px;">
<td colspan=8>
请先选择生成条件后点击生成对账数据
</td>
</tr>
</tbody>
<tbody id="statementShow">
</tbody>
</table>
</div>
</div>
<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="">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt" name="password" value="" 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" disabled="disabled" placeholder="请先选择支付给谁" name="invoice_item" value="">
</td>
</tr>
<tr>
<td class="l">发票类型:</td>
<td class="r">
<input type="text" class="txt" disabled="disabled" placeholder="请先选择支付给谁" name="invoice_type" value="">
</td>
</tr>
<!-- <tr>
<td class="l">付款方名称:</td>
<td class="r">
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt" name="password" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr> -->
</tbody>
</table>
</div>
</div>
<div class="search_list" style="display: flex;justify-content:flex-end;width:960px;">
<div class="input-list" style="margin-left: 30px;float: right;">
<a class="sch-btn" href="javascript:;" id="createStatement" style="width: 150px;">申请开票</a>
</div>
</div>
<script type="text/html" id="partbasetpl">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt normalchange" data-change="${type}.link_man" name="link_man" value="${link_man|nonull}" placeholder="请输入联系人">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt normalchange" name="link_phone" data-change="${type}.link_phone" value="${link_phone|nonull}" placeholder="请输入联系电话">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt normalchange" name="address" data-change="${type}.address" value="${address|nonull}" placeholder="请输入地址">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt normalchange" name="company_tax_no" data-change="${type}.company_tax_no" value="${company_tax_no|nonull}" placeholder="请输入公司税号">
</td>
</tr>
</script>
<script type="text/html" id="partpaytpl">
<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 normalchange" placeholder="请输入收款方名称" data-change="${'skf'|setChange}.payee_name" name="payee_name" value="${skfdata.payee_name|nonull}">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入银行账号" name="bank_account" data-change="${'skf'|setChange}.bank_account" value="${skfdata.bank_account|nonull}">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入开户行" data-change="${'skf'|setChange}.opening_bank" value="${skfdata.opening_bank|nonull}" name="opening_bank">
</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 normalchange" placeholder="信息技术服务费" data-change="${'skf'|setChange}.invoice_item" name="invoice_item" value="${skfdata.invoice_item|nonull}">
</td>
</tr>
<tr>
<td class="l">发票类型:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="增值税专用发票" name="invoice_type" data-change="${'skf'|setChange}.invoice_type" value="${skfdata.invoice_type|nonull}">
</td>
</tr>
<!-- <tr>
<td class="l">付款方名称:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入付款方名称" data-change="${'fkf'|setChange}.payee_name" name="payee_name" value="${fkfdata.payee_name|nonull}">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入银行账号" data-change="${'fkf'|setChange}.bank_account" name="bank_account" value="${fkfdata.bank_account|nonull}" >
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入开户行" data-change="${'fkf'|setChange}.opening_bank" value="${fkfdata.opening_bank|nonull}" name="opening_bank">
</td>
</tr> -->
</tbody>
</table>
</div>
</script>
<script type="text/html" id="statementTpl">
{@each list as it,index}
<tr>
<td>${it.begintime}~${it.endtime}</td>
<td>${it.game_name}</td>
<td>${it.money}元</td>
<td><input type="text" class="txt statementchange" name="ratio" data-index ="${index}" data-change="statement_info[${index}]['ratio']" value="${it.ratio}" style="width: 40px;">%</td>
<td><input type="text" class="txt statementchange" name="fax_ratio" data-index ="${index}" data-change="statement_info[${index}]['fax_ratio']" value="${it.fax_ratio}" style="width: 40px;">%</td>
<td>${it.ratio_money}元</td>
</tr>
{@/each}
<tr>
<td>合计</td>
<td></td>
<td>${count.pay_money}元</td>
<td></td>
<td></td>
<td>${count.ratio_money}元</td>
</tr>
<tr>
<td colspan=5>本月分成总金额(人民币大写):</td>
<td>${count.ratio_money|number_chinese}</td>
</tr>
</script>
<script>
$(function(){
TPLSHOW.juicerInit();
$(".select_gallery").select2();
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
endDate:new Date()
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
endDate:new Date(),
autoclose: true,
pickerPosition: 'bottom-left'
})
EVENT.changeCompany();
EVENT.createStatement();
//获取账单信息
TPLSHOW.showStatementList(true);
// $("#first_partner_id").change();//默认甲方只能是我们公司
});
//基础类
var PUBLIC = {
CompanyKeyName:{
id:"公司表id",
partner:"公司名称",
link_man:'联系人',
link_phone:"联系电话",
address:'邮寄地址',
company_tax_no:'公司税号',
payee_name:'名称',
bank_account:"银行账号",
opening_bank:"开户行"
},
checkCompanyKey(type,key){
//获取公司名
var company = '';
if(key == "payee_name" || key == "bank_account" || key == "opening_bank"){
if((DATAOBJ.statement_type == 0 && type == "first_party_info") || (DATAOBJ.statement_type == 1 && type == "second_party_info")){
company = "收款方";
}
if((DATAOBJ.statement_type == 0 && type == "second_party_info")|| (DATAOBJ.statement_type == 1 && type == "first_party_info")){
company = "付款方";
}
}else{
if(type == "first_party_info"){
company = "甲方";
}else{
company = "乙方";
}
}
//获取键名
try {
var keyname = company+PUBLIC.CompanyKeyName[key];
} catch (error) {
var keyname = false;
}
//验证
if(DATAOBJ[type][key] ===''){
layer.msg(keyname+"不能为空");
return false;
}
if(key == "link_phone" && !CHECK.mobile.test(DATAOBJ[type][key])){
layer.msg(keyname+"格式错误");
return false;
}
if(key == "bank_account" && !CHECK.BankNo.test(DATAOBJ[type][key])){
layer.msg(keyname+"格式错误");
return false;
}
return true;
},
postData(url,data,callback){
$.ajax({
url:url,
data:data,
type:"post",
dataType:"json",
success:function(data){
callback(data)
}
})
},
floatAdd(a,b){
return Math.round(a*100+b*100)/100;
},
floatCut(a,b){
return Math.round(a*100-b*100)/100;
}
}
//数据类
var DATAOBJ = {
first_partner_type:false,
first_part_company:false,
second_part_company:false,
statement_type:false,
first_party_info:false,
second_party_info:false,
statement_info:{$data|json_encode=###,JSON_UNESCAPED_UNICODE},
statement_count:{$data_count|json_encode=###,JSON_UNESCAPED_UNICODE},
fine:0,
// statement_begin_time:false,
// statement_end_time:false,
statement_id:{$id}
}
//事件类
var EVENT = {
changeCompany(){
$("#first_partner_type").on("change",function(){
var type = $(this).find("option:selected").val();
if(type == ''){
type=false;
}
DATAOBJ.first_partner_type = type;
//获取cp和内部公司
var url = "{:U('getCompanyList')}";
PUBLIC.postData(url,{id:DATAOBJ.statement_id},function(data){
var ptCompany = data.success.ptCompany;
var cpCompany = data.success.cpCompany;
var ptstr = '<option value="">请选择平台归属公司</option>';
for (var i in ptCompany) {
ptstr += "<option value='" + ptCompany[i].id + "'>" + ptCompany[i].partner + "</option>"
}
var cpstr = '<option value="">请选择合作公司</option>';
for (var i in cpCompany) {
cpstr += "<option value='" + cpCompany[i].id + "'>" + cpCompany[i].partner + "</option>"
}
//
if(type == 0){
$("#first_partner_id").html(cpstr);
$("#second_partner_id").html(ptstr);
}else{
$("#first_partner_id").html(ptstr);
$("#second_partner_id").html(cpstr);
}
$("#first_partner_id").select2();
$("#second_partner_id").select2();
//重置数据
DATAOBJ.first_part_company=false;
DATAOBJ.second_part_company=false;
TPLSHOW.pushStatementTypeOption();
})
})
$("#first_partner_id").on("change",function(){
//获取数据
var comid = $(this).find("option:selected").val();
//获取基础数据
var url = "{:U('getCpCompanyInfo')}";
var company_type;
if(DATAOBJ.first_partner_type == 0){
//CP上游公司
company_type = "cp";
}else{
company_type = "pt";
}
PUBLIC.postData(url,{company_id:comid,company_type:company_type},function(data){
DATAOBJ.first_part_company = data.success.partner;
DATAOBJ.first_party_info = data.success;
data.success.type = "first_party_info";
TPLSHOW.firstPartInfo(data.success);
})
})
$("#second_partner_id").on("change",function(){
//获取数据
var comid = $(this).find("option:selected").val();
//获取基础数据
var url = "{:U('getCpCompanyInfo')}";
var company_type;
if(DATAOBJ.first_partner_type == 0){
//CP上游公司
company_type = "pt";
}else{
company_type = "cp";
}
PUBLIC.postData(url,{company_id:comid,company_type:company_type},function(data){
DATAOBJ.second_part_company = data.success.partner;
DATAOBJ.second_party_info = data.success;
data.success.type = "second_party_info";
TPLSHOW.secondPartInfo(data.success);
})
})
//生成订单
// $("#getSpendStatement").on("click",function(){
// //获取开始结束时间
// var time_start = $("#time_start").val();
// var time_end = $("#time_end").val();
// if(time_start == '' || time_end == '' || DATAOBJ.statement_type === false){
// layer.msg("收款方或账单开始结束时间均不允许为空");
// return false;
// }
// if (Date.parse(time_start) > Date.parse(time_end)){
// layer.msg('开始时间必须小于等于结束时间');
// return false;
// }
// var company_id;
// if(DATAOBJ.first_partner_type == 0){
// //CP上游公司
// company_id = $("#first_partner_id").find("option:selected").val();
// }else{
// company_id = $("#second_partner_id").find("option:selected").val();
// }
// //发起查询
// var selectData = {
// "time_start":time_start,
// "time_end":time_end,
// "statement_type":DATAOBJ.statement_type,
// "first_partner_type":DATAOBJ.first_partner_type,
// "company_id": company_id
// }
// var url = "{:U('getSpendStatement')}";
// PUBLIC.postData(url,selectData,function(data){
// console.log(data);
// if(data.code > 0){
// layer.alert(data.error);
// return false;
// }else{
// DATAOBJ.statement_begin_time = time_start;
// DATAOBJ.statement_end_time = time_end;
// DATAOBJ.statement_info = data.success;
// DATAOBJ.statement_count = data.count;
// TPLSHOW.showStatementList(true);
// }
// })
// })
},
createStatement(){
$("#createStatement").on("click",function(){
//验证信息
for (const key in DATAOBJ) {
if(DATAOBJ[key] === false){
layer.msg('页面中的参数均是必填项目,请先填满');
return false;
}
}
//验证甲方信息
// for (const key in DATAOBJ.first_party_info) {
// var t = DATAOBJ.first_party_info;
// var flag = PUBLIC.checkCompanyKey("first_party_info",key);
// if(!flag){
// return flag;
// }
// }
// //乙方
// for (const key in DATAOBJ.second_party_info) {
// var t = DATAOBJ.second_party_info;
// var flag = PUBLIC.checkCompanyKey("second_party_info",key);
// if(!flag){
// return flag;
// }
// }
layer.load(2);
$("#createStatement").off("click");//自我解绑
PUBLIC.postData("{:U('doAddStatement')}",DATAOBJ,function(data){
if(data.success){
layer.closeAll('loading');
layer.msg('添加成功');
setTimeout(function(){
window.parent.reload();
},350);
}else{
alert("添加失败,请联系管理员")
}
});
//发送添加请求
})
},
normalchange(){
$(".normalchange").off("blur");
$(".normalchange").on("blur",function(){
var val = $(this).val();
var index = $(this).data("change");
var str = "DATAOBJ."+index+"='"+val+"';";
eval(str);
})
},
statementchange(){
$(".statementchange").off("blur");
$(".statementchange").on("blur",function(){
// alert(1);
var sort = $(this).data("change");
var val = $(this).val();
var vdata = eval("DATAOBJ."+sort);//原先值
var dom = $(this);
if(!CHECK.number.test(val)){
layer.msg('结算单中的税率必须是数字,且不能为空');
dom.val(vdata);
return false;
}
var str = "DATAOBJ."+sort+"='"+val+"';";
if(val > 100 || val < 0){
layer.msg('结算单中的税率不允许大于100和小于0');
dom.val(vdata);
return false;
}
eval(str);
var index = $(this).data("index");
var td = DATAOBJ.statement_info[index];
var ratio = td['ratio']/100;
DATAOBJ.statement_count['ratio_money'] = PUBLIC.floatCut(DATAOBJ.statement_count['ratio_money'],td['ratio_money']);
td['ratio_money'] = Math.round((td['money']*ratio*(100-td['fax_ratio'])/100)* 100) / 100 ;
DATAOBJ.statement_count['ratio_money']=PUBLIC.floatAdd(DATAOBJ.statement_count['ratio_money'],td['ratio_money']);
TPLSHOW.showStatementList(true);
})
},
changeStatementType(){
$("#statement_type").off("change")
$("#statement_type").on("change",function(){
//获取数据
var statement_type = $(this).find("option:selected").val();
if(statement_type == ''){
statement_type = false;
}
DATAOBJ.statement_type = statement_type;
TPLSHOW.showPartPayInfo();
// TPLSHOW.showStatementList(true);
})
$(".select_gallery").select2();
}
}
var CHECK = {
number: /^\d+(\.{1}\d+)?$/,
mobile:/^1[3456789]\d{9}$/,
// BankNo:/^([1-9]{1})(\d{15}|\d{18})$/,
BankNo:/^([1-9]{1})\d{10,19}$/,
money:/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/
}
//
var TPLSHOW = {
juicerInit(){
var nonull = function(data) {
if(!data){
return '';
}
return data;
};
var setChange = function(typestr) {
if(DATAOBJ.statement_type == 0){
if(typestr == "fkf"){
return 'second_party_info';
}else{
return 'first_party_info';
}
}else{
if(typestr == "fkf"){
return 'first_party_info';
}else{
return 'second_party_info';
}
}
};
var number_chinese = function (str) {
var num = parseFloat(str);
var strOutput = "",
strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分';
num += "00";
var intPos = num.indexOf('.');
if (intPos >= 0){
num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
}
strUnit = strUnit.substr(strUnit.length - num.length);
for (var i=0; i < num.length; i++){
strOutput += '零壹贰叁肆伍陆柒捌玖'.substr(num.substr(i,1),1) + strUnit.substr(i,1);
}
return strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元")
}
juicer.register('nonull', nonull);
juicer.register('setChange', setChange);
juicer.register('number_chinese', number_chinese);
},
//
firstPartInfo(data){
var tpl =$("#partbasetpl").html();
var html = juicer(tpl, data);
$("#first_part_bser_info_show").html(html);
TPLSHOW.pushStatementTypeOption();
},
secondPartInfo(data){
var tpl =$("#partbasetpl").html();
var html = juicer(tpl, data);
$("#second_part_bser_info_show").html(html);
TPLSHOW.pushStatementTypeOption();
},
//支付给公司
pushStatementTypeOption(){
EVENT.normalchange();
DATAOBJ.statement_type = false;//重新选择
// TPLSHOW.showStatementList(false);
if(DATAOBJ.first_part_company && DATAOBJ.second_part_company){
var str = "<option value=''>请选择合作公司</option><option value='0' selected>"+DATAOBJ.first_part_company+"</option>";
str += ("<option value='1' >"+DATAOBJ.second_part_company+"</option>");//默认支付给甲方
$("#statement_type").html(str);
EVENT.changeStatementType();
$("#statement_type").change();//默认支付给乙方
// TPLSHOW.showPartPayInfo();//查看底下是否有值
}else{
var str = "<option value=''>请选择合作公司</option>";
$("#statement_type").html(str);
EVENT.changeStatementType();
}
},
//支付信息显示
showPartPayInfo(){
var data = {};
if(DATAOBJ.statement_type !== false){
if(DATAOBJ.statement_type == 1){
data.fkfdata = DATAOBJ.first_party_info;
data.skfdata = DATAOBJ.second_party_info;
}else{
data.skfdata = DATAOBJ.first_party_info;
data.fkfdata = DATAOBJ.second_party_info;
}
data.type = DATAOBJ.statement_type;
}else{
data.skfdata = {};
data.fkfdata = {};
}
var tpl =$("#partpaytpl").html();
var html = juicer(tpl, data);
$("#partpatinfo").html(html);
EVENT.normalchange();
},
//订单信息显示
showStatementList(flag){
if(flag){
var data = {list:DATAOBJ.statement_info,count:DATAOBJ.statement_count,fine:DATAOBJ.fine};
console.log(DATAOBJ);
$("#statementInit").addClass("hidebox");
var tpl =$("#statementTpl").html();
var html = juicer(tpl, data);
$("#statementShow").html(html);
EVENT.statementchange();
}else{
// DATAOBJ.statement_info = false;
// DATAOBJ.statement_count = false;
// DATAOBJ.fine = 0;
$("#statementInit").removeClass("hidebox");
$("#statementShow").html('');
}
}
}
</script>
</body>
</html>

@ -0,0 +1,879 @@
<!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="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div style="display: flex;margin: auto;">
<div class="tab-content tabcon1711" id="firstPartBaseInfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">甲方:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="first_partner_id" name="partner_id" class="select_gallery">
<option value="{$data['first_party_info']['id']}" selected>{$data['first_part_company']}</option>
</select>
</div>
</td>
</tr>
<tbody id="first_part_bser_info_show">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt" name="link_man" value="" disabled="disabled" placeholder="请先选择甲方公司">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt" name="link_phone" value="" disabled="disabled" placeholder="请先选择甲方公司">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt" name="address" value="" disabled="disabled" placeholder="请先选择甲方公司">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt" name="company_tax_no" disabled="disabled" value="" placeholder="请先选择甲方公司">
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
<div class="tab-content tabcon1711" id="secondPartBaseInfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">乙方:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="second_partner_id" name="partner_id" class="select_gallery">
<option value="{$data['second_party_info']['id']}" selected>{$data['second_part_company']}</option>
</select>
</div>
</td>
</tr>
<tbody id="second_part_bser_info_show">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt" name="link_man" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt" name="link_phone" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt" name="address" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt" name="company_tax_no" value="" disabled="disabled" placeholder="请先选择合作公司">
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
</div>
<div style="padding: 30px 0px 10px;display: block;height:30px;">
<div class="input-list input-list-server search_label_rehab">
<p style="font-size: 20px;font-weight: 600;">支付给:<spen style="margin-left: 15px;font-size: 16px;">{$company}
</spen>
</p>
</div>
<!-- <div class="input-list input-list-server search_label_rehab" style="margin-left: 20px;">
<select id="statement_type" name="statement_type" class="select_gallery" style="width: 215px;">
<option value="">请选择合作公司</option>
</select>
</div> -->
</div>
<!-- <div class="search_list" style="display: block;line-height: 30px;height: 10px;">
<div class="input-list input-list-server search_label_rehab">
<p>请选择需要生成结算订单的月份:</p>
</div>
<div class="input-list" style="margin-left: 20px;">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}"
placeholder="开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}"
placeholder="结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list" style="margin-left: 30px;">
<a class="sch-btn" href="javascript:;" id="getSpendStatement" style="width: 100px;">生成</a>
</div>
</div> -->
<!-- <div style="font-size: 12px;color:#777;">仅当选择时间为每月的1号至当月的最后一天才满足月结梯度分成比例,否则默认比例为最低分成比例。</div> -->
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th style="border-right: solid 1px #b6cad2;">结算时间</th>
<th style="border-right: solid 1px #b6cad2;">产品</th>
<th style="border-right: solid 1px #b6cad2;">平台总额</th>
<th style="border-right: solid 1px #b6cad2;">分成比例</th>
<th style="border-right: solid 1px #b6cad2;">税费费率</th>
<th >结算金额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="statementInit" class="">
<tr style="height: 100px;">
<td colspan=8>
请先选择生成条件后点击生成对账数据
</td>
</tr>
</tbody>
<tbody id="statementShow">
</tbody>
</table>
</div>
</div>
<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="">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt" name="password" value="" 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" disabled="disabled" placeholder="请先选择支付给谁" name="invoice_item" value="">
</td>
</tr>
<tr>
<td class="l">发票类型:</td>
<td class="r">
<input type="text" class="txt" disabled="disabled" placeholder="请先选择支付给谁" name="invoice_type" value="">
</td>
</tr>
<!-- <tr>
<td class="l">付款方名称:</td>
<td class="r">
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt" name="password" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
</td>
</tr> -->
</tbody>
</table>
</div>
</div>
<div class="search_list" style="display: flex;justify-content:flex-end;width:960px;">
<div class="input-list" style="margin-left: 30px;float: right;">
<a class="sch-btn" href="javascript:;" id="createStatement" style="width: 150px;">确认修改</a>
</div>
</div>
<script type="text/html" id="partbasetpl">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt normalchange" data-change="${type}.link_man" name="link_man" value="${link_man|nonull}" placeholder="请输入联系人">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt normalchange" name="link_phone" data-change="${type}.link_phone" value="${link_phone|nonull}" placeholder="请输入联系电话">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt normalchange" name="address" data-change="${type}.address" value="${address|nonull}" placeholder="请输入地址">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt normalchange" name="company_tax_no" data-change="${type}.company_tax_no" value="${company_tax_no|nonull}" placeholder="请输入公司税号">
</td>
</tr>
</script>
<script type="text/html" id="partpaytpl">
<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 normalchange" placeholder="请输入收款方名称" data-change="${'skf'|setChange}.payee_name" name="payee_name" value="${skfdata.payee_name|nonull}">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入银行账号" name="bank_account" data-change="${'skf'|setChange}.bank_account" value="${skfdata.bank_account|nonull}">
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入开户行" data-change="${'skf'|setChange}.opening_bank" value="${skfdata.opening_bank|nonull}" name="opening_bank">
</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 normalchange" placeholder="信息技术服务费" data-change="${'skf'|setChange}.invoice_item" name="invoice_item" value="${skfdata.invoice_item|nonull}">
</td>
</tr>
<tr>
<td class="l">发票类型:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="增值税专用发票" name="invoice_type" data-change="${'skf'|setChange}.invoice_type" value="${skfdata.invoice_type|nonull}">
</td>
</tr>
<!-- <tr>
<td class="l">付款方名称:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入付款方名称" data-change="${'fkf'|setChange}.payee_name" name="payee_name" value="${fkfdata.payee_name|nonull}">
</td>
</tr>
<tr>
<td class="l">银行账号:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入银行账号" data-change="${'fkf'|setChange}.bank_account" name="bank_account" value="${fkfdata.bank_account|nonull}" >
</td>
</tr>
<tr>
<td class="l">开户行:</td>
<td class="r">
<input type="text" class="txt normalchange" placeholder="请输入开户行" data-change="${'fkf'|setChange}.opening_bank" value="${fkfdata.opening_bank|nonull}" name="opening_bank">
</td>
</tr> -->
</tbody>
</table>
</div>
</script>
<script type="text/html" id="statementTpl">
{@each list as it,index}
<tr>
<td>${it.begintime}~${it.endtime}</td>
<td>${it.game_name}</td>
<td>${it.money}元</td>
<td><input type="text" class="txt statementchange" name="ratio" data-index ="${index}" data-change="statement_info[${index}]['ratio']" value="${it.ratio}" style="width: 40px;">%</td>
<td><input type="text" class="txt statementchange" name="fax_ratio" data-index ="${index}" data-change="statement_info[${index}]['fax_ratio']" value="${it.fax_ratio}" style="width: 40px;">%</td>
<td>${it.ratio_money}元</td>
</tr>
{@/each}
<tr>
<td>合计</td>
<td></td>
<td>${count.pay_money}元</td>
<td></td>
<td></td>
<td>${count.ratio_money}元</td>
</tr>
<tr>
<td colspan=5>本月分成总金额(人民币大写):</td>
<td>${count.ratio_money|number_chinese}</td>
</tr>
</script>
<script>
$(function(){
TPLSHOW.juicerInit();
$(".select_gallery").select2();
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
endDate:new Date()
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
endDate:new Date(),
autoclose: true,
pickerPosition: 'bottom-left'
})
EVENT.changeCompany();
EVENT.createStatement();
//获取账单信息
TPLSHOW.showStatementList(true);
$("#first_partner_id").change();
});
//基础类
var PUBLIC = {
CompanyKeyName:{
id:"公司表id",
partner:"公司名称",
link_man:'联系人',
link_phone:"联系电话",
address:'邮寄地址',
company_tax_no:'公司税号',
payee_name:'名称',
bank_account:"银行账号",
opening_bank:"开户行"
},
checkCompanyKey(type,key){
//获取公司名
var company = '';
if(key == "payee_name" || key == "bank_account" || key == "opening_bank"){
if((DATAOBJ.statement_type == 0 && type == "first_party_info") || (DATAOBJ.statement_type == 1 && type == "second_party_info")){
company = "收款方";
}
if((DATAOBJ.statement_type == 0 && type == "second_party_info")|| (DATAOBJ.statement_type == 1 && type == "first_party_info")){
company = "付款方";
}
}else{
if(type == "first_party_info"){
company = "甲方";
}else{
company = "乙方";
}
}
//获取键名
try {
var keyname = company+PUBLIC.CompanyKeyName[key];
} catch (error) {
var keyname = false;
}
//验证
if(DATAOBJ[type][key] ===''){
layer.msg(keyname+"不能为空");
return false;
}
if(key == "link_phone" && !CHECK.mobile.test(DATAOBJ[type][key])){
layer.msg(keyname+"格式错误");
return false;
}
if(key == "bank_account" && !CHECK.BankNo.test(DATAOBJ[type][key])){
layer.msg(keyname+"格式错误");
return false;
}
return true;
},
postData(url,data,callback){
$.ajax({
url:url,
data:data,
type:"post",
dataType:"json",
success:function(data){
callback(data)
}
})
},
floatAdd(a,b){
return Math.round(a*100+b*100)/100;
},
floatCut(a,b){
return Math.round(a*100-b*100)/100;
}
}
//数据类
var DATAOBJ = {$data|json_encode=###,JSON_UNESCAPED_UNICODE};
//事件类
var EVENT = {
changeCompany(){
$("#first_partner_id").on("change", function () {
TPLSHOW.firstPartInfo(DATAOBJ.first_party_info);
TPLSHOW.secondPartInfo(DATAOBJ.second_party_info);
TPLSHOW.showPartPayInfo();
TPLSHOW.showStatementList(true);
})
// $("#first_partner_id").on("change", function () {
// TPLSHOW.secondPartInfo(DATAOBJ.second_party_info);
// })
// $("#first_partner_type").on("change",function(){
// var type = $(this).find("option:selected").val();
// if(type == ''){
// type=false;
// }
// DATAOBJ.first_partner_type = type;
// //获取cp和内部公司
// var url = "{:U('getCompanyList')}";
// PUBLIC.postData(url,{id:DATAOBJ.statement_id},function(data){
// var ptCompany = data.success.ptCompany;
// var cpCompany = data.success.cpCompany;
// var ptstr = '<option value="">请选择平台归属公司</option>';
// for (var i in ptCompany) {
// ptstr += "<option value='" + ptCompany[i].id + "'>" + ptCompany[i].partner + "</option>"
// }
// var cpstr = '<option value="">请选择合作公司</option>';
// for (var i in cpCompany) {
// cpstr += "<option value='" + cpCompany[i].id + "'>" + cpCompany[i].partner + "</option>"
// }
// //
// if(type == 0){
// $("#first_partner_id").html(cpstr);
// $("#second_partner_id").html(ptstr);
// }else{
// $("#first_partner_id").html(ptstr);
// $("#second_partner_id").html(cpstr);
// }
// $("#first_partner_id").select2();
// $("#second_partner_id").select2();
// //重置数据
// DATAOBJ.first_part_company=false;
// DATAOBJ.second_part_company=false;
// TPLSHOW.pushStatementTypeOption();
// })
// })
// $("#first_partner_id").on("change",function(){
// //获取数据
// var comid = $(this).find("option:selected").val();
// //获取基础数据
// var url = "{:U('getCpCompanyInfo')}";
// var company_type;
// if(DATAOBJ.first_partner_type == 0){
// //CP上游公司
// company_type = "cp";
// }else{
// company_type = "pt";
// }
// PUBLIC.postData(url,{company_id:comid,company_type:company_type},function(data){
// DATAOBJ.first_part_company = data.success.partner;
// DATAOBJ.first_party_info = data.success;
// data.success.type = "first_party_info";
// TPLSHOW.firstPartInfo(data.success);
// })
// })
// $("#second_partner_id").on("change",function(){
// //获取数据
// var comid = $(this).find("option:selected").val();
// //获取基础数据
// var url = "{:U('getCpCompanyInfo')}";
// var company_type;
// if(DATAOBJ.first_partner_type == 0){
// //CP上游公司
// company_type = "pt";
// }else{
// company_type = "cp";
// }
// PUBLIC.postData(url,{company_id:comid,company_type:company_type},function(data){
// DATAOBJ.second_part_company = data.success.partner;
// DATAOBJ.second_party_info = data.success;
// data.success.type = "second_party_info";
// TPLSHOW.secondPartInfo(data.success);
// })
// })
//生成订单
// $("#getSpendStatement").on("click",function(){
// //获取开始结束时间
// var time_start = $("#time_start").val();
// var time_end = $("#time_end").val();
// if(time_start == '' || time_end == '' || DATAOBJ.statement_type === false){
// layer.msg("收款方或账单开始结束时间均不允许为空");
// return false;
// }
// if (Date.parse(time_start) > Date.parse(time_end)){
// layer.msg('开始时间必须小于等于结束时间');
// return false;
// }
// var company_id;
// if(DATAOBJ.first_partner_type == 0){
// //CP上游公司
// company_id = $("#first_partner_id").find("option:selected").val();
// }else{
// company_id = $("#second_partner_id").find("option:selected").val();
// }
// //发起查询
// var selectData = {
// "time_start":time_start,
// "time_end":time_end,
// "statement_type":DATAOBJ.statement_type,
// "first_partner_type":DATAOBJ.first_partner_type,
// "company_id": company_id
// }
// var url = "{:U('getSpendStatement')}";
// PUBLIC.postData(url,selectData,function(data){
// console.log(data);
// if(data.code > 0){
// layer.alert(data.error);
// return false;
// }else{
// DATAOBJ.statement_begin_time = time_start;
// DATAOBJ.statement_end_time = time_end;
// DATAOBJ.statement_info = data.success;
// DATAOBJ.statement_count = data.count;
// TPLSHOW.showStatementList(true);
// }
// })
// })
},
createStatement(){
$("#createStatement").on("click",function(){
//验证信息
for (const key in DATAOBJ) {
if(DATAOBJ[key] === false){
layer.msg('页面中的参数均是必填项目,请先填满');
return false;
}
}
//验证甲方信息
// for (const key in DATAOBJ.first_party_info) {
// var t = DATAOBJ.first_party_info;
// var flag = PUBLIC.checkCompanyKey("first_party_info",key);
// if(!flag){
// return flag;
// }
// }
// //乙方
// for (const key in DATAOBJ.second_party_info) {
// var t = DATAOBJ.second_party_info;
// var flag = PUBLIC.checkCompanyKey("second_party_info",key);
// if(!flag){
// return flag;
// }
// }
layer.load(2);
$("#createStatement").off("click");//自我解绑
PUBLIC.postData("{:U('doAddStatement')}",DATAOBJ,function(data){
if(data.success){
layer.closeAll('loading');
layer.msg('添加成功');
setTimeout(function(){
window.parent.reload();
},350);
}else{
alert("添加失败,请联系管理员")
}
});
//发送添加请求
})
},
normalchange(){
$(".normalchange").off("blur");
$(".normalchange").on("blur",function(){
var val = $(this).val();
var index = $(this).data("change");
var str = "DATAOBJ."+index+"='"+val+"';";
eval(str);
})
},
statementchange(){
$(".statementchange").off("blur");
$(".statementchange").on("blur",function(){
// alert(1);
var sort = $(this).data("change");
var val = $(this).val();
var vdata = eval("DATAOBJ."+sort);//原先值
var dom = $(this);
if(!CHECK.number.test(val)){
layer.msg('结算单中的税率必须是数字,且不能为空');
dom.val(vdata);
return false;
}
var str = "DATAOBJ."+sort+"='"+val+"';";
if(val > 100 || val < 0){
layer.msg('结算单中的税率不允许大于100和小于0');
dom.val(vdata);
return false;
}
eval(str);
var index = $(this).data("index");
var td = DATAOBJ.statement_info[index];
var ratio = td['ratio']/100;
DATAOBJ.statement_count['ratio_money'] = PUBLIC.floatCut(DATAOBJ.statement_count['ratio_money'],td['ratio_money']);
td['ratio_money'] = Math.round((td['money']*ratio*(100-td['fax_ratio'])/100)* 100) / 100 ;
DATAOBJ.statement_count['ratio_money']=PUBLIC.floatAdd(DATAOBJ.statement_count['ratio_money'],td['ratio_money']);
TPLSHOW.showStatementList(true);
})
},
changeStatementType(){
$("#statement_type").off("change")
$("#statement_type").on("change",function(){
//获取数据
var statement_type = $(this).find("option:selected").val();
if(statement_type == ''){
statement_type = false;
}
DATAOBJ.statement_type = statement_type;
TPLSHOW.showPartPayInfo();
// TPLSHOW.showStatementList(true);
})
$(".select_gallery").select2();
}
}
var CHECK = {
number: /^\d+(\.{1}\d+)?$/,
mobile:/^1[3456789]\d{9}$/,
// BankNo:/^([1-9]{1})(\d{15}|\d{18})$/,
BankNo:/^([1-9]{1})\d{10,19}$/,
money:/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/
}
//
var TPLSHOW = {
juicerInit(){
var nonull = function(data) {
if(!data){
return '';
}
return data;
};
var setChange = function(typestr) {
if(DATAOBJ.statement_type == 0){
if(typestr == "fkf"){
return 'second_party_info';
}else{
return 'first_party_info';
}
}else{
if(typestr == "fkf"){
return 'first_party_info';
}else{
return 'second_party_info';
}
}
};
var number_chinese = function (str) {
var num = parseFloat(str);
var strOutput = "",
strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分';
num += "00";
var intPos = num.indexOf('.');
if (intPos >= 0){
num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
}
strUnit = strUnit.substr(strUnit.length - num.length);
for (var i=0; i < num.length; i++){
strOutput += '零壹贰叁肆伍陆柒捌玖'.substr(num.substr(i,1),1) + strUnit.substr(i,1);
}
return strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元")
}
juicer.register('nonull', nonull);
juicer.register('setChange', setChange);
juicer.register('number_chinese', number_chinese);
},
//
firstPartInfo(data){
var tpl =$("#partbasetpl").html();
var html = juicer(tpl, data);
$("#first_part_bser_info_show").html(html);
TPLSHOW.pushStatementTypeOption();
},
secondPartInfo(data){
var tpl =$("#partbasetpl").html();
var html = juicer(tpl, data);
$("#second_part_bser_info_show").html(html);
TPLSHOW.pushStatementTypeOption();
},
//支付给公司
pushStatementTypeOption(){
EVENT.normalchange();
// DATAOBJ.statement_type = false;//重新选择
// // TPLSHOW.showStatementList(false);
// if(DATAOBJ.first_part_company && DATAOBJ.second_part_company){
// var str = "<option value=''>请选择合作公司</option><option value='0' selected>"+DATAOBJ.first_part_company+"</option>";
// str += ("<option value='1' >"+DATAOBJ.second_part_company+"</option>");//默认支付给甲方
// $("#statement_type").html(str);
// EVENT.changeStatementType();
// $("#statement_type").change();//默认支付给乙方
// // TPLSHOW.showPartPayInfo();//查看底下是否有值
// }else{
// var str = "<option value=''>请选择合作公司</option>";
// $("#statement_type").html(str);
// EVENT.changeStatementType();
// }
},
//支付信息显示
showPartPayInfo(){
var data = {};
if(DATAOBJ.statement_type !== false){
if(DATAOBJ.statement_type == 1){
data.fkfdata = DATAOBJ.first_party_info;
data.skfdata = DATAOBJ.second_party_info;
}else{
data.skfdata = DATAOBJ.first_party_info;
data.fkfdata = DATAOBJ.second_party_info;
}
data.type = DATAOBJ.statement_type;
}else{
data.skfdata = {};
data.fkfdata = {};
}
var tpl =$("#partpaytpl").html();
var html = juicer(tpl, data);
$("#partpatinfo").html(html);
EVENT.normalchange();
},
//订单信息显示
showStatementList(flag){
if(flag){
var data = {list:DATAOBJ.statement_info,count:DATAOBJ.statement_count,fine:DATAOBJ.fine};
console.log(DATAOBJ);
$("#statementInit").addClass("hidebox");
var tpl =$("#statementTpl").html();
var html = juicer(tpl, data);
$("#statementShow").html(html);
EVENT.statementchange();
}else{
// DATAOBJ.statement_info = false;
// DATAOBJ.statement_count = false;
// DATAOBJ.fine = 0;
$("#statementInit").removeClass("hidebox");
$("#statementShow").html('');
}
}
}
</script>
</body>
</html>

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<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__/module.css">
<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">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
.hide{
display: none !important;
}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;margin-top: 20px;padding-left: 50px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr style="padding: 10px;height: 50px;">
<td class="l">文件选择: </td>
<td >
<input type="file" id="fileinput" name="file" accept="image/*">
</td>
<td style="color: #777;font-size: 12px;">仅能添加一张凭证,重复添加将覆盖</td>
</tr>
</table>
<div class="jssearch search_list fl cf">
<div class="input-list">
<div class="sch-btn uploadfile" style="width: 100px;padding: 5px;">确认修改</div>
<div id="delVoucher" class="sch-btn " style="width: 100px;padding: 5px;background-color: red;">删除凭证</div>
</div>
</div>
<div style="display: block;clear: both;">
<img id="voucher" src="{$ext_field}" class="" style="width: auto;height: 350px;margin: auto;">
</div>
</div>
<script>
var id = {$id};
$(function(){
$(".uploadfile").on("click",function(){
var acceptedTypes = ['image/png','image/jpeg','image/jpg','image/gif'];
var type = document.getElementById('fileinput').files[0].type;
if (acceptedTypes.indexOf(type) === -1) {
layer.msg("只允许图片格式文件");
return false;
}
var formData = new FormData();
formData.append("id",id);
formData.append("file", document.getElementById("fileinput").files[0]);
var index = layer.load();
$.ajax({
url:"{:U('saveVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("上传成功");
$('#voucher').attr("src",data.file_path).removeClass("hide");
$('#delVoucher').removeClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
$("#delVoucher").on("click",function(){
var index = layer.load();
var formData = new FormData();
formData.append("id",id);
$.ajax({
url:"{:U('delVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("删除成功");
$('#voucher').attr("src",'').addClass("hide");
$('#delVoucher').addClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
});
</script>
</body>
</html>

@ -0,0 +1,798 @@
<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;}
.layui-layer-dialog .layui-layer-content{color:red}
.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;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">聚合渠道结算单管理</h3>
<p class="description_text">流程说明:结算自动生成对账单--->发起人申请开票--->财务审核开票--->寄发票--->发起人上传收款凭证--->财务确认到账</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-promote search_label_rehab">
<select id="channel_id" name="channel_id" class="select_gallery" >
<option company-type="" value="">请选择或输入合作公司</option>
<volist name="channel" id="vo">
<option value="{$vo.channel_id}" <?php echo $vo.channel_id == I('channel_id') ? 'selected':''; ?> >{$vo.channel_name}</option>
</volist>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="withdraw_type" name="withdraw_type" class="select_gallery" style="width:150px;">
<option value="">结算周期</option>
<option value="0">周结</option>
<option value="1">月结</option>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="withdraw_type" name="withdraw_type2" class="select_gallery" style="width:150px;">
<option value="">结算类型</option>
<option value="1">正常计算</option>
<option value="2">补点</option>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="结算开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="结算结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="verify_status" name="verify_status" class="select_gallery" >
<option value="">请选择审核状态</option>
<foreach name="verify_status" item="vo" >
<option value="{$key}" <?php echo (isset($_REQUEST['verify_status']) && $key == I('verify_status')) ? 'selected':''; ?> >{$vo}</option>
</foreach>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start2" name="time_start2" class="" value="{:I('time_start2')}" placeholder="操作开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker2" style="display:inline-block">
<input type="text" readonly id="time_end2" name="time_end2" class="" value="{:I('time_end2')}" placeholder="操作结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('AggregateFinanceStatement/lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<foreach name="menubtn" item="vo" >
{$vo}
</foreach>
</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>
<th>结算类型</th>
<th>结算金额</th>
<th>审批状态</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" data-status="{$data.verify_status}" value="{$data['id']}" name="ids[]" >
</td>
<td>{$data.channel_name}</td>
<td>{$data.begintime}-{$data.endtime}</td>
<td>{$data.withdraw_type_1}</td>
<td>{$data.withdraw_type_2}</td>
<td>{$data.ratio_money}</td>
<td>{$data.verify_status_str}</td>
<td>{$data.admin_name}</td>
<td>{$data.create_time}</td>
<td>
<foreach name="data.oplist" item="vo" >
{$vo}
</foreach>
</td>
</tr>
</volist>
<tr><td>合计</td><td colspan="10">结算总流水:{$pay_money}元&#12288;&#12288;&#12288;&#12288;结算金额:{$total}元 </td></tr>
</notemtpy>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_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('AggregateFinanceStatement/lists')}");
function reload() {
window.location.reload();
}
$(function(){
$("#export").click(function () {
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;
}
for (var index = 0; index < text.length; index++) {
var id = text[index];
var url ="{:U('export')}"+"&id="+id;
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel)
}
})
//审批通过
$("#agreeApply").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") != 1){
flag = true;
}else{
return $(elem).val();
}
}).get().join(",");
if(text == ''){
layer.msg("<font style='color:white'>" + '无需要审核通过的结算单' + "</font>");
return;
}
if(flag){
layer.confirm("审批成功仅会对 [已申请发票] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){
_doAgreeApply();
layer.close(index);
});
}else{
_doAgreeApply();
}
function _doAgreeApply(){
//执行
$.ajax({
type: "POST",
url: "{:U('agreeApply')}",
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);
}
}
});
}
})
//审批拒绝
$("#refuseApply").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") != 1){
flag = true;
}else{
return $(elem).val();
}
}).get().join(",");
if(text == ''){
layer.msg("<font style='color:white'>" + '无需要审核拒绝的结算单' + "</font>");
return;
}
if(flag){
layer.confirm("审批拒绝仅会对 [已申请发票] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){
_doRefuseApply();
layer.close(index);
});
}else{
_doRefuseApply();
}
function _doRefuseApply(){
//执行
$.ajax({
type: "POST",
url: "{:U('refuseApply')}",
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);
}
}
});
}
})
//已开票
$("#Invoiced").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") != 2){
flag = true;
}else{
return $(elem).val();
}
}).get().join(",");
if(text == ''){
layer.msg("<font style='color:white'>" + '无需要进行已开票的结算单' + "</font>");
return;
}
if(flag){
layer.confirm("已开票仅会对 [审核同意] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){
_doInvoiced();
layer.close(index);
});
}else{
_doInvoiced();
}
function _doInvoiced(){
//执行
$.ajax({
type: "POST",
url: "{:U('Invoiced')}",
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);
}
}
});
}
})
//已到账
$("#Received").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") == 3 || $(elem).data("status") == 4){
return $(elem).val();
}else{
flag = true;
}
}).get().join(",");
if(text == ''){
layer.msg("<font style='color:white'>" + '无需要进行已到账的结算单' + "</font>");
return;
}
if(flag){
layer.confirm("已到账仅会对 [已开票]或[已上传凭证] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){
_doReceived();
layer.close(index);
});
}else{
_doReceived();
}
function _doReceived(){
//执行
$.ajax({
type: "POST",
url: "{:U('Received')}",
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);
}
}
});
}
})
//重算金额
$("#updateStatement").on("click",function(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") == 0 || $(elem).data("status") == 1 || $(elem).data("status") == -1){
return $(elem).val();
}else{
flag = true;
}
// return $(elem).val();
}).get().join(",");
if(text == ''){
layer.msg("<font style='color:white'>" + '无需要进行重新结算的结算单' + "</font>");
return;
}
layer.confirm("重算结算金额会对结算单回退到未申请发票状态,请慎重处理,点击取消停止操作",{title:false}, function(index){
_doReceived();
layer.close(index);
});
function _doReceived(){
//执行
$.ajax({
type: "POST",
url: "{:U('updateStatement')}",
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);
}
}
});
}
})
$("#shenhe").click(function () {
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get().join(",");
layer.confirm('【警告】撤销后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(index) {
if (!text) {
layer.msg("<em style='color:white'>" + '请选择后再进行操作' + "</em>");
return;
}
$.ajax({
url: "{:U('statementMangement/verifyStatementStatus')}",
type: "get",
data: {order: text},
dataType: 'json',
success: function (data) {
if (data.status == 0) {
layer.msg("<em style='color:white'>" + '审核通过失败' + "</em>");
} else {
layer.msg("<em style='color:white'>" + '审核通过成功' + "</em>")
setTimeout(function(){
window.parent.reload();
},1500);
}
}
});
})
})
$("#reject").click(function () {
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get().join(",");
layer.confirm('【警告】撤销后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(index) {
if (!text) {
layer.msg("<em style='color:white'>" + '请选择后再进行操作' + "</em>");
return;
}
$.ajax({
url: "{:U('statementMangement/rejectStatementStatus')}",
type: "get",
data: {order: text},
dataType: 'json',
success: function (data) {
if (data.status == 0) {
layer.msg("<em style='color:white'>" + '审核拒绝失败' + "</em>");
} else {
layer.msg("<em style='color:white'>" + '审核拒绝成功' + "</em>")
setTimeout(function(){
window.parent.reload();
},1500);
}
}
});
})
})
//查看开票信息
$(".viewStatement").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "查看开票信息",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content:'/admin.php?s=/AggregateFinanceStatement/viewStatement/id/'+id
});
});
//申请开票
$(".createStatement").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "申请开票",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content:'/admin.php?s=/AggregateFinanceStatement/createStatement/id/'+id
});
});
//开票编辑
$(".editStatement").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "开票编辑",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content:'/admin.php?s=/AggregateFinanceStatement/editStatement/id/'+id
});
});
//上传凭证
$(".uploadVoucher").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "上传凭证",
shadeClose: true,
shade: 0.8,
area: ['60%', '60%'],
content:'/admin.php?s=/AggregateFinanceStatement/uploadVoucher/id/'+id,
end:function(){
reload();
}
});
});
//查看凭证
$(".viewVoucher").click(function () {
var img = $(this).data("img");
layer.open({
type: 1,
title:false,
content:"<img src='"+img+"' style='width: auto;height: 450px;margin: auto;'>"
});
});
//编辑凭证
$(".editVoucher").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "编辑凭证",
shadeClose: true,
shade: 0.8,
area: ['60%', '60%'],
content:'/admin.php?s=/AggregateFinanceStatement/editVoucher/id/'+id,
end:function(){
reload();
}
});
});
//新增批注
$(".addRemark").click(function(){
var id = $(this).data("id");
layer.prompt({
formType: 2,
value: '',
title: '输入备注',
area: ['360px', '300px'] //自定义文本域宽高
}, function(value, index, elem){
if(value != ''){
$.ajax({
type: "POST",
url: "{:U('saveRemark')}",
dataType: 'json',
async: false,
data: {id:id,remark:value},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}
}
});
}else{
layer.closeAll();
}
});
})
//编辑批注
$(".editRemark").click(function(){
var id = $(this).data("id");
var remark = $(this).data("remark");
layer.prompt({
formType: 2,
title: '修改备注',
value:remark,
area: ['360px', '300px'],
btnAlign: 'c',
id: 'prompt',
yes: function (index, layero) {
// 获取文本框输入的值
var value = layero.find(".layui-layer-input").val();
$.ajax({
type: "POST",
url: "{:U('saveRemark')}",
dataType: 'json',
async: false,
data: {id:id,remark:value},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}
}
});
}
});
})
//查看批注
$(".viewRemark").click(function () {
var remark = $(this).data("remark");
layer.open({
type: 1,
title:false,
content:"<div style='width: 300;height:auto;margin: auto;padding:20px;'>"+remark+"</div>"
});
});
//撤销审核
$(".cancelVerify").click(function(){
var id = $(this).data("id");
layer.confirm("撤销审核将回退到[已申请开票]状态,点击取消停止操作",{title:false}, function(index){
$.ajax({
type: "POST",
url: "{:U('cancelVerify')}",
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);
}
}
});
// layer.close(index);
});
})
//撤销申请
$(".cancelApply").click(function(){
var id = $(this).data("id");
layer.confirm("撤销申请将回退到[未申请开票]状态,点击取消停止操作",{title:false}, function(index){
$.ajax({
type: "POST",
url: "{:U('cancelApply')}",
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);
}
}
});
// layer.close(index);
});
})
$(".statement_del").click(function () {
var del = $(this).data();
layer.confirm('【警告】撤销后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
if(del.type == 0){
var url = "/admin.php?s=/Statement/delCpStatement/id/"+del.id;
}else{
var url = "/admin.php?s=/StatementMangement/delStatementData/id/"+del.id;
}
layer.load(2);
$.ajax({
url: url,
type: "get",
dataType: "json",
success: function (data) {
if(data.code == 0){
layer.closeAll('loading');
layer.msg("<font style='color:#fff'>删除成功</font>");
setTimeout(function(){
window.location.reload();
},350);
}else{
alert("删除失败,请联系管理员")
}
}
})
}, function(){
});
});
$("#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'
})
$('#time_start2').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker2').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,120 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<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__/module.css">
<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">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
.hide{
display: none !important;
}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;margin-top: 20px;padding-left: 50px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr style="padding: 10px;height: 50px;">
<td class="l">文件选择: </td>
<td >
<input type="file" id="fileinput" name="file" accept="image/*">
</td>
<td style="color: #777;font-size: 12px;">仅能添加一张凭证,重复添加将覆盖</td>
</tr>
</table>
<div class="jssearch search_list fl cf">
<div class="input-list">
<div class="sch-btn uploadfile" style="width: 100px;padding: 5px;">确认添加</div>
<div id="delVoucher" class="sch-btn hide" style="width: 100px;padding: 5px;background-color: red;">删除凭证</div>
</div>
</div>
<div style="display: block;clear: both;">
<img id="voucher" src="" class="hide" style="width: auto;height: 350px;margin: auto;">
</div>
</div>
<script>
var id = {$id};
$(function(){
$(".uploadfile").on("click",function(){
var acceptedTypes = ['image/png','image/jpeg','image/jpg','image/gif'];
var type = document.getElementById('fileinput').files[0].type;
if (acceptedTypes.indexOf(type) === -1) {
layer.msg("只允许图片格式文件");
return false;
}
var formData = new FormData();
formData.append("id",id);
formData.append("file", document.getElementById("fileinput").files[0]);
var index = layer.load();
$.ajax({
url:"{:U('saveVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("上传成功");
$('#voucher').attr("src",data.file_path).removeClass("hide");
$('#delVoucher').removeClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
$("#delVoucher").on("click",function(){
var index = layer.load();
var formData = new FormData();
formData.append("id",id);
$.ajax({
url:"{:U('delVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("删除成功");
$('#voucher').attr("src",'').addClass("hide");
$('#delVoucher').addClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
});
</script>
</body>
</html>

@ -0,0 +1,277 @@
<!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="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div style="display: flex;margin: auto;">
<if condition="$data['first_party_info']">
<div class="tab-content tabcon1711" id="firstPartBaseInfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">甲方:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="first_partner_id" name="partner_id" class="select_gallery">
<option value="{$data['first_party_info']['id']}" selected>{$data['first_part_company']}</option>
</select>
</div>
</td>
</tr>
<tbody id="first_part_bser_info_show">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt" name="link_man" value="{$data['first_party_info']['link_man']}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt" name="link_phone" value="{$data['first_party_info']['link_phone']}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt" name="address" value="{$data['first_party_info']['address']}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt" name="company_tax_no" disabled="disabled" value="{$data['first_party_info']['company_tax_no']}" placeholder="">
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
</if>
<if condition="$data['second_party_info']">
<div class="tab-content tabcon1711" id="secondPartBaseInfo">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">乙方:</td>
<td class="r">
<div class="input-list input-list-game search_label_rehab">
<select id="second_partner_id" name="partner_id" class="select_gallery">
<option value="{$data['second_party_info']['id']}" selected>{$data['second_part_company']}</option>
</select>
</div>
</td>
</tr>
<tbody id="second_part_bser_info_show">
<tr>
<td class="l">联系人:</td>
<td class="r">
<input type="text" class="txt" name="link_man" value="{$data['second_party_info']['link_man']}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">联系电话:</td>
<td class="r">
<input type="text" class="txt" name="link_phone" value="{$data['second_party_info']['link_phone']}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">邮寄地址:</td>
<td class="r">
<input type="text" class="txt" name="address" value="{$data['second_party_info']['address']}" disabled="disabled" placeholder="">
</td>
</tr>
<tr>
<td class="l">公司税号:</td>
<td class="r">
<input type="text" class="txt" name="company_tax_no" value="{$data['second_party_info']['company_tax_no']}" disabled="disabled" placeholder="">
</td>
</tr>
</tbody>
</tbody>
</table>
</div>
</if>
</div>
<if condition="$data['company']">
<div style="padding: 30px 0px 10px;display: block;height:30px;">
<div class="input-list input-list-server search_label_rehab">
<p style="font-size: 20px;font-weight: 600;">支付给:<spen style="margin-left: 15px;font-size: 16px;">{$data.company}
</spen>
</p>
</div>
</div>
</if>
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th style="border-right: solid 1px #b6cad2;">结算时间</th>
<th style="border-right: solid 1px #b6cad2;">产品</th>
<th style="border-right: solid 1px #b6cad2;">平台总额</th>
<th style="border-right: solid 1px #b6cad2;">分成比例</th>
<th style="border-right: solid 1px #b6cad2;">税费费率</th>
<th >结算金额</th>
</tr>
</thead>
<tbody id="statementShow">
<foreach name="data.statement_info" item="it" >
<tr>
<td>{$it.begintime}~{$it.endtime}</td>
<td>{$it.game_name}</td>
<td>{$it.money}元</td>
<td><input type="text" class="txt statementchange" name="ratio" disabled="disabled" value="{$it.ratio}" style="width: 40px;">%</td>
<td><input type="text" class="txt statementchange" name="fax_ratio" disabled="disabled" value="{$it.fax_ratio}" style="width: 40px;">%</td>
<td>{$it.ratio_money}元</td>
</tr>
<!-- {$key}|{$vo} -->
</foreach>
<tr>
<td>合计</td>
<td></td>
<td>{$data.statement_count.pay_money}元</td>
<td></td>
<td></td>
<td>{$data.statement_count.ratio_money}元</td>
</tr>
<tr>
<td colspan=5>本月分成总金额(人民币大写):</td>
<td>{$data.statement_count.big_ratio_money}</td>
</tr>
</tbody>
</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" disabled="disabled" placeholder="" name="invoice_item" value="{$data.payinfo.invoice_item}">
</td>
</tr>
<tr>
<td class="l">发票类型:</td>
<td class="r">
<input type="text" class="txt" disabled="disabled" placeholder="" name="invoice_type" value="{$data.payinfo.invoice_type}">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</if>
</body>
</html>

@ -1605,3 +1605,43 @@ CREATE TABLE `tab_finance_compare_info` (
KEY `pay_way` (`pay_way`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='财务导入对账详情表';
--kv chenzhi 20200422
CREATE TABLE `sys_kv` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`key` varchar(50) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'key',
`value` varchar(1000) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'value',
`type` varchar(50) DEFAULT NULL COMMENT '类型说明',
`remark` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `key_name` (`key`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='系统简单kv储存表';
INSERT INTO `platform`.`sys_kv` (`key`, `value`, `type`, `remark`) VALUES ('aggregate_finance_api', 'http://admin.cz.com/index.php?g=api&m=FinanceWeekCount&a=returnFinanceAccountsDataList', 'string', '聚合下游结算Api地址');
-- chenzhi 20200422
CREATE TABLE `tab_aggregate_statement` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`withdraw_type` tinyint(2) DEFAULT '0' COMMENT '对账类型(0-周结,1月结,2补点)',
`channel_id` int(11) DEFAULT '0' COMMENT '对账公司id',
`channel_name` varchar(60) NOT NULL COMMENT '对账公司名称',
`link_phone` varchar(24) DEFAULT NULL COMMENT '对账公司联系人电话',
`begintime` int(11) NOT NULL DEFAULT '0' COMMENT '对账开始时间',
`endtime` int(11) NOT NULL DEFAULT '0' COMMENT '对账截止时间',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建对账单时间',
`ratio_money` decimal(10,2) DEFAULT '0.00' COMMENT '对账金额',
`pay_money` decimal(10,2) DEFAULT '0.00' COMMENT '原始金额合计',
`pay_type` tinyint(2) DEFAULT '0' COMMENT '收款方(0-甲方付给乙方,乙方收款;1-乙方付给甲方,甲方收款)',
`ext_field` longtext COMMENT '凭证地址',
`first_party_info` longtext DEFAULT NULL COMMENT '甲方相关信息json',
`second_party_info` longtext DEFAULT NULL COMMENT '乙方相关信息json',
`statement_info` longtext NOT NULL COMMENT '订单相关信息json',
`admin_name` varchar(60) NOT NULL COMMENT '操作人名称',
`admin_id`int(11) DEFAULT '0' COMMENT '操作人id',
`verify_status` tinyint(2) DEFAULT '0' COMMENT '审核状态 -1审核拒绝 0:系统生成结算单 1:申请开票 2:审核同意 3:已开票 4:上传收款凭证 5已到账',
`remark` longtext DEFAULT NULL COMMENT '备注信息',
PRIMARY KEY (`id`),
KEY `withdraw_type` (`withdraw_type`) USING BTREE,
KEY `channel_id` (`channel_id`) USING BTREE,
KEY `link_phone` (`link_phone`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='聚合渠道结算单';
Loading…
Cancel
Save