Changeset 1467 for Scheduling/trunk/m/BSDX08.m
- Timestamp:
- Jul 5, 2012, 7:42:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX08.m
r1461 r1467 1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/26/12 10:49am1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 7/5/12 12:39pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; … … 16 16 ; 3120625 VEN/SMH v1.7 17 17 ; - Transactions removed. Code refactored to work w/o txns. 18 ; - Moved AVUPDT to AVUPDTCN in BSDXAPI1. BSDXAPI takes care of calling 19 ; that. 18 20 ; 19 21 ; Error Reference: … … 128 130 ; If error happens, must rollback ^BSDXAPPT 129 131 I BSDXLOC D QUIT:BSDXERR 130 . N BSDXLEN S BSDXLEN=$$APPLEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) ; appt length131 132 . S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) ; Cancel through BSDXAPI 132 133 . ; Rollback BSDXAPPT if error occurs 133 . ; TODO: If an M error occurs in BSDXAPI, ETRAP gets called, ^BSDXTMP is134 . ; populated, then the output of $$CANCEL is the output of ETRAP.135 . ; Then, we see that BSDXERR is true, and we do another write,136 . ; which deletes the information we had in ^BSDXTMP. What to do???137 134 . I BSDXERR D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXERR,U,2)),ROLLBACK(BSDXAPTID) QUIT 138 . ;139 . ; Update Legacy PIMS clinic Availability ; no failure expected here.140 . D AVUPDT(BSDXLOC,BSDXSTART,BSDXLEN)141 ;142 135 ; 143 136 L -^BSDXAPPT(BSDXAPTID) … … 146 139 S BSDXI=BSDXI+1 147 140 S ^BSDXTMP($J,BSDXI)=$C(31) 148 Q149 ;150 AVUPDT(BSDXSCD,BSDXSTART,BSDXLEN) ;Update Legacy PIMS Clinic availability151 ;See SDCNP0152 N SD,S ; Start Date153 S (SD,S)=BSDXSTART154 N I ; Clinic IEN in 44155 S I=BSDXSCD156 ; if day has no schedule in legacy PIMS, forget about this update.157 Q:'$D(^SC(I,"ST",SD\1,1))158 N SL ; Clinic characteristics node (length of appt, when appts start etc)159 S SL=^SC(I,"SL")160 N X ; Hour Clinic Display Begins161 S X=$P(SL,U,3)162 N STARTDAY ; When does the day start?163 S STARTDAY=$S($L(X):X,1:8) ; If defined, use it; otherwise, 8am164 N SB ; ?? Who knows? Day Start - 1 divided by 100.165 S SB=STARTDAY-1/100166 S X=$P(SL,U,6) ; Now X is Display increments per hour167 N HSI ; Slots per hour, try 1168 S HSI=$S(X:X,1:4) ; if defined, use it; otherwise, 4169 N SI ; Slots per hour, try 2170 S SI=$S(X="":4,X<3:4,X:X,1:4) ; If slots "", or less than 3, then 4171 N STR ; ??172 S STR="#@!$* XXWVUTSRQPONMLKJIHGFEDCBA0123456789jklmnopqrstuvwxyz"173 N SDDIF ; Slots per hour diff??174 S SDDIF=$S(HSI<3:8/HSI,1:2)175 S SL=BSDXLEN ; Dammit, reusing variable; SL now Appt Length from GUI176 S S=^SC(I,"ST",SD\1,1) ; reusing var again; S now Day Pattern from PIMS177 N Y ; Hours since start of Date178 S Y=SD#1-SB*100 ;SD#1=FM Time portion; -SB minus start of day; conv to hrs179 N ST ; ??180 ; Y#1 -> Minutes; *SI -> * Slots per hour; \.6 trunc min to hour181 ; Y\1 -> Hours since start of day; * SI: * slots182 S ST=Y#1*SI\.6+(Y\1*SI)183 N SS ; how many slots are supposed to be taken by appointment184 S SS=SL*HSI/60 ; (nb: try SL: 30 min; HSI: 4 slots)185 N I186 I Y'<1 D ; If Hours since start of Date is greater than 1187 . ; loop through pattern. Tired of documenting.188 . F I=ST+ST:SDDIF D Q:Y="" Q:SS'>0189 . . S Y=$E(STR,$F(STR,$E(S,I+1))) Q:Y=""190 . . S S=$E(S,1,I)_Y_$E(S,I+2,999)191 . . S SS=SS-1192 . . Q:SS'>0193 S ^SC(BSDXSCD,"ST",SD\1,1)=S ; new pattern; global set194 141 Q 195 142 ; … … 254 201 ; 255 202 ERR(BSDXI,BSDXERR) ;Error processing 203 ; If last line is $C(31), we are done. No more errors to send to client. 204 I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT 256 205 S BSDXI=BSDXI+1 257 206 S BSDXERR=$TR(BSDXERR,"^","~") … … 265 214 N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap 266 215 D ^%ZTER 267 S $EC="" ; Clear Error268 216 ; Roll back BSDXAPPT; 269 ; TODO: What if a Mumps error happens in fileman in BSDXAPI? The Scheduling files can potentially be out of sync 217 ; NB: What if a Mumps error happens inside fileman in BSDXAPI? 218 ; I have decided the M errors are out of scope for me to handle. 270 219 D:$G(BSDXAPTID) ROLLBACK(BSDXAPTID) 271 220 ; Log error message and send to client
Note:
See TracChangeset
for help on using the changeset viewer.