<%option explicit%> <% ShopCheckAdmin "shopa_stock.asp" '*********************************************************** ' VP-ASP Shop Administration ' Stock Low Report Summary ' inputs are table, database ' Version 4.00 ' invoked shopa_addproduct if table=products '************************************************************* Dim dbtable Dim fields(10) dim fieldcount Dim File Dim ScriptResponder Dim Dbc dim Action dim Stocklimit Dim Limit Dim rs dim Idfield scriptresponder="shopa_addproduct.asp" idfield="catalogID" GetInput If Action = "" or Serror<>"" Then DisplayForm Else GenerateSQL WriteReport end if '******************************** Sub GetInput Serror="" dbtable="Products" action=request("summary") if action<>"" then action="SUMMARY" else action=request("Details") if action<>"" then action="DETAILS" end if end if limit=100 ' Stock display If action<>"" then ValidateFields end if end sub Sub ValidateFields Stocklimit=request("StockLimit") if Stocklimit<>"" then if isnumeric(Stocklimit) then stocklimit= clng(stocklimit) else Serror=LangstockInvalidStock end if else Stocklimit=getconfig("XstockLow") ' Default from shop$config if isnumeric(Stocklimit) then stocklimit= clng(stocklimit) else Serror=LangstockInvalidStock end if end if limit=request("Limit") if limit="" then limit=100 ' Stock display end if If not Isnumeric(limit) then Serror=LangstockInvalidRow end if end sub ' Sub GenerateSQL dim limitsql sql="select * from products " if Stocklimit <> "" then sql = sql & " Where cstock <= " & Stocklimit end if Sql = SQL & " order by " & idfield 'debugwrite sql end sub ' Sub WriteReport ' Generate table AdminPageHeader ShopOpendatabase dbc Set rs = Server.CreateObject ("ADODB.Recordset") rs.Open SQL, dbc, adOpenStatic,adLockReadOnly,adCmdtext ReportHeader if rs.eof then Response.write "
" & LangStockNone & "
" else If Action="SUMMARY" then ProduceSummary else ProduceDetail end if end if AdMinPageTrailer end sub ' Sub ReportHeader end sub ' Sub ProduceSummary dim count dim total dim nopayment count=0 total=0 nopayment=0 While Not rs.EOF count=count+1 rs.movenext wend rs.close shopclosedatabase dbc response.write "

" Response.write "
" & LangStockNum & count response.write "

" end sub ' Sub ProduceDetail dim count dim total dim nopayment count=0 total=0 nopayment=0 FormatTableStart limit=clng(limit) While Not rs.EOF and count" Response.write "
" & LangStockNum & count response.write "

" end sub ' Sub FormatRow dim i, my_link dim fieldvalue response.write ReportDetailRow for i = 0 to fieldcount fieldvalue=rs(fields(i)) if i=0 then my_link=scriptresponder & "?which=" & rs(idfield) & "&idfield=" & idfield & "&table=products" fieldvalue="" & rs(idfield) & "" end if response.write ReportDEtailColumn & fieldvalue & ReportDEtailColumnEnd next response.write ReportRowEnd end sub ' ' Sub Displayform AdminPageHeader if sError<> "" then response.write "" & SError & "" Serror="" end if %>
<%=LangStock01%>


<%=LangStockLow%>


<%=LangStockMaxRows%>


<% AdminPageTrailer end sub Sub FormattableStart dim i fields(0)="catalogid" fields(1)="cstock" fields(2)="ccode" fields(3)="cname" fields(4)="cdescription" fields(5)="cprice" fieldcount=5 Response.write "
" & LangStockDetailHeader & " " & StockLimit & "

" response.write ReportTableDef response.write ReportHeadRow for i = 0 to fieldcount response.write ReportHeadColumn & fields(i) & reportHeadColumnend next response.write ReportRowEnd end sub ' Sub FormatTableEnd response.write ReportTableEnd end sub %>