Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save the Form values after submitted to server

Status
Not open for further replies.

axslearnr

Technical User
Apr 1, 2004
78
US
Hi
I need some help.I will be very thankful to you if you can help me. This is my program stepwise. Pls someone help me.

Note: Everytime I select an item from the combo box or select box I havea wrote function so it retuns the whole ReportTrainingType ASP page. with this function SubmitMe()

1) I have a combo box on a form which has three values. TP,SP,IP. When I select one of the value from the combobox TP, or IP or SP

2) it gives me a list of records which I populate in the Select box I have.

3) When I click on the select box item it gives me the records of the employee in that particular item. It gives me all the records.

4) I want only a certain number of records using the date fields.

5) So I kept a date field on the form and retrieve those values.

I used this function to refresh the ReportTrainingType ASP page
function SubmitMe()
{

document.TCForm.submit();
return(true);
}

' This is the initial combo box
<form method="POST" name="TCForm" action="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=<%=TType%>">
<SELECT name="TrainType" size="1" onchange="SubmitMe()">
<%
'Populate the drop down menu with training code names


response.write "<OPTION VALUE = -1> </OPTION>"
Do While NOT RST.EOF
if cint(RST("Training_Method_ID")) = TType then
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "' SELECTED>"
Response.Write RST("Training_Method_Text") & "</OPTION>"

else
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "'>"
Response.Write RST("Training_Method_Text") & "</OPTION>"

end if
RST.MoveNext
Loop

rst.close
set rst = nothing
%>

' This is the Select box where i select the item to display all the emp records.

response.write "<SELECT name='TrainCode' size='10' onclick='SubmitMe()'>"

'Go through list and write information
do while not rst.eof

WriteClass(TType)
rst.movenext
loop
response.write "</Select>"
end if
rst.close
set rst = nothing

' This where I display the all the emp records.

Set RST=Server.CreateObject("adodb.recordset")
rst.open strSQL, conn

if not rst.eof then
rst.MoveFirst



response.write "<tr><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td></tr>"

CurrentName = -1
NameCount = 1
'Go through list and write information. Eliminate duplicates.
do while not rst.eof
if CurrentName <> rst("Employee ID") then 'Different Names. Print
if NameCount = 1 then
response.write "<tr>"
end if

Response.Write " <td width='200'>" & rst("First Name") & " " & rst("Middle Name") & " " & rst("Last Name") & "</td><td width='200' align='center'>" & rst("Training_Date") & "</td> "

if NameCount = 2 then
response.write "</tr>"
NameCount = 1
Else
NameCount = NameCount + 1
end if

CurrentName = rst("Employee ID")
' else Names are same. Do not print duplicates.
end if

rst.movenext 'Go to next record
loop



end if
rst.close
set rst = nothing
conn.close
set conn = nothing

end if
%>


Pls help me

Thanks
 
>>Everytime I select an item from the combo box or select box I havea wrote function so it retuns the whole ReportTrainingType ASP page. with this function SubmitMe()


i dont understand...


Known is handfull, Unknown is worldfull
 
Hi
sorry for it. Whenever i select an intial item from a combo box it submits the page to server and populates the list box with values. Again when i select the item in list box it submits the page again and displays the values from them. I want to add text boxes on the same page to filter those records. How to do it?

pls let me know

thanks
 
when u resubmit the form u can read the text box values, why no use it then???

Known is handfull, Unknown is worldfull
 
Hi
thnaks for the reply. I cannot retrieve the form date values when i click on the item in the second select box. I get nulls. it doesn't retrieve the form values I put the forms values in another form named Dform but on the same APS page.
how to retrieve them?

pls let me know
thanks
Added this script in the javascript

function DSubmitMe()
{
document.DForm.submit();

return(true);
}


<form method="POST" name="DForm">

Start Date:</b>&nbsp;<input type="text" name="BeginMonth" size="2" value=<%=Month(BDate)%> tabindex="1" maxlength="2" onchange="return CheckMonth(BeginMonth.value)">
/ &nbsp;<input type="text" name="BeginDay" size="2" value=<%=Day(BDate)%> tabindex="2" maxlength="2" onchange="return CheckDay(BeginDay.value)">
/ <input type="text" name="BeginYear" size="4" value=<%=Year(BDate)%> tabindex="3" maxlength="4" onchange="return CheckYear(BeginYear.value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>End Date:&nbsp;</b><input type="text" name="EndDateMonth" size="2" value=<%=Month(EDate)%> tabindex="4" maxlength="2" onchange="return CheckMonth(EndDateMonth.value)">
/ <input type="text" name="EndDateDay" size="2" value=<%=Day(EDate)%> tabindex="5" maxlength="2" onchange="return CheckDay(EndDateDay.value)">
/ <input type="text" name="EndDateYear" size="4" value=<%=Year(EDate)%> tabindex="6" maxlength="4" onchange="return CheckYear(EndDateYear.value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value=" Filter " name="BtnFilter" onClick= "DSubmitMe()"> </font></p>
 
ahh, now i get it, dont use Two forms, when u submit A form only that form's data will be passed, there is only one workaround, in the fomr that u r submitting have hidden fields, when u submit the form take the values from the other form feed it inside ur hidden fields...

Known is handfull, Unknown is worldfull
 
Hi
Can you tell how to do it? I mean the code for it.
I will be very thankful to you. Pls let me know

thanks
 
something like this, this will take form2's value along with form1
<html>
<script>
function submitFrm()
{
document.Form1.HFrm2Txt.value=document.Form1.Frm2Txt.value
}
</script>
<form name="Form1" action="Read.asp">
<input type="text" name="Frm1Txt" value="Form 1 value">
<input type="hidden" name="HFrm2Txt">
<input type="submit" onclick="submitFrm()">
</form>

<form name="Form2">
<input type="text" name="Frm2Txt" value="Form 2 value">
</form>
</html>



in Read.asp
response.write request("Frm1Txt")&"<br>"
response.write request("HFrm2Txt")

Known is handfull, Unknown is worldfull
 

thanks for ur reply. I still cant retrieve the form values. My both forms are on the same ASP page ReportTrainingType.asp. I am just resubmitting to the server and loading the same asp page. pls let me know how to do it
thanks
 
mys mistake:
function submitFrm()
{
document.Form1.HFrm2Txt.value=document.Form2.Frm2Txt.value
}


it was Form1 before...



Known is handfull, Unknown is worldfull
 
Hi
I wrote Form2 only in there. It still didnt work. This is the code i used for it.

<html>
<head>
<script language=javascript>
function SubmitMe()
{
document.TCForm.BeginMonth.value=document.DForm.BeginMonth.value
document.TCForm.BeginDay.value=document.DForm.BeginDay.value
document.TCForm.BeginYear.value=document.DForm.BeginYear.value
document.TCForm.EndDateMonth.value=document.DForm.EndDateMonth.value
document.TCForm.EndDateDay.value=document.DForm.EndDateDay.value
document.TCForm.EndDateYear.value=document.DForm.EndDateYear.value
document.TCForm.submit();



return(true);
}

</script>
</head>

<body>

StartDate = request.Form("BeginMonth") & "/" & request.Form("BeginDay") & "/" & request.Form("BeginYear")

'Get date values entered in fields
StartDate = DateValue(StartDate)
EndDate = DateValue(request("EndDateMonth") & "/" & request("EndDateDay") & "/" & request("EndDateYear"))


<form method="POST" name="DForm">
Start Date:</b>&nbsp;<input type="text" name="BeginMonth" size="2" value=<%=Month(BDate)%> tabindex="1" maxlength="2" onchange="return CheckMonth(BeginMonth.value)">
/ &nbsp;<input type="text" name="BeginDay" size="2" value=<%=Day(BDate)%> tabindex="2" maxlength="2" onchange="return CheckDay(BeginDay.value)">
/ <input type="text" name="BeginYear" size="4" value=<%=Year(BDate)%> tabindex="3" maxlength="4" onchange="return CheckYear(BeginYear.value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>End Date:&nbsp;</b><input type="text" name="EndDateMonth" size="2" value=<%=Month(EDate)%> tabindex="4" maxlength="2" onchange="return CheckMonth(EndDateMonth.value)">
/ <input type="text" name="EndDateDay" size="2" value=<%=Day(EDate)%> tabindex="5" maxlength="2" onchange="return CheckDay(EndDateDay.value)">
/ <input type="text" name="EndDateYear" size="4" value=<%=Year(EDate)%> tabindex="6" maxlength="4" onchange="return CheckYear(EndDateYear.value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" value=" Filter " name="BtnFilter" onClick="SubmitMe()"> </font></p>

</form>
</body>
</html>
 
from ur code i can see that its DForm thats being submitted, if u want the tcfrom to submit change:
<input type="submit" value=" Filter " name="BtnFilter" onClick="SubmitMe()">



to:
<input type="button" value=" Filter " name="BtnFilter" onClick="SubmitMe()">

Known is handfull, Unknown is worldfull
 
Hi
thansk for ur help. i really appreciate it.I tried that too. it still cnt retrieve the form values.
Can you pls tell me

thanks
 
now i am confused, can u give me a link to the page???

Known is handfull, Unknown is worldfull
 
Hi
I dont have any link to the page since it is not online.
well here is the code.

pls let me know
thanks


<!-- #include file="Include_Files/Security/Security_Level_3.inc" -->
<!-- #include file="Include_Files/Add_Records/Select_Menu.inc" -->
<%



'Initialize variables
Dim conn 'Link to database
Dim strSQL 'All
Dim rst 'Record set of all training codes that can be accessed
Dim code 'Training code of currently selected type
Dim ClassTitle 'Title of Current Training


%>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Language" CONTENT="en-us">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<script language="javascript">
function SubmitMe()
{
document.TCForm.BeginMonth.value=document.DForm.BeginMonth.value
document.TCForm.BeginDay.value=document.DForm.BeginDay.value
document.TCForm.BeginYear.value=document.DForm.BeginYear.value
document.TCForm.EndDateMonth.value=document.DForm.EndDateMonth.value
document.TCForm.EndDateDay.value=document.DForm.EndDateDay.value
document.TCForm.EndDateYear.value=document.DForm.EndDateYear.value
document.TCForm.submit();
return(true);
}

function DSubmitMe()
{

document.DForm.sbmit();

return(true);
}
function GetTrainingCode()
{
alert (window.document.TCForm.SaveCode.value);

return(true);
}
function GetTraining()
{
alert (window.document.DForm.SaveCode.value);

return(true);
}



</Script>
<TITLE>Training by Type</TITLE>

</HEAD>

<BODY TEXT="#510000" LINK="#999900" VLINK="#CC9966" ALINK="#990066" >
<FONT FACE="Trebuchet MS, Arial, Helvetica">
<Table Cellspacing=0 border="0" cellpadding="0" width="800" height="52">
<tr><td width="149" height="46" valign="top"><img border="0" src="images/Metrics_Heading.png" width="149" height="46"></td><td width="651" height="46" valign="bottom" align="center"><b><font size="6">Training
by Type
</font></b>
</td></tr>
<tr><td colspan="2" width="800" height="16"> <img border="0" src="images/Heading_LineInc.gif"> </td>
</FONT>
</Table>

<%

if request.Querystring("typeid") <> "" and not isnull(request.querystring("typeid")) then
TType = cint(Request.querystring("typeid"))
else
TType = -1
end if


if request.Querystring("classid") <> "" and not isnull(request.querystring("classid")) then
Class_ID = cint(Request.querystring("classid"))
else
Class_ID = -1
end if



Response.Write "kumar3"
menuid = request.querystring("menuid")


' Create an ADO Connection to connect to the sample database.
set conn = Server.CreateObject("ADODB.Connection")

'Use ODBC DSN to link to MS Access database
conn.open "DSN=Metrics;uid=" & session("Userid") & ";pwd=" & session("Password")

Set RST=Server.CreateObject("adodb.recordset")
strSQL = "Select * from training_method Where (training_method_ID > 0 and training_method_id < 4) or (training_method_id > 8 and training_method_id < 12) order by training_method_ID ;"
rst.open strSQL, conn
rst.MoveFirst

StartDate = request.Form("BeginMonth") & "/" & request.Form("BeginDay") & "/" & request.Form("BeginYear")

if len(StartDate) > 2 then

'Get date values entered in fields
StartDate = DateValue(StartDate)
EndDate = DateValue(request("EndDateMonth") & "/" & request("EndDateDay") & "/" & request("EndDateYear"))

'Set date values that are displayed on form
EDate = EndDate
BDate = StartDate
FirstTime = False

else
FirstTime = True
EDate = now()
'EDate = DateValue(rst("Training_Date"))
'rst.movelast
'BDate = DateValue(rst("Training_Date"))


end if

Response.Write StartDate

%>

<form method="POST" name="TCForm" action="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=<%=TType%>">
<table cellspacing="0" cellpadding="0" width="792">
<td valign=" width="50%" top" width="135">
<font face="Arial, Helvetica, sans-serif"> <b>Training Type:</b> &nbsp; </font>&nbsp;
&nbsp;&nbsp;



<td valign="top" width="657">
<SELECT name="TrainType" size="1" onchange="SubmitMe()">
<%
'Populate the drop down menu with training code names


response.write "<OPTION VALUE = -1> </OPTION>"
Do While NOT RST.EOF
if cint(RST("Training_Method_ID")) = TType then
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "' SELECTED>"
Response.Write RST("Training_Method_Text") & "</OPTION>"

else
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "'>"
Response.Write RST("Training_Method_Text") & "</OPTION>"

end if
RST.MoveNext
Loop

rst.close
set rst = nothing



%>
</SELECT>&nbsp;

</Table>

<input type="hidden" name="BeginMonth">
/ &nbsp;<input type="hidden" name="BeginDay" >
/ <input type="hidden" name="BeginYear">
/ <input type="hidden" name="EndDateDay" >
/ <input type="hidden" name="EndDateYear">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="EndDateMonth">




<Table>
<%
'************************************************************************************************
'Spacing for the display
'CName - Text field used to pad with blanks
'CLength - Total Length of Space in Field
'************************************************************************************************
Function GetBlanks (CName, CLength)
Dim SpacesNeeded 'Number of spaces needed

SpacesNeeded = Clength - Len(CName)

Select Case SpacesNeeded
Case 1: GetBlanks = CName & "&nbsp;&nbsp;"
Case 2: GetBlanks = CName & "&nbsp;&nbsp;&nbsp;"
Case 3: GetBlanks = CName & "&nbsp;&nbsp;&nbsp;"
Case 4: GetBlanks = CName & "&nbsp;&nbsp;&nbsp;&nbsp;"
Case 5: GetBlanks = CName
Case 6: GetBlanks = CName Case 7: GetBlanks = CName Case 8: GetBlanks = CName
Case 9: GetBlanks = CName
Case 10: GetBlanks = CName
Case 11: GetBlanks = CName
Case 12: GetBlanks = CName
Case 13: GetBlanks = CName
Case 14: GetBlanks = CName
Case 15: GetBlanks = CName
Case 16: GetBlanks = CName
Case 17: GetBlanks = CName
Case 18: GetBlanks = CName
Case 19: GetBlanks = CName
Case 20: GetBlanks = CName
Case 21: GetBlanks = CName
Case 22: GetBlanks = CName
Case 23: GetBlanks = CName
Case 24: GetBlanks = CName
Case 25: GetBlanks = CName
Case 26: GetBlanks = CName
Case 27: GetBlanks = CName
Case 28: GetBlanks = CName
Case 29: GetBlanks = CName
Case 30: GetBlanks = CName
Case 31: GetBlanks = CName
Case 32: GetBlanks = CName
Case 33: GetBlanks = CName
Case 34: GetBlanks = CName
Case 35: GetBlanks = CName
Case 36: GetBlanks = CName
Case 37: GetBlanks = CName
Case 38: GetBlanks = CName
Case 39: GetBlanks = CName
Case 40: GetBlanks = CName
Case 41: GetBlanks = CName
Case 42: GetBlanks = CName
Case 43: GetBlanks = CName
Case 44: GetBlanks = CName
Case 45: GetBlanks = CName
Case 46: GetBlanks = CName
Case 47: GetBlanks = CName
Case 48: GetBlanks = CName
Case 49: GetBlanks = CName
Case 50: GetBlanks = CName
Case Else: GetBlanks = CName
End Select
End Function

Sub WriteHeader(ClassCode)
'************************************************************************************************************
'Writes class header information for each class based on class type.
'Input: ClassCode - type of class as a string numeric value
'************************************************************************************************************

Select Case ClassCode

Case "1": 'SOP Header
Response.Write "<TR ><TD ALIGN=left valign=top><B><U>ID</U></B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B><U>Title</U></B></TD></TR>"

Case "2" : 'TP Header
Response.Write "<tr><td align=left valign=top><B><U>ID</U></B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B><U>Title</U></B></td></tr>"

Case "3" : 'Internal Class Header
Response.Write "<TR ><TD ALIGN=left valign=top><B><U>ID</U></B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B><U>Training Type</U></B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B><U>Title</U></B></TD></TR>"

Case "9" : 'SHEP Header
Response.Write "<TR ><TD ALIGN=left valign=top ><B><U>ID</U></B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B><U>Title</U></B></TD></TR>"

Case "10": 'Client SOP Header
Response.Write "<TR ><TD ALIGN=left valign=top><B><U>ID</U></B><B><U>Title</U></B></TD></TR>"

Case "11": 'Client Method Header
Response.Write "<TR ><TD ALIGN=left valign=top><B><U>ID</U></B><B><U>Title</U></B></TD></TR>"


end select

end sub

'************************************************************************************************************
'Writes class information for each class based on class type.
'Input: ClassCode - type of class as a string numeric value
'************************************************************************************************************
Sub WriteClass(ClassCode)

Select Case ClassCode
Case "1": 'SOP Method
'Write the Client Code number

if isnull(rst("Type_ID")) or (rst("Type_ID") = "") then
TypeID = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
else
TypeID = rst("Type_ID")
end if

if isnull(rst("SOP_ID_NUM")) or (rst("SOP_ID_NUM") = "") THEN
SOPIDNUM = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
else
SOPIDNUM = rst("SOP_ID_NUM")
end if


Response.Write "<OPTION VALUE='" & rst("SOP_ID") & "'>"
Response.Write TypeID & " " & SOPIDNUM & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & rst("Title") & "</OPTION>"

Case "2": 'TP Method
'Write the TP Method list
Response.Write "<OPTION VALUE='" & rst("TP_ID") & "'>"
response.write "TP " & rst("TP_ID_Num") & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & rst("Title") & "</OPTION>"

Case "3": 'Internal Class
'Write the Internal Class list
TrainingTypeText = GetBlanks(trim(rst("Training_Type_Text")), 20)
Response.Write "<OPTION VALUE='" & rst("Class_ID") & "'>"
response.write rst("Class_ID_Num") & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & TrainingTypeText & rst("Class_Title") & "</Option>"

Case "9": 'SHEP Training
'Write the SHEP Method list
Response.Write "<OPTION VALUE='" & rst("SHEP_ID") & "'>"
response.write rst("Type_ID") & "&nbsp;&nbsp;" & rst("Shep_ID_NUM") & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & rst("Title") & "</OPTION>"

Case "10": 'Client SOP Method
ClientCode = GetBlanks(trim(rst("code") & " " & rst("SOP_ID_NUM")), 40)

'Write the Client Code number
Response.Write "<OPTION VALUE='" & rst("SOP_ID") & "'>"
response.write ClientCode & rst("Title") & "</OPTION>"

Case "11": 'Client Method
'Write the Client Method list
ClientCode = GetBlanks(trim(rst("code") & " " & rst("Method_ID_NUM")), 40)
Response.Write "<OPTION VALUE='" & rst("METHOD_ID") & "'>"
response.write ClientCode & rst("Title") & "</OPTION>"

End Select
End Sub
if TType > 0 then 'If code selected write instructions.
response.write "<FONT FACE='Trebuchet MS, Arial, Helvetica' size='2'><i>Click on the title below to see which employees have been trained:"
end if

if TType > 0 then
Set RST=Server.CreateObject("adodb.recordset")
strSQL = "Select Training_Method_Text from training_method where Training_Method_ID = " & TType
rst.open strSQL, conn 'Get the list of Classes employee has taken
rst.MoveFirst 'Move to the first record in the list
if not rst.eof then 'If a record is in the list
MethodType = rst("Training_Method_Text")
end if
rst.close
set rst = nothing
end if


Set RST=Server.CreateObject("adodb.recordset")
if TType > 0 then

Select case TType
Case 1: 'SOP method
strSQL = "Select sop.SOP_ID, sop.Type_ID, sop.SOP_ID_NUM, sop.Client_ID, sop.Title, sop.Status_ID, sop.Revision_Code, doc_status.Status_Text from employee RIGHT JOIN (doc_status RIGHT JOIN sop ON doc_status.Status_ID = sop.Status_ID) on employee.[Employee ID] = sop.Author_ID WHERE (((sop.Client_ID) is Null)) AND sop.Status_ID = 1 Order by sop.Type_ID, sop.SOP_ID_NUM;"

Case 2: 'TP method
strSQL = "Select tp.TP_ID, tp.TP_ID_Num, tp.Revision_Code, tp.Status_ID, tp.Title, doc_status.Status_Text from doc_status RIGHT JOIN tp ON doc_status.Status_ID = tp.Status_ID WHERE tp.Status_ID = 1 Order by tp.tp_ID;"

Case 3: 'Internal Class
strSQL = "Select class.Class_ID, class.Class_ID_Num, class.Class_Title, training_type.Training_Type_Text from training_type INNER JOIN class on training_type.Training_Type_ID = class.Training_Type_ID Order by training_type.Training_Type_Text;"

Case 9: 'SHEP
strSQL = "Select shep.Shep_ID, shep.Revision_Code, shep.Title, shep.Type_ID, shep.shep_ID_NUM, doc_status.Status_Text from doc_status RIGHT JOIN shep ON doc_status.Status_ID = shep.Status_ID WHERE shep.Status_ID = 1 ORDER BY Status_Text, Type_ID, SHEP_ID_NUM;"

Case 10: 'Client SOP
strSQL = "Select sop.SOP_ID, sop.SOP_ID_NUM, sop.Client_ID, client_codes.Code, client_codes.[Client Name], sop.Title, sop.Revision_Code, doc_status.Status_Text from doc_status RIGHT JOIN (client_codes RIGHT JOIN sop ON client_codes.ID = sop.Client_ID) ON doc_status.Status_ID = sop.Status_ID WHERE (((sop.Client_ID) is Not Null)) AND sop.Status_ID = 1 Order by code, sop_id_num;"

Case 11: 'Client Method
strSQL = "Select methods.Method_ID, methods.Method_ID_NUM, methods.Revision_Code, doc_status.Status_Text, client_codes.Code, client_codes.[Client Name], methods.Title from (methods LEFT JOIN doc_status ON methods.Status_ID = doc_status.Status_ID) LEFT JOIN client_codes ON methods.Client_ID=client_codes.ID Where methods.Status_ID = 1 Order BY client_codes.Code, methods.Method_ID_NUM;"
End select

rst.open strSQL, conn
rst.MoveFirst 'Move to the first record in the list
if not rst.eof then 'If a record is in the list



'Print heading
response.write "<br><br>"
response.write "<Table>"
Response.Write "<TR bgcolor='#DEDEEF'><TD COLSPAN=12 ALIGN=left width='800'><B>" & methodtype & "s</B></TD></TR>"
WriteHeader (TType)

response.write "</Table>"
response.write "<SELECT name='TrainCode' size='10' onclick='SubmitMe()'>"

'Go through list and write information
do while not rst.eof

WriteClass(TType)
rst.movenext
loop
response.write "</Select>"

end if

rst.close
set rst = nothing
response.write "<br><br>"
response.write "</Table>"



if Class_ID > 0 then

Class_ID=cint(Request.Querystring("classid"))
end if


If Class_ID > 0 then
Select Case TType
Case 1: 'SOP
strSQL = "Select sop.Title, [Type_ID] & ' ' & [SOP_ID_NUM] as ID_Num from sop where sop_ID = " & Class_ID & ";"

Case 2: 'TP
strSQL = "Select tp.Title, 'TP ' & tp.TP_ID_Num as ID_Num from tp where TP_ID = " & Class_ID & ";"

Case 3: 'Internal Class
strSQL = "Select class.Class_Title as Title, class.Class_ID_Num as ID_Num from class where Class_ID = " & Class_ID & ";"

Case 9: 'SHEP
strSQL = "Select shep.Title, shep.Type_ID & ' ' & shep.shep_ID_NUM as ID_Num from shep where Shep_ID = " & Class_ID & ";"

Case 10: 'Client SOP
strSQL = "Select sop.Title, client_codes.Code & ' ' & sop.SOP_ID_NUM as ID_Num from sop LEFT JOIN client_codes ON sop.Client_ID = client_codes.ID where sop_ID = " & Class_ID & ";"

Case 11: 'Client Method
strSQL = "Select methods.Title, client_codes.Code & ' ' & methods.Method_ID_NUM as ID_Num from methods INNER JOIN client_codes ON methods.Client_ID = client_codes.ID where Method_ID = " & Class_ID & ";"

Case else:
strSQL = ""
end select

Set RST=Server.CreateObject("adodb.recordset")
rst.open strSQL, conn

if not rst.eof then
rst.MoveFirst
if trim(rst("ID_NUM")) = "" or isnull(rst("ID_NUM")) then
ClassTitle = rst("Title")
else
ClassTitle = rst("ID_NUM") & "&nbsp;&nbsp;&nbsp;" & rst("Title")
end if
end if
rst.close
set rst = nothing
end if

if Session("SecurityLvl") < 3 then 'Not Supervisor
strSQL = "SELECT employee.[Employee ID], employee.[First Name], employee.[Middle Name], employee.[Last Name], employee_training.Training_Method_ID, "
strSQL = strSQL & " employee_training.Train_ID, employee_training.Training_Date FROM "
strSQL = strSQL & "employee INNER JOIN employee_training ON employee.[Employee ID] = employee_training.Employee_ID "
strSQL = strSQL & "WHERE (((employee_training.Training_Method_ID)=" & TType & ") AND ((employee_training.Train_ID)=" & Class_ID & ")) ORDER BY employee.[Last Name], employee.[First Name], employee_training.training_date DESC;"

else 'Supervisor
SupervisorID = session("EmployeeID")
strSQL = "SELECT employee.[Employee ID], employee.[First Name], employee.[Middle Name], employee.[Last Name], employee_training.Training_Method_ID, "
strSQL = strSQL & " employee_training.Train_ID, employee_training.Training_Date FROM "
strSQL = strSQL & "employee INNER JOIN employee_training ON employee.[Employee ID] = employee_training.Employee_ID "
strSQL = strSQL & "WHERE (((employee_training.Training_Method_ID)=" & TType & ") AND ((employee_training.Train_ID)=" & Class_ID & ")) AND (employee.[Supervisor ID] =" & SupervisorID & " OR employee.[Employee ID]=" & SupervisorID & ") ORDER BY employee.[Last Name], employee.[First Name], employee_training.training_date DESC;"

end if
%>
</Table>
<FONT FACE='Trebuchet MS, Arial, Helvetica' size='2'>
<table Cellspacing=0 border="0" cellpadding="0">

<%
response.write "<tr><td colspan='8'>&nbsp;</td></tr>"
response.write "<tr><td colspan='8'><b>" & ClassTitle & "</b></td></tr>"
response.write "<tr><td colspan='8'>&nbsp;</td></tr>"
Set RST=Server.CreateObject("adodb.recordset")
rst.open strSQL, conn

if not rst.eof then
rst.MoveFirst

response.write "<tr><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td></tr>"

CurrentName = -1
NameCount = 1
'Go through list and write information. Eliminate duplicates.
do while not rst.eof
if CurrentName <> rst("Employee ID") then 'Different Names. Print
if NameCount = 1 then
response.write "<tr>"
end if
rec_Training_Date=DateValue(rst("Training_Date"))
'Response.Write rec_Training_Date
Response.Write StartDate
Response.Write EndDate


if (rec_Training_Date>=StartDate AND rec_Training_Date<=EndDate ) then
Response.Write " <td width='200'>" & rst("First Name") & " " & rst("Middle Name") & " " & rst("Last Name") & "</td><td width='200' align='center'>" & rst("Training_Date") & "</td> "

else
'Response.Write " <td width='200'>" & rst("First Name") & " " & rst("Middle Name") & " " & rst("Last Name") & "</td><td width='200' align='center'>" & rst("Training_Date") & "</td> "
end if

if NameCount = 2 then
response.write "</tr>"
NameCount = 1
Else
NameCount = NameCount + 1
end if

CurrentName = rst("Employee ID")
' else Names are same. Do not print duplicates.
end if

rst.movenext 'Go to next record
loop



end if
rst.close
set rst = nothing
conn.close
set conn = nothing

end if
%>
<input type="hidden" name="CID" value="<% =request.Form("TrainCode") %>">


</table>
</form>

<form method="POST" name="DForm">

Start Date:</b>&nbsp;<input type="text" name="BeginMonth" size="2" value=<%=Month(BDate)%> tabindex="1" maxlength="2" onchange="return CheckMonth(BeginMonth.value)">
/ &nbsp;<input type="text" name="BeginDay" size="2" value=<%=Day(BDate)%> tabindex="2" maxlength="2" onchange="return CheckDay(BeginDay.value)">
/ <input type="text" name="BeginYear" size="4" value=<%=Year(BDate)%> tabindex="3" maxlength="4" onchange="return CheckYear(BeginYear.value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>End Date:&nbsp;</b><input type="text" name="EndDateMonth" size="2" value=<%=Month(EDate)%> tabindex="4" maxlength="2" onchange="return CheckMonth(EndDateMonth.value)">
/ <input type="text" name="EndDateDay" size="2" value=<%=Day(EDate)%> tabindex="5" maxlength="2" onchange="return CheckDay(EndDateDay.value)">
/ <input type="text" name="EndDateYear" size="4" value=<%=Year(EDate)%> tabindex="6" maxlength="4" onchange="return CheckYear(EndDateYear.value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" value=" Filter " name="BtnFilter" onClick="SubmitMe()"> </font></p>

</form>
<a href=<%=Get_Menu(menuid)%>><img border="0" src="images/B_Return_Off.gif" onclick=history.go(-1) onmouseover="src='images/B_Return_On.gif'" onmouseout="src='images/B_Return_Off.gif'" alt="Return" border="0"></a>


</BODY>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top