<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!--#include file="../include/config.inc"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_buy.asp
'* 最后更新 2012-01-09 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",1.4,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_buy.inc"
CurrentId = 2
CurrentUrl = "admin_buy.asp"
LB_Head()
LB_Menu()
Response.Write("<div class=""mainbody"">")
Response.Write("<div class=""mainbody2"">")
If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
        adminflag()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
        Select Case Request("action")
  	           Case "view" : view()
	           Case "del" : del()
			   Case "update" : update()
	           Case Else
		            list()
        End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

sub del()
        If OnlyRead = 1 Then OnlyReadMessage()
        id=safereplace(request("id"))
        if id="" then
                response.write"<SCRIPT language=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
                response.End
        end if
        conn.execute "delete from [Lebi_pay_log] where l_id in ("&id&")"
		ManageLog Lang_Buy(1) & id
        m_t=Lang_sys(43)
        m_s="·"& Lang_sys(42)
        m_u="?page="& request("page") &"&pagenum="& request("pagenum") &"&l_type="& request("l_type") &"&state="& request("state") &"&keyword="& request("keyword") &"&DateFrom="& request("DateFrom") &"&DateTo="& request("DateTo")
	    m_time="2"
        Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end Sub

sub update()
        If OnlyRead = 1 Then OnlyReadMessage()
        id = CheckNum(request("id"),0)
		pro_id = CheckNum(request("pro_id"),0)
		upstock = CheckNum(request("upstock"),0)
		l_virify = CheckNum(request("l_virify"),0)
        conn.execute "update [Lebi_pay_log] set l_virify ="& l_virify &" where l_id = "&id&""
		If upstock = 1 Then
                conn.execute("update [Lebi_product] set kucun = kucun -1 where id = "& pro_id &"")
		End If
		ManageLog Lang_Buy(2) & id
        m_t=Lang_sys(69)
        m_s="·"& Lang_sys(68)
		If upstock = 1 Then m_s=m_s&"<br>·"& Lang_Buy(3) &""
        m_u="admin_buy.asp?l_type="& request("l_type") &"&pagenum="& request("pagenum") &"&page="& request("page")
	    m_time="2"
        Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end Sub

Function GetPayName(paytype)
         Select Case paytype
		        Case "1" GetPayName = Lang_Buy(4)
				Case "2" GetPayName = Lang_Buy(5)
				Case "3" GetPayName = Lang_Buy(6)
				Case "4" GetPayName = Lang_Buy(7)
				Case "5" GetPayName = Lang_Buy(8)
				Case "6" GetPayName = Lang_Buy(9)
				Case "7" GetPayName = Lang_Buy(10)
				Case "8" GetPayName = Lang_Buy(44)
         End Select
End Function

sub list
		l_type = CheckNum(request("l_type"),0)
		page = CheckNum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),15)
		datefrom = safeReplace(request("datefrom"))
		dateto = safeReplace(request("dateto"))
		state = safeReplace(request("state"))
		keyword = safeReplace(request("keyword"))
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=pagenum
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=-1
		.Pkey="l_id"
		.Field="l_id,l_time,l_ordernum,l_userid,l_price,l_type,l_mes,l_state,l_virify"
		.Table="[Lebi_pay_log]"
		sql = "1=1"
		If l_type <> 0 Then sql = sql &" and l_type ="& l_type &""
		If state <> "" Then sql = sql &" and l_virify = "& state &""
		if keyword<>"" then sql=sql&" and (l_username like '%"&keyword&"%' or l_ordernum like '%"&keyword&"%' or l_userid like '%"&keyword&"%' or l_mes like '%"&keyword&"%')"
		If IsSqlDataBase = 1 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff(d,l_time,'"& datefrom &"')<=0 and DateDiff(d,l_time,'"& dateto &"')>=0"
		If IsSqlDataBase = 0 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff('d',l_time,'"& datefrom &"')<=0 and DateDiff('d',l_time,'"& dateto &"')>=0"
		.Condition=sql
		.OrderBy="l_id desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script language="javascript" src="inc/js/MyCalendar.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<form name="form" action="?" method="get">
<tr>
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="l_type">
<option value="0">┌ <%=Lang_Buy(11)%></option>
<option value="1"<%=judge2(1,l_type)%>>├ <%=Lang_Buy(4)%></option>
<option value="2"<%=judge2(2,l_type)%>>├ <%=Lang_Buy(5)%></option>
<option value="3"<%=judge2(3,l_type)%>>├ <%=Lang_Buy(6)%></option>
<option value="4"<%=judge2(4,l_type)%>>├ <%=Lang_Buy(7)%></option>
<option value="5"<%=judge2(5,l_type)%>>├ <%=Lang_Buy(8)%></option>
<option value="6"<%=judge2(6,l_type)%>>├ <%=Lang_Buy(9)%></option>
<option value="7"<%=judge2(7,l_type)%>>├ <%=Lang_Buy(10)%></option>
<option value="7"<%=judge2(8,l_type)%>>├ <%=Lang_Buy(44)%></option>
</select>
<select name="state"><option value="">┌ <%=Lang_Buy(12)%></option><option value="0"<%=judge2(0,state)%>>├ <%=Lang_Buy(13)%></option><option value="1"<%=judge2(1,state)%>>├ <%=Lang_Buy(14)%></option><option value="2"<%=judge2(2,state)%>>├ <%=Lang_Buy(15)%></option></select>
</td>
<td style="padding-left:5px;"><input type="text" name="dateFrom" value="<%=dateFrom%>" size="12" class="form_calendar" onclick="setday(this)" /> - <input type="text" name="dateTo" value="<%=dateTo%>" size="12" class="form_calendar" onclick="setday(this)" />
</td>
<td style="padding-left:5px;"><input name="keyword" id="keyword" type="text" value="<%=keyword%>" class="form_query" size="15" autocomplete="off" onkeyup="search_suggest('keyword','Lebi_pay_log','')"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="pagenum" value="<%= pagenum %>"><br /><div id="search_suggest_keyword" class="search_suggest" style="display:none"></div>
</td>
</tr>
</table>
</td>
<td class="classhead" align="right">
<%=QuickMenu("Admin_order_quick.asp|"& Lang_Menu(87) &"","Admin_sh.asp|"& Lang_Menu(99) &"")%>
</td>
</tr>
</form>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable2">
<tbody>
<form name="form" action="?" method="post">
<tr>
<td height="30" align="left" colspan="2" class="classhead">
<input type="image" name="Submit" title=" <%=Lang_sys(15)%> " onClick="return confirm('<%=Lang_sys(64)%>')" src="lang/<%=LangFilePath%>/images/bt_delete.gif" align="absmiddle">
<input type="hidden" name="page" value="<%=page%>">
<input type="hidden" name="state" value="<%=state%>">
<input type="hidden" name="l_type" value="<%=l_type%>">
<input type="hidden" name="keyword" value="<%=keyword%>">
<input type="hidden" name="dateFrom" value="<%=dateFrom%>">
<input type="hidden" name="dateTo" value="<%=dateTo%>">
<input type="hidden" name="pagenum" value="<%= pagenum %>">
<input type="hidden" name="action" value="del">
</td>
<td height="30" class="classhead" align="right" colspan="8"><%=ors.ShowPageHead(page)%></td>
</tr>
<tr>
<td width="5%" height="30" class="classtop" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
<td width="10%" class="classtop"><%=Lang_Buy(16)%></td>
<td width="15%" class="classtop"><%=Lang_Buy(17)%></td>
<td width="10%" class="classtop"><%=Lang_Buy(18)%></td>
<td width="10%" class="classtop"><%=Lang_Buy(19)%></td>
<td width="15%" class="classtop"><%=Lang_Buy(20)%></td>
<td width="15%" class="classtop"><%=Lang_Buy(21)%></td>
<td width="5%" class="classtop"><%=Lang_Buy(12)%></td>
<td width="5%" class="classtop"><%=Lang_Buy(22)%></td>
<td width="5%" class="classtop"><%=Lang_Buy(23)%></td>
</tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
<tr height="30" class="classrow">
<td class="classrow"><input name="id" type="checkbox" value="<%=DataList(0,i)%>"></td>
<td class="classrow"><%=FormatDateTime(DataList(1,i),2)%></td>
<td class="classrow"><a href="?action=view&id=<%=DataList(0,i)%>&l_type=<%=l_type%>&page=<%=page%>" title="<%=DataList(6,i)%>"><%=DataList(2,i)%></a></td>
<td class="classrow"><%=DataList(3,i)%>&nbsp;</td>
<td class="classrow"><%=formatnumber2(DataList(4,i))%></td>
<td class="classrow"><%=GetPayName(DataList(5,i))%>&nbsp;</td>
<td class="classrow"><%=DataList(6,i)%></td>
<td class="classrow"><%If DataList(7,i)=1 Then response.write"<font color=red>√</font>" Else response.write"×" End If %></td>
<td class="classrow"><%If DataList(8,i)=1 Then
response.write"<span style=""color:red;"" title="""& Lang_Buy(14) &""">√</span>"
ElseIf DataList(8,i)=0 Then
response.write"<span title="""& Lang_Buy(13) &""">×</span>"
ElseIf DataList(8,i)=2 Then
response.write"<span style=""color:red;"" title="""& Lang_Buy(15) &""">×</span>"
End If%></td>
<td class="classrow"><a href="?action=view&id=<%=DataList(0,i)%>&l_type=<%=l_type%>&page=<%=page%>"><img src="images/icon_edit.gif" width="16" height="16" title="<%=Lang_sys(51)%>" border="0"></a></td>
</tr>
<%
        Next
End If
%>
</form>
<tr>
	<td height="30" class="classfooter" colspan="2"><%=GetPageNum(15,pagenum)%></td>
	<td height="30" class="classfooter" align="right" colspan="8"><%=ors.ShowPageFoot(page)%></td>
</tr>
</tbody>
</table>
<script>tdshow("classtable");</script>
<%
end sub

sub view
id = CheckNum(request("id"),0)
set rs=conn.execute("select * from [Lebi_pay_log] where l_id="& id &"")
%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
		  <form name="form" method="post" action="?action=update">
		<tr>
			<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_print.gif" border="0" title=" <%=Lang_sys(24)%> " onclick="location.href='javascript:window.print()';return false;" align="absmiddle"></td>
			<td class="classhead" align="right">
			<%=QuickMenu("","")%>
			</td>
		 </tr>
		   <tr>
			  <td height="30" class="classtop" colspan="2"><%=Lang_Buy(24)%></td>
		   </tr>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(25)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_time")%></TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(26)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_ordernum")%></TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(27)%></TD>
			<TD width="85%" class="classrow"><%=formatnumber2(rs("l_price"))%></TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(29)%></TD>
			<TD width="85%" class="classrow"><%=GetPayName(rs("l_type"))%>&nbsp;</TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(30)%></TD>
			<TD width="85%" class="classrow"><%If rs("l_state") = 1 Then response.write("<font color=red>"& Lang_Buy(35) &"</font>") Else response.write(Lang_Buy(36)) End If%></TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(31)%></TD>
			<TD width="85%" class="classrow"><select name="l_virify"><option value="0"><%=Lang_Buy(13)%></option><option value="1"<%If rs("l_virify") = 1 Then response.write(" selected") End If%>><%=Lang_Buy(14)%></option><option value="2"<%If rs("l_virify") = 2 Then response.write(" selected") End If%>><%=Lang_Buy(15)%></option></select> <%If rs("l_pro_id") <> 0 Then response.write("<input type=""checkbox"" name=""upstock"" value=""1""> "& Lang_Buy(33) &" <img src=""images/help.gif"" align=""absmiddle"" title="""& Lang_Buy(32) &""">") End If%></TD>
		  </TR>
		  <%If rs("l_pro_id") <> 0 Then
			Set getpro = conn.execute("select product_name from [Lebi_product] where id = "& rs("l_pro_id") &"")
			If Not getpro.eof Then
					product_name = getpro(0)
			Else
					product_name = "<font color=red>"& Lang_Buy(37) &"</font>"
			End If
			getpro.close : Set getpro = Nothing
			%>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(28)%></TD>
			<TD width="85%" class="classrow"><a href="<%If Config_Lebi_Eshop(16) = 0 Then
response.write("../showproduct.asp")
Else
response.write("../product/")
End If
%>?id=<%=rs("l_pro_id")%>" target="_blank"><%=product_name%></a></TD>
		  </TR>
		  <%End If%>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(34)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_mes")%></TD>
		  </TR>
		   <tr>
			  <td height="30" class="classtop" colspan="2"><%=Lang_Buy(38)%></td>
		   </tr>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(39)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_username")%>&nbsp;</TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(40)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_userid")%>&nbsp;</TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(41)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_usertel")%>&nbsp;</TD>
		  </TR>
		  <TR class="classrow">
			<TD width="15%"" height="30" class="classrow"><%=Lang_Buy(42)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_useradds")%>&nbsp;</TD>
		  </TR>
			<TR class="classrow">
			<TD width="15%" height="30" class="classrow"><%=Lang_Buy(43)%></TD>
			<TD width="85%" class="classrow"><%=rs("l_userzip")%>&nbsp;</TD>
		  </TR>
		   <tr>
			   <td height="30" class="classfooter" colspan="2">
				   <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" border="0" title=" <%=Lang_sys(3)%> " onclick="location.href='javascript:history.back()';return false;" align="absmiddle">
				   <input type="hidden" name="id" value="<%=id%>"><input type="hidden" name="pro_id" value="<%=rs("l_pro_id")%>"><input type="hidden" name="page" value="<%=request("page")%>"><input type="hidden" name="l_type" value="<%=request("l_type")%>">
			   </td>
		   </tr>
		   </form>
		</table>
		<script>tdshow("classtable");</script>
<%
rs.close : set rs=nothing
end sub%>