<!--#include file="../include/Conn.jsp"-->
<!--#include file="../Include/Char.jsp" -->
<!--#include file="Admin_IsLogin.jsp" -->
<%
'Define Variable 
dim i
dim rs
dim mGrade,m_SQL,mFlag,mBgColor
'initialization 
mFlag=true'add

'Display
if request("action")="edit" then 
 m_SQL="Select * From Tour_HotalOrder Where F_ID="&Request.QueryString("ModifyID")
 Set rs = conn.Execute(m_SQL)
 if Not rs.Eof then
   m_TravelLineID = Trim(rs("F_TravelLineID"))
   m_BeginYear = Trim(rs("F_BeginYear"))
   m_BeginMonth = Trim(rs("F_BeginMonth"))
   m_BeginDay = Trim(rs("F_BeginDay"))
   m_EndYear = Trim(rs("F_EndYear"))
   m_EndMonth = Trim(rs("F_EndMonth"))
   m_EndDay = Trim(rs("F_EndDay"))
   m_Linkman = Trim(rs("F_Linkman"))
   m_PersonNumber = Trim(rs("F_PersonNumber"))
   m_CityNumber = Trim(rs("F_CityNumber"))
   m_Tel = Trim(rs("F_Tel"))
   m_Price = Trim(rs("F_Price"))
   m_Email = Trim(rs("F_Email"))
   m_Address = Trim(rs("F_Address"))
   m_Memo = Trim(rs("F_Memo"))
  End if
  mFlag=false
  rs.Close
end if

if Request.ServerVariables("REQUEST_METHOD")="POST" then
   m_TravelLineID = Request.form("selTravelLineID")
   m_BeginYear = checkStr(Trim(Request.Form("selBeginYear")))
   m_BeginMonth = checkStr(Trim(Request.Form("selBeginMonth")))
   m_BeginDay = checkStr(Trim(Request.Form("selBeginDay")))
   m_EndYear = checkStr(Trim(Request.Form("selEndYear")))
   m_EndMonth = checkStr(Trim(Request.Form("selEndMonth")))
   m_EndDay = checkStr(Trim(Request.Form("selEndDay")))
   m_Linkman = checkStr(Trim(Request.Form("txtLinkman")))
   m_PersonNumber = checkStr(Trim(Request.Form("txtPersonNumber")))
   m_CityNumber = checkStr(Trim(Request.Form("txtCityNumber")))
   m_Tel = checkStr(Trim(Request.Form("txtTel")))
   m_Price = checkStr(Trim(Request.Form("txtPrice")))
   m_Email = checkStr(Trim(Request.Form("txtEmail")))
   m_Address = checkStr(Trim(Request.Form("txtAddress")))
   m_Memo = checkStr(rTrim(Request.Form("txtMemo")))
 if Request.Querystring("action")="Insert" then
      m_SQL = "Insert Into Tour_HotalOrder(F_TravelLineID,F_BeginYear,F_BeginMonth,F_BeginDay,F_EndYear,F_EndMonth,F_EndDay,F_PersonNumber,F_Price,F_Linkman,F_Email,F_CityNumber,F_Tel,F_Address,F_Memo)Values"
      m_SQL = m_SQL + "("&m_TravelLineID&",'"&m_BeginYear&"','"&m_BeginMonth&"','"&m_BeginDay&"','"&m_EndYear&"','"&m_EndMonth&"','"&m_EndDay&"',"&m_PersonNumber&","&m_Price&",'"&m_Linkman&"','"&m_Email&"','"&m_CityNumber&"','"&m_Tel&"','"&m_Address&"','"&m_Memo&"')"
	  conn.Execute(m_Sql)
      response.redirect "Admin_AgioOnlineBuyCard2.jsp?action=IsInsert&pageno="&Request("pageno")
  else 
      m_SQL = "UPDATE Tour_HotalOrder SET"
      m_SQL = m_SQL+" F_TravelLineID="&m_TravelLineID&","
      m_SQL = m_SQL+" F_BeginYear='"&m_BeginYear&"',"
      m_SQL = m_SQL+" F_BeginMonth='"&m_BeginMonth&"',"
      m_SQL = m_SQL+" F_BeginDay='"&m_BeginDay&"',"
      m_SQL = m_SQL+" F_EndYear='"&m_EndYear&"',"
      m_SQL = m_SQL+" F_EndMonth='"&m_EndMonth&"',"
      m_SQL = m_SQL+" F_EndDay='"&m_EndDay&"',"
      m_SQL = m_SQL+" F_PersonNumber="&m_PersonNumber&","
      m_SQL = m_SQL+" F_Price="&m_Price&","
      m_SQL = m_SQL+" F_Linkman='"&m_Linkman&"',"
      m_SQL = m_SQL+" F_Email='"&m_Email&"',"
      m_SQL = m_SQL+" F_CityNumber='"&m_CityNumber&"',"
      m_SQL = m_SQL+" F_Tel='"&m_Tel&"',"
      m_SQL = m_SQL+" F_Address='"&m_Address&"',"
      m_SQL = m_SQL+" F_Memo='"&m_Memo&"'"
      m_SQL = m_SQL +" WHERE F_ID=" & Request("ModifyID") 
      conn.Execute(m_SQL)
      Response.redirect "Admin_AgioOnlineBuyCard2.jsp?action=IsModify&pageno="&Request("pageno")
   End if
 End if

'Delect Records
if request("action")="Delete" then
  m_SQL = "DELETE FROM CityCard_Buy WHERE F_ID=" &Request.QueryString("DeleteID")
  conn.execute m_SQL
 
  Response.write "<script>location.replace('Admin_AgioOnlineBuyCard2.jsp?action=IsDelete&pageno="&Request.Querystring("pageno")&"')</script>"
end if
%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true) 
	self.location=url+'&action=Delete';
}
</SCRIPT>
</head>
<body text="#000000" >

	  <%
      admin_flag=",0|12|0,"
      if instr(session("flag"),admin_flag)=0 or isnull(session("flag"))=true then
         Response.write "<br><br><br><br><b><font color=red>对不起，您没有管理本页面的权限!</font></B>"
		 Response.end
	  end if
      %>
<br>
<table class=tableBorder width="95%" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>
    <td>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
        <tr> 
          <th height=22 colspan="12" align="center" sytle="line-height:150%">在线购卡订单</th>
        </tr>
        <tr > 
          <td width="4%" align="center" class=forumHeaderBackgroundAlternate><b>ID</b></td>
          <td width="8%" align="center" class=forumHeaderBackgroundAlternate><b>姓名</b></td>
          <td width="15%" align="center" class=forumHeaderBackgroundAlternate><b>单位</b></td>
          <td width="5%" align="center" class=forumHeaderBackgroundAlternate ><b>性别</b></td>
          <td width="5%" align="center" class=forumHeaderBackgroundAlternate><b>数量</b></td>
          <td align="center" class=forumHeaderBackgroundAlternate><b>地址</b></td>
          <td width="9%" align="center" class=forumHeaderBackgroundAlternate><b>电话</b></td>
          <td width="10%" align="center" class=forumHeaderBackgroundAlternate><b>手机</b></td>
          <td width="11%" align="center" class=forumHeaderBackgroundAlternate><b>预定时间</b></td>
          <td width="5%" align="center" class=forumHeaderBackgroundAlternate><b>打印</b></td>
          <td width="6%" align="center" class=forumHeaderBackgroundAlternate><b>管理</b></td>
        </tr>
        <%  
	Set rs=Server.createobject("Adodb.RecordSet")
    pageno=request.querystring("pageno")
    pmcount=16  
    m_SQL="select * from CityCard_Buy WHERE F_IsBuy = 1 order by F_ID desc"
	rs.open m_SQL,conn,1,1
	if rs.eof then
	  'response.write "<br><p  align='center'><font color=red><B> 对不起，数据已清空！</B></font></p>"
    else
    rs.pagesize=pmcount
    mpage=rs.pagecount
    if pageno="" then pageno=1
    if  cint(pageno)<1 or cint(pageno)>mpage then  pageno=1
    rs.absolutepage=pageno

 Dim rc,re
 rc=rs.pagesize
 re=1
 do while not rs.eof and rc>0
 mBgColor=Request.Querystring("BgColor")
 if Trim(rs("F_ID"))=Trim(mBgColor) then mColor= "D6DFFF" else mColor= "ffffff"
%>
        <tr bgcolor="<%=mColor%>"   onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#EBEEF6'" > 
          <td class=forumRowHighlight align="center"><%=rs("F_ID")%></td>
          <td align="center" class=forumRowHighlight >
		  <a href="Admin_MailSend.jsp?Email=<%= rs("F_Email")%>"> <%= rs("F_RealName")%></a> </td>
          <td width="12%" class=forumRowHighlight ><%=rs("F_CorpName")%></td>
          <td class=forumRowHighlight align="center" ><%=rs("F_Sex")%> </td>
          <td class=forumRowHighlight align="center" ><%=rs("F_BuyNumber")%></td>
          <td class=forumRowHighlight ><%=rs("F_HomeAddress")%></td>
          <td width="5%" align="center" class=forumRowHighlight ><%=rs("F_Tel")%></td>
          <td width="3%" align="center" class=forumRowHighlight ><%=rs("F_Mobile")%></td>
          <td width="3%" align="center" class=forumRowHighlight ><%=rs("F_Addtime")%></td>
          <td class=forumRowHighlight align="center" ><a href="Admin_BuyCard_Print.jsp?ID=<%=rs("F_ID")%>" target="_blank">打印</a></td>
          <td class=forumRowHighlight align="center" >
            <%
			'审核处理
			if Request("action") = "IsBuy" then
			  mIsBuy = Request("IsBuy")
			  if mIsBuy then mIsBuy = 0 else mIsBuy = 1 
			  mSql = "update CityCard_Buy Set F_IsBuy= "&mIsBuy&" Where F_ID="&Request("ID")
              conn.execute(mSql)
			  Response.redirect "Admin_AgioOnlineBuyCard2.jsp?pageno="&Request("pageno")
			end if
			m_IsBuy = rs("F_IsBuy") : if isnull(m_IsBuy) then m_IsBuy=False
			Response.Write "<a href='Admin_AgioOnlineBuyCard2.jsp?action=IsBuy&IsBuy="&m_IsBuy&"&pageno="&Request("pageno")&"&ID="&rs("F_ID")&"'>"
			if rs("F_IsBuy") then Response.Write "<font color=red>恢复</font>" Else Response.write "删除"
			Response.Write "</a>"
			%>
          </td>
        </tr>
        <%
 rs.movenext
 re=re+1
 rc=rc-1
 loop
 end if
%>
      </table>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="38%" height="22"> &nbsp;共 <font color=red><strong>
            <% = rs.recordcount%>
            </strong></font> 条记录 当前第 <font color=red><strong>
            <% = Trim(pageno)%>
            </strong></font>页/共 <font color=red><strong>
            <% = Trim(mpage)%>
            </strong></font>页 </td>
          <td width="62%" align="right"> 
            <%
if pageno="" then pageno=1
if pageno>1 then
   response.write "<a href='Admin_AgioOnlineBuyCard2.jsp'> <img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'>"
end if

if pageno>1 then
   response.write "<a href='Admin_AgioOnlineBuyCard2.jsp?pageno="&pageno-1&"'><img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'>"
end if

add=5'数字分页个数+1
if pageno-int(add/2)<=1 then m=1 else m=pageno-int(add/2)
if m+add>mpage then 
   n=mpage
   if mpage-add<=1 then m=1 else m=mpage-add
else
   n=m+add
end if

for pno=m to n
 if pno=cint(pageno) then
   response.write "&nbsp;<font color=red>"&pno&"</font>"
 else
   response.write "<b>&nbsp;<a href='Admin_AgioOnlineBuyCard2.jsp?pageno="&pno&"'>"&pno&"</a></b>"
 end if
next
response.write "&nbsp"

if int(pageno) < int(rs.pagecount) then
  response.write "<a href='Admin_AgioOnlineBuyCard2.jsp?pageno="&pageno+1&"'><img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'></a>"
else 
  response.write "<img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'>"
end if

if int(pageno) < int(rs.pagecount) then
   response.write "<a href='Admin_AgioOnlineBuyCard2.jsp?pageno="&mpage&"'><img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'>"
end if
Response.write "&nbsp;&nbsp;"
%>
          </td>
        </tr>
      </table>
        </td>
  </tr>
</table>
</body>
</html>
<%
 set rs=nothing
 CloseDatabase
%>
