<!--#include file="conn.asp"-->
<%
page_title=Eval("case_title"&Language)
page_keywords=Eval("case_keywords"&Language)
page_description=Eval("case_description"&Language)
if page_title="" then
page_title=city_title
page_keywords=city_keywords
page_description=city_description
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=page_title%></title>
<meta name="keywords" content="<%=page_keywords%>" />
<meta name="description" content="<%=page_description%>" />
<!--#include file="top.asp"-->
<!--#include file="header.asp"-->
<%
if session("user_xxx_name")="" then
response.Redirect("login.asp")
end if
%>
<link href="<%=filepath%>inc/mycenter.css" type="text/css" rel="stylesheet">
<link href="<%=filepath%>inc/style.css" type="text/css" rel="stylesheet">
<link href="<%=filepath%>inc/user.css" type="text/css" rel="stylesheet">

    <div id="wrap">
        <!--container-->
        <div class="main">
            
<!--sidebar-->
<!--#include file="Mb_left.asp"-->

<script type="text/javascript">
                try
                {
                    document.getElementById("User_MyCoupons").className = "current"; //控制CSS
                }
                catch(e){}
</script>

<!--sidebar end-->

<!--main-->

<div class="mainBox">
				<div class="mainContent">
					<div class="mycontent">
						<div class="mycontent_10">
							<span>我的优惠券</span>
						</div>
						
					</div>
<table cellspacing="0" cellpadding="0" align="center" border="1"
					class="listtable margin_bottom10">
					<thead>
						<tr>
							<th>优惠码</th>
							<th>优惠券名称</th>
							<th>金额</th>
							<th>生效时间</th>
							<th>过期时间</th>
							<th>优惠券状态</th>
						</tr>
					</thead>

					<tbody>
					<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_coupon where username='"&session("user_xxx_name")&"' and sh=1 order by date desc",conn,1,1

dim MaPerPage
MaPerPage=12
dim text,checkpage
text="0123456789"
Rs.PageSize=MaPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1 
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
i=0
if rs.eof or rs.bof then
%>
<tr>
							<td style="color: red" colspan="6">暂没有优惠劵数据</td>
						</tr>
<%
else
do while not rs.eof
%>
 <tr>
                            <td style="word-break:break-all;word-wrap:break-word;"><strong><%=rs("CodeNumber")%></strong></td>
                            <td><%=rs("CodeName")%></td>
                            <td><%=rs("amount")%></td>
                            <td><%=rs("date")%></td>
							<td><%=rs("enddate")%></td>
							<td>
<%if rs("date")>date() then%>
<span style="color:red">已过期</span>
<%elseif rs("enddate")<date() then%>
<span style="color:red">已过期</span>
<%elseif rs("used")=1 then%>
<span style="color:#a6a6a6">已使用</span>
<%else%>
<span style="color:green">未使用</span>
<%end if%></td>
                        </tr>
<%
i=i+1 
if i >= MaPerpage then exit do 
rs.movenext 
loop 
end if
%>
						
					</tbody>
				</table>
				
				
            <!--内容-->


            <p></p>

            <div id="wqPager" class="pager" style="white-space: nowrap;">
								<div class="pager_left" align="right" style="width:;">
<%
Response.write "每页" & MaPerpage & "条，&nbsp;"
Response.write "共" & Cstr(Rs.RecordCount) & "条&nbsp;"
%>
								</div>
								<div>
<%
If currentpage > 1 Then
response.write "<a href='MyCoupons.asp?page="+cstr(1)+"#product' style='margin-right: 5px;'>第一页</a>"
Response.write "<a href='MyCoupons.asp?page="+Cstr(currentpage-1)+"#product' style='margin-right: 5px;'>上一页</a>"
Else
Response.write "<a disabled='disabled' style='margin-right: 5px;'>上一页</a>"
End if
If currentpage < Rs.PageCount Then
Response.write "<a href='MyCoupons.asp?page="+Cstr(currentPage+1)+"#product' style='margin-right: 5px;'>下一页</a>"
Response.write "<a href='MyCoupons.asp?page="+Cstr(Rs.PageCount)+"#product' style='margin-right: 5px;'>最后一页</a>"
Else
Response.write ""
Response.write "<a disabled='disabled' style='margin-right: 5px;'>下一页</a>"
End if
%>
&nbsp;&nbsp;						
<%
Response.write "转到:"
response.write"<select name='sel_page' onChange='javascript:location=this.options[this.selectedIndex].value;'>"
    for i = 1 to Rs.PageCount
       if i = currentpage then 
          response.write"<option value='MyCoupons.asp?page="&i&"' selected>"&i&"</option>"
       else

          response.write"<option value='MyCoupons.asp?page="&i&"'>"&i&"</option>"
       end if
    next
response.write"</select>"
%>
								</div>
							</div>

<%
rs.close
set rs=nothing
%>
            <!--内容end-->
 
					</div>
				</div>
			</div>
			<!--main end-->
        </div>
        <!--container end-->
        <div class="clr">
        </div>
        

  
<!--#include file="foot.asp"--> 