-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoan.cfm
2006 lines (1981 loc) · 80.8 KB
/
Loan.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<cfinclude template="includes/_header.cfm">
<cfif not isdefined("project_id")><cfset project_id = -1></cfif>
<cfquery name="ctLoanType" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select loan_type from ctloan_type order by loan_type
</cfquery>
<cfquery name="ctshipment_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select shipment_type from ctshipment_type where shipment_type like 'loan%' order by shipment_type
</cfquery>
<cfquery name="ctLoanStatus" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select loan_status from ctloan_status order by loan_status
</cfquery>
<cfquery name="ctcoll" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select collection_cde from ctcollection_cde order by collection_cde
</cfquery>
<cfquery name="cttrans_agent_role" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select distinct(trans_agent_role) from cttrans_agent_role where trans_agent_role != 'entered by' order by trans_agent_role
</cfquery>
<cfquery name="ctcollection" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select * from collection order by guid_prefix
</cfquery>
<cfquery name="ctShip" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select shipped_carrier_method from ctshipped_carrier_method order by shipped_carrier_method
</cfquery>
<cfquery name="ctType" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select loan_type from ctloan_type order by loan_type
</cfquery>
<cfquery name="ctStatus" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select loan_status from ctloan_status order by loan_status
</cfquery>
<cfquery name="ctCollObjDisp" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select coll_obj_disposition from ctcoll_obj_disp order by coll_obj_disposition
</cfquery>
<style>
.nextnum{
border:2px solid green;
position:absolute;
top:10em;
right:1em;
}
</style>
<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
$("#trans_date").datepicker();
$("#closed_date").datepicker();
$("#to_trans_date").datepicker();
$("#return_due_date").datepicker();
$("#to_return_due_date").datepicker();
$("#initiating_date").datepicker();
$("#shipped_date").datepicker();
$(".reqdClr:visible").each(function(e){
$(this).prop('required',true);
});
$("#newloan").submit(function(event){
// just call the function - it will prevent submission if necessary
checkReplaceNoPrint(event,'nature_of_material');
checkReplaceNoPrint(event,'loan_instructions');
checkReplaceNoPrint(event,'loan_description');
checkReplaceNoPrint(event,'trans_remarks');
});
$("#editloan").submit(function(event){
// just call the function - it will prevent submission if necessary
checkReplaceNoPrint(event,'nature_of_material');
checkReplaceNoPrint(event,'loan_instructions');
checkReplaceNoPrint(event,'loan_description');
checkReplaceNoPrint(event,'trans_remarks');
});
$("#saveNewProject").click(function(event){
if ($(this).prop('checked')===true) {
$("#newProjectAgent").removeClass().addClass('reqdClr').prop('required',true);
$("#project_agent_role").removeClass().addClass('reqdClr').prop('required',true);
$("#project_name").removeClass().addClass('reqdClr').prop('required',true);
} else {
$("#newProjectAgent").removeClass().prop('required',false);
$("#project_agent_role").removeClass().prop('required',false);
$("#project_name").removeClass().prop('required',false);
}
});
});
function cucAgnt(i){
if (!$("#del_agnt_" + i).prop('checked')===true) {
$("#trans_agent_" + i).removeClass().addClass('reqdClr').prop('required',true);
} else {
$("#trans_agent_" + i).removeClass().prop('required',false);
}
}
function useThsProjAgnt(n,i) {
$("#newProjectAgent").val(n);
$("#newProjectAgent_id").val(i);
}
function deleteLoan(tid){
var x=confirm('Delete this loan?');
if (x===true){
window.location='Loan.cfm?transaction_id=' + tid + '&action=deleLoan';
}
}
function removeProjectFromLoan(tid,pid){
var x=confirm('Unlink this project?');
if (x===true){
window.location='Loan.cfm?transaction_id=' + tid + '&project_id=' + pid + '&action=unlinkProject';
}
}
function setAccnNum(i,v) {
var e = document.getElementById('loan_number');
e.value=v;
var inst = document.getElementById('collection_id');
inst.value=i;
}
function dCount() {
var countThingees=new Array();
countThingees.push('nature_of_material');
countThingees.push('loan_description');
countThingees.push('loan_instructions');
countThingees.push('trans_remarks');
for (i=0;i<countThingees.length;i++) {
var els = countThingees[i];
var el=document.getElementById(els);
var elVal=el.value;
var ds='lbl_'+els;
var d=document.getElementById(ds);
var lblVal=d.innerHTML;
d.innerHTML=elVal.length + " characters";
}
var t=setTimeout("dCount()",500);
}
function addMediaHere (lnum,tid){
$("#mmmsgdiv").html('refresh the page to see just-loaded media.');
var bgDiv = document.createElement('div');
bgDiv.id = 'bgDiv';
bgDiv.className = 'bgDiv';
bgDiv.setAttribute('onclick','removeMediaDiv()');
document.body.appendChild(bgDiv);
var theDiv = document.createElement('div');
theDiv.id = 'mediaDiv';
theDiv.className = 'annotateBox';
ctl='<span class="likeLink" style="position:absolute;right:0px;top:0px;padding:5px;color:red;" onclick="removeMediaDiv();">Close Frame</span>';
theDiv.innerHTML=ctl;
document.body.appendChild(theDiv);
jQuery('#mediaDiv').append('<iframe id="mediaIframe" />');
jQuery('#mediaIframe').attr('src', '/media.cfm?action=newMedia').attr('width','100%').attr('height','100%');
jQuery('iframe#mediaIframe').load(function() {
jQuery('#mediaIframe').contents().find('#relationship__1').val('documents loan');
jQuery('#mediaIframe').contents().find('#related_value__1').val(lnum);
jQuery('#mediaIframe').contents().find('#related_id__1').val(tid);
viewport.init("#mediaDiv");
});
}
function removeMediaDiv() {
if(document.getElementById('bgDiv')){
jQuery('#bgDiv').remove();
}
if (document.getElementById('mediaDiv')) {
jQuery('#mediaDiv').remove();
}
}
function cloneTransAgent(i){
var id=$('#agent_id_' + i).val();
var name=$('#trans_agent_' + i).val();
var role=$('#cloneTransAgent_' + i).val();
$('#cloneTransAgent_' + i).val('');
addTransAgent (id,name,role);
}
function addTransAgent (id,name,role) {
if (typeof id == "undefined") {
id = "";
}
if (typeof name == "undefined") {
name = "";
}
if (typeof role == "undefined") {
role = "";
}
$.getJSON("/component/functions.cfc",
{
method : "getTrans_agent_role",
returnformat : "json",
queryformat : 'column'
},
function (data) {
var i=parseInt(document.getElementById('numAgents').value)+1;
var d='<tr><td>';
d+='<input type="hidden" name="trans_agent_id_' + i + '" id="trans_agent_id_' + i + '" value="new">';
d+='<input type="text" id="trans_agent_' + i + '" name="trans_agent_' + i + '" class="reqdClr" required size="30" value="' + name + '"';
d+=' onchange="getAgent(\'agent_id_' + i + '\',\'trans_agent_' + i + '\',\'editloan\',this.value);"';
d+=' return false;" onKeyPress="return noenter(event);">';
d+='<input type="hidden" id="agent_id_' + i + '" name="agent_id_' + i + '" value="' + id + '">';
d+='</td><td>';
d+='<select name="trans_agent_role_' + i + '" id="trans_agent_role_' + i + '">';
for (a=0; a<data.ROWCOUNT; ++a) {
d+='<option ';
if(role==data.DATA.TRANS_AGENT_ROLE[a]){
d+=' selected="selected"';
}
d+=' value="' + data.DATA.TRANS_AGENT_ROLE[a] + '">'+ data.DATA.TRANS_AGENT_ROLE[a] +'</option>';
}
d+='</td><td>';
d+='<input type="checkbox" name="del_agnt_' + i + '" name="del_agnt_' + i + '" id="del_agnt_' + i + '" value="1" onclick="cucAgnt(' + i + ');">';
d+='</td><td>';
d+='<select id="cloneTransAgent_' + i + '" onchange="cloneTransAgent(' + i + ')" style="width:8em">';
d+='<option value=""></option>';
for (a=0; a<data.ROWCOUNT; ++a) {
d+='<option value="' + data.DATA.TRANS_AGENT_ROLE[a] + '">'+ data.DATA.TRANS_AGENT_ROLE[a] +'</option>';
}
d+='</select>';
d+='</td><td>-</td></tr>';
document.getElementById('numAgents').value=i;
$('#loanAgents tr:last').after(d);
}
);
}
</script>
<!----
just fooling idiot cfclipse into using the right colors
'"
---->
<!-------------------------------------------------------------------------------------------------->
<cfif action is "nothing">
<cflocation url="Loan.cfm?action=addItems" addtoken="false">
</cfif>
<!-------------------------------------------------------------------------------------------------->
<cfif action is "newLoan">
<cfset title="New Loan">
Initiate a loan: <span class="infoLink" onClick="getDocs('loan')">Help</span>
<cfoutput>
<form name="newloan" id="newloan" action="Loan.cfm" method="post" onSubmit="return noenter();">
<input type="hidden" name="action" value="makeLoan">
<table border>
<tr>
<td>
<label for="collection_id">Collection</label>
<select name="collection_id" size="1" id="collection_id" class="reqdClr">
<cfloop query="ctcollection">
<option value="#ctcollection.collection_id#">#ctcollection.guid_prefix#</option>
</cfloop>
</select>
</td>
<td>
<label for="loan_number">Loan Number</label>
<input type="text" name="loan_number" class="reqdClr" id="loan_number">
</td>
</tr>
<tr>
<td>
<label for="auth_agent_name">Authorized By</label>
<input type="text" name="auth_agent_name" class="reqdClr" size="40"
onchange="getAgent('auth_agent_id','auth_agent_name','newloan',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="auth_agent_id">
</td>
<td>
<label for="rec_agent_name"><a href="javascript:void(0);" onClick="getDocs('loan','to')">To:</a></label>
<input type="text" name="rec_agent_name" class="reqdClr" size="40"
onchange="getAgent('rec_agent_id','rec_agent_name','newloan',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="rec_agent_id">
</td>
</tr>
<tr>
<td>
<label for="in_house_contact_agent_name">In-House Contact:</label>
<input type="text" name="in_house_contact_agent_name" size="40"
onchange="getAgent('in_house_contact_agent_id','in_house_contact_agent_name','newloan',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="in_house_contact_agent_id">
</td>
<td>
<label for="outside_contact_agent_name">Outside Contact:</label>
<input type="text" name="outside_contact_agent_name" size="40"
onchange="getAgent('outside_contact_agent_id','outside_contact_agent_name','newloan',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="outside_contact_agent_id">
</td>
</tr>
<tr>
<td>
<label for="loan_type">Loan Type</label>
<select name="loan_type" id="loan_type" class="reqdClr">
<cfloop query="ctLoanType">
<option value="#ctLoanType.loan_type#">#ctLoanType.loan_type#</option>
</cfloop>
</select><span class="infoLink" onclick="getCtDoc('ctloan_type');">Define</span>
</td>
<td>
<label for="loan_status">Loan Status</label>
<select name="loan_status" id="loan_status" class="reqdClr">
<cfloop query="ctLoanStatus">
<option value="#ctLoanStatus.loan_status#"
<cfif #ctLoanStatus.loan_status# is "open">selected='selected'</cfif>
>#ctLoanStatus.loan_status#</option>
</cfloop>
</select><span class="infoLink" onclick="getCtDoc('ctloan_status');">Define</span>
</td>
</tr>
<tr>
<td>
<label for="initiating_date">Transaction Date</label>
<input type="text" name="initiating_date" id="initiating_date" value="#dateformat(now(),"yyyy-mm-dd")#">
</td>
<td>
<label for="return_due_date">Return Due Date</label>
<input type="text" name="return_due_date" id="return_due_date">
</td>
</tr>
<tr>
<td colspan="2">
<label for="nature_of_material">Nature of Material</label>
<textarea name="nature_of_material" id="nature_of_material" rows="3" cols="80" class="reqdClr"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<label for="loan_instructions">Loan Instructions</label>
<textarea name="loan_instructions" id="loan_instructions" rows="3" cols="80"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<label for="loan_description">Description</label>
<textarea name="loan_description" id="loan_description" rows="3" cols="80"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<label for="trans_remarks">Remarks</label>
<textarea name="trans_remarks" id="trans_remarks" rows="3" cols="80"></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Create Loan" class="insBtn">
<input type="button" value="Quit" class="qutBtn" onClick="document.location = 'Loan.cfm'">
</td>
</tr>
</table>
</form>
<div class="nextnum">
Next Available Loan Number:
<br>
<cfquery name="all_coll" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from collection order by guid_prefix
</cfquery>
<cfloop query="all_coll">
<cfif (institution_acronym is 'UAM' and collection_cde is 'Mamm')>
<!---- yyyy.nnn.CCDE format --->
<cfset stg="'#dateformat(now(),"yyyy")#.' || lpad(max(to_number(substr(loan_number,6,3))) + 1,3,0) || '.#collection_cde#'">
<cfset whr=" AND substr(loan_number, 1,4) ='#dateformat(now(),"yyyy")#'">
<cfelseif (institution_acronym is 'UAM' and collection_cde is 'Herb') OR
(institution_acronym is 'MSB') OR
(institution_acronym is 'DGR')>
<!---- yyyy.n.CCDE format --->
<cfset stg="'#dateformat(now(),"yyyy")#.' || max(to_number(substr(loan_number,instr(loan_number,'.')+1,instr(loan_number,'.',1,2)-instr(loan_number,'.')-1) + 1)) || '.#collection_cde#'">
<cfset whr=" AND substr(loan_number, 1,4) ='#dateformat(now(),"yyyy")#'">
<cfelseif (institution_acronym is 'MVZ' or institution_acronym is 'MVZObs')>
<cfset stg="'#dateformat(now(),"yyyy")#.' || max(SUBSTR(loan_number, INSTR(loan_number,'.', 1, 1)+1,INSTR(loan_number,'.',1,2)-INSTR(loan_number,'.',1,1)-1)+1) || '.#collection_cde#'">
<cfset whr=" and collection.institution_acronym in ('MVZ','MVZObs')">
<cfelseif (institution_acronym is 'UAM' and collection_cde is 'Es')>
<cfset stg="substr(loan_number,0,instr(loan_number,'.',1,1)-1) || '.' || to_char(sysdate,'yyyy') ||'.ESCI'">
<cfset whr=" AND substr(loan_number, -4,4) ='ESCI'">
<cfelse>
<!--- n format --->
<cfset stg="'#dateformat(now(),"yyyy")#.' || max(to_number(substr(loan_number,instr(loan_number,'.')+1,instr(loan_number,'.',1,2)-instr(loan_number,'.')-1) + 1)) || '.#collection_cde#'">
<cfset whr=" AND is_number(loan_number)=1 and substr(loan_number, 1,4) ='#dateformat(now(),"yyyy")#'">
</cfif>
<hr>
<cftry>
<cfquery name="thisq" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
#preservesinglequotes(stg)# nn
from
loan,
trans,
collection
where
loan.transaction_id=trans.transaction_id and
trans.collection_id=collection.collection_id
<cfif institution_acronym is not "MVZ" and institution_acronym is not "MVZObs">
and collection.collection_id=#collection_id#
</cfif>
#preservesinglequotes(whr)#
</cfquery>
<cfcatch>
<hr>
#cfcatch.detail#
<br>
#cfcatch.message#
<cfset thisq = querynew("nn")>
<cfset queryaddrow(thisq,1)>
<cfset QuerySetCell(thisq, "nn", 'check data', 1)>
</cfcatch>
</cftry>
<cfif len(thisQ.nn) gt 0>
<span class="likeLink" onclick="setAccnNum('#collection_id#','#thisQ.nn#')">#guid_prefix# #thisQ.nn#</span>
<cfif (institution_acronym is 'MVZ' or institution_acronym is 'MVZObs')>
<cfset temp=replace(thisQ.nn,collection_cde,'Data')>
<br><span class="infoLink" onclick="setAccnNum('#collection_id#','#temp#')">#guid_prefix# #temp#</span>
</cfif>
<cfelse>
<span style="font-size:x-small">
No data available for #guid_prefix#.
</span>
</cfif>
<br>
</cfloop>
</div>
</cfoutput>
</cfif>
<!-------------------------------------------------------------------------------------------------->
<cfif action is "editLoan">
<cfset title="Edit Loan">
<style>
#thisLoanMediaDiv{
max-height:20em;
overflow:auto;
}
</style>
<cfoutput>
<cfquery name="loanDetails" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
trans.transaction_id,
trans_date,
loan_number,
loan_type,
loan_status,
loan_instructions,
loan_description,
nature_of_material,
trans_remarks,
return_due_date,
trans.collection_id,
collection.guid_prefix,
concattransagent(trans.transaction_id,'entered by') enteredby,
closed_date
from
loan,
trans,
collection
where
loan.transaction_id = trans.transaction_id AND
trans.collection_id=collection.collection_id and
trans.transaction_id = #transaction_id#
</cfquery>
<!--- include trans in this query to assure VPD protection --->
<cfquery name="loanAgents" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
trans_agent_id,
trans_agent.agent_id,
agent_name,
trans_agent_role
from
trans,
trans_agent,
preferred_agent_name
where
trans.transaction_id=trans_agent.transaction_id and
trans_agent.agent_id = preferred_agent_name.agent_id and
trans_agent_role != 'entered by' and
trans_agent.transaction_id=#transaction_id#
order by
trans_agent_role,
agent_name
</cfquery>
<cfquery name="numItems" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select count(*) c from loan_item where transaction_id=#transaction_id#
</cfquery>
<cfquery name="projs" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select project_name, project.project_id from project,
project_trans where
project_trans.project_id = project.project_id
and transaction_id=#transaction_id#
</cfquery>
<table width="100%" border><tr><td valign="top"><!--- left cell ---->
<form name="editloan" id="editloan" action="Loan.cfm" method="post">
<input type="hidden" name="action" value="saveEdits">
<input type="hidden" name="transaction_id" value="#loanDetails.transaction_id#">
<strong>Edit Loan #loanDetails.guid_prefix# #loanDetails.loan_number#</strong>
<span style="font-size:small;">Entered by #loanDetails.enteredby#</span>
<span style="font-size:small;"> (#numItems.c# items)</span>
<label for="loan_number">Loan Number</label>
<select name="collection_id" id="collection_id" size="1">
<cfloop query="ctcollection">
<option <cfif ctcollection.collection_id is loanDetails.collection_id> selected </cfif>
value="#ctcollection.collection_id#">#ctcollection.guid_prefix#</option>
</cfloop>
</select>
<input type="text" name="loan_number" id="loan_number" value="#loanDetails.loan_number#" class="reqdClr">
<cfquery name="inhouse" dbtype="query">
select count(distinct(agent_id)) c from loanAgents where trans_agent_role='in-house contact'
</cfquery>
<cfquery name="outside" dbtype="query">
select count(distinct(agent_id)) c from loanAgents where trans_agent_role='outside contact'
</cfquery>
<table id="loanAgents" border>
<tr>
<th>Agent Name <span class="likeLink" onclick="addTransAgent()">Add Row</span></th>
<th>
Role
<span class="infoLink" onclick="getCtDoc('cttrans_agent_role');">Define</span>
</th>
<th>Delete?</th>
<th>CloneAs</th>
<th></th>
<td rowspan="99">
<cfif inhouse.c is 1 and outside.c is 1>
<span style="color:green;font-size:small">OK to print</span>
<cfelse>
<span style="color:red;font-size:small">
One "in-house contact" and one "outside contact" are required to print loan forms.
</span>
</cfif>
</td>
</tr>
<cfset i=1>
<cfloop query="loanAgents">
<tr>
<td>
<input type="hidden" name="trans_agent_id_#i#" id="trans_agent_id_#i#" value="#trans_agent_id#">
<input type="text" name="trans_agent_#i#" id="trans_agent_#i#" class="reqdClr" size="30" value="#agent_name#"
onchange="getAgent('agent_id_#i#','trans_agent_#i#','editloan',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="agent_id_#i#" id="agent_id_#i#" value="#agent_id#">
</td>
<td>
<select name="trans_agent_role_#i#" id="trans_agent_role_#i#">
<cfloop query="cttrans_agent_role">
<option
<cfif cttrans_agent_role.trans_agent_role is loanAgents.trans_agent_role>
selected="selected"
</cfif>
value="#trans_agent_role#">#trans_agent_role#</option>
</cfloop>
</select>
</td>
<td>
<input type="checkbox" name="del_agnt_#i#" id="del_agnt_#i#" value="1" onclick="cucAgnt(#i#);">
</td>
<td>
<select id="cloneTransAgent_#i#" onchange="cloneTransAgent(#i#)" style="width:8em">
<option value=""></option>
<cfloop query="cttrans_agent_role">
<option value="#trans_agent_role#">#trans_agent_role#</option>
</cfloop>
</select>
</td>
<td>
<span class="infoLink" onclick="rankAgent('#agent_id#');">Rank</span>
<span class="infoLink" onclick="useThsProjAgnt('#agent_name#','#agent_id#');">Use@>></span>
</td>
</tr>
<cfset i=i+1>
</cfloop>
<cfset na=i-1>
<input type="hidden" id="numAgents" name="numAgents" value="#na#">
</table><!-- end agents table --->
<table width="100%">
<tr>
<td>
<label for="loan_type">Loan Type</label>
<select name="loan_type" id="loan_type" class="reqdClr">
<cfloop query="ctLoanType">
<option <cfif ctLoanType.loan_type is loanDetails.loan_type> selected="selected" </cfif>
value="#ctLoanType.loan_type#">#ctLoanType.loan_type#</option>
</cfloop>
</select><span class="infoLink" onclick="getCtDoc('ctloan_type');">Define</span>
</td>
<td>
<label for="loan_status">Loan Status</label>
<select name="loan_status" id="loan_status" class="reqdClr">
<cfloop query="ctLoanStatus">
<option <cfif ctLoanStatus.loan_status is loanDetails.loan_status> selected="selected" </cfif>
value="#ctLoanStatus.loan_status#">#ctLoanStatus.loan_status#</option>
</cfloop>
</select><span class="infoLink" onclick="getCtDoc('ctloan_status');">Define</span>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%">
<tr>
<td>
<label for="initiating_date">Transaction Date</label>
<input type="text" name="initiating_date" id="initiating_date"
value="#dateformat(loanDetails.trans_date,"yyyy-mm-dd")#" class="reqdClr">
</td>
<td>
<label for="return_due_date">Due Date</label>
<input type="text" id="return_due_date" name="return_due_date"
value="#dateformat(loanDetails.return_due_date,'yyyy-mm-dd')#">
</td>
<td>
<label for="closed_date">Closed Date</label>
<input type="text" id="closed_date" name="closed_date"
value="#loanDetails.closed_date#">
</td>
</tr>
</table>
</td>
</tr>
</table>
<label for="">Nature of Material (<span id="lbl_nature_of_material"></span>)</label>
<textarea name="nature_of_material" id="nature_of_material" rows="7" cols="60"
class="reqdClr">#loanDetails.nature_of_material#</textarea>
<label for="loan_description">Description (<span id="lbl_loan_description"></span>)</label>
<textarea name="loan_description" id="loan_description" rows="7"
cols="60">#loanDetails.loan_description#</textarea>
<label for="loan_instructions">Instructions (<span id="lbl_loan_instructions"></span>)</label>
<textarea name="loan_instructions" id="loan_instructions" rows="7"
cols="60">#loanDetails.loan_instructions#</textarea>
<label for="trans_remarks">Remarks (<span id="lbl_trans_remarks"></span>)</label>
<textarea name="trans_remarks" id="trans_remarks" rows="7" cols="60">#loanDetails.trans_remarks#</textarea>
<br>
<input type="submit" value="Save Edits" class="savBtn">
<cfif numItems.c is 0 and projs.recordcount lt 1>
<input type="button" value="Delete Loan" class="delBtn" onClick="deleteLoan('#transaction_id#');">
<cfelse>
Delete dependencies to delete loan
</cfif>
<ul>
<li><a href="SpecimenSearch.cfm?Action=dispCollObj&transaction_id=#transaction_id#">[ add items ]</a></li>
<li><a href="loanByBarcode.cfm?transaction_id=#transaction_id#">[ add items by part container barcode ]</a></li>
<li><a href="a_loanItemReview.cfm?transaction_id=#transaction_id#">[ review loan items ]</a></li>
<li><a href="SpecimenResults.cfm?loan_trans_id=#transaction_id#">[ specimens ]</a></li>
</ul>
<label for="redir">Print...</label>
<select name="redir" id="redir" size="1" onchange="if(this.value.length>0){window.open(this.value,'_blank')};">
<option value=""></option>
<option value="/Reports/report_printer.cfm?transaction_id=#transaction_id#&report=uam_mamm_loan_head">UAM Mammal Invoice Header</option>
<!----
<option value="/Reports/UAMMammLoanInvoice.cfm?transaction_id=#transaction_id#&Action=itemList">UAM Mammal Item Invoice</option>
<option value="/Reports/UAMMammLoanInvoice.cfm?transaction_id=#transaction_id#&Action=showCondition">UAM Mammal Item Conditions</option>
---->
<option value="/Reports/report_printer.cfm?transaction_id=#transaction_id#&report=UAM_ES_Loan_Header_II">UAM ES Invoice Header</option>
<option value="/Reports/MSBMammLoanInvoice.cfm?transaction_id=#transaction_id#">MSB Mammal Invoice Header</option>
<option value="/Reports/report_printer.cfm?transaction_id=#transaction_id#&report=MSB_Mamm_loan_invoice">MSB Mammal Item Invoice</option>
<option value="/Reports/MSBBirdLoanInvoice.cfm?transaction_id=#transaction_id#">MSB Bird Invoice Header</option>
<option value="/Reports/MSBBirdLoanInvoice.cfm?transaction_id=#transaction_id#&Action=itemList">MSB Bird Item Invoice</option>
<!----
<option value="/Reports/UAMLoanInvoice.cfm?transaction_id=#transaction_id#">UAM Generic Invoice Header</option>
<option value="/Reports/UAMLoanInvoice.cfm?transaction_id=#transaction_id#&Action=itemList">UAM Generic Item Invoice</option>
<option value="/Reports/UAMLoanInvoice.cfm?transaction_id=#transaction_id#&Action=showCondition">UAM Generic Item Conditions</option>
---->
<option value="/Reports/report_printer.cfm?transaction_id=#transaction_id#&report=loan_instructions">Instructions Appendix</option>
<option value="/Reports/report_printer.cfm?transaction_id=#transaction_id#&report=shipping_label">Shipping Label</option>
<option value="/Reports/report_printer.cfm?transaction_id=#transaction_id#">Any Report</option>
</select>
</td><!---- end left cell --->
<td valign="top"><!---- right cell ---->
<strong>Projects associated with this loan:</strong>
<ul>
<cfif projs.recordcount gt 0>
<cfloop query="projs">
<li>
<a href="/Project.cfm?Action=editProject&project_id=#project_id#"><strong>#project_name#</strong></a>
<span class="infoLink" onclick="removeProjectFromLoan('#transaction_id#','#project_id#');">[ unlink ]</span>
</li>
</cfloop>
<cfelse>
<li>None</li>
</cfif>
</ul>
<hr>
<div class="newRec">
<label for="project_id">Type part of Project name to Pick a Project to associate with this loan</label>
<input type="hidden" name="project_id">
<input type="text"
size="50"
name="pick_project_name"
onchange="getProject('project_id','pick_project_name','editloan',this.value); return false;"
onKeyPress="return noenter(event);">
</div>
<hr>
<div class="newRec">
<label for=""><span style="font-size:large">Create a project from this loan</span></label>
<label for="newProjectAgent">Project Agent</label>
<input type="text" name="newProjectAgent" id="newProjectAgent" size="30" value=""
onchange="getAgent('newProjectAgent_id','newProjectAgent','editloan',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="newProjectAgent_id" id="newProjectAgent_id" value="">
<cfquery name="ctProjAgRole" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select project_agent_role from ctproject_agent_role order by project_agent_role
</cfquery>
<label for="">Project Agent Role</label>
<select name="project_agent_role" id="project_agent_role" size="1">
<cfloop query="ctProjAgRole">
<option value="#ctProjAgRole.project_agent_role#">#ctProjAgRole.project_agent_role#</option>
</cfloop>
</select>
<label for="project_name" class="likeLink" onClick="getDocs('project','title')">Project Title</label>
<textarea name="project_name" id="project_name" cols="50" rows="2" ></textarea>
<label for="start_date" class="likeLink" onClick="getDocs('project','date')">Project Start Date</label>
<input type="text" name="start_date" value="#dateformat(loanDetails.trans_date,"yyyy-mm-dd")#">
<label for="">Project End Date</label>
<input type="text" name="end_date">
<label for="project_description" class="likeLink" onClick="getDocs('project','description')">Project Description (>100 characters for visibility)</label>
<textarea name="project_description"
id="project_description" cols="50" rows="6">#loanDetails.loan_description#</textarea>
<label for="project_remarks">Project Remark</label>
<textarea name="project_remarks" cols="50" rows="3">#loanDetails.trans_remarks#</textarea>
<label for="saveNewProject">Check to create project with save - Click the project in the list above to add more information after save</label>
<input type="checkbox" value="yes" name="saveNewProject" id="saveNewProject">
</div>
</form>
<hr>
<strong>Media associated with this loan</strong>
<br>
<span class="likeLink" onclick="addMediaHere('#loanDetails.guid_prefix# #loanDetails.loan_number#','#transaction_id#');">
Create Media
</span>
<br><a href="/MediaSearch.cfm" target="_blank">Find Media</a> and edit it to create links to this loan.
<div id="mmmsgdiv"></div>
<cfquery name="media" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
media_uri,
preview_uri,
media_type,
media.media_id,
mime_type
from
media,
media_relations
where
media.media_id=media_relations.media_id and
media_relations.media_relationship='documents loan' and
media_relations.related_primary_key=#transaction_id#
</cfquery>
<cfset obj = CreateObject("component","component.functions")>
<div id="thisLoanMediaDiv">
<cfloop query="media">
<cfset preview = obj.getMediaPreview(
preview_uri="#media.preview_uri#",
media_type="#media.media_type#")>
<br>
<a href="/media/#media_id#?open" target="_blank"><img src="#preview#" class="theThumb"></a>
<p>
#media_type# (#mime_type#)
<br><a href="/media/#media_id#" target="_blank">Media Details</a>
</p>
</cfloop>
</div>
</td></tr></table>
<cfquery name="ship" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from shipment where transaction_id = #transaction_id#
</cfquery>
<table>
<cfset s=0>
<cfloop query="ship">
<cfset s=s+1>
<tr #iif(s MOD 2,DE("class='evenRow'"),DE("class='oddRow'"))#><td>
<cfquery name="shipped_to_addr_id" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select address from address where
address_id = #ship.shipped_to_addr_id#
</cfquery>
<cfquery name="shipped_from_addr_id" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select address from address where
address_id = #ship.shipped_from_addr_id#
</cfquery>
<cfquery name="packed_by_agent" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select agent_name from preferred_agent_name where
agent_id = #packed_by_agent_id#
</cfquery>
<cfform name="shipment#s#" method="post" action="Loan.cfm">
<input type="hidden" name="Action" value="saveShipEdit">
<input type="hidden" name="shipment_id" value="#shipment_id#">
<input type="hidden" name="transaction_id" value="#transaction_id#">
<label for="packed_by_agent">Packed By Agent</label>
<input type="text" name="packed_by_agent" class="reqdClr" size="50" value="#packed_by_agent.agent_name#"
onchange="getAgent('packed_by_agent_id','packed_by_agent','shipment#s#',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="packed_by_agent_id" value="#packed_by_agent_id#">
<label for="shipped_carrier_method">Shipped Method</label>
<select name="shipped_carrier_method" id="shipped_carrier_method" size="1" class="reqdClr">
<option value=""></option>
<cfloop query="ctShip">
<option
<cfif ctShip.shipped_carrier_method is ship.shipped_carrier_method> selected="selected" </cfif>
value="#ctShip.shipped_carrier_method#">#ctShip.shipped_carrier_method#</option>
</cfloop>
</select>
<label for="shipment_type">Shipment Type</label>
<select name="shipment_type" id="shipment_type" size="1" class="reqdClr">
<option value=""></option>
<cfloop query="ctshipment_type">
<option
<cfif ctshipment_type.shipment_type is ship.shipment_type> selected="selected" </cfif>
value="#ctshipment_type.shipment_type#">#ctshipment_type.shipment_type#</option>
</cfloop>
</select><span class="infoLink" onclick="getCtDoc('ctshipment_type');">Define</span>
<label for="packed_by_agent">Shipped To Address (may format funky until save)</label>
<textarea name="shipped_to_addr" id="shipped_to_addr" cols="60" rows="5"
readonly="yes" class="reqdClr">#shipped_to_addr_id.address#</textarea>
<input type="hidden" name="shipped_to_addr_id" value="#shipped_to_addr_id#">
<input type="button" value="Pick Address" class="picBtn"
onClick="addrPick('shipped_to_addr_id','shipped_to_addr','shipment#s#'); return false;">
<label for="packed_by_agent">Shipped From Address</label>
<textarea name="shipped_from_addr" id="shipped_from_addr" cols="60" rows="5"
readonly="yes" class="reqdClr">#shipped_from_addr_id.address#</textarea>
<input type="hidden" name="shipped_from_addr_id" value="#shipped_from_addr_id#">
<input type="button" value="Pick Address" class="picBtn"
onClick="addrPick('shipped_from_addr_id','shipped_from_addr','shipment#s#'); return false;">
<label for="carriers_tracking_number">Tracking Number</label>
<input type="text" value="#carriers_tracking_number#" name="carriers_tracking_number" id="carriers_tracking_number">
<label for="shipped_date">Ship Date</label>
<input type="text" value="#dateformat(shipped_date,'yyyy-mm-dd')#" name="shipped_date" id="shipped_date">
<label for="package_weight">Package Weight (TEXT, include units)</label>
<input type="text" value="#package_weight#" name="package_weight" id="package_weight">
<label for="hazmat_fg">Hazmat?</label>
<select name="hazmat_fg" id="hazmat_fg" size="1">
<option <cfif hazmat_fg is 0> selected="selected" </cfif>value="0">no</option>
<option <cfif hazmat_fg is 1> selected="selected" </cfif>value="1">yes</option>
</select>
<label for="insured_for_insured_value">Insured Value (NUMBER, US$)</label>
<cfinput type="text" validate="float" label="Numeric value required."
value="#INSURED_FOR_INSURED_VALUE#" name="insured_for_insured_value" id="insured_for_insured_value">
<label for="shipment_remarks">Remarks</label>
<input type="text" value="#shipment_remarks#" name="shipment_remarks" id="shipment_remarks">
<label for="contents">Contents</label>
<input type="text" value="#contents#" name="contents" id="contents" size="60">
<label for="foreign_shipment_fg">Foreign shipment?</label>
<select name="foreign_shipment_fg" id="foreign_shipment_fg" size="1">
<option <cfif foreign_shipment_fg is 0> selected="selected" </cfif>value="0">no</option>
<option <cfif foreign_shipment_fg is 1> selected="selected" </cfif>value="1">yes</option>
</select>
<br><input type="submit" value="Save Shipment" class="savBtn">
</cfform>
</td></tr>
</cfloop>
<tr><td class="newRec">
Create a shipment....
<cfform name="newshipment" method="post" action="Loan.cfm">
<input type="hidden" name="Action" value="createShip">
<input type="hidden" name="transaction_id" value="#transaction_id#">
<label for="packed_by_agent">Packed By Agent</label>
<input type="text" name="packed_by_agent" class="reqdClr" size="50"
onchange="getAgent('packed_by_agent_id','packed_by_agent','newshipment',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="packed_by_agent_id">
<label for="shipped_carrier_method">Shipped Method</label>
<select name="shipped_carrier_method" id="shipped_carrier_method" size="1" class="reqdClr">
<option value=""></option>
<cfloop query="ctShip">
<option value="#ctShip.shipped_carrier_method#">#ctShip.shipped_carrier_method#</option>
</cfloop>
</select>
<label for="shipment_type">Shipment Type</label>
<select name="shipment_type" id="shipment_type" size="1" class="reqdClr">
<option value=""></option>
<cfloop query="ctshipment_type">
<option value="#ctshipment_type.shipment_type#">#ctshipment_type.shipment_type#</option>
</cfloop>
</select><span class="infoLink" onclick="getCtDoc('ctshipment_type');">Define</span>
<label for="packed_by_agent">Shipped To Address (may format funky until save)</label>
<textarea name="shipped_to_addr" id="shipped_to_addr" cols="60" rows="5"
readonly="yes" class="reqdClr"></textarea>
<input type="hidden" name="shipped_to_addr_id">
<input type="button" value="Pick Address" class="picBtn"
onClick="addrPick('shipped_to_addr_id','shipped_to_addr','newshipment'); return false;">
<label for="packed_by_agent">Shipped From Address</label>
<textarea name="shipped_from_addr" id="shipped_from_addr" cols="60" rows="5"
readonly="yes" class="reqdClr"></textarea>
<input type="hidden" name="shipped_from_addr_id">
<input type="button" value="Pick Address" class="picBtn"
onClick="addrPick('shipped_from_addr_id','shipped_from_addr','newshipment'); return false;">
<label for="carriers_tracking_number">Tracking Number</label>
<input type="text" name="carriers_tracking_number" id="carriers_tracking_number">
<label for="shipped_date">Ship Date</label>
<input type="text" name="shipped_date" id="shipped_date">
<label for="package_weight">Package Weight (TEXT, include units)</label>
<input type="text" name="package_weight" id="package_weight">
<label for="hazmat_fg">Hazmat?</label>
<select name="hazmat_fg" id="hazmat_fg" size="1">
<option value="0">no</option>
<option value="1">yes</option>
</select>
<label for="insured_for_insured_value">Insured Value (NUMBER, US$)</label>
<cfinput type="text" validate="float" label="Numeric value required."
name="insured_for_insured_value" id="insured_for_insured_value">
<label for="shipment_remarks">Remarks</label>
<input type="text" name="shipment_remarks" id="shipment_remarks">
<label for="contents">Contents</label>
<input type="text" name="contents" id="contents" size="60">
<label for="foreign_shipment_fg">Foreign shipment?</label>
<select name="foreign_shipment_fg" id="foreign_shipment_fg" size="1">
<option value="0">no</option>
<option value="1">yes</option>
</select>
<br><input type="submit" value="Create Shipment" class="insBtn">
</cfform>
</td></tr>
</table>
<cfquery name="getPermits" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
SELECT
permit.permit_id,
issuedBy.agent_name as IssuedByAgent,
issuedTo.agent_name as IssuedToAgent,
issued_Date,
renewed_Date,
exp_Date,
permit_Num,
permit_Type,
permit_remarks
FROM
permit,
permit_trans,
preferred_agent_name issuedTo,
preferred_agent_name issuedBy
WHERE
permit.permit_id = permit_trans.permit_id AND
permit.issued_by_agent_id = issuedBy.agent_id AND
permit.issued_to_agent_id = issuedTo.agent_id AND
permit_trans.transaction_id = #loanDetails.transaction_id#
</cfquery>
<br><strong>Permits:</strong>
<cfloop query="getPermits">
<form name="killPerm#currentRow#" method="post" action="Loan.cfm">
<p>
<strong>Permit ## #permit_Num# (#permit_Type#)</strong> issued to
#IssuedToAgent# by #IssuedByAgent# on
#dateformat(issued_Date,"yyyy-mm-dd")#.
<cfif len(renewed_Date) gt 0>
(renewed #renewed_Date#)
</cfif>
Expires #dateformat(exp_Date,"yyyy-mm-dd")#
<cfif len(permit_remarks) gt 0>Remarks: #permit_remarks#</cfif>
<br>
<input type="hidden" name="transaction_id" value="#transaction_id#">
<input type="hidden" name="action" value="delePermit">
<input type="hidden" name="permit_id" value="#permit_id#">
<input type="submit" value="Remove this Permit" class="delBtn">
</p>
</form>
</cfloop>
<form name="addPermit" action="Loan.cfm" method="post">
<input type="hidden" name="transaction_id" value="#transaction_id#">
<input type="hidden" name="permit_id">
<label for="">Click to add Permit. Reload to see added permits.</label>
<input type="button" value="Add a permit" class="picBtn"
onClick="window.open('picks/PermitPick.cfm?transaction_id=#transaction_id#', 'PermitPick',
'resizable,scrollbars=yes,width=600,height=600')">
</form>
</cfoutput>
<script>
dCount();
</script>
</cfif>
<!-------------------------------------------------------------------------------------------------->
<cfif Action is "deleLoan">
<cftransaction>
<cfquery name="killLoan" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from loan where transaction_id=#transaction_id#
</cfquery>
<cfquery name="killTransAgent" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from trans_agent where transaction_id=#transaction_id#
</cfquery>
<cfquery name="killTrans" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from trans where transaction_id=#transaction_id#
</cfquery>
</cftransaction>
loan deleted
</cfif>
<!-------------------------------------------------------------------------------------------------->
<cfif Action is "delePermit">
<cfquery name="killPerm" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
DELETE FROM permit_trans WHERE transaction_id = #transaction_id# and
permit_id=#permit_id#
</cfquery>
<cflocation url="Loan.cfm?Action=editLoan&transaction_id=#transaction_id#">
</cfif>
<!-------------------------------------------------------------------------------------------------->
<cfif action is "createShip">
<cfquery name="newShip" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
INSERT INTO shipment (
TRANSACTION_ID
,PACKED_BY_AGENT_ID
,SHIPPED_CARRIER_METHOD
,CARRIERS_TRACKING_NUMBER
,SHIPPED_DATE
,PACKAGE_WEIGHT
,HAZMAT_FG
,INSURED_FOR_INSURED_VALUE
,SHIPMENT_REMARKS
,CONTENTS
,FOREIGN_SHIPMENT_FG
,SHIPPED_TO_ADDR_ID
,SHIPPED_FROM_ADDR_ID