-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateContainer.cfm
337 lines (316 loc) · 10.2 KB
/
CreateContainer.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
<cfinclude template = "includes/_header.cfm">
<!---- this is an internal use page and needs a security wrapper --->
This form is obsolete. Please file a bug report detailing how you got here.
<p>
The current form is <a href="EditContainer.cfm?action=newContainer">here</a>
</p>
<cfabort>
<cfset title="Create Container">
<cfif URL.action is "CreateNew">
<!--- Make sure we have required values--->
<cfif #container_type# is not ""><!--- always required-got that, so we can make the container--->
<cfset mkCont = "valid">
<cfelse><cfset mkCont = "invalid">
</cfif>
<cfif #checked_date# is not ""
OR #fluid_type# is not ""
OR #concentration# is not ""
OR #fluid_remarks# is not ""><!--- They are trying to make a fluid container, make sure they have all required values--->
<cfif #checked_date# is ""
OR #fluid_type# is ""
OR #concentration# is ""><!--- They put in all the required fields--->
<cfset mkFluid = "invalid">
<cfelse><cfset mkFluid = "valid">
</cfif>
<cfelse><cfset mkFluid = "noTry">
</cfif>
<cfoutput>
<cfif #mkCont# is "valid" and #mkFluid# is "noTry">
<cfquery name="nextContainer" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
SELECT sq_container_id.nextval newid FROM dual
</cfquery>
<cfset container_id = "#nextContainer.newid#">
<!--- clean up nulls --->
<cfif #label# is "">
<cfset label = "null">
<cfelse><cfset label = "'#label#'">
</cfif>
<cfif #description# is "">
<cfset description = "null">
<cfelse><cfset description = "'#description#'">
</cfif>
<cfif #container_remarks# is "">
<cfset container_remarks = "null">
<cfelse><cfset container_remarks = "'#container_remarks#'">
</cfif>
<cfif #barcode# is "">
<cfset barcode = "null">
<cfelse><cfset barcode = "'#barcode#'">
</cfif>
<cfif #width# is "">
<cfset width = "null">
<cfelse><cfset width = "#width#">
</cfif>
<cfif #height# is "">
<cfset height = "null">
<cfelse><cfset height = "#height#">
</cfif>
<cfif #length# is "">
<cfset length = "null">
<cfelse><cfset length = "#length#">
</cfif>
<cfif #number_positions# is "">
<cfset number_positions = "null">
<cfelse><cfset number_positions = "#number_positions#">
</cfif>
<cfquery name="setDate" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
alter session set nls_date_format = 'yyyy-mm-ddTHH24:MI:SS'
</cfquery>
<cfset newContainerSQL="INSERT INTO
container
(container_id,
parent_container_id,
container_type,
label,
description,
container_remarks,
barcode,
width,
height,
length,
number_positions,
locked_position,
institution_acronym)
VALUES
(#container_id#,
0,
'#container_type#',
#label#,
#description#,
#container_remarks#,
#barcode#,
#width#,
#height#,
#length#,
#number_positions#,
0,
'#institution_acronym#')">
<cftransaction>
<cfquery name="newContainer" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
#preservesinglequotes(newContainerSQL)#
</cfquery>
</cftransaction>
<font color="##00FF00"><br>
You created a new dry container: <br>
ID: #container_id# <br>
Type: #container_type# <br>
Description: #description# <br>
Barcode: #barcode# <br>
Remarks: #container_remarks#</font> <br>
</cfif>
<cfif #mkCont# is "valid" and #mkFluid# is "valid">
<!--- Get the next container_id --->
<cfquery name="nextContainer" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
SELECT sq_container_id.nextval newid FROM dual
</cfquery>
<cfset container_id = "#nextContainer.newid#">
<!--- clean up nulls --->
<cfif #label# is "">
<cfset label = "null">
<cfelse><cfset label = "'#label#'">
</cfif>
<cfif #description# is "">
<cfset description = "null">
<cfelse><cfset description = "'#description#'">
</cfif>
<cfif #container_remarks# is "">
<cfset container_remarks = "null">
<cfelse><cfset container_remarks = "'#container_remarks#'">
</cfif>
<cfif #barcode# is "">
<cfset barcode = "null">
<cfelse><cfset barcode = "'#barcode#'">
</cfif>
<cfif #fluid_remarks# is "">
<cfset fluid_remarks = "null">
<cfelse><cfset fluid_remarks = "'#fluid_remarks#'">
</cfif>
<cfif #width# is "">
<cfset width = "null">
<cfelse><cfset width = "'#width#'">
</cfif>
<cfif #height# is "">
<cfset height = "null">
<cfelse><cfset height = "'#height#'">
</cfif>
<cfif #length# is "">
<cfset length = "null">
<cfelse><cfset length = "'#length#'">
</cfif>
<cfif #number_positions# is "">
<cfset number_positions = "null">
<cfelse><cfset number_positions = "'#number_positions#'">
</cfif>
<cfset newContainerSQL="INSERT INTO
container
(container_id,
parent_container_id,
container_type,
label,
description,
container_remarks,
barcode,
width,
height,
length,
number_positions)
VALUES
(#container_id#,
0,
'#container_type#',
#label#,
#description#,
#container_remarks#,
#barcode#,
#width#,
#height#,
#length#,
#number_positions#)">
<cfset newFlSql = "INSERT INTO
fluid_container_history
(container_id,
checked_date,
fluid_type,
concentration,
fluid_remarks)
VALUES
(#container_id#,
'#checked_date#',
'#fluid_type#',
#concentration#,
#fluid_remarks#)">
<cftransaction>
<cfquery name="newFluidContainer" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
#preservesinglequotes(newFlSql)#
</cfquery>
<cfquery name="newContainer" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
#preservesinglequotes(newContainerSQL)#
</cfquery>
</cftransaction>
<font color="##00FF00"><br>
You created a new fluid container: <br>
ID: #container_id# <br>
Type: #container_type# <br>
Description: #description# <br>
Barcode: #barcode# <br>
Remarks: #container_remarks# <br>
Fluid Checked Date: #checked_date# <br>
Fluid Type: #fluid_type# <br>
Concentration: #concentration# <br>
Fluid Remarks: #fluid_remarks#</font> <br>
</cfif>
<cfif #mkCont# is "invalid">
<font color="##FF0000"><br>
You have not entered enough data to create a container. Container Type is
a required field.</font>
</cfif>
<cfif #mkCont# is "valid" and #mkFluid# is "invalid">
<font color="##FF0000"><br>
It appears that you are trying to create a fluid container, but you have
not entered enough information to do so.</font>
</cfif>
</cfoutput>
</cfif><!---end of <cfif URL.action is "CreateNew">--->
<cfquery name="ContType" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select container_type as ctContType from ctcontainer_type
</cfquery>
<cfquery name="FluidType" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select fluid_type from ctFluid_Type ORDER BY fluid_type
</cfquery>
<form name="form1" method="post" action="CreateContainer.cfm?&action=CreateNew">
<table border="0">
<tr>
<td colspan="2" align="center">
<b>Create Container</b>
</td>
</tr>
<tr>
<td align="right"><b>Container Type:</b></td>
<td>
<select name="Container_Type" size="1" class="reqdClr">
<option value=""></option>
<cfoutput query="ContType">
<cfif #ContType.ctContType# is not "collection object">
<option value="#ContType.ctContType#">#ContType.ctContType#</option>
</cfif>
</cfoutput>
</select>
</td>
</tr>
<tr>
<td align="right"><b>Dimensions:</b></td>
<td>
W: <input name="width" type="text" value="" size="6">
H: <input name="height" type="text" value="" size="6">
L: <input name="length" type="text" value="" size="6">
</td>
</tr>
<tr>
<td align="right"><b>Number of Positions:</b></td>
<td>
<input name="number_positions" type="text" value="">
</td>
</tr>
<tr>
<td align="right"><b>Description:</b></td>
<td>
<input name="description" type="text" value="">
</td>
</tr>
<tr>
<td align="right"><b>Barcode:</b></td>
<td><input name="barcode" type="text" value=""></td>
</tr>
<tr>
<td align="right"><b>Label:</b></td>
<td><input name="label" type="text" value="" class="reqdClr"></td>
</tr> <tr>
<td align="right"><b>Remarks:</b></td>
<td><input name="container_remarks" type="text" value=""></td>
</tr>
<tr>
<td align="right"><b>Fluid Checked Date:</b></td>
<td><input name="checked_date" type="text" value=""></td>
</tr>
<tr>
<td align="right"><b>Fluid Type:</b></td>
<td>
<select name="Fluid_Type" size="1">
<option value=""></option>
<cfoutput query="FluidType">
<option value="#FluidType.Fluid_Type#">#FluidType.Fluid_Type#</option>
</cfoutput>
</select>
</td>
</tr>
<tr>
<td align="right"><b>Fluid Concentration:</b></td>
<td><input name="concentration" type="text" value=""></td>
</tr>
<tr>
<td align="right"><b>Fluid Remarks: </b></td>
<td>
<input name="fluid_remarks" type="text" value="">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<cfoutput>
<input type="submit" value="Create Container" class="insBtn"
onmouseover="this.className='insBtn btnhov'" onmouseout="this.className='insBtn'">
</cfoutput>
</td>
</tr>
</table>
</form>
<cfinclude template = "includes/_footer.cfm">