source: Scheduling/trunk/m/BSDX33.m@ 871

Last change on this file since 871 was 863, checked in by Sam Habiel, 14 years ago

more i18n work

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