<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/conn.asp"-->
<!--#include file="../Include/ConnDatabase.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方网站http://www.ip126.com
'技术支持论坛 http://bbs.ip126.com/
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%Response.Charset="utf-8"%>
<%
SiteUrl=conn.execute("select SiteUrl from TianTianCMS_Config")(0)
SiteTitle=conn.execute("select SiteTitleEN from TianTianCMS_Config")(0)
if DateDiff("s",session("time"),now())<Refresh then
   response.write "<script language='JavaScript'>alert('Anti-refresh mechanism: Please Do not "& Refresh &" seconds to repeat refresh！');" & "history.back()" & "</script>"
   response.end
else
   session("time")=now()
end if
dim mOrderName,mgoods,mRemark,mMemID,mRealName,mSex,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,muserqq,mEmail,GetCode,Products_id,Products_num,amount,Payment_goods,freight,tax,strMth
dim rs,sql,orderid,shijian,ddhm
mOrderName=trim(request.form("OrderName"))
mgoods=request.form("Products")
mRemark=request.form("Remark")
mMemID=request.QueryString("MemberID")
mRealName=trim(request.form("RealName"))
mSex=trim(request.form("Sex"))
mCompany=trim(request.form("Company"))
mAddress=trim(request.form("Address"))
mZipCode=trim(request.form("ZipCode"))
mTelephone=trim(request.form("Telephone"))
mFax=trim(request.form("Fax"))
mMobile=trim(request.form("Mobile"))
muserqq=trim(request.form("userqq"))
mEmail=trim(request.form("Email"))
GetCode = Trim(request.form("GetCode"))
total=Formatnumber(request.form("total"),2,-1,-1,0)
Products_id=trim(request.form("Products_id"))
Products_num=trim(request.form("Products_num"))
amount=trim(request.form("amount"))
Payment_goods=trim(request.form("Payment_goods"))
freight=trim(request.form("freight"))
tax=trim(request.form("tax"))
strMth=trim(request.form("strMth"))

If trim(request("Action_pay"))="yes" Then'过后支付
ddhm=trim(request("ddhm"))
total=Formatnumber(request("total"),2,-1,-1,0)
set rs = server.createobject("adodb.recordset")
sql="select * from TianTianCMS_Members where ID="&request.QueryString("MemberID")
rs.open sql,conn,1,1
mRealName=rs("RealName")
mOrderName="Order product"
mAddress=rs("Address")
mZipCode=rs("ZipCode")
mTelephone=rs("Telephone")
mMobile=rs("Mobile")
rs.close
set rs=Nothing

else'下订单即支付
shijian=now()

If trim(request.form("paymentType"))="cz" Then'如果是充值
session("NoList")="cz"
ddhm="cz"&year(shijian)&month(shijian)&day(shijian)&hour(shijian)&minute(shijian)&second(shijian)
set rs = server.createobject("adodb.recordset")
sql="select * from TianTianCMS_financiallog"
rs.open sql,conn,1,3
rs.addnew
rs("members")=trim(request.form("username"))
rs("ddhm")=ddhm
rs("OrderName")="top-up"
rs("income")=total
rs("operator")=trim(request.form("username"))
rs("Operatingtime")=now()
rs.update
orderid=rs("id")
rs.close
set rs=nothing
else'如果是购物
dim ErrMessage,ErrMsg(10),FindErr(10),i
  ErrMsg(0)="·Your title must contain 1 - 100 characters."
  ErrMsg(1)="·Your name must contain 1 - 50 characters."
  ErrMsg(2)="·Please fill out the detailed address."
  ErrMsg(3)="·Your Zip/Postal Code must contain 6 - 20 characters."
  ErrMsg(4)="·Your tel must contain 1 - 50 characters.Contact phone number and mobile phone can t At the same time for empty."
  ErrMsg(5)="·Choose the invoice unit name cannot be empty."
  ErrMsg(6)="·Your mobile must contain 11 - 50 characters."
  ErrMsg(7)="·Please enter a valid email address."
  ErrMsg(8)="·Please enter the number in the image."
  ErrMsg(9)="·Time that you stop over in the 【 Shopping Cart 】 page over long, cause verify the code the expiration.\ the n pleases return and break the 【 Shopping Cart 】 page to Order afresh！"
  ErrMsg(10)="·Verifying the code cannot for getting empty please return the check."
if len(mOrderName)>100 Or len(mOrderName)=0 then
  FindErr(0)=true
end if
if len(mRealName)>50 Or len(mRealName)=0 then
  FindErr(1)=true
end if
if len(mAddress)=0 then
  FindErr(2)=true
end if
if len(mZipCode)<>6 then
  FindErr(3)=true
end if
if len(mMobile)=0 and len(mTelephone)=0 then
  FindErr(4)=true
end If
if tax>0 and len(mCompany)=0 then
  FindErr(5)=true
end If

for i = 0 to UBound(FindErr)
  if FindErr(i)=true then
    ErrMessage=ErrMessage+ErrMsg(i)+"\n"
  end if
next
if not (ErrMessage="" Or isnull(ErrMessage)) then
  WriteMsg(ErrMessage)
  response.end
end If

ddhm="gw"&year(shijian)&month(shijian)&day(shijian)&hour(shijian)&minute(shijian)&second(shijian)

set rs = server.createobject("adodb.recordset")
sql="select * from TianTianCMS_Order"
rs.open sql,conn,1,3
rs.addnew
rs("OrderName")=StrReplace(mOrderName)
rs("goods")=mgoods
rs("Remark")=mRemark
rs("MemID")=mMemID
rs("Linkman")=StrReplace(mRealName)
rs("Sex")=mSex
rs("Company")=StrReplace(mCompany)
rs("Address")=StrReplace(mAddress)
rs("ZipCode")=StrReplace(mZipCode)
rs("Telephone")=StrReplace(mTelephone)
rs("Fax")=StrReplace(mFax)
rs("Mobile")=StrReplace(mMobile)
rs("userqq")=muserqq
rs("Email")=mEmail
rs("ddhm")=ddhm
rs("cash")=total
rs("Products_id")=Products_id
rs("Products_num")=Products_num
rs("amount")=amount
rs("Payment_goods")=Payment_goods
rs("freight")=freight
rs("tax")=tax
rs("strMth")=strMth
rs("AddTime")=now()
rs.update
orderid=rs("id")
rs.close
set rs=nothing
End If

function NoList()
  if request("UpdateOrder")="Select Update" then
    Session("NoList")=""
  end if
  dim ProductNo,NoArray,i
  if trim(request("ProductNo"))<>"" then ProductNo=trim(request("ProductNo"))&","
  if session("NoList")="" and trim(request("ProductNo"))="" then
    NoList=""
    exit function
  end if
  if instr(ProductNo,",")>0 then
  	NoArray=split(ProductNo, ",")
  	for i = 0 to ubound(NoArray)
      if not instr(session("NoList"),NoArray(i)&",")>0 then session("NoList")=session("NoList")&NoArray(i)&","
  	next
  end if
  for i = 0 to ubound(split(session("NoList"), ","))
    NoList=NoList&"'"&trim(split(session("NoList"),",")(i))&"',"
  next
  NoList=left(NoList,len(NoList)-4)
end Function


buylist = Session("NoList")
if buylist="" then
response.redirect "index.asp"
response.end
end if
total=Formatnumber(total,2,-1,-1,0)%>
<table border="0" cellspacing="1" cellpadding="0" align="center" valign="absmiddle" bgcolor="#E4EFFA" width="760">
<tr><td align="center" valign="middle" height=60><br><br><font color="#FF3333">Congratulations, you successfully generate orders, please note that your order information! <br></td></tr>
</table>

<%End if'立即支付与过后支付选择结束
dim alipay_id,chinaid,chinakey,chinaback,china_dz,china_kg,yeepayid,yeepaykey,yeepay_dz,yeepay_kg,pay,alipay_securityCode,aliorder,alipay_name,alipay_dz,alipay_kg,tenpay_id,tenpay_key,tenpay_name,tenpay_dz,tenpay_kg
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from TianTianCMS_pay",conn,1,1   
pay= rs("pay")
chinaid=rs("chinaid")
chinakey=rs("chinakey")
chinaback=rs("chinaback")
china_dz=rs("china_dz")
china_kg=rs("china_kg")
alipay_id=rs("alipay_id")
alipay_securityCode=rs("alipay_securityCode")
partner=rs("partner")
alipay_dz=rs("alipay_dz")
alipay_kg=rs("alipay_kg")
yeepayid=rs("yeepayid")
yeepaykey=rs("yeepaykey")
yeepay_dz=rs("yeepay_dz")
yeepay_kg=rs("yeepay_kg")
tenpay_id=rs("tenpay_id")
tenpay_key=rs("tenpay_key")
tenpay_name=rs("tenpay_name")
tenpay_dz=rs("tenpay_dz")
tenpay_kg=rs("tenpay_kg")    
rs.close
set rs=Nothing
%>


<table border="0" cellspacing="1" cellpadding="0" align="center" valign="absmiddle" bgcolor="#E4EFFA" width="760">
<tr><td align="center" valign="middle" height=60><br><br><font color="#FF3333">Order No:<b><%=ddhm%></b>&nbsp;&nbsp;&nbsp;&nbsp;Payments：<b>￥<%=total%></b></font></td></tr>
<tr><td align="center" valign="middle"  height=60>Please select your payment, and pay attention to the following matters needing attention</td></tr>
</table>
<%'在线支付开始
dim inBillNo,total
inBillNo=ddhm '订单号
total=total '支付金额
If trim(request.form("paymentType"))="cz" Then
hkuse="members"&trim(request.form("username"))&"top-up"
else
hkuse="Product order"
End if
%>
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle  bgcolor="#E4EFFA" width="760">
<tr><td  width=50% height=120>
<br>
<%If trim(request.form("paymentType"))<>"cz" Then'=====从钱包支付开始%>                            
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=760>
<tr><td  width=20% height=80>
<form action="paywallet.asp" method="post" name="formAlipay" id="formAlipay">
<input type="hidden" name="username" value="<%=session("MemName")%>" />
<input type="hidden" name="ddhm" value="<%=ddhm%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input name="Submit" type="submit" value="Payment from my wallet" />
</form>
</td></tr>
</table>
<%End If
if alipay_kg=1 then'=====支付宝支付开始%>                            
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=760>
<tr><td  width=20% height=80>
<%If alipay_dz=1 then%>
<form action="../alipay/db/index.asp" method="post" name="formAlipay" id="formAlipay" target=new>
<input type="hidden" name="ddhm" value="<%=ddhm%>" />
<input type="hidden" name="hkuse" value="<%=hkuse%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input type="hidden" name="mainname" value="<%=SiteTitle%>" />
<input type="hidden" name="RealName" value="<%=mRealName%>" />
<input type="hidden" name="OrderName" value="<%=mOrderName%>" />
<input type="hidden" name="Address" value="<%=mAddress%>" />
<input type="hidden" name="ZipCodee" value="<%=mZipCode%>" />
<input type="hidden" name="Telephone" value="<%=mTelephone%>" />
<input type="hidden" name="Mobile" value="<%=mMobile%>" />
<input name="Submit" type="submit" value="Pay treasure to pay--Guarantee transaction Collect money" />
</form>
<%elseIf alipay_dz=2 then%>
<form action="../alipay/sj/index.asp" method="post" name="formAlipay" id="formAlipay" target=new>
<input type="hidden" name="ddhm" value="<%=ddhm%>" />
<input type="hidden" name="hkuse" value="<%=hkuse%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input type="hidden" name="mainname" value="<%=SiteTitle%>" />
<input type="hidden" name="RealName" value="<%=mRealName%>" />
<input type="hidden" name="OrderName" value="<%=mOrderName%>" />
<input type="hidden" name="Address" value="<%=mAddress%>" />
<input type="hidden" name="ZipCodee" value="<%=mZipCode%>" />
<input type="hidden" name="Telephone" value="<%=mTelephone%>" />
<input type="hidden" name="Mobile" value="<%=mMobile%>" />
<input name="Submit" type="submit" value="Pay treasure to pay--The double function of Collect money" />
</form>
<%else%>
<form action="../alipay/js/index.asp" method="post" name="formAlipay" id="formAlipay" target=new>
<input type="hidden" name="ddhm" value="<%=ddhm%>" />
<input type="hidden" name="hkuse" value="<%=hkuse%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input type="hidden" name="mainname" value="<%=SiteTitle%>" />
<input type="hidden" name="RealName" value="<%=mRealName%>" />
<input type="hidden" name="OrderName" value="<%=mOrderName%>" />
<input type="hidden" name="Address" value="<%=mAddress%>" />
<input type="hidden" name="ZipCodee" value="<%=mZipCode%>" />
<input type="hidden" name="Telephone" value="<%=mTelephone%>" />
<input type="hidden" name="Mobile" value="<%=mMobile%>" />
<input name="Submit" type="submit" value="Pay treasure to pay--Instant to account Collect money" />
</form>
<%End if%>
</td></tr>
</table>
<%End If

if tenpay_kg=1 then'财付通在线支付%>
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=760>
<tr><td  width=20% height=80>
<%If tenpay_dz=0 then%>
<form action="../tenpay/b2c/index.asp" method="post" name="formTenpay" id="formTenpay" target=new>
<input type="hidden" name="order_no" value="<%=ddhm%>" />
<input type="hidden" name="hkuse" value="<%=hkuse%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input type="hidden" name="mainname" value="<%=SiteTitle%>" />
<input name="Submit" type="submit" value="Payment TenPay--Immediately arrive" />
</form>
<%else%>
<form action="../tenpay/med/index.asp" method="post" name="formTenpay" id="formTenpay" target=new>
<input type="hidden" name="order_no" value="<%=ddhm%>" />
<input type="hidden" name="hkuse" value="<%=hkuse%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input type="hidden" name="mainname" value="<%=SiteTitle%>" />
<input name="Submit" type="submit" value="Payment TenPay--Secured Transactions" />
</form>
<%End if%>
</td></tr>
</table>
<%End If
if china_kg=1 then'网银在线支付
dim v_rcvtel,v_rcvmobile,v_orderemail,v_rcvname,v_rcvaddr,v_rcvpost,v_oid,v_amount,remark1
v_rcvtel=dianhua'电话
v_rcvmobile=CompPhone'手机
v_orderemail = email '信箱
v_rcvname =  aliname'收货人
v_rcvaddr =  RecAddress'地址
v_rcvpost = Zipcode'邮编
v_oid=inBillNo'订单号.
v_amount=replace(total,",","")'付款金额
remark1=webname&inBillNo&"Order No"'备注一
%>
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=760>
<tr><td  width=20% height=80>
<FORM name=formbill action="../chinabank/Send.asp" method=post target=new>
<input type="submit" name="v_action" value="Internet Banking Online--Immediately arrive">
<input type="hidden" name="v_oid" value="<%=v_oid%>">
<input type="hidden" name="v_amount" value="<%=v_amount%>">
<input type="hidden" name="v_rcvtel" value="<%=v_rcvtel%>">
<input type="hidden" name="v_rcvmobile" value="<%=v_rcvmobile%>">
<input type="hidden" name="v_rcvname" value="<%=v_rcvname%>">
<input type="hidden" name="v_rcvaddr" value="<%=v_rcvaddr%>">
<input type="hidden" name="v_rcvpost" value="<%=v_rcvpost%>">
<input type="hidden" name="v_orderemail"  value="<%=v_orderemail%>">
<input type="hidden" name="remark1"  value="<%=remark1%>">
<input type="hidden" name="mainname"  value="<%=SiteTitle%>">
</form>
</td></tr>
</table>
<%End if

If yeepay_kg=1 then'易宝支付%>
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=760>
<tr><td width=20% height=120>
<form action="../yeepay/pay.asp" method="post" name="formYeepay" id="formYeepay" target=new>
<input type="hidden" name="ddhm" value="<%=ddhm%>" />
<input type="hidden" name="hkuse" value="<%=hkuse%>" />
<input type="hidden" name="alimoney" value="<%=total%>" />
<input type="hidden" name="mainname" value="<%=SiteTitle%>" />
<input name="Submit" type="submit" value="YeePay--Immediately arrive" />
</form>
</table>
</td></tr>
</table>
<%End if%>

<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=760>
<tr>If there is no online payment, select the traditional remittance:<br>(Note: After the remittance,The member ID, order number,to the bank,Remittance time and Information such as the remittance amount,Notify the merchant enter an item in an account.)<td  width=50%  height=150>
<center>
<%Dim er,bankN
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from TianTianCMS_pay ",conn,1,3
er=0
if rs("bank1")="" or isnull(rs("bank1")) then er=er+1
if rs("bank2")="" or isnull(rs("bank2")) then er=er+1
if rs("bank3")="" or isnull(rs("bank3")) then er=er+1
if rs("bank4")="" or isnull(rs("bank4")) then er=er+1
if rs("bank5")="" or isnull(rs("bank5")) then er=er+1
if rs("bank6")="" or isnull(rs("bank6")) then er=er+1
if rs("bank7")="" or isnull(rs("bank7")) then er=er+1
if rs("bank8")="" or isnull(rs("bank8")) then er=er+1
if rs("bank9")="" or isnull(rs("bank9")) then er=er+1
if rs("bank10")="" or isnull(rs("bank10")) then er=er+1
if rs("bank11")="" or isnull(rs("bank11")) then er=er+1
if rs("bank12")="" or isnull(rs("bank12")) then er=er+1
if rs("bank13")="" or isnull(rs("bank13")) then er=er+1
if rs("bank14")="" or isnull(rs("bank14")) then er=er+1
if rs("bank15")="" or isnull(rs("bank15")) then er=er+1


  if er=15 then '如果er=15，则表明没有全部银行帐号信息为空
response.write "Not add bank account information"
response.end
  end if

'显示银行帐号信息
response.write "<table border='1'  style='border-collapse: collapse; border-style: dotted; border-width: 0px'   bgcolor='#E4EFFA' width='100%' bordercolor='#333333' cellspacing='0' cellpadding='2'>"
for N=1 to 15
bankN="bank"&N
if rs(bankN)="" or isnull(rs(bankN)) then
else
response.write "<tr><td width=20% valign='middle' align='center'><img border=0 src='../IMAGES/bank/"&bankN&".gif'></td><td  valign='middle'>"&rs(bankN)&"</td></tr>"
end if
next
response.write "</table>"
Call CloseRs(rs)
Call CloseDB(conn)%>
