Invoice List Based on Criteria 
Admin > Invoice List Log Off
SELECT orders.*, customers.*, oitems.* FROM (customers INNER JOIN orders ON customers.custID = orders.ocustomerid) INNER JOIN oitems ON orders.orderID = oitems.orderid WHERE (((orders.odate)>now()-3000)) ORDER BY orders.orderID DESC;
Start Date:
End Date: OR days
Show Deleted, Refund, Fraud, etc.
Search Help
Invoice #: OR
Customer Name: partial name OK

<--- OR --->

SKU QTY Invoice
Number
Invoice
Date
Amount Order
Complete
Customer
Turn ON/OFF Source Display (One Level deep include files are also shown)
<!-- #include file="../DatabaseInclude.asp" -->
This include file is NOT output to debug file.<%
if ucase(left(Request.form("setCriteria"),4)) = "INVO" then
  setDays = Clng(Request.form("setDays"))
else
  setDays = 14
end if
%>


<table class="TableSkins">
  <tr>
    <td class="TDHeader" colspan="10">Invoice List Based on Criteria </td>
  </tr>
  <tr>
    <td class="TDHeader" colspan="10"><a href="Index.asp">Admin</a> > Invoice List
      <a href="SessionClose.asp">Log Off</a>
      <%
      Set rsOrders= Server.CreateObject("ADODB.Recordset")
      if Request.Form("Search") <> "Search" then
        if ucase(left(Request.form("setCriteria"),4)) = "INVO" then
          setDays = Clng(Request.form("setDays"))
        else
          setDays = 14
        end if
      
        if Request.form("timecriteria") = "start_end_date" then
          strStartDate = Request.form("StartDate")
          strEndDate = Request.form("EndDate")
          setDays= DateDiff("d",strStartDate,strEndDate)
          Session("strStaretEndDate") = "start:" & strStartdate & " end:" & strEndDate
        else
          strStartDate = now()-setDays
          strEnddate = Now()
        end if
        
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''' force startdate
setDays = 3000
strStartDate = "1/1/2000"
    
        'All Invoices
        'SQLstr = "SELECT orders.*, customers.cfirstname, customers.clastname, products.cname, customers.custID FROM (customers INNER JOIN orders ON customers.custID = orders.ocustomerid) INNER JOIN (products INNER JOIN oitems ON products.SupplierSKU = oitems.catalogid) ON orders.orderID = oitems.orderid ORDER BY orders.orderID DESC;"
      
        'Select Invoices for the last setDays days
        SQLstr = "SELECT orders.*, customers.*, oitems.*"
        SQLstr = SQLstr & " FROM (customers INNER JOIN orders ON customers.custID = orders.ocustomerid) INNER JOIN oitems ON orders.orderID = oitems.orderid "
      
        'if Session("Engine") = "SQL" then
          'if Request.form("ShowDeletedInvoices") <> "ON" then
            'SQLstr = SQLstr & " WHERE (((orders.odate)>getdate()-" & setDays & " AND oDeleteStatus = 'OK'))"
          'else
            'SQLstr = SQLstr & " WHERE (((orders.odate)>getdate()-" & setDays & " AND (oDeleteStatus like '%Delete%' or oDeleteStatus like '%Fraud%' or oDeleteStatus like '%Refund%' ) ))"
          'end if
        'end if
      
        'if Session("Engine") = "ACCESS" then
          SQLstr = SQLstr & " WHERE (((orders.odate)>now()-" & setDays & "))"
        'end if
      
        'Only show those that have NOT been processed
        'AND ((orders.oComplete) Is Null))
        
        SQLstr = SQLstr & " ORDER BY orders.orderID DESC;"
      else
        SQLstr = "SELECT orders.*, customers.*, oitems.*"
        SQLstr = SQLstr & " FROM (customers INNER JOIN orders ON customers.custID = orders.ocustomerid) INNER JOIN oitems ON orders.orderID = oitems.orderid "
      
          If Request.Form("customerName") <> "" then
            SQLstr = SQLstr & " WHERE (customers.clastname like '%" & Request.Form("customerName") & "%')"
          else
            SQLstr = SQLstr & " WHERE (orders.orderID like '%" & Request.Form("InvoiceNumber") & "%')"
          end if
        
      end if 'Request.Form("Search") <> "Search" then
      Session("SQLStr") = SQLstr
      rsOrders.Open SQLstr, dbc
      %>

    </td>
  </tr>
  <tr>
  <td class="TDSkins" colspan=10>
    <%=SQLstr%>
  </td>
  
  
  </tr>
  
  <tr>
        
    <td class="TDSkins" width="50%">
      <form method="POST" action="InvoiceList.asp">
        <input class="InputSkins" type="radio" value="start_end_date" name="timecriteria" checked>Start
        Date:<input class="InputSkins" type="text" name="startdate" size="15" value="<%=formatdatetime(strStartDate,vbShortdate)%>"><br>
        End Date:
        <input class="InputSkins" type="text" name="enddate" size="15" value="<%=formatDateTime(strEndDate,vbShortdate)%>">
        OR
        <input class="InputSkins" type="radio" value="number_of_days" name="timecriteria">
        <input class="InputSkins" type="text" name="setDays" size="4" value="<%=setDays%>">
        days<br>
        <input type="checkbox" name="ShowDeletedInvoices" value="ON" class="InputForms">
          Show Deleted, Refund, Fraud, etc.
    </td>
    
    <td width="298" class="TDSkins">
    
            <a onmouseover="return overlib('<!-- #include file="popupoutput.asp" -->',FGCOLOR,'#ffffff',TEXTCOLOR,'#000000',BELOW,LEFT)" onMouseOut="nd();">
<pre><!----------------------- Start PopUpOutPut.asp -----------------------><br><table border=0 cellspacing=0 cellpadding=0 background=Skins/<font color=#990000><b><%=ucase(Session(SkinOption))%></font></b><br>/TableBackground.gif class=PopUp><br><tr><br><td background=Skins/<font color=#990000><b><%=ucase(Session(SkinOption))%></font></b><br>/TopSquared.gif><br><p class=Popup><br>There are 3 types of Searches:</p><br></td><br></tr><br><tr><br><td valign=top><br><p class=Popup><br><b><br>STRING</b><br> Search: input any number of characters you would like to search for, spaces are OK.<br><br>(ex: <b><br>shoe rep</b><br> will find <b><br>Shoe Rep</b><br>air Men and <b><br>Shoe Rep</b><br>air Women)<br><br><br><br><b><br>WORD</b><br> Search: <i><br><b><br>space</b><br></i><br>WORD<i><br><b><br>space</b><br></i><br><br><br>(ex: <b><br>food </b><br>will find all items with food )<br><br><br><br><b><br>COMBINATION </b><br>search for multiple words in any order.<br><br>The [+] (PLUS sign) between the search strings indicates a new string/word.<br><br>You can have any reasonable number strings/words.<br><br>(ex: <b><br>fast+food+health</b><br>)<br><br>(ex: <b><br>fast+food+cowboy club+main street)</b><br></p><br></td><br></tr><br></table><br><!----------------------- End PopUpOutPut.asp -----------------------><br></pre>        <b>Search Help</b></a>
    
    
    <br>
      Invoice #:
      <input type="text" name="invoiceNumber" size="24" class="InputSkins">
      OR<br>
      Customer Name:<input type="text" name="customerName" size="20" class="InputSkins">
            partial name OK</td>
        
  </tr>

  <tr>
        
    <td class="TDSkins" colspan="3">
      <p align="center">
      <input class="InputSkins" type="submit" style="size=100" value="Invoice By Date" name="setCriteria">
      <--- OR --->
      <input type="submit" value="Search" name="Search" class="InputSkins">
    </td></form>
  </tr>
      
<%if Request.form("ShowDeletedInvoices") = "ON" then%>  
  <tr>
    <td colspan="5">
        Deleted, Refund, Fraud INVOICES ONLY!
    </td>
  </tr>
<%end if%>
</table>

<table class="TableSkins">
  <tr>
    <td class="TDHeader">SKU</td>
    <td class="TDHeader">QTY</td>
    <td class="TDHeader">Invoice<br>Number</td>
    <td class="TDHeader">Invoice<br>Date</td>
    <td class="TDHeader">Amount</td>
    <td class="TDHeader">Order<br>Complete</td>
    <td class="TDHeader">Customer</td>
  </tr>

<%
Dim orderItemCounter
Session("lastOderid") = ""
orderItemCounter= 1
While Not rsOrders.EOF
%>

  <tr>
    <td class="TDSkins">
      <%  
      realLength = len(rsOrders("catalogID"))
      countCharacter=1
      EndOfLineCounter = 8
      strLong = rsOrders("catalogID")
      OutPut = ""
  
      do until countCharacter + EndOfLineCounter > RealLength
        InstrRevIS = InstrRev(mid(strLong,1,EndOfLineCounter),"")
        OutPut = OutPut & mid(strLong,1,InstrRevIS) & "<br>"
        strLong = mid(strLong,InstrRevIS+1,RealLength)
        countCharacter = countCharacter + EndOfLineCounter
      loop
        'pre
        OutPut = OutPut & strLong
        'Replace(strLong, vbCrLf, "")%>
<%=OutPut %>
       
    </td>

    <td class="TDSkins">
      <%=rsOrders("numItems")%>
       
    </td>
      <td class="TDSkins">
        <%strOrderID =rsOrders("orderID")%>

        <a href="InvoiceForm.asp?ID=<%=strOrderID%>">

      <%if Session("lastOderid") <> strOrderID then%>
        <%YesFallThru = "yes"%>
        <%if orderItemCounter > 1 then
          orderItemCounter = 1
        end if%>

        <%=strOrderID %>-<%=orderItemCounter %> <%Session("lastOderid") = strOrderID %>
        <%orderItemCounter= 1%>
      </a>
       
    </td>
    
    <td class="TDSkins">
      <%=month(rsOrders("odate")) & "-" & day(rsOrders("odate")) & "-" & right(year(rsOrders("odate")),2)%>
       
    </td>
    <td class="TDSkins">
      <%if YesFallThru = "yes" then%>
        <%=Session("CompanyCurrencyText")%><%=formatnumber(rsOrders("orderamount"),2)%>
      <%end if%>
       
    </td>
    <td class="TDSkins">
      <%if ucase(rsOrders("oComplete")) = "YES" then%>
        Yes
      <%else%>
        No
      <%end if%>
      <%if ucase(rsOrders("oComplete")) = "YES" and (rsOrders("opicker") <> "" OR rsOrders("opacker") <> "") then%>
        Pick:<%=rsOrders("opicker")%><br>
        Pack:<%=rsOrders("opacker")%>
      <%end if%>
       
    </td>
    <td class="TDSkins">
      <%=rsOrders("clastname") & ", " & rsOrders("cfirstname")%>
       
    </td>
  </tr>
  <%
  'AmWayOnly end
end if
rsOrders.MoveNext
Wend
rsOrders.close
set rsOrders= nothing
dbc.close
set dbc= nothing
%>

</table>
</body>
</html><!-- #include file="../ReadFile.asp" -->
This include file is NOT output to debug file.