<%option explicit%> <% ShopCheckAdmin "shopa_stock.asp" '*********************************************************** ' VP-ASP Shop Administration ' Stock Low Report Summary ' inputs are table, database ' Version 6.50 Jan 21, 2004 ' 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= getlang("LangstockInvalidStock") end if else Stocklimit=getconfig("XstockLow") ' Default from shop$config if isnumeric(Stocklimit) then stocklimit= clng(stocklimit) else Serror= getlang("LangstockInvalidStock") end if end if limit=request("Limit") if limit="" then limit=100 ' Stock display end if If not Isnumeric(limit) then Serror= getlang("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 GenerateSQL ShopOpendatabaseP dbc Set rs = Server.CreateObject ("ADODB.Recordset") rs.Open SQL, dbc, adOpenStatic,adLockReadOnly,adCmdtext ReportHeader if rs.eof then Response.write "
" & getlang("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 GenerateDisplayHeader getlang("LangStock01") GenerateDisplayBodyHeader %>

<%=getlang("LangStockNum") & count %>

<% GenerateDisplayBodyFooter end sub ' Sub ProduceDetail dim count dim total dim nopayment count=0 total=0 nopayment=0 GenerateDisplayHeader getlang("LangStock01") GenerateDisplayBodyHeader 'VP-ASP 6.09 - for print friendly reports response.write "
Print Report
" FormatTableStart limit=clng(limit) While Not rs.EOF and count" & rs(idfield) & "" end if response.write ReportDEtailColumn & fieldvalue & ReportDEtailColumnEnd next response.write ReportRowEnd end sub ' ' Sub Displayform AdminPageHeader GenerateDisplayHeader getlang("LangStock01") GenerateDisplayBodyHeader if sError<> "" then shopwriteError SError Serror="" end if %>

<%= getlang("LangStockLow")%>:

<%= getlang("LangStockMaxRows")%>:

" name="Summary">

" class='submitbtn' name="B2">

" name="Details">

<% GenerateDisplayBodyFooter GetHelp 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 %>
<%=getlang("LangStockDetailHeader") & " " & StockLimit%>

<%=getlang("LangStockNum") & rs.recordcount %>
<% response.write "" for i = 0 to fieldcount response.write ReportHeadColumn & fields(i) & reportHeadColumnend next response.write ReportRowEnd end sub ' Sub FormatTableEnd response.write ReportTableEnd end sub %>