<%response.End()%>

<!--#include virtual="/show/userhead.asp"-->
<!--#include virtual="/user/subleft.asp"-->
<!--#include virtual="/inc/md52.asp"-->

<script>document.getElementById('o_4').setAttribute("class", "ed"); document.getElementById("t_4").style.display="";document.getElementById('s_4_6').setAttribute("class", "ed4");</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=webname%>-转账付款</title>
<%
call chkwurl()
'call iszizhu()

'随机号
Function randarr()
Const stringmodarr = "0123456789"
strlength = Len(stringmodarr)
Randomize timer
For i = 1 To 5 
randarr2 = randarr2&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
Next 
randarr=randarr2
End Function

'创建财务流水randarrcwku
select case	trim(request.Cookies("cwku"))
case "aycaiwu"
randarrcwku="A"
case "aycaiwu01"
randarrcwku="B"
case "aycaiwu02"
randarrcwku="C"
case "aycaiwu03"
randarrcwku="D"
case "aycaiwu04"
randarrcwku="E"
case "aycaiwu05"
randarrcwku="F"
case else
randarrcwku="A"
end select
crandarrlei="C" 	'标示 D订单 C财务
crandarrhost="A" 	'服务器数据库


function HasChinese(str) 
HasChinese = false  
dim i 
for i=1 to Len(str) 
if Asc(Mid(str,i,1)) < 0 then 
HasChinese = true 
exit for 
end if 
next 
end function 


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

keyong=SafeRequestform("keyong")
jine=SafeRequestform("jine")				'提现金额
shouid=trim(SafeRequestform("shouid"))
anquan=trim(SafeRequestform("anquan"))

if shouid="" or anquan="" then call PopErr2("请填写完整","zhuanzhang") 
if shouid=trim(request.Cookies("ayusername")) then call PopErr2("请正确填写收款账号","zhuanzhang") 

if HasChinese(jine) then call PopErr2("请正确填写转账金额","zhuanzhang") 
if CCur(jine)>CCur(keyong) then call PopErr2("转账金额高于账户余额","zhuanzhang") 

Application.Lock
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from ayname where ayusername='"&trim(shouid)&"'" 
rs2.open sql2,conn,1,3
if rs2.bof and rs2.eof then call PopErr2("未找到该收款帐号","zhuanzhang") 
shoukuanuid=rs2("aynameid")

sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,3
if ccur(rs("ayyue"))<=0 then call PopErr("对不起，系统错误请稍后再试")
if CCur(jine)>ccur(rs("ayyue"))-ccur(rs("ayalipayyu")) then call PopErr2("转账金额高于账户余额","zhuanzhang") 
if trim(rs("ayanquan"))="0" or trim(rs("ayanquan"))="" then call PopErr2("请先设置支付密码","anquan") 
if md5(anquan)<>trim(rs("ayanquan")) then call PopErr2("支付密码输入有误","zhuanzhang") 

caiwuyue=ccur(rs("ayyue"))-ccur(jine)
if ccur(caiwuyue)<0 then caiwuyue=0
rs("ayyue")=caiwuyue
rs("ayxiaofei")=ccur(rs("ayxiaofei"))+ccur(jine)
rs.update
rs.close

caiwuyue2=ccur(rs2("ayyue"))+ccur(jine)
rs2("ayyue")=ccur(rs2("ayyue"))+ccur(jine)
rs2.update
rs2.close

crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast

conn.Execute("Insert Into "&request.Cookies("cwku")&"(aycaiwuzt,aycaiwuleibie,aycailiushui,aycaiwujine,aycaiwuuser,aycaiwudate,aycaiwuyue,aycaiwubody) values('1','2','"&crandarr&"','"&jine&"','"&clng(request.Cookies("aynameid"))&"','"&now()&"','"&caiwuyue&"','"&request.Cookies("ayusername")&"-"&shouid&"-站内转账"&"')")

rs.open "select * from ayname where aynameid="&clng(shoukuanuid)&"" ,conn,1,1
if not(rs.bof and rs.eof) then
cwku=trim(rs("cwku"))
else
call PopErr("商户ID有误！")
end if
rs.close

crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast

conn.Execute("Insert Into "&cwku&"(aycaiwuzt,aycaiwuleibie,aycailiushui,aycaiwujine,aycaiwuuser,aycaiwudate,aycaiwuyue,aycaiwubody) values('1','0','"&crandarr&"','"&jine&"','"&shoukuanuid&"','"&now()&"','"&caiwuyue2&"','"&request.Cookies("ayusername")&"-"&shouid&"-站内转账"&"')")

Application.Unlock

call logadd(request.Cookies("aynameid"),request.Cookies("ayusername")&"-"&shouid&"-站内转账成功"&jine&"元",0,0)

call PopErr2("转账成功！","index")

end if
%>

<script language="javascript">
function CheckIfid( String )
{ 
    var Letters = "1234567890.";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}

</script>
<script language=javascript>
function check_form()
{
   if(document.form1.jine.value == "") 
   {alert("请填写转账金额");return false;}
   if(document.form1.shouid.value == "") 
   {alert("请填写收款账户");return false;}
   if(document.form1.anquan.value == "") 
   {alert("请填写支付密码");return false;}
   
   document.form1.tixiansub.value=" 提交中 请勿关闭浏览器 ";
   document.form1.tixiansub.disabled="disabled";
}
</script>

<script type="text/javascript">
function upperCase(zhi){

var myPattern = new RegExp("^[.]"); 
if(myPattern.exec(zhi)) 
	{
	document.getElementById("jine").value="";
	alert('金额输入有误！');
	return false;
	}

if(zhi<=0 || zhi>=49999)
{
	document.getElementById("jine").value="";
	alert('金额输入有误！');
	return false;
}
if(!CheckIfid(zhi))
   {
	document.getElementById("jine").value="";
	alert('金额输入有误！');
	return false;
   }
	arrStr=zhi.split(".");
	if(arrStr.length>2){
	document.getElementById("jine").value="";
	alert('金额输入有误！');
	return false;
	}

}
</SCRIPT>
<br>
<DIV id=main2> 
<%call webleft()%>
<DIV id=main_right>
<DIV id=main_right_content>

<H2><SPAN>站内转账</SPAN></H2>
<DIV class=main4>
<%
sql="select ayyue,ayisjssuo,aynameid,istelrz,ismailrz,ischengxin,ayalipayyu from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,1
isyzhuanzhang="yes"
%>
<form name="form1" method="post" action="" onSubmit="return check_form()">
  <TABLE class=table_style_home_info>
  <TBODY>
  <TR> 
    <TD width=97 height="25" align="center">转账方式：</TD>
    <TD width="631" height="25"><input name="radiobutton" type="radio" value="fangshi" checked>
      站内转账</TD>
    </TR>
  <TR>
    <TD width=97 height="25" align="center">可用金额：</TD>
    <TD height="25"><%=Formatnumber(ccur(rs("ayyue"))-ccur(rs("ayalipayyu")),3,true,-1,0)%>元
	<input name="keyong" type="hidden" id="keyong" value="<%=ccur(rs("ayyue"))-ccur(rs("ayalipayyu"))%>">
	<input name="act" type="hidden" id="act" value="zhuanzhang">	</TD>
  </TR>

	<TR>
    <TD height="25" align="center">收款账户：</TD>
    <TD height="25"><input name="shouid" type="text" id="shouid" size="14" maxlength="15"> 
      请输入商户名 如ikpay </TD>
    </TR>
	<TR>
    <TD height="25" align="center">转账金额：</TD>
    <TD height="11"><input name="jine" type="text" id="jine" onKeyUp="upperCase(this.value)" size="14" maxlength="6">
      请输入金额 最低金额1元</TD>
    </TR>
	<TR>
	  <TD height="25" align="center">支付密码：</TD>
	  <TD height="12"><input name="anquan" type="password" id="anquan" size="14">
	    请输入支付密码 [<a href="anquan">设置</a>] </TD>
	  </TR>
<%if cint(rs("ayisjssuo"))=1 then
isyzhuanzhang="no"%>
  <TR><TD height="12" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF0000">商户余额为锁定状态 请联系管理人员！ </span></TD></TR>
<%end if%>

<%'未审核禁止转账
if cint(rs("ischengxin"))=0 then 
isyzhuanzhang="no"%>
<TR><TD height="12" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" style="color: #FF0000">只有可信商家可用该功能！</a></TD>
</TR>
<%end if%>
  <TR>
    <TD height="11" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="submit" name="Submit" value=" 确 认 转 账 " id="tixiansub" <%if isyzhuanzhang="no" then response.Write("disabled")%> onClick="javascript:return confirm('转账为实时到账并不能退还，你确定要操作吗？');"></TD>
  </TR>

  </TBODY></TABLE>    
</form>
	<%
rs.close
%>
</DIV>
</DIV>
<DIV class=clear></DIV></DIV>
</DIV>



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


