%option explicit%> <% shopcheckadmin "shopa_displayorders.asp" '************************************************************************** ' Version 5.00 Display orders ' April 25, 2003 ' Demo Version '************************************************************************** ' dim mysql Dim Fieldcount Dim Headnames(6) Dim Fieldnames(6) Dim ProcType Dim SortType Dim Sortfield Dim SortUpDown Dim Sortupdownnames(2) Dim Sortupdownvalues(2) Dim Procnames(3) dim Procvalues(3) Dim Pendnames(20) dim Pendvalues(20) dim pendingcount Dim Idfield Dim SearchFieldvalue, searchfieldname Dim i dim orderfieldcount, orderfields Dim item dim dbtable Dim scriptresponder Dim editresponder Dim dbc dim fieldname dim pending, pendtype dim PendingFieldnames(20),pendingfieldcount, pendingnamescount setsess "currenturl","shopa_displayorders.asp" AdminPageHeader ' Admin page headers are different SetFieldNames ' field names for table OpenOrderDB dbc ' open database GetInput ' get all form fields If Request("Delete")<>"" Then For each item in Request("DeleteUser") DeleteRecord Item Next End if If Request("Process")<>"" Then For each item in Request("Processed") MarkProcessed Item Next End if If Request("MarkPending")<>"" Then For each item in Request("Pending") MarkPending Item Next End if GenerateDisplayHeader ' Generate sort button etc scriptresponder="shopa_formatorder.asp" editresponder="shopa_editrecord.asp" 'debugwrite "sql=" & mysql ShopopenRecordSet mysql, rsorder, mypagesize, mypage GenerateTable ' write the tabe Call PageNavBar (Mysql) ' put bottom navigation bar rsOrder.close ' close database set rsOrder=nothing shopCloseDatabase dbc If getconfig("xlistallorders")="Yes" then response.write "
" & getlang("LangAllOrders") & "
" end if AdminPageTrailer ' Write admin trailer ' Sub GetInput Idfield="Orderid" mypage = Request.querystring("page") 'first time we need everything, othertimes sql is set up sortfield=request("Sortfield") ' See how we are sorting If Sortfield="" then sortfield="orderid" end if 'response.write "sortfield="& sortfield ' see which types processed or unprocessed Proctype=request("Proctype") If Proctype="" then Proctype="0" end if 'response.write "Proctype=" & proctype Pendtype=request("Pendtype") If Pendtype="" then Pendtype="" end if SortUpdown=request("SortUpdown") If SortUpdown="" then sortupdown="ASC" end if if mypage="" then mypage=1 GenerateSQL else Mysql=GetSess("sqlquery") Proctype=GetSess("Proctype") sortfield=GetSess("sortfield") sortupdown=GetSess("sortupdown") pendtype=getsess("pendtype") end if maxrecs=getconfig("xeditdisplaymaxrecords") mypagesize=maxrecs end sub ' ' SQL is generate by using fields on form Sub GenerateSQL dim sqlproc dim dbtable, whereok dbtable="orders" MySql = "SELECT * from " & dbtable whereok=" WHERE " 'response.write "generated sql=" & mysql if Proctype="" then sqlproc = whereok & " oprocessed=0" whereok= " AND " else if Proctype="*" then sqlproc="" AddPendingSql sqlproc, whereok else If Proctype="0" then sqlproc = whereok & " oprocessed=" & Proctype whereok=" AND " AddPendingSql sqlproc, whereok else sqlproc = whereok & " oprocessed<>0" whereok=" AND " end if end if end if Mysql = mysql & sqlproc Searchfieldvalue=request("searchfieldvalue") Searchfieldname=request("Searchfieldname") If searchfieldvalue<>"" and searchfieldname<> getlang("Langcommonselect") then mysql = mysql & whereOK & searchfieldname & " LIKE '%" & searchfieldvalue & "%'" end if If sortfield<>"" then mysql=mysql & " order by " & sortfield & " " & sortupdown end if SetSess "sqlquery",MySQL setSess "Proctype",Proctype SetSess "sortfield",sortfield SetSess "sortupdown",sortupdown 'debugwrite mysql End sub ' Sub GenerateTable dim howmanyfields dim howmanyrecs dim my_link dim processed dim pending, orderid, pendingfieldname, fieldname howmanyfields=fieldcount response.write "" & getlang("LangCommonYes") & "
" & ReportDetailColumnEnd else Response.write Reportdetailcolumn & "" & reportdetailcolumnend end if if getconfig("xorderpending")="Yes" then Response.write ReportDetailColumn & "" Pendingfieldname="Pending_" & orderid GenerateSelectNV PendingFieldnames,pending,Pendingfieldname, Pendingfieldcount,getlang("LangCommonSelect") fieldname="pending" Response.write "" ' Response.write 'Pending' value='" & rsorder(idfield) & "'>
" & reportdetailcolumnend Response.write "" & ReportDetailColumnEnd end if for i = 0 to howmanyfields fieldname=fieldnames(i) if ucase(fieldname)="OCUSTOMERID" then response.write ReportDetailColumn & "" & rsorder(fieldname) & "" else if ucase(fieldname)="ORDERAMOUNT" then response.write ReportDetailColumn & shopformatcurrency(rsorder(fieldname),getconfig("xdecimalpoint")) & ReportDetailcolumnend else response.write Reportdetailcolumn & rsorder(fieldname) & Reportdetailcolumnend end if end if next %>