<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!--#include file="../include/lebi_config.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 eshop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 admin_product_list_simple.asp
'* 最后更新 2013-12-01 by 56770.kingdge
'*****************************************
admin_flag=",2.2,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_product.inc"
CurrentId = 1
CurrentUrl = "admin_product_list.asp"
LB_Head()
LB_Menu()%>
<div class="tabmenu mainwidth">
      <ul>
        <li><a href="admin_product_list.asp"><span><%=Lang_Menu(53)%></span></a></li>
        <li><a href="Admin_product_list.asp?zhuangtai=0"><span><%=Lang_Menu(71)%></span></a></li>
		<li class="current"><a href="Admin_product_list_simple.asp"><span><%=Lang_Menu(68)%></span></a></li>
        <li><a href="Admin_product.asp"><span><%=Lang_Menu(52)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If OutSubmit = 1 Then CheckOutSubmit()
if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
	    adminflag()
else
	    select case request("action")
	    	   case "update_list" : update_list()
	    	   case else
	    		    productlist()
	    end select
end If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

sub update_list
        If OnlyRead = 1 Then OnlyReadMessage()
		on error resume next
		pro_id = safereplace(request("pro_id"))
		sprice = safereplace(request("pro_sprice"))
		cprice = safereplace(request("pro_cprice"))
		cx = safereplace(request("pro_cx"))
		buys = safereplace(request("pro_buys"))
		views = safereplace(request("pro_views"))
		zhuangtai = safereplace(request("pro_zhuangtai"))
		p_order = safereplace(request("p_order"))
		SpecificationCount = safereplace(request("SpecificationCount"))
		if pro_id="" then
				response.write"<script language=javascript>alert('"& Lang_sys(70) &"');javascript:history.go(-1)</script>"
				response.end
		end if
		arr_id = split(replace(pro_id," ",""),",")
		arr_sprice = split(replace(sprice," ",""),",")
		arr_cprice = split(replace(cprice," ",""),",")
		arr_cx = split(replace(cx," ",""),",")
		arr_buys = split(replace(buys," ",""),",")
		arr_views = split(replace(views," ",""),",")
		arr_zt = split(replace(zhuangtai," ",""),",")
		arr_p_order = split(replace(p_order," ",""),",")
		arr_SpecificationCount = split(replace(SpecificationCount," ",""),",")
		for i = 0 to ubound(arr_id)
				kucun = checknum(request("kucun"& CLng(arr_id(i))),0)
				If arr_SpecificationCount(i) > 0 Then kucun = checknum(request("total_kucun"& CLng(arr_id(i))),0)
				conn.execute("update [lebi_product] set sprice="&checknum(arr_sprice(i),0)&",cprice="&checknum(arr_cprice(i),0)&",cx="&checknum(arr_cx(i),0)&",kucun="&kucun&",buys="&checknum(arr_buys(i),0)&",views="&checknum(arr_views(i),0)&",zhuangtai="&checknum(arr_zt(i),0)&",p_order="&checknum(arr_p_order(i),0)&" where id="&CLng(arr_id(i))&"")
				for j=1 to UserGroupNumber
						conn.execute("update [lebi_product_price] set price="& checknum(split(replace(request("pro_price_"& j)," ",""),",")(i),0) &" where product_id = "&CLng(arr_id(i))&" and grade_id = "& j &"")
				Next
				If arr_SpecificationCount(i) > 0 Then 
				For s = 0 To arr_SpecificationCount(i)-1
						s_id = checknum(request("s_id_"& CLng(arr_id(i)) &"_"& s),0)
						p_no = safereplace(request("p_no_"& CLng(arr_id(i)) &"_"& s))
						p_stock = checknum(request("p_stock_"& CLng(arr_id(i)) &"_"& s),0)
						p_price = checknum(request("p_price_"& CLng(arr_id(i)) &"_"& s),0)
						p_cbprice = checknum(request("p_cbprice_"& CLng(arr_id(i)) &"_"& s),0)
						p_weight = checknum(request("p_weight_"& CLng(arr_id(i)) &"_"& s),0)
						sql = "select * from [Lebi_Product_Stock] where id = "& s_id
						set rs = server.CreateObject("adodb.recordset")
						rs.open sql, conn, 1, 3
						If Not rs.eof Then
						rs("p_no") = p_no
						rs("p_stock") = p_stock
						rs("p_price") = p_price
						rs("p_cbprice") = p_cbprice
						rs("p_weight") = p_weight
						rs.update 
						End If 
						rs.close : Set rs = Nothing
				Next 
				End If 
		Next
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		managelog Lang_Product(117) &" ["&pro_id&"]"
		m_u="?page=" & request("page")& "&sort_id=" & request("sort_id")& "&vtype=" & request("vtype")& "&keyword=" & server.urlencode(request("keyword")) &"&DateFrom="& request("DateFrom") &"&DateTo="& request("DateTo") &"&pagenum="& request("pagenum") &"&Lang="& request("lang")
		Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,m_u,0,0,2,1)
end sub

sub productlist
        Dim list_type
        list_type = CheckNum(request("list_type"),0)
        sort_id = CheckNum(request("sort_id"),0)
        vtype = request("vtype")
        page = CheckNum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),10)
		zhuangtai = safereplace(request("zhuangtai"))
		keyword = safereplace(request("keyword"))
		datefrom=safeReplace(request("datefrom"))
		dateto=safeReplace(request("dateto"))
		lang = safereplace(request("lang"))
		If lang = "" Then lang = LanguageTxt(0)
		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=0
		.Pkey="id"
		Field = "product_name"& lang &",id,sprice,cprice,cx,zhuangtai,kucun,buys,views,p_order,pic,P_SpecificationName"
		for j=1 to UserGroupNumber
				Field = Field &",(Select top 1 price from [Lebi_product_price] where product_id=p.id and grade_id="&j&") as buyprice_"&j&""
		Next
		.Field=Field
		.Table="[Lebi_product] as p"
		sql = "1=1"
		if zhuangtai<>"" then sql=sql + " and zhuangtai="&zhuangtai&""
		if keyword<>"" then sql=sql + " and (product_name"& lang &" like '%"&keyword&"%' or bianhao like '%"&keyword&"%')"
		If sort_id<>"0" And IsSqlDataBase = 1 Then sql=sql + " and charindex(',"&sort_id&",',categoryid)>0"
		If sort_id<>"0" And IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"&sort_id&",')>0"
		if vtype="6" then sql=sql + " and kucun=0"
		if vtype="3" then sql=sql + " and cx=1"
		if vtype="4" then sql=sql + " and (stj=1 or ytj=1)"
		if vtype="7" then sql=sql + " and IsNew=1"
		If IsSqlDataBase = 1 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff(d,sj,'"& datefrom &"')<=0 and DateDiff(d,sj,'"& dateto &"')>=0"
		If IsSqlDataBase = 0 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff('d',sj,'"& datefrom &"')<=0 and DateDiff('d',sj,'"& dateto &"')>=0"
		.Condition=sql
		if vtype="" then sqlorder = "p_order desc,id desc" 'p_order desc,sj desc"
		if vtype="1" then sqlorder = "views desc"
		if vtype="2" then sqlorder = "buys desc"
		if vtype="3" then sqlorder = "p_order desc,id desc" 'p_order desc,id desc"
		if vtype="4" then sqlorder = "p_order desc,id desc" 'p_order desc,id desc"
		if vtype="5" then sqlorder = "sj desc,id desc"
		.OrderBy=sqlorder
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
		Iscolordata = 0
		set rs = conn.execute("select c_id,c_color,c_name from [Lebi_color] order by c_paixu desc")
		if not rs.eof then
			  colordata = rs.getrows()
			  Iscolordata = 1
		End If
		rs.close
		Ischimadata = 0
		set rs = conn.execute("select c_id,c_name from [Lebi_chima] order by c_paixu desc")
		if not rs.eof Then
			  chimadata = rs.getrows()
			  Ischimadata = 1
		End If
		rs.close
%>
<script language="javascript" type="text/javascript" src="inc/js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/product.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/MyCalendar.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<form name="Lebi" method="get" action="?">
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="anclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0; }">
<option selected>┌ <%=Lang_Product(91)%></option>
<option value="?">├ <%=Lang_Product(92)%></option>
<option value="?vtype=7"<%=judge2(vtype,7)%>>├ <%=Lang_Product(93)%></option>
<option value="?vtype=3"<%=judge2(vtype,3)%>>├ <%=Lang_Product(94)%></option>
<option value="?vtype=4"<%=judge2(vtype,4)%>>├ <%=Lang_Product(95)%></option>
<option value="?vtype=1"<%=judge2(vtype,1)%>>├ <%=Lang_Product(96)%></option>
<option value="?vtype=2"<%=judge2(vtype,2)%>>├ <%=Lang_Product(97)%></option>
<option value="?vtype=5"<%=judge2(vtype,5)%>>├ <%=Lang_Product(98)%></option>
<option value="?vtype=6"<%=judge2(vtype,6)%>>├ <%=Lang_Product(99)%></option>
</select>
<select name="lang">
<option value="" selected>┌ <%=Lang_sys(67)%></option>
<%For LangT = 1 To TotalLang%>
<option value="<%= LanguageTxt(LangT) %>"<%=judge2(LanguageTxt(LangT),Lang)%>>├ <%= LanguageName(LangT) %></option>
<%Next%>
</select>
<select name="sort_id">
<option value="0" selected>┌ <%=Lang_Product(85)%></option>
<script src="../include/lebi_html/categoryoption.js"></script>
</select>
<select name="zhuangtai">
<option value="" selected>┌ <%=Lang_Product(86)%></option>
<option value="0" <%=judge2("0",zhuangtai)%>>├ <%=Lang_Product(76)%></option>
<option value="1" <%=judge2("1",zhuangtai)%>>├ <%=Lang_Product(75)%></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" class="form_query" size="15" autocomplete="off" onkeyup="search_suggest('keyword','lebi_product','<%=lang%>')"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="vtype" value="<%= vtype %>"><input type="hidden" name="pagenum" value="<%= pagenum %>"><br /><div id="search_suggest_keyword" class="search_suggest" style="display:none"></div>
</td>
</tr>
</table>
</td>
</form>
<td align="right" class="classhead">
<%=QuickMenu("Admin_product_list.asp?zhuangtai=0|"& Lang_Menu(71) &"","Admin_product.asp|"& Lang_Menu(52) &"")%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="list" class="classtable2">
<form name="form" action="?action=update_list" method="post">
<input type="hidden" name="keyword" value="<%= keyword %>">
<input type="hidden" name="page" value="<%= page %>">
<input type="hidden" name="list_type" value="<%= list_type %>">
<input type="hidden" name="sort_id" value="<%= sort_id %>">
<input type="hidden" name="zhuangtai" value="<%= zhuangtai %>">
<input type="hidden" name="vtype" value="<%= vtype %>">
<input type="hidden" name="dateFrom" value="<%=dateFrom%>">
<input type="hidden" name="dateTo" value="<%=dateTo%>">
<input type="hidden" name="pagenum" value="<%= pagenum %>">
<tr>
<td height="30" align="left" class="classhead">
<input type="image" name="submit" title=" <%=Lang_sys(1)%> " src="lang/<%=LangFilePath%>/images/bt_app.gif" align="absmiddle">
</td>
<td height="30" align="right" colspan="<%=UserGroupNumber+8%>" class="classhead"><%=ors.ShowPageHead(page)%></td>
</tr>
<tr>
<td width="29%" class="classtop" height="30"><%=Lang_Product(101)%></td>
<td width="6%" class="classtop"><%=Lang_Product(118)%></td>
<td width="7%" class="classtop"><%=Lang_Product(119)%></td>
<%for j=1 to UserGroupNumber%><td width="7%" class="classtop"><%=cache_ugrade_txt(j)%></td><%Next%>
<td width="7%" class="classtop"><%=Lang_Product(120)%></td>
<td width="6%" class="classtop"><%=Lang_Product(32)%></td>
<td width="6%" class="classtop"><%=Lang_Product(104)%></td>
<td width="6%" class="classtop"><%=Lang_Product(121)%></td>
<td width="6%" class="classtop"><%=Lang_Product(122)%></td>
<td width="7%" class="classtop"><%=Lang_Product(86)%></td>
</tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
'				If InStr(DataList(11,i),"$")= 0 Then DataList(11,i) = "$$$$$$$"
'				If InStr(DataList(12,i),"$$$")= 0 Then DataList(12,i) = "$$$$$$$$$$$$$$$$$$$$$"
'				pro_name=split(DataList(11,i),"$")
'				pro_info=split(DataList(12,i),"$$$")
'				productinfo = ""
'				For ii = 0 To UBound(pro_name)
'						If Trim(pro_name(ii)) <> "" Then
'								productinfo = productinfo & Trim(pro_name(ii)) &"："& Trim(pro_info(ii)) &"<br/>"
'						End If
'				Next
%>
<tr class="classrow">
<input type="hidden" name="pro_id" value="<%=DataList(1,i)%>">
<input type="hidden" name="SpecificationCount" id="SpecificationCount" value="<%=checknum(conn.execute("select count(id) from [Lebi_Product_Stock] where p_id = "& DataList(1,i) &"")(0),0)%>" />
<td class="classrow" height="30"><a href="admin_product_edit.asp?id=<%=DataList(1,i)%>&ref=<%=server.urlencode(backurl())%>" title="<%=Lang_sys(51)%>" onMouseover="javascript:ddrivetip('<img src=../<%= PicPath %>/<%=trim(DataList(10,i))%> width=<%=Upload_SPicWidth%> height=<%=Upload_SPicHeight%>>', '#ffffff', '<%=Upload_SPicWidth%>')" onMouseout="hideddrivetip()"><%=DataList(0,i)%></a></td>
<td class="classrow"><input type="text" name="p_order" id="p_order" value="<%=DataList(9,i)%>" onkeyup="value=value.replace(/[^\d\.]/g,'');" style="width:35px;" class="form"></td>
<td class="classrow"><input type="text" name="pro_sprice" value="<%=replace(formatnumber2(DataList(2,i)),",","")%>" style="width:45px;" onkeyup="value=value.replace(/[^\d\.]/g,'');" class="form"></td>
<%
for j=1 to UserGroupNumber
%><td class="classrow"><input type="text" name="pro_price_<%=j%>" value="<%=replace(formatnumber2(DataList(11+j,i)),",","")%>" style="width:45px;" class="form"></td><%Next%>
<td class="classrow"><input type="text" name="pro_cprice" value="<%=replace(formatnumber2(DataList(3,i)),",","")%>" style="width:45px;" class="form"></td>
<td class="classrow"><select name="pro_cx"><option value="1" <%if DataList(4,i)="1" then response.write"selected"%> style="color:#ff0000"><%=Lang_Product(123)%></option><option value="0" <%if DataList(4,i)="0" then response.write"selected"%>><%=Lang_Product(124)%></option></select></td>
<td  class="classrow"><%If DataList(11,i) <> "" Then%><input type="text" name="kucun<%=DataList(1,i)%>" id="kucun<%=DataList(1,i)%>" value="<%=DataList(6,i)%>" style="width:40px;" class="form" disabled><input type="hidden" name="total_kucun<%=DataList(1,i)%>" id="total_kucun<%=DataList(1,i)%>" value="<%=DataList(6,i)%>" /><%Else%><input type="text" name="kucun<%=DataList(1,i)%>" value="<%=DataList(6,i)%>" style="width:40px;" class="form"><%End If%></td>
<td  class="classrow"><input type="text" name="pro_buys" value="<%=DataList(7,i)%>" style="width:35px;" class="form"></td>
<td  class="classrow"><input type="text" name="pro_views" value="<%=DataList(8,i)%>" style="width:35px;" class="form"></td>
<td  class="classrow"><select name="pro_zhuangtai" style="width:48px;"><option value="1" <%if DataList(5,i)="1" then response.write"selected"%>><%=Lang_Product(75)%></option><option value="0" <%if DataList(5,i)="0" then response.write"selected"%> style="color:#ff0000"><%=Lang_Product(76)%></option></select></td>
</tr>
<%
		If DataList(11,i) <> "" Then 
		response.write("<tr><td class=""classrow"">&nbsp;</td><td colspan="""& UserGroupNumber+8 &""" class=""classrow"">")
'		<span id=""Get_Specification"& DataList(1,i) &"""><script type=""text/javascript"">getspecification("& DataList(1,i) &",'"& DataList(11,i) &"',1);</script></span>
		Set rs = conn.execute("select p_no,p_stock,p_price,p_cbprice,p_weight,s_value,id from [Lebi_Product_Stock] where p_id = "& DataList(1,i) &"")
		If Not rs.eof Then 
				DataCount = 1
				DataValue = rs.getrows()
		End If 
		rs.close : Set rs = Nothing
		If DataCount = 1 Then 
				response.write("<table id=""Table_Specification"" cellpadding=""0"" cellspacing=""0"" width=""100%"" class=""tablelist""><tbody><tr>")
				If InStr(DataList(11,i),",") = 0 Then 
						response.write("<td class='listhead' height='25'>")
						Set rs = conn.execute("select s_name from [Lebi_SelectName] where s_id = "& checknum(DataList(11,i),0) &"")
						If Not rs.eof Then 
								response.write(rs(0))
						End If 
						rs.close : Set rs = Nothing
						response.write("</td>")
				Else
						For n = 0 To UBound(Split(DataList(11,i),","))
						response.write("<td class='listhead' height='25'>")
						Set rs = conn.execute("select s_name from [Lebi_SelectName] where s_id = "& checknum(Split(DataList(11,i),",")(n),0) &"")
						If Not rs.eof Then 
								response.write(rs(0))
						End If 
						rs.close : Set rs = Nothing
						response.write("</td>")
						Next 
				End If 
				response.write("<td width='20%' class='listhead'>"& Lang_Product(102) &"</td><td width='10%' class='listhead'>"& Lang_Product(104) &"</td><td width='10%' class='listhead'>"& Lang_Product(236) &"</td><td width='10%' class='listhead'>"& Lang_Product(103) &"</td><td width='10%' class='listhead'>"& Lang_Product(198) &"</td>")
				response.write("</tr>")
				For s = 0 To UBound(DataValue,2)
						response.write("<tr>")
						If InStr(DataValue(5,s),",") = 0 Then 
								response.write("<td class='listrow'>"& DataValue(5,s) &"</td>")
						Else
								For n = 0 To UBound(Split(DataValue(5,s),","))
								response.write("<td class='listrow'>"& Split(DataValue(5,s),",")(n) &"</td>")
								Next 
						End If 
						response.write("<td class='listrow'>")
						response.write("<input style='width:130px;' class='form' type='text' name='p_no_"& DataList(1,i) &"_"& s &"' id='p_no_"& DataList(1,i) &"_"& s &"' value='"& DataValue(0,s) &"' /><input type='hidden' name='s_id_"& DataList(1,i) &"_"& s &"' id='s_id_"& DataList(1,i) &"_"& s &"' value='"& DataValue(6,s) &"' /><input type='hidden' name='s_value_"& DataList(1,i) &"_"& s &"' id='s_value_"& DataList(1,i) &"_"& s &"' value='"& Replace(DataValue(5,s),",","@") &"' />")
						response.write("</td><td class='listrow'>")
						response.write("<input style='width:40px;' class='form' type='text' name='p_stock_"& DataList(1,i) &"_"& s &"' id='p_stock_"& DataList(1,i) &"_"& s &"' onblur=""countle('"& UBound(DataValue,2) + 1 &"','"& DataList(1,i) &"')"" value='"& DataValue(1,s) &"' />")
						response.write("</td><td class='listrow'>")
						response.write("<input style='width:40px;' class='form' type='text' name='p_price_"& DataList(1,i) &"_"& s &"' id='p_price_"& DataList(1,i) &"_"& s &"' value='"& DataValue(2,s) &"' />")
						response.write("</td><td class='listrow'>")
						response.write("<input style='width:40px;' class='form' type='text' name='p_cbprice_"& DataList(1,i) &"_"& s &"' id='p_cbprice_"& DataList(1,i) &"_"& s &"' value='"& DataValue(3,s) &"' />")
						response.write("</td><td class='listrow'>")
						response.write("<input style='width:40px;' class='form' type='text' name='p_weight_"& DataList(1,i) &"_"& s &"' id='p_weight_"& DataList(1,i) &"_"& s &"' value='"& DataValue(4,s) &"' />")
						response.write("</td></tr>")
				Next 
				response.write("</tbody></table>")
		End If 
		response.write("</td></tr>")
		End If 
        Next
End If
%>
</form>
<tfoot>
<tr>
	<td height="30" class="classfooter"><%=GetPageNum(10,pagenum)%></td>
	<td height="30" class="classfooter" align="right" colspan="<%=UserGroupNumber+8%>"><%=ors.ShowPageFoot(page)%></td>
</tr>
</tfoot>
</table>
<script>tdshow("list");</script>
<%
end sub
%>