I am working with an update form that includes an iframe. What I am trying to do is is pass three values from the ifame into the main body of the form. You can see a screen shot of the form here.
http://www.coopnet.com/images/addeditscreenshot.jpg The flow is that a Patient is selected (this is a select box populated from the db). Then a location is selected (These radio buttons are built from the db). Once the radio button is selected then the available dates are supposed to be displayed in the calendar (I plane to use an onclick event here I dont have that working yet). Then when the date is clicked I want all the info; patientID, LocationID, and Date to be passed into the main form where a query will be done to retrieve other relative information like Patient Name, Location Name, tech Name, etc.
I am using a previous post that Fritz responded to (07/06/2005 - 02:34PM CDT, ID: 21482427) as a guide. I am trying to use the Iframe1.asp and the Iframe2.asp that Fritz wrote. The primary function is below:
<script language="JavaScript">
<!--
function PassValues(){
document.forms['frmControl
Ledger'].e
lements['d
atStart'].
value = document.frames('IFrame1')
.document.
forms['frm
Dates'].el
ements['da
tStart'].v
alue;
document.forms['frmControl
Ledger'].e
lements['d
atEnd'].va
lue = document.frames('IFrame1')
.document.
forms['frm
Dates'].el
ements['da
tEnd'].val
ue;
}
//-->
</script>
I normally post a form back to itself with an action and additional variables to achive what I want. In this case I need the iframe to query the db upon selecting a radio button to display the available dates, then when the date is clicked to pass that info to the main form in such a manner that the main form will query the db and retrive the proper informaion. At the same time I want the Iframe to retain the values that were selected.
The code for these forms is rather lenghly but I am posting it for both forms.
If I were writing to Dear Abby I would sign this Confused
Code Below:
'*************************
** Main Form **************************
****
<!-- #include file="../functions.asp" -->
<script language="JavaScript">
<!--
function PassValues(){
document.forms['frmMain'].
elements['
EventPatie
ntID'].val
ue = document.frames('techDate'
).document
.forms['fr
mMainIfram
e'].elemen
ts['EventP
atientID']
.value;
document.forms['frmMain'].
elements['
PrimaryEve
ntDepartme
nt'].value
= document.frames('techDate'
).document
.forms['fr
mMainIfram
e'].elemen
ts['Primar
yEventDepa
rtment'].v
alue;
}
//-->
</script>
<%
'Department_On = True
'Category_On = True
'If (Session("StaffID") < 1) Then
' Response.Redirect("../Logi
n.asp")
'End If
function CoalesceDate(sDate)
RetVal = "NULL"
if sDate > "" then
if isDate(sDate) then
RetVal = "'" & cStr(cDate(sDate)) & "'"
end if
end if
CoalesceDate = RetVal
end function
Dim iCustomID, edit_EvntName, edit_ReferringPhysician, edit_id, sql, _
edit_EvntBegin, edit_EvntEnd, edit_EvntContactLast, _
edit_EvntContactFirst, edit_InterpretingPhysician
, edit_EvntContactPhone, edit_EvntContactFax, _
sProcedureType, edit_EvntPublic, edit_EvntUrl, edit_EvntSource
edit_id = Request("id")
sAction = Trim(Request("action"))
sPage = "Appointment Information"
ishowtop = Request("showtop")
If (sAction = "Update Appointment") Then
'----- For this application, it is best to DELETE all occurences of the event then
'----- do an INSERT (instead of UPDATE)
edit_id = SQLFilter(Request.Form("ed
it_id"))
DBConnect "DELETE FROM Events WHERE EvntID = " & edit_id
DBConnect "DELETE FROM Events WHERE Event_MasterID = " & edit_id
DBConnect "DELETE FROM EventCategoryRT WHERE EventCategoryRT_evntID = " & edit_id
InsertEvent
edit_EvntBegin = SQLFilter(Request.Form("ed
it_EvntBeg
in"))
iMonth = DatePart("m", CDate(edit_EvntBegin))
iYear = DatePart("yyyy", CDate(edit_EvntBegin))
Response.Redirect("list.as
p?month=" + CStr(iMonth) + "&year=" + CStr(iYear))
ElseIf (sAction = "Add Appointment") Then
InsertEvent
edit_EvntBegin = SQLFilter(Request.Form("ed
it_EvntBeg
in"))
iMonth = DatePart("m", CDate(edit_EvntBegin))
iYear = DatePart("yyyy", CDate(edit_EvntBegin))
If ishowtop <> "no" Then
Response.Write("<SCRIPT language='javascript'>wind
ow.close()
;opener.lo
cation.rel
oad();</SC
RIPT>")
Else
Response.Redirect("list.as
p?month=" + CStr(iMonth) + "&year=" + CStr(iYear))
End If
ElseIf (sAction = "Update1") Then
If (edit_id > 0) Then
sSQL = "SELECT * FROM Events WHERE EvntID=" & edit_id
DBConnect sSQL
If Not objRS.EOF Then
sEvntID = objRS("EvntID")
edit_id = objRS("EvntID")
edit_EvntBegin = objRS("EvntBegin")
edit_EventTime = objRS("Event_Time")
edit_EvntEnd = objRS("EvntEnd")
sEventPatientID = objRS("EventPatientID")
edit_EvntName = objRS("EvntName")
edit_ReferringPhysicianID = objRS("ReferringPhysicianI
D")
edit_ReferringPhysician = objRS("ReferringPhysician"
)
sEvntDescription = objRS("EvntDescription")
edit_EvntContactLast = objRS("EvntContactLast")
edit_EvntContactFirst = objRS("EvntContactFirst")
edit_InterpretingPhysician
= objRS("InterpretingPhysici
an")
edit_EvntContactPhone = objRS("EvntContactPhone")
edit_EvntContactFax = objRS("EvntContactFax")
sProcedureType = objRS("ProcedureType")
iPrimaryProc = objRS("ProcedureType")
sEvntConfirmed = objRS("EvntConfirmed")
sEvntConfDate = objRS("EvntConfDate")
sEventConfBy = objRS("EventConfBy")
edit_EvntPublic = objRS("EvntPublic")
edit_EvntRecurringType = objRS("Event_RecurringType
")
edit_EvntMasterID = objRS("Event_MasterID")
edit_EvntUrl = objRS("Event_Url")
sFileName = objRS("Event_PDF")
edit_EvntSource = objRS("Event_Source")
DBClose
sButtonLabel = "Update Appointment"
Else
Response.Redirect("addedit
New.asp")
End If
'*************************
**********
**********
**********
******
'----- Get the primary Department for this event
sSQL = "SELECT * FROM EventCategoryRT WHERE EventCategoryRT_evntID=" & edit_id
DBConnect sSQL
If Not objRS.EOF Then
iPrimaryDept = objRS("EventCategoryRT_Eve
ntDepartme
ntID")
DBClose
End If
'*************************
**********
**********
*******
'----- Get the primary event category for this event
sSQL = "SELECT * FROM EventCategoryRT WHERE EventCategoryRT_evntID=" & edit_id
DBConnect sSQL
If Not objRS.EOF Then
iPrimaryCat = objRS("EventCategoryRT_Eve
ntCategory
ID")
DBClose
End If
'*************************
**********
**********
**********
******
IF (Procezzdure_On = "True") Then
'----- Get the primary Procedure for this event
sSQL = "SELECT * FROM EventProcedure WHERE EventCategoryRT_evntID=" & edit_id & " AND EventCategoryRT_Primary=1;
"
DBConnect sSQL
If Not objRS.EOF Then
iPrimaryDept = objRS("EventCategoryRT_Eve
ntDepartme
ntID")
DBClose
End If
End If
'*************************
**********
**********
*******
sSQL = "SELECT * FROM Patients WHERE PatientID=" & sEventPatientID & ";"
DBConnect sSQL
If Not objRS.EOF Then
iedit_EvntName = CStr(objRS.Fields("Title")
.Value) + " " + CStr(objRS.Fields("FirstNa
me").Value
) + " " + CStr(objRS.Fields("LastNam
e").Value)
DBClose
End If
'*************************
**********
**********
*******
Else
Response.Redirect("addedit
New.asp")
End If
'****** End of Update1 **************************
**********
****
Else 'Insert1
sButtonLabel = "Add Appointment"
End If
Sub InsertEvent
sEvntID = Request.Form("edit_id")
edit_EvntBegin = SQLFilter(Request.Form("ed
it_EvntBeg
in"))
edit_EvntEnd = SQLFilter(Request.Form("ed
it_EvntEnd
"))
If (Len(edit_EvntEnd) < 3) Then
edit_EvntEnd = edit_EvntBegin
End If
edit_EventTime = SQLFilter(Request.Form("ed
it_EventTi
me"))
sEventPatientID = SQLFilter(Request.Form("Ev
entPatient
ID"))
edit_EvntName = SQLFilter(Request.Form("ed
it_EvntNam
e"))
sRefPhysicanID = SQLFilter(Request.Form("ed
it_Referri
ngPhysicia
nID"))
edit_ReferringPhysician = SQLFilter(Request.Form("ed
it_Referri
ngPhysicia
n"))
edit_InterpretingPhysician
= SQLFilter(Request.Form("ed
it_Interpr
etingPhysi
cian"))
sProcedureType= Trim(Request.Form("sProced
ureType"))
If (Request.Form("EvntConfirm
ed") = "1") Then
sEvntConfirmed = True
Else
sEvntConfirmed = False
End If
sEvntConfDate= Trim(Request.Form("EvntCon
fDate"))
sEventConfBy= Trim(Request.Form("EventCo
nfBy"))
'If (EvntBegin = "") then Response.Redirect("../erro
r.asp")
sSQL = "INSERT INTO Events (EventPatientID, EvntName, EvntBegin, Event_Time, " + _
"EvntEnd, ReferringPhysicianID, ReferringPhysician, InterpretingPhysician, EvntConfirmed, " + _
"EvntConfDate, EventConfBy, ProcedureType) " + _
"VALUES ('" + CStr(sEventPatientID) + "', " + _
"'" + CStr(edit_EvntName) + "', " + _
"'" + CStr(edit_EvntBegin) + "', " + _
"'" + CStr(edit_EventTime) + "', " + _
"'" + CStr(edit_EvntEnd) + "', " + _
"'" + CStr(sRefPhysicanID) + "', " + _
"'" + CStr(edit_ReferringPhysici
an) + "', " + _
"'" + CStr(edit_InterpretingPhys
ician) + "', " + _
"" + CStr(sEvntConfirmed) + ", " + _
"" + CoalesceDate(sEvntConfDate
) + ", " + _
"'" + CStr(sEventConfBy) + "', " + _
"'" + CStr(sProcedureType) + "')"
'Response.Write("<br>sSQL:
" + sSQL)
'Response.end
DBConnect sSQL
'----- Get the ID of the master event just added
sSQL = "SELECT evntID FROM Events ORDER BY evntID DESC;"
'sSQL = "SELECT evntID FROM Events WHERE " + _
' "EvntName='" + CStr(edit_EvntName) + "' AND " + _
' "EvntBegin=#" + CStr(edit_EvntBegin) + "#;"
DBConnect sSQL
If Not objRS.EOF Then
edit_id = objRS("evntID")
End If
DBClose
If (sAction = "Update Appointment") Then
sSQL = "UPDATE Notations SET Note_AppointmentID='" + CStr(edit_id) + "' " + _
"WHERE Note_AppointmentID=" + CStr(sEvntID) + ";"
'Response.write ssql
'response.end
DBConnect sSQL
End If
'----- Primary Event Category stuff
sPrimaryDept = SQLFilter(Request.Form("Pr
imaryEvent
Department
"))
sPrimaryCat = SQLFilter(Request.Form("Pr
imaryEvent
Category")
)
sSQL = "INSERT INTO EventCategoryRT (EventCategoryRT_EventDepa
rtmentID, EventCategoryRT_EventCateg
oryID, EventCategoryRT_evntID, EventCategoryRT_Primary) VALUES (" + _
CStr(sPrimaryDept) + ", " + _
CStr(sPrimaryCat) + ", " + _
CStr(edit_id) + ", " + _
"1);"
'Response.Write("<br>" + sSQL)
DBConnect sSQL
End Sub
'----- Sub to load Primary Department Box ------- This the Locations
Sub LoadPrimaryDeptCombo(iPrim
aryDept)
Dim sSQL, rsData, sTemp, iTemp
sSQL = "SELECT EventDepartment_ID, EventDepartment_Name FROM EventDepartment ORDER BY EventDepartment_Name; "
DBConnect sSQL
Response.Write("<OPTION selected value='0'>Select Location</OPTION>")
While Not objRS.EOF
sTemp = CStr(objRS.Fields("EventDe
partment_N
ame").Valu
e)
iTemp = CInt(objRS.Fields("EventDe
partment_I
D").Value)
if (CInt(iPrimaryDept) = iTemp) then
Response.Write("<OPTION selected value='" & iTemp & "'>" & sTemp & "</OPTION>")
else
Response.Write("<OPTION value='" & iTemp & "'>" & sTemp & "</OPTION>")
end if
objRS.MoveNext
wend
DBClose
End Sub
'----- Sub to load Primary Catagory Box ---------- This is the Techs
Sub LoadPrimaryCombo(iPrimaryC
at)
Dim sSQL, rsData, sTemp, iTemp
sSQL = "SELECT EventCategory_ID, EventCategory_Name FROM EventCategory ORDER BY EventCategory_Name "
DBConnect sSQL
Response.Write("<OPTION selected value='0'>Select Technician</OPTION>")
While Not objRS.EOF
sTemp = CStr(objRS.Fields("EventCa
tegory_Nam
e").Value)
iTemp = CInt(objRS.Fields("EventCa
tegory_ID"
).Value)
if (CInt(iPrimaryCat) = iTemp) then
Response.Write("<OPTION selected value='" & iTemp & "'>" & sTemp & "</OPTION>")
else
Response.Write("<OPTION value='" & iTemp & "'>" & sTemp & "</OPTION>")
end if
objRS.MoveNext
wend
DBClose
End Sub
'----- Sub to load Primary Procedure Box
Sub LoadPrimaryProcCombo(iPrim
aryProc)
Dim sSQL, rsData, sTemp, iTemp
sSQL = "SELECT EventProcedure_ID, EventProcedure_Name FROM EventProcedure ORDER BY EventProcedure_Name; "
DBConnect sSQL
Response.Write("<OPTION selected value='0'>Select Procedure</OPTION>")
While Not objRS.EOF
sTemp = CStr(objRS.Fields("EventPr
ocedure_Na
me").Value
)
iTemp = CInt(objRS.Fields("EventPr
ocedure_ID
").Value)
if (CInt(iPrimaryProc) = iTemp) then
Response.Write("<OPTION selected value='" & iTemp & "'>" & sTemp & "</OPTION>")
else
Response.Write("<OPTION value='" & iTemp & "'>" & sTemp & "</OPTION>")
end if
objRS.MoveNext
wend
DBClose
End Sub
'*************************
**********
**********
*******
If Request.QueryString("pid")
<>"" Then
sSQL = "SELECT * FROM Patients WHERE PatientID=" & Request.QueryString("pid")
& ";"
DBConnect sSQL
If Not objRS.EOF Then
iedit_EvntName = CStr(objRS.Fields("Title")
.Value) + " " + CStr(objRS.Fields("FirstNa
me").Value
) + " " + CStr(objRS.Fields("LastNam
e").Value)
iRefPhysicanID = objRS("Patient_RefPhysican
ID")
iInterpreterID = objRS("patient_Interpreter
ID")
DBClose
End If
sSQL = "SELECT Physicians_ID, Physicians_Salutation, Physicians_FirstName, Physicians_LastName FROM Physicians WHERE Physicians_ID=" & iInterpreterID & ";"
DBConnect sSQL
If Not objRS.EOF Then
edit_InterpretingPhysician
= CStr(objRS.Fields("Physici
ans_Saluta
tion").Val
ue) + " " + CStr(objRS.Fields("Physici
ans_FirstN
ame").Valu
e) + " " + CStr(objRS.Fields("Physici
ans_LastNa
me").Value
)
DBClose
End If
sSQL = "SELECT Physicians_ID, Physicians_Salutation, Physicians_FirstName, Physicians_LastName FROM Physicians WHERE Physicians_ID=" & iRefPhysicanID & ";"
DBConnect sSQL
If Not objRS.EOF Then
edit_ReferringPhysicianID = CStr(objRS.Fields("Physici
ans_ID").V
alue)
edit_ReferringPhysician = CStr(objRS.Fields("Physici
ans_Saluta
tion").Val
ue) + " " + CStr(objRS.Fields("Physici
ans_FirstN
ame").Valu
e) + " " + CStr(objRS.Fields("Physici
ans_LastNa
me").Value
)
DBClose
End If
End If
'*************************
**********
**********
*******
%>
<%If ishowtop <> "no" Then %>
<!-- #include file="../tabmenu.asp" -->
<%Else%>
<link rel="stylesheet" href="<%=sAbsolutePath%>ed
itmenu.css
" type="text/css">
<%End If%>
<script language="JavaScript" src="datepicker/ts_picker4
.js"></scr
ipt>
<form name="frmMain" action="addeditNew.asp" method="post">
<input type="hidden" name="edit_id" value="<%=edit_id%>">
<input type="hidden" name="edit_EvntName" value="<%=iedit_EvntName%>
">
<input type="hidden" name="edit_ReferringPhysic
ianID" value="<%=edit_ReferringPh
ysicianID%
>">
<table Class="ID2" border="0" width="600" cellpadding="0" cellspacing="0" align="center">
<tr>
<td class="title_new" colspan="4" align=center>
<%=sButtonLabel%>
</td>
</tr>
<tr>
<td class="text_new" colspan="4" align=center>
<table>
<tr>
<td align=right>
<IFRAME SRC="../calendar/techCalen
dar_inc.as
p?Cid=<%=i
Dept%>" ID="techIframe" Name="techIframe" SCROLLING="no" HSPACE="0" VSPACE="0" FRAMEBORDER="no" MARGINHEIGHT="0" ALIGN="MIDDLE" MARGINWIDTH="0" WIDTH="600" HEIGHT="200"><font color='003366'></IFRAME>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type="button" value="Set Date" onClick="PassValues()">
</td>
</tr>
<tr>
<td valign=top align=left>
<table Class="ID3" border="1" width="300" cellpadding="0" cellspacing="0" align="center">
<tr>
<td class="text_new">
Patient Name:
<!-- #include file="../patients/Pat_inc.
asp" -->
</td>
</tr>
<tr>
<td class="text_new">
Appt. Date: &nb
sp; &
nbsp; 
; &nb
sp;Appt. Time: <!-
- Public -->
<br>
<input type="text" size=10 maxlength=255 name="edit_EvntBegin" value="<%=edit_EvntBegin%>
">
<a href="javascript:show_cale
ndar4('doc
ument.frmM
ain.edit_E
vntBegin',
document.frmMain.edit_Evnt
Begin.valu
e);"><img src="datepicker/cal.gif" width="16" height="16" border="0" alt="Click here to choose date"></a>
&n
bsp;
<input type="text" size=10 maxlength="100" name="edit_EventTime" value="<%=edit_EventTime%>
">
<!
-- <INPUT id="EvntPublic=" type="checkbox" name="edit_EvntPublic" value="1" <% If edit_EvntPublic Then %>checked<% ElseIf (sAction = "") Then %>checked<% End If %>> --><br>
<span class="smalltext">(i.e. "10:00AM - 4:00PM", "all day", "9:00 PM - ???")</span>
</td>
</tr>
<%IF (Department_On = "True") Then%>
<tr>
<td class="text_new">
Appointment Location:
</td>
</tr>
<tr>
<td align="left">
<select name="PrimaryEventDepartme
nt" size="1" style="WIDTH: 150px">
<% LoadPrimaryDeptCombo iPrimaryDept %>
</select>
<%If (Session("AccessLevel") > 7) Then%>
<a href="EventDepartment/defa
ult.asp">A
dd Loc.</a>
<%End IF%>
</td>
</tr>
<tr>
<td class="text_new">
Technician:
</td>
</tr>
<tr>
<td align="left">
<select name="PrimaryEventCategory
" size="1" style="WIDTH: 150px">
<% LoadPrimaryCombo iPrimaryCat %>
</select>
<%If (Session("AccessLevel") > 7) Then%>
<a href="EventCategory/defaul
t.asp">Add
Tech.</a>
<%End IF%>
</td>
</tr>
<%End IF%>
</table>
</td>
<td valign=top align=left>
<table Class="ID3" border="1" width="300" cellpadding="0" cellspacing="0" align="left">
<tr>
<td class="text_new">
Ref_Physician:
</td>
<td class="text_new">
<input type="text" readonly size=30 maxlength="50" name="edit_ReferringPhysic
ian" value="<%=edit_ReferringPh
ysician%>"
>
</td>
</tr>
<tr>
<td class="text_new">
Inter_Physician:
</td>
<td class="text_new">
<input type="text" readonly size=30 maxlength="50" name="edit_InterpretingPhy
sician" value="<%=edit_Interpretin
gPhysician
%>" ID="Text3">
</td>
</tr>
<tr>
<td class="text_new">
Procedure Type:
</td>
<td class="text_new">
<select name="sProcedureType" size="1" style="WIDTH: 110px">
<% LoadPrimaryProcCombo iPrimaryProc %>
</select>
<%If (Session("AccessLevel") > 7) Then%>
<a href="EventProcedure/defau
lt.asp">Ad
d Proc.</a>
<%End IF%>
</td>
</tr>
<tr>
<td>
Appt. Confirmed :
</td>
<td>
<INPUT id="EvntConfirmed=" type="checkbox" name="EvntConfirmed" value="1" <% If sEvntConfirmed Then %>checked<% End If %>>
</td>
</tr>
<tr>
<td class="cttext">
Confirm Date :
</td>
<td>
<input type="text" size=10 maxlength=20 name="EvntConfDate" value="<%=sEvntConfDate%>"
>
<a href="javascript:show_cale
ndar4('doc
ument.frmM
ain.EvntCo
nfDate', document.frmMain.EvntConfD
ate.value)
;"><img src="datepicker/cal.gif" width="16" height="16" border="0" alt="Click here to choose date"></a>
</td>
</tr>
<tr>
<td class="text_new">
Confirmed_By:
</td>
<td class="text_new">
<input type="text" size=30 maxlength="50" name="EventConfBy" value="<%=sEventConfBy%>" ID="Text1">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=4>
<table border="0" BGColor="#6089c7" width="600" cellpadding="2" cellspacing="0" align="center">
<tr>
<td align="left">
<%
iMonth = DatePart("m", CDate(edit_EvntBegin))
iYear = DatePart("yyyy", CDate(edit_EvntBegin))
sLink = "list.asp?month=" + CStr(iMonth) + "&year=" + CStr(iYear)
%>
<input type="button" name="btnCancel" value="Cancel" onclick="location.href='<%
=sLink%>';
" ID="Button1">
</td>
<td align="right">
<input type="submit" name="action" value="<%=sButtonLabel%>" ID="Submit1">
</td>
</tr>
</table>
</td>
</tr>
<%If (sAction <> "New") Then%>
<%If (Session("AccessLevel") > 6) Then%>
<tr>
<td height=10 colspan=1>
<font size=1 face=Verdana><b>Notations:
</b></font
>
</td>
<td align="right" height=10 colspan=1>
<font size=1 face=Verdana><b><a href="../notations/addedit
New.asp?sh
owtop=no&a
id=<%=sEvn
tID%>&pid=
<%=sEventP
atientID%>
" onclick="NewWindow(this.hr
ef,'popup'
,'650','20
0','no','c
enter');re
turn false" onfocus="this.blur()">Add Notation:</a></b></font>
</td>
</tr>
<tr>
<td height=10 bgcolor="#6089c7" colspan=4></td>
</tr>
<tr>
<td colspan="4" align="center" height="100">
<IFRAME SRC="../notations/notation
s_i.asp?ai
d=<%=sEvnt
ID%>" Name="Notations" SCROLLING="AUTO" HSPACE="0" VSPACE="0" FRAMEBORDER="0" MARGINHEIGHT="5" ALIGN="MIDDLE" MARGINWIDTH="5" WIDTH="100%" HEIGHT="150"><font color='003366'></IFRAME>
</td>
</tr>
<%
End IF
End If
%>
</table>
</form>
</body>
</html>
'*************************
** Form in Iframe **************************
****
<!-- #include file="../functions.asp" -->
<%
If (Session("StaffID") < 1) Then
'Response.Redirect("../Log
in.asp")
End If
Department_On = True 'Switch for Department_On
Category_On = False 'Switch for Category_On
sPage = "techCalendar_inc"
Session("AdminLevel") = "full"
iStaffID = Session("StaffID")
sTdHeight = 15
Dim Repeat1__numRows, Repeat1__index, iEvent, iClick
iDept =14
'iDept = Request.Form("edit_Departm
ent_ID")
iEvent = Request.Form("edit_EventCa
tegory_ID"
)
If Request("iDate") <> "" Then
iDate = DateValue(Request("iDate")
)
Else
iDate = date
End if
set rsEventsDay = Server.CreateObject("ADODB
.Recordset
")
rsEventsDay.ActiveConnecti
on = "DSN=" & dsn
IF (iEvent = 0) And (iDept = 0 )Then ' If no Dept or Cat is selected
rsEventsDay.Source = "SELECT * FROM TechSchd ORDER BY TechSchdDate"
Else
rsEventsDay.Source = "select * from TechSchd " + _
"where TechSchdLocID =" & iDept & " " + _
"ORDER BY TechSchdDate ASC;"
End IF
rsEventsDay.CursorType = 0
rsEventsDay.CursorLocation
= 2
rsEventsDay.LockType = 3
rsEventsDay.Open()
rsEventsDay_numRows = 0
Repeat1__numRows = -1
Repeat1__index = 0
rsEventsDay_numRows = rsEventsDay_numRows + Repeat1__numRows
sAction = Request("action")
IF (sAction = "Go") Then
iEvent = Request.Form("edit_EventCa
tegory_ID"
)
iDept = Request.Form("edit_Departm
ent_ID")
sMonth = Request.Form("sMonth")
syear = Request.Form("sYear")
iDate =DateSerial(sYear, sMonth, 1)
End IF
IF (sAction = "Today") Then
iDate = date
End if
Sub getColor2(cEvent)
sSQL = "SELECT * FROM EventCategoryRT WHERE EventCategoryRT_evntID =" & cEventID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventCatID = objRS("EventCategoryRT_Eve
ntCategory
ID")
End IF
DBClose
IF (sEventCatID <> "") Then
sSQL = "SELECT EventCategory_Color FROM EventCategory WHERE EventCategory_ID =" & sEventCatID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventCatColor = objRS("EventCategory_Color
")
End IF
DBClose
End IF
End Sub
Sub getColor(cEvent)
sSQL = "SELECT * FROM EventCategoryRT WHERE EventCategoryRT_evntID =" & cEventID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventCatID = objRS("EventCategoryRT_Eve
ntCategory
ID")
End IF
DBClose
IF (sEventCatID <> "") Then
sSQL = "SELECT EventCategory_Color FROM EventCategory WHERE EventCategory_ID =" & sEventCatID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventCatColor = objRS("EventCategory_Color
")
End IF
DBClose
End IF
End Sub
Sub LoadCombo(iEvent)
sSQL = "SELECT EventCategory_ID, EventCategory_Name FROM EventCategory ORDER BY EventCategory_Name; "
DBConnect sSQL
Response.Write("<OPTION selected value='0'>Show All</OPTION>")
While Not objRS.EOF
iTemp = CInt(objRS("EventCategory_
ID"))
IF (CInt(iEvent) = iTemp) Then
Response.Write("<OPTION selected value='" & iTemp & "'>" & objRS("EventCategory_Name"
) & "</OPTION>")
Else
Response.Write("<OPTION value='" & iTemp & "'>" & objRS("EventCategory_Name"
) & "</OPTION>")
End IF
objRS.MoveNext
Wend
DBClose
End Sub
Sub LoadCombo2(iDept)
sSQL = "SELECT EventDepartment_ID, EventDepartment_Name FROM EventDepartment ORDER BY EventDepartment_Name; "
DBConnect sSQL
Response.Write("<OPTION selected value='0'>Show All</OPTION>")
While Not objRS.EOF
iTemp1 = CInt(objRS("EventDepartmen
t_ID"))
IF (CInt(iDept) = iTemp1) Then
Response.Write("<OPTION selected value='" & iTemp1 & "'>" & objRS("EventDepartment_Nam
e") & "</OPTION>")
Else
Response.Write("<OPTION value='" & iTemp1 & "'>" & objRS("EventDepartment_Nam
e") & "</OPTION>")
End IF
objRS.MoveNext
Wend
DBClose
End Sub
CurrentMonth = Month(iDate)
CurrentMonthName = MonthName(CurrentMonth)
CurrentYear = Year(iDate)
FirstDayDate = DateSerial(CurrentYear, CurrentMonth, 1)
FirstDay = WeekDay(FirstDayDate, 0)
CurrentDay = FirstDayDate
%>
<!-- #inzzclude file="../tabmenu.asp" -->
<script language="JavaScript">
var popupwidth = 150;
var popupheight = 100;
function showpopup(popupid,defaultp
r)
{
var obj = MM_findObj(popupid);
var helptext = 'Desc: '+defaultpr;
obj.innerText = helptext;
obj.style.left = eval(event.x + document.body.scrollLeft - popupwidth);
obj.style.top = eval(event.y + document.body.scrollTop - (popupheight/2));
if (document.all) { document.all(popupid).styl
e.visibili
ty = "visible" }
else { document[popupid].visibili
ty = "show" }
}
function hidepopup(popupid)
{
if (document.all) { document.all(popupid).styl
e.visibili
ty = "hidden" }
else { document[popupid].visibili
ty = "hide" }
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&p
arent.fram
es.length)
{
d=parent.frames[n.substrin
g(p+1)].do
cument; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;
i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.
layers.len
gth;i++) x=MM_findObj(n,d.layers[i]
.document)
;
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
</script>
<link rel="stylesheet" href="<%=sAbsolutePath%>ed
itmenu.css
" type="text/css">
<div class = "links">
<form name="frmMainIframe" action="techCalendar_inc.a
sp" method="post">
<table width="600" align=center border="0" cellpadding="2" cellspacing="1" bgcolor="#cccccc">
<tr>
<td colspan=2>
Patient Name:
<!-- #include file="../patients/Pat_inc.
asp" -->
</td>
</tr>
<tr>
<td>
<table width="250" align=center border="0" cellpadding="2" cellspacing="1" bgcolor="#cccccc">
<tr>
<td>
<!-- #include file="loc_inc.asp" -->
</td>
</tr>
</table>
</td>
<td>
<table width="250" align=center border="1" cellpadding="2" cellspacing="1" bgcolor="#cccccc">
<tr>
<td class="bgMonthListing" align="center" colspan="7">
<table width="100%" align=center border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="bgMonthListing">
<!-- This is the Left Arrow for Month -->
« <A Href="techCalendar_inc.asp
?iDate=<%=
Server.URLEncode(DateAdd("
m",-1, iDate))%>&sAction=""&iEven
t="edit_Ev
entCategor
y_ID""><%=
UCASE(Left(MonthName(Month
(DateAdd("
m", -1, CurrentDay))),3)) %></a>
<!-- This is the Selection for Month -->
<select class="cal5" name="sMonth" ID="Select1">
<option value="1" <%If CurrentMonth="1" Then%>selected<%End If%>>January</option>
<option value="2" <%If CurrentMonth="2" Then%>selected<%End If%>>February</option>
<option value="3" <%If CurrentMonth="3" Then%>selected<%End If%>>March</option>
<option value="4" <%If CurrentMonth="4" Then%>selected<%End If%>>April</option>
<option value="5" <%If CurrentMonth="5" Then%>selected<%End If%>>May</option>
<option value="6" <%If CurrentMonth="6" Then%>selected<%End If%>>June</option>
<option value="7" <%If CurrentMonth="7" Then%>selected<%End If%>>July</option>
<option value="8" <%If CurrentMonth="8" Then%>selected<%End If%>>August</option>
<option value="9" <%If CurrentMonth="9" Then%>selected<%End If%>>September</option>
<option value="10" <%If CurrentMonth="10" Then%>selected<%End If%>>October</option>
<option value="11" <%If CurrentMonth="11" Then%>selected<%End If%>>November</option>
<option value="12" <%If CurrentMonth="12" Then%>selected<%End If%>>December</option>
</select>
<!-- This is the Selection for Year -->
<select class="cal5" name="sYear" ID="Select2">
<option value="2004" <%If CurrentYear="2004" Then%>selected<%End If%>>2004</option>
<option value="2005" <%If CurrentYear="2005" Then%>selected<%End If%>>2005</option>
<option value="2006" <%If CurrentYear="2006" Then%>selected<%End If%>>2006</option>
<option value="2007" <%If CurrentYear="2007" Then%>selected<%End If%>>2007</option>
<option value="2008" <%If CurrentYear="2008" Then%>selected<%End If%>>2008</option>
<option value="2009" <%If CurrentYear="2009" Then%>selected<%End If%>>2009</option>
<option value="2010" <%If CurrentYear="2010" Then%>selected<%End If%>>2010</option>
<option value="2011" <%If CurrentYear="2011" Then%>selected<%End If%>>2011</option>
<option value="2012" <%If CurrentYear="2012" Then%>selected<%End If%>>2012</option>
<option value="2013" <%If CurrentYear="2013" Then%>selected<%End If%>>2013</option>
<option value="2014" <%If CurrentYear="2014" Then%>selected<%End If%>>2014</option>
</select>
<input type="submit" value="Go" name="action">
<!-- This is the Right Arrow for Month -->
<A Href="techCalendar_inc.asp
?iDate=<%=
Server.URLEncode(DateAdd("
m",1,iDate
))%>&sActi
on="""><%=
UCASE(Left(MonthName(Month
(DateAdd("
m", 1, CurrentDay))),3)) %></a> »
</td>
</tr>
</table>
</td>
</tr>
<tr>
<% For DayLoop = 1 to 7 %>
<td width="100" align="center" valign="middle" class="bgDayListing">
<%= WeekDayName(Dayloop, True, 0)%>
</td>
<% Next%>
</tr>
<tr align="center" valign="middle">
<%
If FirstDay <> 1 Then
i = FirstDay - 1
Do While i > 0
%>
<TD height="<%=sTdHeight%>" align="right" valign="top" class="bgGrey">
<%=Day(CurrentDay - i)%>
</td>
<%
i = i - 1
Loop
%>
<%
End if
DayCounter = FirstDay
CorrectMonth = True
Do While CorrectMonth = True
%>
<TD height="<%=sTdHeight%>" align="right" valign="top" bgcolor="##F0FFFF" class="text_cal">
<%IF (iDept = 0 )Then ' If no Location is selected%>
<%'=Day(CurrentDay)%>
<%Else%>
<!--<A Href="addeditTech.asp?acti
on=New&iLI
D=<%=iDept
%>&iCID=<%
=0%>&iDate
=<%= Server.URLEncode(CurrentDa
y)%>"" onclick="NewWindow(this.hr
ef,'popup'
,'350','12
5','no','c
enter');re
turn false" onfocus="this.blur()"><%=D
ay(Current
Day)%></A>
-->
<%End If%>
<%
rsEventsDay.Filter = "TechSchdDate = #" & CurrentDay & "#"
If not rsEventsDay.EOF Or not rsEventsDay.BOF Then
While ((Repeat1__numRows <> 0) AND (NOT rsEventsDay.EOF))
cEventID = rsEventsDay("TechSchdID")
sSQL = "SELECT * FROM TechSchd WHERE TechSchdID =" & cEventID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventCatID = objRS("TechSchdTechID")
sDeptCatID = objRS("TechSchdLocID")
End IF
DBClose
IF (sEventCatID <> "") Then
sSQL = "SELECT EventCategory_Name, EventCategory_Color FROM EventCategory WHERE EventCategory_ID =" & sEventCatID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventCatName = objRS("EventCategory_Name"
)
sEventCatColor = objRS("EventCategory_Color
")
End IF
DBClose
End IF
IF (sDeptCatID <> "") Then
sSQL = "SELECT EventDepartment_Name, EventDepartment_Color FROM EventDepartment WHERE EventDepartment_ID =" & sDeptCatID & " "
DBConnect sSQL
IF Not objRS.EOF Then
sEventDeptName = objRS("EventDepartment_Nam
e")
sEventDeptColor = objRS("EventDepartment_Col
or")
End IF
DBClose
End IF
%>
<%'getColor%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<TD height="<%=sTdHeight%>" align="right" valign="top" bgcolor="<%=sEventDeptColo
r%>" class="text_cal">
<a style="color:<%=sEventDept
Color%>;" href="addeditNew.asp?iTID=
<%=(rsEven
tsDay.Fiel
ds.Item("T
echSchdID"
).Value)%>
&iCID=<%= (rsEventsDay.Fields.Item("
TechSchdTe
chID").Val
ue)%>&iLID
=<%=(rsEve
ntsDay.Fie
lds.Item("
TechSchdLo
cID").Valu
e)%>&iDate
=<%= Server.URLEncode(CurrentDa
y)%>"><%=D
ay(Current
Day)%></a>
</td>
</tr>
</table>
<%
Repeat1__index=Repeat1__in
dex+1
Repeat1__numRows=Repeat1__
numRows-1
rsEventsDay.MoveNext()
Wend
End If
%>
</TD>
<%
DayCounter = DayCounter + 1
If DayCounter > 7 then
DayCounter = 1 %>
</TR>
<tr align="center" valign="middle">
<%
End if
CurrentDay = DateAdd("d", 1, CurrentDay)
If Month(CurrentDay) <> CurrentMonth then
CorrectMonth = False
End if
Loop
If DayCounter <> 1 Then
i = 0
Do While i < 8 - DayCounter
%>
<TD height="<%=sTdHeight%>" align="right" valign="top" class="bgGrey"><%= i + 1 %></TD>
<%
i = i + 1
Loop
End if
%>
</TR>
<tr>
<td colspan=7>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
<div id="EventDesc" contenteditable="true" style="position:absolute;
width:<%=popupwidth%>px; height:<%=popupheight%>px;
z-index:1;
visibility: hidden; background-color: #ffff99; border-width: 1;
border-style : solid ; border-color : #b4ceec" ></div>