-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccnscan.cfm
140 lines (130 loc) · 4.01 KB
/
accnscan.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
<!---
create table accn_scan (
id number not null,
accn_number varchar2(30) not null,
accn_id number,
remark varchar2(255),
barcode varchar2(255) not null,
container_id number,
who varchar2(255),
when date
);
alter table accn_scan modify remark null;
create unique index u_pi_accn_barcode on accn_scan(barcode) tablespace uam_idx_1;
create unique index u_pi_accn_accn on accn_scan(accn_number) tablespace uam_idx_1;
create sequence sq_accn_scan_id;
CREATE OR REPLACE TRIGGER tg_accn_scan_key
before insert ON accn_scan
for each row
begin
select
sq_accn_scan_id.nextval,
sys_context('USERENV', 'SESSION_USER'),
sysdate
into
:new.id,
:new.who,
:new.when
from dual;
end;
/
CREATE PUBLIC SYNONYM accn_scan FOR accn_scan;
GRANT all ON accn_scan to data_entry;
--->
<cfinclude template="/includes/_header.cfm">
<cfoutput>
<cfset numAccnRow=1>
<cfif action is "nothing">
<script>
jQuery(document).ready(function() {
$("##barcode").focus();
});
</script>
<cfset title="ES Imaging: Accn Cards">
Use this form to attach barcodes to UAM Paleo Accesson Cards.
<br>Barcode and Accession are exact case-sensitive match.
<br>Sucessful save will silently redirect to an empty form. Errors will be listed; use your back button to fix them.
"UI_bla bla bla" errors are Unique Index problems: we've already got one.
<br>See existing data <a href="accnscan.cfm?action=list">[ here ]</a>
<hr>
<form name="f" action="accnscan.cfm" method="post">
<input type="hidden" name="action" value="saveNew">
<label for="barcode">Barcode</label>
<input type="text" name="barcode" id="barcode">
<label for="accn">Accn</label>
<input type="text" name="accn" id="accn">
<label for="remark">Remark</label>
<input type="text" name="remark" id="remark">
<br><input type="submit" class="savBtn" value="Save Accn/Barcode">
</form>
</cfif>
<cfif action is "saveNew">
<cfset title="ES Imaging: Accn Cards: Dammit">
<cftransaction>
<br>barcode: #barcode#
<cfquery name="vB" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select container_id from container where barcode='#barcode#'
</cfquery>
<cfif vB.recordcount is 1>
is valid (#vB.container_id#)
<cfelse>
is invalid. Use your back button.
<cfabort>
</cfif>
<br>accn: #accn#
<cfquery name="vA" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select accn.transaction_id from
trans,accn where
trans.transaction_id=accn.transaction_id and
trans.collection_id=21 and
accn.accn_number='#accn#'
</cfquery>
<cfif vA.recordcount is 1>
is valid (#vA.transaction_id#)
<cfelse>
is invalid Use your back button.
<cfabort>
</cfif>
<br>comment: #remark#
<br>inserting....
<cfquery name="vA" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into accn_scan (
accn_number,
accn_id,
remark,
barcode,
container_id
) values (
'#accn#',
#vA.transaction_id#,
'#escapeQuotes(remark)#',
'#barcode#',
#vB.container_id#
)
</cfquery>
<br>success!
</cftransaction>
<cflocation url="accnscan.cfm" addtoken="false">
</cfif>
<cfif action is "list">
<script src="/includes/sorttable.js"></script>
<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from accn_scan
</cfquery>
<table border id="t" class="sortable">
<tr>
<th>Barcode</th>
<th>Accn</th>
<th>Remark</th>
</tr>
<cfloop query="d">
<tr>
<td>#barcode#</td>
<td>#accn_number#</td>
<td>#remark#</td>
</tr>
</cfloop>
</table>
</cfif>
</cfoutput>
<cfinclude template="/includes/_footer.cfm">