|
baldcat -> RE: Display Date Range (8/24/2005 21:49:43)
|
Ok cool, I'm starting to get some results... Here is my code thus far... index.asp <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/cfs_gateway_nm.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script language="javascript" src="cal2.js">
/*
Xin's Popup calendar script- Xin Yang (http://www.yxscripts.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/
</script>
<script language="javascript" src="cal_conf2.js"></script>
<link href="/styles.css" rel="stylesheet" type="text/css">
<!-- InstanceEndEditable -->
<link href="/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" >
<tr>
<td colspan="2"><img src="/images/EMMETTS_web.jpg" width="237" height="112"></td>
<td>Emmett Motors CFS Gateway - <!-- InstanceBeginEditable name="headertext" -->Purshase Order Date Search <!-- InstanceEndEditable --></td>
<td> </td>
</tr>
<tr bgcolor="#00629F" class="capmain">
<td width="7%"><a href="/index.asp" class="button">Home</a></td>
<td width="14%"> </td>
<td width="39%"> </td>
<td width="33%"> </td>
</tr>
</table>
<table width="90%" >
<tr>
<td> </td>
</tr>
</table>
<!-- InstanceBeginEditable name="Main Body" -->
<table width="90%" align="center" >
<tr>
<td>
<form action="results1.asp" method="POST" name="sampleform" id="purchase">
<input type="text" name="firstinput" size=20> <small><a href="javascript:showCal('Calendar1')">Select Date</a></small>
<p><input type="text" name="secondinput" size=20> <small><a href="javascript:showCal('Calendar2')">Select Date</a></small>
<p>
<input name="Submit" type="submit" class="button" value="Submit">
</form></td>
</tr>
</table>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
results1.asp <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/CFS.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows
startdate = Cdate(Request.Form("firstinput"))
enddate = Cdate(Request.Form("secondinput"))
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_CFS_STRING
Recordset1.Source = "SELECT stock_no, date_exp_d, account, po_type, branch, descz FROM EMMG.RDL, EMMG.RDH WHERE (date_exp_d BETWEEN '"& startdate &"' AND '"& enddate &"') AND po_type = 'V' AND doc_status = '6' ORDER BY date_exp_d"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<link href="/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="75%" >
<tr>
<th width="24%" scope="col">Date Expected </th>
<th width="21%" scope="col">Stock No </th>
<th width="21%" scope="col">Description</th>
<th width="29%" scope="col">Account</th>
<th width="2%" scope="col">Branch</th>
<th width="3%" scope="col"> </th>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td><%=(Recordset1.Fields.Item("date_exp_d").Value)%></td>
<td><%=(Recordset1.Fields.Item("stock_no").Value)%></td>
<td><%=(Recordset1.Fields.Item("descz").Value)%></td>
<td><%=(Recordset1.Fields.Item("account").Value)%></td>
<td><%=(Recordset1.Fields.Item("branch").Value)%></td>
<td> </td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Ok the problem is now, that the dates just don't work... I may put in 05\08\2005 - 25\08\2005 and get a heap of results starting at 22\08\2005 and going till December, then I put in 04\08\2005 and get nothing ?? It isn't the javascript is it ?, as I would have thought that is a quick way to put a date in the box. Also it is displaying multible entries Not sure why , As I don't use the business system to know what data I'm pulling up.. But I think it is becuase these entries have been edited a number of times, and it is bringing up each version. Is there a way to let only the most current show ? Or let me know what info is needed and I will post it here. Cheers all..
|
|
|
|