1 | BSDX33 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 7/11/10 11:38am
|
---|
2 | ;;2.0;IHS WINDOWS SCHEDULING;;NOV 01, 2007
|
---|
3 | ; Mods by WV/STAR
|
---|
4 | ;
|
---|
5 | ;
|
---|
6 | Q
|
---|
7 | RBNEXTD(BSDXY,BSDXDATE,BSDXRES,BSDXTPID) ;EP
|
---|
8 | ;Entry point for debugging
|
---|
9 | ;
|
---|
10 | ;D DEBUG^%Serenji("RBNEXT^BSDX33(.BSDXY,BSDXDATE,BSDXRES,BSDXTPID)")
|
---|
11 | Q
|
---|
12 | ;
|
---|
13 | RBNEXT(BSDXY,BSDXDATE,BSDXRES,BSDXTPID) ;EP
|
---|
14 | ;Called by BSDX REBOOK NEXT BLOCK to find
|
---|
15 | ;the next ACCESS BLOCK in resource BSDXRES after BSDXSTART
|
---|
16 | ;Returns 1 in ERRORID and date in NEXTBLOCK if a block was found or NULL in NEXTBLOCK of no date found
|
---|
17 | ;Otherwise, returns 0 and error message in ERRORTEXT
|
---|
18 | ;If BSDXTPID = 0 then any access type match
|
---|
19 | ;
|
---|
20 | S X="ERROR2^BSDX33",@^%ZOSF("TRAP")
|
---|
21 | N BSDXI,BSDXIENS,%DT,BSDXMSG,Y,BSDXRESD,BSDXFND,BSDXIEN,BSDXNOD,BSDXATID
|
---|
22 | S BSDXY="^BSDXTMP("_$J_")"
|
---|
23 | S BSDXI=0
|
---|
24 | S ^BSDXTMP($J,BSDXI)="I00020ERRORID^D00010NEXTBLOCK^T00030ERRORTEXT"_$C(30)
|
---|
25 | ;
|
---|
26 | I BSDXRES="" D ERR2("BSDX REBOOK NEXT BLOCK: Invalid resource name") Q
|
---|
27 | I '$D(^BSDXRES("B",BSDXRES)) D ERR2("BSDX REBOOK NEXT BLOCK: Invalid resource name") Q
|
---|
28 | S BSDXRESD=$O(^BSDXRES("B",BSDXRES,0))
|
---|
29 | I '+BSDXRESD D ERR2("BSDX REBOOK NEXT BLOCK: Invalid resource name") Q
|
---|
30 | S X=BSDXDATE,%DT="XT" D ^%DT
|
---|
31 | I Y=-1 D ERR2(1,"BSDX REBOOK NEXT BLOCK: Invalid datetime") Q
|
---|
32 | S BSDXDATE=$P(Y,".")
|
---|
33 | ;
|
---|
34 | S BSDXFND=0
|
---|
35 | F S BSDXDATE=$O(^BSDXAB("ARSCT",BSDXRESD,BSDXDATE)) Q:'+BSDXDATE D Q:BSDXFND
|
---|
36 | . S BSDXIEN=0 F S BSDXIEN=$O(^BSDXAB("ARSCT",BSDXRESD,BSDXDATE,BSDXIEN)) Q:'+BSDXIEN D Q:BSDXFND
|
---|
37 | . . Q:'$D(^BSDXAB(BSDXIEN,0))
|
---|
38 | . . S BSDXNOD=^BSDXAB(BSDXIEN,0)
|
---|
39 | . . Q:+$P(BSDXNOD,U,4)=0 ;Slots
|
---|
40 | . . S BSDXATID=$P(BSDXNOD,U,5)
|
---|
41 | . . I BSDXTPID=0!(BSDXATID=BSDXTPID) S BSDXFND=$P(BSDXNOD,U,2) Q
|
---|
42 | ;
|
---|
43 | I BSDXFND=0 S BSDXFND=""
|
---|
44 | E S Y=BSDXFND X ^DD("DD") S BSDXFND=Y
|
---|
45 | S BSDXI=BSDXI+1
|
---|
46 | ;//smh - bug: Need to replace @ in FM date for C# to recognize it
|
---|
47 | S BSDXFND=$TR(BSDXFND,"@"," ")
|
---|
48 | ;//smh end fix
|
---|
49 | S ^BSDXTMP($J,BSDXI)="1^"_BSDXFND_"^"_$C(30)_$C(31)
|
---|
50 | Q
|
---|
51 | SETRBKD(BSDXY,BSDXAPPT,BSDXDATE) ;EP
|
---|
52 | ;Entry point for debugging
|
---|
53 | ;
|
---|
54 | ;D DEBUG^%Serenji("SETRBK^BSDX33(.BSDXY,BSDXAPPT,BSDXDATE)")
|
---|
55 | Q
|
---|
56 | ;
|
---|
57 | SETRBK(BSDXY,BSDXAPPT,BSDXDATE) ;EP
|
---|
58 | ;
|
---|
59 | ;Sets rebook date into appointment
|
---|
60 | ;BSDXAPPT - Appointment ID
|
---|
61 | ;BSDXDATE - Rebook Datetime in external format
|
---|
62 | ;Called by BSDX REBOOK SET
|
---|
63 | ;
|
---|
64 | ;ErrorID:
|
---|
65 | ; 0 if a problem. Message in ERRORTEXT
|
---|
66 | ; 1 if OK
|
---|
67 | ;
|
---|
68 | S X="ERROR^BSDX33",@^%ZOSF("TRAP")
|
---|
69 | N BSDXI,BSDXIENS,%DT,BSDXMSG,Y
|
---|
70 | S BSDXY="^BSDXTMP("_$J_")"
|
---|
71 | S BSDXI=0
|
---|
72 | S ^BSDXTMP($J,BSDXI)="I00020ERRORID^T00030ERRORTEXT"_$C(30)
|
---|
73 | ;
|
---|
74 | I '+BSDXAPPT
|
---|
75 | I '$D(^BSDXAPPT(BSDXAPPT,0)) D ERR(1,"BSDX REBOOK SET: Invalid appointment ID") Q
|
---|
76 | S X=BSDXDATE,%DT="XT" D ^%DT
|
---|
77 | I Y=-1 D ERR(1,"BSDX REBOOK SET: Invalid rebook datetime") Q
|
---|
78 | S BSDXDATE=Y
|
---|
79 | S BSDXIENS=BSDXAPPT_","
|
---|
80 | S BSDXFDA(9002018.4,BSDXIENS,.11)=BSDXDATE
|
---|
81 | ;
|
---|
82 | K BSDXMSG
|
---|
83 | D FILE^DIE("","BSDXFDA","BSDXMSG")
|
---|
84 | S BSDXI=BSDXI+1
|
---|
85 | S ^BSDXTMP($J,BSDXI)="1^"_$C(31)
|
---|
86 | ;
|
---|
87 | Q
|
---|
88 | ;
|
---|
89 | ERR(BSDXERID,ERRTXT) ;Error processing
|
---|
90 | S:'+$G(BSDXI) BSDXI=999999
|
---|
91 | S BSDXI=BSDXI+1
|
---|
92 | S ^BSDXTMP($J,BSDXI)=BSDXERID_"^"_ERRTXT_$C(30)
|
---|
93 | S BSDXI=BSDXI+1
|
---|
94 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
95 | Q
|
---|
96 | ;
|
---|
97 | ERROR ;
|
---|
98 | D ^%ZTER
|
---|
99 | I '+$G(BSDXI) N BSDXI S BSDXI=999999
|
---|
100 | S BSDXI=BSDXI+1
|
---|
101 | D ERR(0,"BSDX33 M Error: <"_$G(%ZTERROR)_">")
|
---|
102 | Q
|
---|
103 | ;
|
---|
104 | ERR2(BSDXERID,ERRTXT) ;Error processing
|
---|
105 | S:'+$G(BSDXI) BSDXI=999999
|
---|
106 | S BSDXI=BSDXI+1
|
---|
107 | S ^BSDXTMP($J,BSDXI)=BSDXERID_"^^"_ERRTXT_$C(30)
|
---|
108 | S BSDXI=BSDXI+1
|
---|
109 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
110 | Q
|
---|
111 | ;
|
---|
112 | ERROR2 ;
|
---|
113 | D ^%ZTER
|
---|
114 | I '+$G(BSDXI) N BSDXI S BSDXI=999999
|
---|
115 | S BSDXI=BSDXI+1
|
---|
116 | D ERR2(0,"BSDX33 M Error: <"_$G(%ZTERROR)_">")
|
---|
117 | Q
|
---|