<!--#include virtual="/show/adminhead.asp"-->
<!--#include file="adminleft.asp"--> 

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<%
call logquanxian("e3",1)

Function RndNumber(Min,Max) 
Randomize 
RndNumber=Int((Max - Min + 1) * Rnd() + Min) 
End Function 
today=Date 
suiji=Year(today)&Right("0" & Month(today),2)&Right("0" & Day(today),2)&RndNumber(1000000,9999999)

Function MoveR(Rstr) 
Dim i,SpStr 
SpStr = Split(Rstr,",") 
For i = 0 To Ubound(Spstr) 
If I = 0 then 
MoveR = MoveR & SpStr(i) & "," 
Else 
If instr(MoveR,SpStr(i))=0 and i=Ubound(Spstr) Then 
MoveR = MoveR & SpStr(i) 
Elseif instr(MoveR,SpStr(i))=0 Then 
MoveR = MoveR & SpStr(i) & "," 
End If 
End If 
Next 
End Function 

act=SafeRequest("act")

'单独处理转成功
if act="onechuli" then
caiwuid=SafeRequest("caiwuid")
cwku=SafeRequest("cwku")

sql="select * from "&cwku&" where aycaiwuid="&caiwuid&" and aycaiwuleibie=9"
rs.open sql,conn,1,3
if rs.bof and rs.eof then
call PopErr("未找到此提现申请")
else
aycailiushui=rs("aycailiushui")
uid=rs("aycaiwuuser")
tixianjin=rs("aycaiwujine")
lastjin=rs("aycaiwulastjin")
lirunj=ccur(tixianjin)-ccur(lastjin)
rs("aycaiwuzt")=1
rs("aycaiwutxcl")=1
rs("aycwdtime")=now()
rs.update
end if
rs.close

sql="select * from ayname where aynameid="&uid&""
rs.open sql,conn,1,3
'ydongjie=ccur(rs("aydongjie"))-ccur(tixianjin)
'if ccur(ydongjie)<0 then ydongjie=0
'rs("aydongjie")=ydongjie
rs("ayljjs")=ccur(rs("ayljjs"))+ccur(lastjin) 
rs("ayxiaofei")=0
ayusername=rs("ayusername")
aytrueuser=rs("aytrueuser")
ayshoukuanid=rs("ayshoukuanid")
aybank=rs("aybank")
aytel=rs("aytel")
rs.update
rs.close

conn.Execute("Insert Into ayjslist(ayjsjin,ayjsname,ayjstruename,ayjsfs,ayjssid,ayjsbank,ayjstel) values('"&lastjin&"','"&trim(ayusername)&"','"&trim(aytrueuser)&"','"&trim(ayshoukuanfs)&"','"&trim(ayshoukuanid)&"','"&trim(aybank)&"','"&trim(aytel)&"')")	

if ccur(lirunj)>0 then
sql="select * from aycaiwu"
rs.open sql,conn,1,3
rs.addnew
rs("aycaiwuzt")=1
rs("aycailiushui")=trim(aycailiushui)
rs("aycaiwuleibie")=15
rs("aycaiwudingdan")=trim(aycailiushui)
rs("aycaiwujine")=lirunj
rs("aycaiwuisjs")=1
rs("aycwfsjin")=lirunj
rs("aycaiwuzhifu")=6
rs("aycaiwuuser")=0
rs("aycaiwudate")=now()
rs.update
rs.close
end if

					rs.open "select top 1 * from ayjslist where ayjsname='"&trim(ayusername)&"' order by ayjsid desc" ,conn,1,3
					if rs.bof and rs.eof then
					rs.addnew
					rs("ayjsjin")=lastjin
					if trim(ayusername)<>"" then rs("ayjsname")=trim(ayusername)
					if trim(aytrueuser)<>"" then rs("ayjstruename")=trim(aytrueuser)
					if trim(ayshoukuanfs)<>"" then rs("ayjsfs")=trim(ayshoukuanfs)
					if trim(ayshoukuanid)<>"" then rs("ayjssid")=trim(ayshoukuanid)
					if trim(aybank)<>"" then rs("ayjsbank")=trim(aybank)
					if trim(aytel)<>"" then rs("ayjstel")=trim(aytel)
					rs.update
					else
					rs("ayjsjin")=lastjin
					if trim(ayusername)<>"" then rs("ayjsname")=trim(ayusername)
					if trim(aytrueuser)<>"" then rs("ayjstruename")=trim(aytrueuser)
					if trim(ayshoukuanfs)<>"" then rs("ayjsfs")=trim(ayshoukuanfs)
					if trim(ayshoukuanid)<>"" then rs("ayjssid")=trim(ayshoukuanid)
					if trim(aybank)<>"" then rs("ayjsbank")=trim(aybank)
					if trim(aytel)<>"" then rs("ayjstel")=trim(aytel)
					rs.update
					end if
					rs.close


'title="来自"&webname&" "&DateValue(now())&"结算申请已提交！"  
'teltitle="来自"&webname&"："&DateValue(now())&"结算申请已提交！详情登录"&weburl&"了解" 
'body=webname&"提醒您：<br><br>"&DateValue(now())&" 您的账户余额已经为您提交了结算申请，具体到账时间已银行时间为准。<br><br> 如果您的提现账户有误，请联系我们进行修改，以免影响您的结算业务！<br><br> "&webname&" "&weburl&""
'call SendEMail(usermail,title,body)       '******************** 
'call getHTTPPagetel(usertel,teltitle)     '********************
call logadd(request.Cookies("aynameid"),"管理-财务结算成功"&ayusername,0,0)
call PopErr2("财务结算处理成功","adminjiesuan44.asp")
end if

'批量处理转成功
if SafeRequestform("cact")="piliang" then
list1=trim(SafeRequestform("list1"))

if list1="" then call PopErr2("未勾选不能批量结算","adminjiesuan44.asp")

		list1=split(list1,",")  '427382|CAA062322445115094,427389|CAA062322540048845
		For sum=0 To Ubound(list1) 
		
			cliushui=split(list1(sum),"|") '427382|CAA062322445115094       cliushui(0)=427382     cliushui(1)=CAA062322445115094
			
			cwku="aycaiwu"
			select case	mid(trim(cliushui(1)),3,1)
			case "A"
			cwku="aycaiwu"
			case "B"
			cwku="aycaiwu01"
			case "C"
			cwku="aycaiwu02"
			case "D"
			cwku="aycaiwu03"
			case "E"
			cwku="aycaiwu04"
			case "F"
			cwku="aycaiwu05"
			end select
		
					sql="select * from "&cwku&" where aycaiwuid="&trim(cliushui(0))&" and aycaiwuleibie=9 and aycaiwuisjs=0"
					rs.open sql,conn,1,3
					if rs.bof and rs.eof then
					call PopErr("未找到此提现申请")
					else
					aycailiushui=rs("aycailiushui")'财务流水
					uid=rs("aycaiwuuser")          '商户ID
					tixianjin=rs("aycaiwujine")    '提现金额
					lastjin=rs("aycaiwulastjin")   '结算金额
					lirunj=ccur(tixianjin)-ccur(lastjin) '平台利润
					rs("aycaiwuzt")=1
					rs("aycaiwutxcl")=1
					rs("aycaiwuisjs")=1
					rs("aycwdtime")=now()
					rs.update
					end if
					rs.close
					
					sql="select * from ayname where aynameid="&uid&""
					rs.open sql,conn,1,3
					'ydongjie=ccur(rs("aydongjie"))-ccur(tixianjin)
					'if ccur(ydongjie)<0 then ydongjie=0
					'rs("aydongjie")=ydongjie
					rs("ayljjs")=ccur(rs("ayljjs"))+ccur(lastjin) 
					rs("ayxiaofei")=0
					ayusername=rs("ayusername")
					aytrueuser=rs("aytrueuser")
					ayshoukuanfs=rs("ayshoukuanfs")
					ayshoukuanid=rs("ayshoukuanid")
					aybank=rs("aybank")
					aytel=rs("aytel")
					rs.update
					rs.close
					
					rs.open "select top 1 * from ayjslist where ayjsname='"&trim(ayusername)&"' order by ayjsid desc" ,conn,1,3 
					if rs.bof and rs.eof then
					rs.addnew
					rs("ayjsjin")=lastjin
					if trim(ayusername)<>"" then rs("ayjsname")=trim(ayusername)
					if trim(aytrueuser)<>"" then rs("ayjstruename")=trim(aytrueuser)
					if trim(ayshoukuanfs)<>"" then rs("ayjsfs")=trim(ayshoukuanfs)
					if trim(ayshoukuanid)<>"" then rs("ayjssid")=trim(ayshoukuanid)
					if trim(aybank)<>"" then rs("ayjsbank")=trim(aybank)
					if trim(aytel)<>"" then rs("ayjstel")=trim(aytel)
					rs.update
					else
					rs("ayjsjin")=lastjin
					if trim(ayusername)<>"" then rs("ayjsname")=trim(ayusername)
					if trim(aytrueuser)<>"" then rs("ayjstruename")=trim(aytrueuser)
					if trim(ayshoukuanfs)<>"" then rs("ayjsfs")=trim(ayshoukuanfs)
					if trim(ayshoukuanid)<>"" then rs("ayjssid")=trim(ayshoukuanid)
					if trim(aybank)<>"" then rs("ayjsbank")=trim(aybank)
					if trim(aytel)<>"" then rs("ayjstel")=trim(aytel)
					rs.update
					end if
					rs.close
					
					if ccur(lirunj)>0 then
					sql="select * from aycaiwu"
					rs.open sql,conn,1,3
					rs.addnew
					rs("aycaiwuzt")=1
					rs("aycailiushui")=trim(aycailiushui)
					rs("aycaiwuleibie")=15
					rs("aycaiwudingdan")=trim(aycailiushui)
					rs("aycaiwujine")=lirunj
					rs("aycaiwuisjs")=1
					rs("aycwfsjin")=lirunj
					rs("aycaiwuzhifu")=6
					rs("aycaiwuuser")=0
					rs("aycaiwudate")=now()
					rs.update
					rs.close
					end if
					
					'title="来自"&webname&" "&DateValue(now())&"结算申请已提交！"  
					'teltitle="来自"&webname&"："&DateValue(now())&"结算申请已提交！详情登录"&weburl&"了解" 
					'body=webname&"提醒您：<br><br>"&DateValue(now())&" 您的账户余额已经为您提交了结算申请，具体到账时间已银行时间为准。<br><br> 如果您的提现账户有误，请联系我们进行修改，以免影响您的结算业务！<br><br> "&webname&" "&weburl&""
					'call SendEMail(usermail,title,body)       '******************** 
					'call getHTTPPagetel(usertel,teltitle)                '********************
					
		
		next
		
call logadd(request.Cookies("aynameid"),"管理-财务结算成功"&ayusername,0,0)
call PopErr2("批量财务结算处理成功","adminjiesuan44.asp")
end if


'支付宝分账操作成功后  库转成功
if SafeRequestform("act")="qfenzhang" then
caiwuid=SafeRequestform("caiwuid")
caiwuliushui=SafeRequestform("caiwuliushui")
uid=SafeRequestform("uid")
f_num=SafeRequestform("f_num")

sql="select * from aysumyz" 
rs.open sql,conn,1,3
rs("aysumyzi")=ccur(rs("aysumyzi"))+ccur(f_num)
rs.update
rs.close

caiwuliushui=split(caiwuliushui,",")
caiwuid=split(caiwuid,",")
For sum=0 To Ubound(caiwuid) 

sql="select * from "&trim(caiwuliushui(sum))&" where aycaiwuid="&trim(caiwuid(sum))&" and aycaiwuleibie=9 and aycaiwuisjs=0"
rs.open sql,conn,1,3
if rs.bof and rs.eof then
call PopErr("未找到此提现申请")
else
aycailiushui=rs("aycailiushui")'财务流水
uid=rs("aycaiwuuser")          '商户ID
tixianjin=rs("aycaiwujine")    '提现金额
lastjin=rs("aycaiwulastjin")   '结算金额
lirunj=ccur(tixianjin)-ccur(lastjin) '平台利润
rs("aycaiwuzt")=1
rs("aycaiwutxcl")=1
rs("aycaiwuisjs")=1
rs("aycwdtime")=now()
rs.update
end if
rs.close

sql="select * from ayname where aynameid="&uid&""
rs.open sql,conn,1,3
'ydongjie=ccur(rs("aydongjie"))-ccur(tixianjin)
'if ccur(ydongjie)<0 then ydongjie=0
'rs("aydongjie")=ydongjie
rs("ayljjs")=ccur(rs("ayljjs"))+ccur(lastjin) 
rs("ayxiaofei")=0
ayusername=rs("ayusername")
aytrueuser=rs("aytrueuser")
ayshoukuanfs=rs("ayshoukuanfs")
ayshoukuanid=rs("ayshoukuanid")
aybank=rs("aybank")
aytel=rs("aytel")
rs.update
rs.close

sql="select * from ayjslist where ayjsname='"&trim(ayusername)&"'" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.addnew
rs("ayjsjin")=lastjin
if trim(ayusername)<>"" then rs("ayjsname")=trim(ayusername)
if trim(aytrueuser)<>"" then rs("ayjstruename")=trim(aytrueuser)
if trim(ayshoukuanfs)<>"" then rs("ayjsfs")=trim(ayshoukuanfs)
if trim(ayshoukuanid)<>"" then rs("ayjssid")=trim(ayshoukuanid)
if trim(aybank)<>"" then rs("ayjsbank")=trim(aybank)
if trim(aytel)<>"" then rs("ayjstel")=trim(aytel)
rs.update
else
rs("ayjsjin")=lastjin
if trim(ayusername)<>"" then rs("ayjsname")=trim(ayusername)
if trim(aytrueuser)<>"" then rs("ayjstruename")=trim(aytrueuser)
if trim(ayshoukuanfs)<>"" then rs("ayjsfs")=trim(ayshoukuanfs)
if trim(ayshoukuanid)<>"" then rs("ayjssid")=trim(ayshoukuanid)
if trim(aybank)<>"" then rs("ayjsbank")=trim(aybank)
if trim(aytel)<>"" then rs("ayjstel")=trim(aytel)
rs.update
end if
rs.close

if ccur(lirunj)>0 then
sql="select * from aycaiwu" 
rs.open sql,conn,1,3
rs.addnew
rs("aycaiwuzt")=1
rs("aycailiushui")=trim(aycailiushui)
rs("aycaiwuleibie")=15
rs("aycaiwudingdan")=trim(aycailiushui)
rs("aycaiwujine")=lirunj
rs("aycaiwuisjs")=1
rs("aycwfsjin")=lirunj
rs("aycaiwuzhifu")=6
rs("aycaiwuuser")=0
rs("aycaiwudate")=now()
rs.update
rs.close
end if


next


call logadd(request.Cookies("aynameid"),"管理-财务批量结算成功",0,0)
call PopErr2("批量结算成功","ik_adminfenzhang.asp")
end if


if SafeRequestform("act")="shaixuan" then

	if SafeRequestform("norenzheng")="yes" then
	response.Cookies("norenzheng")="yes"
	else
	response.Cookies("norenzheng")="no"
	end if

	if SafeRequestform("nohaoyou")="yes" then
	response.Cookies("nohaoyou")="yes"
	else
	response.Cookies("nohaoyou")="no"
	end if
	
	if SafeRequestform("notousu")="yes" then
	response.Cookies("notousu")="yes"
	else
	response.Cookies("notousu")="no"
	end if
	
	response.Cookies("wangyinlei")=SafeRequestform("wangyinlei")
	
end if

if act="uidpaixu" then
if request.Cookies("paixu")<>"" then
response.Cookies("paixu")=""
response.Redirect "adminjiesuan44.asp"
else
response.Cookies("paixu")="uidpaixu"
response.Redirect "adminjiesuan44.asp"
end if
end if
%>
 
<title><%=webname%>-最高权限-商户结算-自助提现结算模式</title> 

<DIV>
<SCRIPT LANGUAGE="JavaScript">
var checkflag1 = "false";
function check1(field) {
if (document.myform.chkAll1.checked == false) 
{
document.getElementById("hebinjin").value=0;
price.innerHTML = "合并结算金额：0元 "; 
}else{
var byjsz=document.getElementById("byjsz").value;
document.getElementById("hebinjin").value=parseFloat(byjsz).toFixed(3);
price.innerHTML = "合并结算金额："+parseFloat(byjsz).toFixed(3)+"元 "; 
}
if (checkflag1 == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag1 = "true";
return "false"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag1 = "false";
return "true"; }
}

function unselectall1(jin,list)
{
var aaa="t"+list;

var bbb=document.getElementById(aaa).checked;



	var hebinjin=document.getElementById("hebinjin").value;
	
	if (bbb==false)
	{
	var hej=parseFloat(hebinjin)-parseFloat(jin);
	document.getElementById("hebinjin").value=parseFloat(hej).toFixed(3);
	}
	else
	{
	var hej=parseFloat(hebinjin)+parseFloat(jin);
	document.getElementById("hebinjin").value=parseFloat(hej).toFixed(3);
	}
	
	
	price.innerHTML = "合并结算金额："+parseFloat(hej).toFixed(3)+"元 "; 
	
    if(document.myform.chkAll1.checked){
	document.myform.chkAll1.checked = document.myform.chkAll1.checked&0;
	checkflag1 = "false";
    } 	
}
</script>
<SCRIPT LANGUAGE="JavaScript">
function piliang(){
	document.getElementById("cact").value="piliang";
	document.getElementById(myform).submit();
    return true;

}
</script>

<SCRIPT LANGUAGE="JavaScript">
function fenzhang(){
	document.getElementById("cact").value="fenzhang";
	document.getElementById(myform).submit();
    return true;

}
</script>

<DIV id=main1200> 
<%call webleft()%>
<DIV id=main_right>
<DIV id=main_right_content>
<STYLE>.apply_style {
	POSITION: absolute
}
.right_title A {
	LINE-HEIGHT: 27px; WIDTH: 126px; DISPLAY: inline-block; BACKGROUND: url(<%=ossurl%>images/bg22.gif) no-repeat; HEIGHT: 27px
}
.right_title A.current {
	BACKGROUND: url(<%=ossurl%>images/main_right_title_bg.gif) no-repeat; COLOR: #fff; FONT-WEIGHT: bold
}
.table_style_1 TD {
	HEIGHT: 38px
}
.table_style_home_info TD {
	PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; HEIGHT: 30px; PADDING-TOP: 0px
}
</STYLE>

<DIV class=right_titleadmin>&nbsp;&nbsp;自助提现结算模式</DIV>
<DIV class=main>
<%
rs.open "select ayalipaymail,alipayname,ayjiesuanzhouqi from ayquanju" ,conn,1,1
ayalipaymail=trim(rs("ayalipaymail"))
alipayname=trim(rs("alipayname"))
ayjiesuanzhouqi=rs("ayjiesuanzhouqi")
rs.close
%>



    <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="33%" height="25" align="left"><a href="adminjiesuan44.asp" style="COLOR: #FF0000">·提现结算</a> <a style="color:#666666" href="adminjiesuan5.asp">[不可结算列表]</a></td>
        <td width="21%" align="left"><a href="ik_adminjiesuan.asp" style="COLOR: #FF0000">·自动结算</a></td>
        <td width="21%" align="left"><a href="ik_adminjiesuanjj.asp" style="COLOR: #FF0000">·加急提现</a></td>
        <td width="25%" align="left"><a href="ik_adminfenzhang.asp" style="COLOR: #FF0000">·秒结算</a></td>
      </tr>
    </table>
    <br>


%>
	<TABLE width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
    <TBODY>
	<TR><TD colspan="8" bgcolor="#BFFFD5" class="border_bottom border_right">
    <form name="shaixuan" method="post" action="">&nbsp;&nbsp;
    <!--
    <input name="norenzheng" type="checkbox" value="yes" <%'if request.Cookies("norenzheng")="yes" then response.Write "checked"%>>隐藏未认证
    -->
    <input name="nohaoyou" type="checkbox" value="yes" <%if request.Cookies("nohaoyou")="yes" then response.Write "checked"%>>隐藏非好友
	<input name="notousu" type="checkbox" value="yes" <%if request.Cookies("notousu")="yes" then response.Write "checked"%>>隐藏有投诉
    <select name="wangyinlei" id="wangyinlei">
      <option value="0" <%if request.Cookies("wangyinlei")="0" then response.Write "selected"%>>全部</option>
      <option value="1" <%if request.Cookies("wangyinlei")="1" then response.Write "selected"%>>只显示网银</option>
      <option value="2" <%if request.Cookies("wangyinlei")="2" then response.Write "selected"%>>隐藏网银</option>
    </select>
    
    <input name="act" type="hidden" value="shaixuan">
    <input type="submit" name="button" id="button" value=" 确 定 ">
    </form>
      </TD>
	  <TD colspan="6" bgcolor="#BFFFD5" class="border_bottom border_right" style="color: #009933; font-weight: bold">&nbsp;可结算列表</TD>
	  </TR>
  	<TR>
    <TD align="center" class="border_bottom border_right">合</TD>
    <TD align="center" class="border_bottom border_right">提现时间</TD>
    <TD align="center" class="border_bottom border_right">流水号</TD>
    <TD align="center" class="border_bottom border_right" style="font-weight: bold">
    <a style="color:#F60" href="?act=uidpaixu" title="点击用户名排序">商户名<%if request.Cookies("paixu")="uidpaixu" then response.Write"↓"%></a></TD>
    <TD align="center" class="border_bottom border_right">级别</TD>
    <TD align="center" class="border_bottom border_right">账户余额</TD>
    <TD align="center" class="border_bottom border_right" >发生余额</TD>
    <TD align="center" class="border_bottom border_right" style="font-weight: bold">提现金额</TD>
    <TD align="center" class="border_bottom border_right" style="font-weight: bold; color: #FF0000">应到账/费用</TD>
    <TD align="center" class="border_bottom border_right" style="font-weight: bold; color: #FF0000">收款姓名</TD>
    <TD align="center" class="border_bottom border_right" style="font-weight: bold; color: #FF0000">收款方式</TD>
    <TD align="center" class="border_bottom border_right" style="font-weight: bold; color: #FF0000">收款帐号</TD>
    <TD align="center" class="border_bottom border_right">银行名称</TD>
    <TD align="center" class="border_bottom">操作</TD>
    </TR>
<form name="myform" id="myform" method="post" action="">
<%
For sum=0 To 5 '财务库数量  总数量-1 如增加库 需修改updata\tongji下的相应文件  case "A"
if sum=0 then cwku="aycaiwu"
if sum=1 then cwku="aycaiwu01"
if sum=2 then cwku="aycaiwu02"
if sum=3 then cwku="aycaiwu03"
if sum=4 then cwku="aycaiwu04"
if sum=5 then cwku="aycaiwu05"
	
	
	if request.Cookies("paixu")<>"" then
	
	sql="select aycaiwuleibie,aycaiwutxcl,aycaiwudate,aytxjj,aycaiwuuser,aycaiwulastjin,aycaiwuid,aytxyue,aycaiwuyue,aycaiwujine,aycailiushui,aycaiwufangshi from "&cwku&" where aycaiwuleibie=9 and datediff(day,aycaiwudate,'"&now()&"')>=0 and (aycaiwutxcl=0 or aycaiwutxcl=2 or aycaiwutxcl=3) and aytxjj=0 order by aycaiwuuser desc" 
	
		if request.Cookies("wangyinlei")<>"0" then
		if request.Cookies("wangyinlei")="1" then wysqldd=" and aycaiwufangshi=3"
		if request.Cookies("wangyinlei")="2" then wysqldd=" and aycaiwufangshi<>3"
		sql="select aycaiwuleibie,aycaiwutxcl,aycaiwudate,aytxjj,aycaiwuuser,aycaiwulastjin,aycaiwuid,aytxyue,aycaiwuyue,aycaiwujine,aycailiushui,aycaiwufangshi from "&cwku&" where aycaiwuleibie=9 and datediff(day,aycaiwudate,'"&now()&"')>=0 and (aycaiwutxcl=0 or aycaiwutxcl=2 or aycaiwutxcl=3) and aytxjj=0 "&wysqldd&" order by aycaiwuuser desc" 
		end if
	
	
	else
	
	sql="select aycaiwuleibie,aycaiwutxcl,aycaiwudate,aytxjj,aycaiwuuser,aycaiwulastjin,aycaiwuid,aytxyue,aycaiwuyue,aycaiwujine,aycailiushui,aycaiwufangshi,jjmoney from "&cwku&" where aycaiwuleibie=9 and datediff(day,aycaiwudate,'"&now()&"')>=0 and (aycaiwutxcl=0 or aycaiwutxcl=2 or aycaiwutxcl=3) and aytxjj=0 order by aytxjj desc,aycaiwudate" 


		if request.Cookies("wangyinlei")<>"0" then
		if request.Cookies("wangyinlei")="1" then wysqldd=" and aycaiwufangshi=3"
		if request.Cookies("wangyinlei")="2" then wysqldd=" and aycaiwufangshi<>3"
		sql="select aycaiwuleibie,aycaiwutxcl,aycaiwudate,aytxjj,aycaiwuuser,aycaiwulastjin,aycaiwuid,aytxyue,aycaiwuyue,aycaiwujine,aycailiushui,aycaiwufangshi,jjmoney from "&cwku&" where aycaiwuleibie=9 and datediff(day,aycaiwudate,'"&now()&"')>=0 and (aycaiwutxcl=0 or aycaiwutxcl=2 or aycaiwutxcl=3) and aytxjj=0 "&wysqldd&" order by aytxjj desc,aycaiwudate" 
		end if
			
		
	end if
	rs.open sql,conn,1,1
	if not(rs.bof and rs.eof) then
	do while not rs.eof 
	n=1
	isok="yes"
	iserr="no"
	
		'相关数据检测  开始*******************
		set rsu=server.CreateObject("adodb.recordset")
		sqlu="select ayisjssuo,aynameid,aymail,isalihy,ayshoukuanfs,istelrz,ismailrz,ayjibie,ayusername,aytrueuser,ayshoukuanid,aybank from ayname where ayisjssuo=0 and aynameid="&rs("aycaiwuuser")&" and (ayjibie=5 or ayjibie=3 or ayjibie=4)" 
		rsu.open sqlu,conn,1,1
		if not(rsu.bof and rsu.eof) then
				aymail=trim(rsu("aymail"))
				aynameid=rsu("aynameid")
				
				if request.Cookies("nohaoyou")<>"" and request.Cookies("nohaoyou")="yes" then
					if cint(rsu("isalihy"))=0 then isok="no"
					if cint(rsu("ayshoukuanfs"))<>1 then isok="yes"
				end if
				
				if cint(rsu("istelrz"))=0 or cint(rsu("ismailrz"))=0 then
					if DateDiff("d",rs("aycaiwudate"),now())<ccur(ayjiesuanzhouqi)+365 then isok="no"
					if request.Cookies("norenzheng")<>"" and request.Cookies("norenzheng")="yes" then isok="no"
				end if
				
				if request.Cookies("notousu")<>"" and request.Cookies("notousu")="yes" then
				set rslist=server.CreateObject("adodb.recordset")
				rslist.open "select top 1 ayjubaouid,ayjuzt from ayjubao where ayjubaouid="&rsu("aynameid")&" and ayjuzt=0",conn,1,1
				if not(rslist.bof and rslist.eof) then isok="no"
				rslist.close
				end if
				
				if isok="yes" then	
					if cint(rsu("ayjibie"))<>5 and cint(rsu("ayjibie"))<>9 then
					set rsj=server.CreateObject("adodb.recordset")
					rsj.open "select ayujbgid,ayujbjsday from ayujb where ayujbgid="&cint(rsu("ayjibie"))&"" ,conn,1,1
					if (rsj.bof and rsj.eof) then call PopErr("商户级别获取失败")
					if DateDiff("d",rs("aycaiwudate"),now())<ccur(rsj("ayujbjsday")) then isok="no"
					rsj.close
					else
					if DateDiff("d",rs("aycaiwudate"),now())<ccur(ayjiesuanzhouqi) then isok="no"
					end if
				end if
		'相关数据检测 结束 *******************
		
				if isok="yes" then	
				bqyjs=ccur(bqyjs)+ccur(rs("aycaiwulastjin"))
				
					if ccur(rs("aycaiwujine"))>ccur(rs("aytxyue")) then iserr="yes"
					if ccur(rs("aycaiwulastjin"))>ccur(rs("aytxyue")) then iserr="yes"
					if ccur(rs("aycaiwulastjin"))>ccur(rs("aycaiwujine")) then iserr="yes"
				%>
				<TR id="tr<%=rs("aycaiwuid")%>" <%if iserr="yes" then response.Write "style=background-color:#F60"%>  onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff' >
					<TD align="center" class="border_bottom border_right">
					<input name="list1" type="checkbox" id="t<%=rs("aycaiwuid")%>" value="<%=rs("aycaiwuid")%>|<%=rs("aycailiushui")%>" onClick="unselectall1(<%=Formatnumber(rs("aycaiwulastjin"),3,true,-1,0)%>,<%=rs("aycaiwuid")%>)">
					</TD>
					<TD align="center" class="border_bottom border_right">
					<%=rs("aycaiwudate")%></TD>
					<TD align="center" class="border_bottom border_right"><%=trim(rs("aycailiushui"))%></TD>
					<TD align="center" class="border_bottom border_right">
					<a href="adminuseredit.asp?id=<%=rsu("aynameid")%>" target="_blank"><%=trim(rsu("ayusername"))%></a>
					<%if cint(rsu("istelrz"))=0 or cint(rsu("ismailrz"))=0 then response.Write "<a href=adminbuhuo.asp?aymail="&aymail&"&aynameid="&aynameid&"&act=renzheng style=color:#FF3300 target=_blank title=通知商户认证>未认证</a>"%>
					</TD>
					<TD align="center" class="border_bottom border_right">
					<%response.Write getjbname(rsu("ayjibie"))%>
					</TD>
					<TD align="center" class="border_bottom border_right"><%=Formatnumber(rs("aytxyue"),3,true,-1,0)%>元</TD>
					<TD align="center" class="border_bottom border_right"><%=Formatnumber(rs("aycaiwuyue"),3,true,-1,0)%>元</TD>
					<TD align="center" class="border_bottom border_right"><%=Formatnumber(rs("aycaiwujine"),3,true,-1,0)%>元</TD>
					<TD align="center" class="border_bottom border_right" style="color: #FF0000">
					<a href=adminmycaiwuc.asp?cid=<%=rs("aycaiwuid")%>&cwku=<%=cwku%> style="color:#FF0000"><%=Formatnumber(rs("aycaiwulastjin"),3,true,-1,0)%>元</a> (手续费<%=Formatnumber(ccur(rs("aycaiwujine"))-ccur(rs("aycaiwulastjin")),3,true,-1,0) %>元)
					</TD>
					<TD align="center" class="border_bottom border_right" style="color: #FF0000">
					<%=rsu("aytrueuser")%>
					<input name="aytrueuser" type="hidden" id="aytrueuser" value="<%=rsu("aytrueuser")%>">
					</TD>
					<TD align="center" class="border_bottom border_right" style=" color: #FF0000">
					<%'收款方式
					if cint(rsu("ayshoukuanfs"))=1 then fs="支付宝"
					if cint(rsu("ayshoukuanfs"))=2 then fs="财付通"
					if cint(rsu("ayshoukuanfs"))=3 then fs="银行"
					response.Write fs%>
					<input name="ayshoukuanfs" type="hidden" id="ayshoukuanfs" value="<%=fs%>">
					</TD>
					<TD align="center" class="border_bottom border_right" style=" color: #FF0000">
					<%
					if instr(1,rsu("ayshoukuanid"),"@")=0 then '邮箱
						response.Write("&nbsp;")
						response.Write("&nbsp;")
						response.Write("&nbsp;")
						For ssum=1 To len(rsu("ayshoukuanid"))
						response.Write mid(rsu("ayshoukuanid"),ssum,1)
						if ssum=4 then response.Write("&nbsp;")
						if ssum=8 then response.Write("&nbsp;")
						if ssum=12 then response.Write("&nbsp;")
						if ssum=16 then response.Write("&nbsp;")
						next
					else
					response.Write trim(rsu("ayshoukuanid"))
					end if
					
					if cint(rsu("ayshoukuanfs"))=1 and cint(rsu("isalihy"))=0 then%>
					<a href="adminbuhuo.asp?aymail=<%=aymail%>&aynameid=<%=aynameid%>&act=alipay" target="_blank" style="color:#339900" title="通知商户添加支付宝好友">通</a>
					<%end if%>
					<input name="ayshoukuanid" type="hidden" id="ayshoukuanid" value="<%=rsu("ayshoukuanid")%>">
					</TD>
					<TD align="center" class="border_bottom border_right"><%if cint(rsu("ayshoukuanfs"))<>3 then response.Write("-"):else:response.Write rsu("aybank"):end if%></TD>
					<TD align="center" class="border_bottom">
						<%'结算详细记录
						set rslist=server.CreateObject("adodb.recordset")
						sqllist="select top 1 ayjsname,ayjsid,ayjstruename,ayjssid from ayjslist where ayjsname='"&trim(rsu("ayusername"))&"' order by ayjsid desc" 
						rslist.open sqllist,conn,1,1
						if not(rslist.bof and rslist.eof) then
							if trim(rsu("aytrueuser"))<>trim(rslist("ayjstruename")) or trim(rsu("ayshoukuanid"))<>trim(rslist("ayjssid")) then
							response.Write "<span style='font-weight:bold'> <a href=adminjiesuanjlxx.asp?uid="&rsu("ayusername")&" style='color:#FF0000' target=_blank>异常</a></span>"
							end if
						end if
						rslist.close
						'投诉记录
						set rslist=server.CreateObject("adodb.recordset")
						sqllist="select top 1 ayjubaouid,ayjuzt,ayjubaoid from ayjubao where ayjubaouid="&rsu("aynameid")&" and ayjuzt=0" 
						rslist.open sqllist,conn,1,1
						if not(rslist.bof and rslist.eof) then
						response.Write "<span style='font-weight:bold'> <a href=ik_adminjubaoc.asp?id="&rslist("ayjubaoid")&" style='color:#FF0000' target=_blank>投诉</a></span>"
						end if
						rslist.close
						
						if isno2="yes" then%>
						<a href=adminjiesuanjlxx.asp?uid=<%=trim(rsu("ayusername"))%> target=_blank>详</a> <a href="adminjiesuanjl.asp?uid=<%=rsu("aynameid")%>&cwku=<%=cwku%>" target="_blank">结</a>
						<%else%>
						<a href=adminjiesuanjlxx.asp?uid=<%=trim(rsu("ayusername"))%> target=_blank>详</a> <a href="adminjiesuanjl.asp?uid=<%=rsu("aynameid")%>&cwku=<%=cwku%>" target="_blank">结</a>
						<a <%if isno2="yes" then response.Write "style=text-decoration:line-through;"%> onClick="javascript:return confirm('您确定要操作吗？');" href="?act=onechuli&caiwuid=<%=rs("aycaiwuid")%>&cwku=<%=cwku%>">转已处理</a>
						<%end if%>	
					</TD>
				</TR>
			<%rsu.close
			end if
		end if
	
	n=n+1
	rs.movenext 
	loop
	end if
	rs.close

next
%>

    <TR id="hebinform">
    <TD colspan="14" class=" border_right border_bottom" style="font-weight: bold;" >
	<input name="cact" type="hidden" id="cact"><input name="hebinjin" type="hidden" id="hebinjin" value="0">
      <input name="chkAll1" type="checkbox" id="chkAll1" onClick="this.value=check1(this.form.list1)" value="checkbox">全选 <span id="price" style="color:#FF0000"></span> <input type="submit" name="Submit" value=" 我已付款 批量结算 " onClick="return piliang();"> <input type="submit" name="Submit2" value=" 支付宝批量付款分账 " onClick="return fenzhang();">    </TD>
    </TR>
</form>
    <TR>
      <TD colspan="14" align="left" class=" border_right">&nbsp;本期应结算总金额&nbsp;<input name="byjsz" type="hidden" id="byjsz" value="<%=bqyjs%>"><%=Formatnumber(bqyjs,3,true,-1,0)%>元</TD>
      </TR>
  </TABLE>
	<br>

  
</DIV></DIV>
<DIV class=clear></DIV></DIV>
</DIV>
<SCRIPT>
$(function(){
$('.left_title').each(function(){
   $(this).click(function(){
	   var index=$('.left_title').index(this);
	   if($(this).next().hasClass('hide_m')){
		   $(this).next().removeClass('hide_m');
           $(this).next().show();		 
		   $(this).find('img').attr('src','<%=ossurl%>images/expansion.gif');
		   $.cookie('m_index_'+index,'',{expires:0});
	   } else {
	       $(this).next().hide();
		   $(this).next().addClass('hide_m');
		   $(this).find('img').attr('src','<%=ossurl%>images/shrank.gif');		   
		   $.cookie('m_index_'+index,'none',{expires:365});
	   }
   })
})

$('.left_title').each(function(){
	var index=$('.left_title').index(this);
    $(this).next().css('display',$.cookie('m_index_'+index) ? $.cookie('m_index_'+index) : '');
	if($.cookie('m_index_'+index)){
	    $(this).next().addClass('hide_m');
	}
	$(this).find('img').attr('src',$.cookie('m_index_'+index) ? '<%=ossurl%>images/shrank.gif' : '<%=ossurl%>images/expansion.gif');
})
})

</SCRIPT>


<!--#include virtual="/show/footadmin.asp"-->

