-
Notifications
You must be signed in to change notification settings - Fork 0
/
incAahsl.cfm
342 lines (337 loc) · 12.2 KB
/
incAahsl.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<cfset colSpan = 6>
<cfif FORM.Duration>
<cfset colSpan = colSpan + 1>
</cfif>
<cfif FORM.PrepTime>
<cfset colSpan = colSpan + 1>
</cfif>
<cfif FORM.Feedback>
<cfset feedSpan = colSpan - 1>
</cfif>
<cfset grandSession = 0>
<cfset grandPeople = 0>
<cfset grandDur = 0>
<cfset grandPrep = 0>
<table width="98%" border="1" cellspacing="1" cellpadding="1" summary="One-on-one consultation for Fiscal Year">
<caption align="center" style="font-weight:bold">
One-on-one consultation
<cfoutput>
<cfif FORM.QuarterID neq 0 and FORM.FYear eq 0 and FORM.CYear eq 0>
<cfif FORM.QuarterID eq 1>Fall</cfif>
<cfif FORM.QuarterID eq 2>Winter</cfif>
<cfif FORM.QuarterID eq 3>Spring</cfif>
<cfif FORM.QuarterID eq 4>Summer</cfif>
FY #fiscalYear#/#fiscalYear + 1#
<cfelseif FORM.QuarterID neq 0 and FORM.FYear neq 0>
<cfif FORM.QuarterID eq 1>Fall</cfif>
<cfif FORM.QuarterID eq 2>Winter</cfif>
<cfif FORM.QuarterID eq 3>Spring</cfif>
<cfif FORM.QuarterID eq 4>Summer</cfif>
FY #FORM.FYear#/#FORM.FYear + 1#
<cfelseif FORM.QuarterID neq 0 and FORM.CYear neq 0>
<cfif FORM.QuarterID eq 1>Fall</cfif>
<cfif FORM.QuarterID eq 2>Winter</cfif>
<cfif FORM.QuarterID eq 3>Spring</cfif>
<cfif FORM.QuarterID eq 4>Summer</cfif>
#FORM.CYear#
<cfelseif FORM.FYear neq 0>
FY #FORM.FYear#/#FORM.FYear + 1#
<cfelseif FORM.CYear neq 0>
#FORM.CYear#
<cfelseif FORM.SessionDate neq "">
#FORM.SessionDate#
<cfelse>
FY #fiscalYear#/#fiscalYear + 1#
</cfif>
</cfoutput>
</caption>
</table>
<cfquery name="Units" datasource="#APPLICATION.dsn#">
SELECT DISTINCT
u.Unit,
u.UnitID
FROM
dbo.Activity a
JOIN dbo.SessionActivity sa ON a.ActivityID = sa.ActivityID
JOIN dbo.Session s ON sa.SessionID = s.SessionID
LEFT JOIN dbo.SessionLibrarian sl ON s.SessionID = sl.SessionID --AND s.CreatedBy = sl.LibrarianID
LEFT JOIN dbo.ActivityLibrarian al ON a.ActivityID = al.ActivityID
LEFT JOIN dbo.Librarian l ON s.CreatedBy = l.LibrarianID
LEFT JOIN dbo.UnitLookup u ON l.UnitID = u.UnitID
LEFT JOIN dbo.SessionContact sco ON s.SessionID = sco.SessionID
LEFT JOIN dbo.SessionClassroom scl ON s.SessionID = scl.SessionID
LEFT JOIN dbo.ActivityMaterial am ON a.ActivityID = am.ActivityID
LEFT JOIN dbo.Material m ON am.MaterialID = m.MaterialID
LEFT JOIN dbo.Contact c ON sco.ContactID = c.ContactID
LEFT JOIN dbo.SessionLearner slR ON s.SessionID = slR.SessionID
WHERE
(a.ActivityTypeID = 6 OR a.ActivityTypeID = 7 OR a.ActivityTypeID = 8)
<cfif FORM.QuarterID neq 0 and FORM.FYear eq 0 and FORM.CYear eq 0>
AND
(
s.QuarterID = #FORM.QuarterID# AND dbo.quarter_matches_year(s.SessionID, s.QuarterID, #fiscalYear#) = 1
)
<cfelseif FORM.QuarterID neq 0 and FORM.FYear neq 0>
AND
(
s.QuarterID = #FORM.QuarterID# AND dbo.quarter_matches_year(s.SessionID, s.QuarterID, #FORM.FYear#) = 1
)
<cfelseif FORM.QuarterID neq 0 and FORM.CYear neq 0>
AND
(
s.QuarterID = #FORM.QuarterID# AND Datepart(Year, s.SessionDateTime) = #FORM.CYear#
)
<cfelseif FORM.FYear neq 0>
AND
(
(Datepart(Year, s.SessionDateTime) = #FORM.FYear# AND Datepart(Month, s.SessionDateTime) BETWEEN 7 AND 12)
OR (Datepart(Year, s.SessionDateTime) = #FORM.FYear# + 1 AND Datepart(Month, s.SessionDateTime) BETWEEN 1 AND 6)
)
<cfelseif FORM.CYear neq 0>
AND
(
Datepart(Year, s.SessionDateTime) = #FORM.CYear#
)
<cfelseif FORM.SessionDate neq "">
AND s.SessionDateTime between '#FORM.SessionDate# 00:00.0' and '#FORM.SessionDate# 23:59.9'
<cfelse>
AND
(
(Datepart(Year, s.SessionDateTime) = #fiscalYear# AND Datepart(Month, s.SessionDateTime) BETWEEN 7 AND 12)
OR (Datepart(Year, s.SessionDateTime) = #fiscalYear# + 1 AND Datepart(Month, s.SessionDateTime) BETWEEN 1 AND 6)
)
</cfif>
<cfif IsDefined("FORM.OwnerID")>
AND s.CreatedBy = #FORM.OwnerID#
</cfif>
<cfif IsDefined("FORM.Presenters")>
AND sl.LibrarianID in (#FORM.Presenters#)
</cfif>
<cfif IsDefined("FORM.Developers")>
AND al.LibrarianID in (#FORM.Developers#)
</cfif>
<cfif FORM.CntctID neq 0>
AND sco.ContactID = #FORM.CntctID#
</cfif>
<cfif FORM.DepartmentID neq 0>
AND s.DepartmentID = #FORM.DepartmentID#
</cfif>
<cfif IsDefined("FORM.LearnerCategoryID")>
AND slR.LearnerCategoryID IN (#FORM.LearnerCategoryID#)
</cfif>
<cfif IsDefined("FORM.DeliveryModes") and FORM.DeliveryModes neq "">
AND (a.DeliveryModes like '%#ListFirst(FORM.DeliveryModes,",")#%'
<cfloop index="delivID" list="#ListRest(FORM.DeliveryModes,',')#" delimiters=",">
OR a.DeliveryModes like '%#delivID#%'
</cfloop>
)
</cfif>
<cfif FORM.MaterialTypeID neq 0>
AND m.MaterialTypeID = #FORM.MaterialTypeID#
</cfif>
<cfif FORM.UnitID neq 0>
AND l.UnitID = #FORM.UnitID#
</cfif>
<cfif FORM.FacultyGroup neq "">
AND c.FacultyGroup = '#FORM.FacultyGroup#'
</cfif>
ORDER BY
u.Unit
</cfquery>
<cfoutput query="Units">
<cfset sessionCount = 0>
<cfset peopleCount = 0>
<cfset durCount = 0>
<cfset prepCount = 0>
<cfquery name="Aahsl" datasource="#APPLICATION.dsn#">
SELECT DISTINCT
dbo.build_session_title(S.SessionID) AS Title,
Coalesce(s.GroupName, 'N/A') AS GroupName,
dbo.get_presenters_by_session(s.SessionID) AS CoLibs,
dbo.get_developers_by_session(a.ActivityID) AS Developers,
dbo.get_presenters_by_session(s.SessionID) AS Presenters,
s.SessionDateTime,
s.FeedbackText,
dbo.total_sessions(s.SessionID) AS Sessions,
dbo.count_attendees_by_session(s.SessionID) AS People,
Coalesce(dbo.total_duration(s.SessionID), 0) AS Duration,
dbo.get_display_time((Coalesce(dbo.total_duration(s.SessionID), 0))) AS display_dur,
Coalesce(dbo.total_prep_time(s.SessionID), 0) AS PrepTime,
dbo.get_display_time((Coalesce(dbo.total_prep_time(s.SessionID), 0))) AS display_prep
FROM
dbo.Activity a
JOIN dbo.SessionActivity sa ON a.ActivityID = sa.ActivityID
JOIN dbo.Session s ON sa.SessionID = s.SessionID
LEFT JOIN dbo.SessionLibrarian sl ON s.SessionID = sl.SessionID --AND s.CreatedBy = sl.LibrarianID
LEFT JOIN dbo.ActivityLibrarian al ON a.ActivityID = al.ActivityID
LEFT JOIN dbo.Librarian l ON s.CreatedBy = l.LibrarianID
LEFT JOIN dbo.SessionContact sco ON s.SessionID = sco.SessionID
LEFT JOIN dbo.SessionClassroom scl ON s.SessionID = scl.SessionID
LEFT JOIN dbo.ActivityMaterial am ON a.ActivityID = am.ActivityID
LEFT JOIN dbo.Material m ON am.MaterialID = m.MaterialID
LEFT JOIN dbo.Contact c ON sco.ContactID = c.ContactID
LEFT JOIN dbo.SessionLearner slR ON s.SessionID = slR.SessionID
WHERE
(a.ActivityTypeID = 6 OR a.ActivityTypeID = 7 OR a.ActivityTypeID = 8)
AND l.UnitID = #Units.UnitID#
<cfif FORM.QuarterID neq 0 and FORM.FYear eq 0 and FORM.CYear eq 0>
AND
(
s.QuarterID = #FORM.QuarterID# AND dbo.quarter_matches_year(s.SessionID, s.QuarterID, #fiscalYear#) = 1
)
<cfelseif FORM.QuarterID neq 0 and FORM.FYear neq 0>
AND
(
s.QuarterID = #FORM.QuarterID# AND dbo.quarter_matches_year(s.SessionID, s.QuarterID, #FORM.FYear#) = 1
)
<cfelseif FORM.QuarterID neq 0 and FORM.CYear neq 0>
AND
(
s.QuarterID = #FORM.QuarterID# AND Datepart(Year, s.SessionDateTime) = #FORM.CYear#
)
<cfelseif FORM.FYear neq 0>
AND
(
(Datepart(Year, s.SessionDateTime) = #FORM.FYear# AND Datepart(Month, s.SessionDateTime) BETWEEN 7 AND 12)
OR (Datepart(Year, s.SessionDateTime) = #FORM.FYear# + 1 AND Datepart(Month, s.SessionDateTime) BETWEEN 1 AND 6)
)
<cfelseif FORM.CYear neq 0>
AND
(
Datepart(Year, s.SessionDateTime) = #FORM.CYear#
)
<cfelseif FORM.SessionDate neq "">
AND s.SessionDateTime between '#FORM.SessionDate# 00:00.0' and '#FORM.SessionDate# 23:59.9'
<cfelse>
AND
(
(Datepart(Year, s.SessionDateTime) = #fiscalYear# AND Datepart(Month, s.SessionDateTime) BETWEEN 7 AND 12)
OR (Datepart(Year, s.SessionDateTime) = #fiscalYear# + 1 AND Datepart(Month, s.SessionDateTime) BETWEEN 1 AND 6)
)
</cfif>
<cfif IsDefined("FORM.OwnerID")>
AND s.CreatedBy = #FORM.OwnerID#
</cfif>
<cfif IsDefined("FORM.Presenters")>
AND sl.LibrarianID in (#FORM.Presenters#)
</cfif>
<cfif IsDefined("FORM.Developers")>
AND al.LibrarianID in (#FORM.Developers#)
</cfif>
<cfif FORM.CntctID neq 0>
AND sco.ContactID = #FORM.CntctID#
</cfif>
<cfif FORM.DepartmentID neq 0>
AND s.DepartmentID = #FORM.DepartmentID#
</cfif>
<cfif IsDefined("FORM.LearnerCategoryID")>
AND slR.LearnerCategoryID IN (#FORM.LearnerCategoryID#)
</cfif>
<cfif IsDefined("FORM.DeliveryModes") and FORM.DeliveryModes neq "">
AND (a.DeliveryModes like '%#ListFirst(FORM.DeliveryModes,",")#%'
<cfloop index="delivID" list="#ListRest(FORM.DeliveryModes,',')#" delimiters=",">
OR a.DeliveryModes like '%#delivID#%'
</cfloop>
)
</cfif>
<cfif FORM.MaterialTypeID neq 0>
AND m.MaterialTypeID = #FORM.MaterialTypeID#
</cfif>
<cfif FORM.FacultyGroup neq "">
AND c.FacultyGroup = '#FORM.FacultyGroup#'
</cfif>
ORDER BY
Title,
GroupName
</cfquery>
<h3>#Units.Unit#</h3>
<table width="98%" border="1" cellspacing="1" cellpadding="1" summary="One-on-one consultation for #Units.Unit#">
<tr style="color: white; background-color: black;">
<th scope="col" align="left">Course: Group Name</th>
<th scope="col" align="left">Start Time</th>
<th scope="col" align="left">Presenter(s)</th>
<th scope="col" align="left">Developer(s)</th>
<th scope="col" align="right">Sessions</th>
<th scope="col" align="right">People</th>
<cfif FORM.Duration>
<th scope="col" align="right" nowrap>Duration</th>
</cfif>
<cfif FORM.PrepTime>
<th scope="col" align="right" nowrap>Dev/Prep. Time</th>
</cfif>
</tr>
<cfloop query="Aahsl">
<tr>
<td align="left">#Aahsl.Title#: #Aahsl.GroupName#</td>
<td align="left">#TimeFormat(Aahsl.SessionDateTime, "h:mm tt")#</td>
<td align="left">#Aahsl.Presenters#</td>
<td align="left">#Aahsl.Developers#</td>
<td align="right">#Aahsl.Sessions#</td>
<td align="right">#Aahsl.People#</td>
<cfif FORM.Duration>
<td align="right">#Aahsl.display_dur#</th>
</cfif>
<cfif FORM.PrepTime>
<td align="right">#Aahsl.display_prep#</th>
</cfif>
</tr>
<cfif FORM.Feedback>
<tr>
<td align="left">Evaluation/Feedback</td>
<td align="left" colspan="#feedSpan#">#Aahsl.FeedbackText#</td>
</tr>
</cfif>
<cfset sessionCount = sessionCount + Aahsl.Sessions>
<cfset peopleCount = peopleCount + Aahsl.People>
<cfset durCount = durCount + Aahsl.Duration>
<cfset prepCount = prepCount + Aahsl.PrepTime>
</cfloop>
<tr>
<td align="left" colspan="#colSpan#"> </td>
</tr>
<tr class="total">
<td align="left">subtotal</td>
<td align="left"> </td>
<td align="left"> </td>
<td align="left"> </td>
<td align="right">#sessionCount#</td>
<td align="right">#peopleCount#</td>
<cfif FORM.Duration>
<td align="right"><cfmodule template="convert_time.cfm" total_time=#durCount#></td>
</cfif>
<cfif FORM.PrepTime>
<td align="right"><cfmodule template="convert_time.cfm" total_time=#prepCount#></td>
</cfif>
</tr>
</table>
<cfset grandSession = grandSession + sessionCount>
<cfset grandPeople = grandPeople + peopleCount>
<cfset grandDur = grandDur + durCount>
<cfset grandPrep = grandPrep + prepCount>
</cfoutput>
<br/><br/>
<cfoutput>
<table width="98%" border="1" cellspacing="1" cellpadding="1" summary="Orientations & Tours Grand Totals">
<caption align="center" style="font-weight:bold">Grand Totals</caption>
<tr style="color: white; background-color: black;">
<th scope="col" align="left">Sessions</th>
<th scope="col" align="left">People</th>
<cfif FORM.Duration>
<th scope="col" align="left">Duration</th>
</cfif>
<cfif FORM.PrepTime>
<th scope="col" align="left">Dev/Prep. Time</th>
</cfif>
</tr>
<tr class="total">
<td align="right">#grandSession#</td>
<td align="right">#grandPeople#</td>
<cfif FORM.Duration>
<td align="right"><cfmodule template="convert_time.cfm" total_time=#grandDur#></td>
</cfif>
<cfif FORM.PrepTime>
<td align="right"><cfmodule template="convert_time.cfm" total_time=#grandPrep#></td>
</cfif>
</tr>
</table>
</cfoutput>