Changeset 1452 for Scheduling/trunk/m/BSDX07.m
- Timestamp:
- Jun 20, 2012, 7:42:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX07.m
r1451 r1452 1 BSDX07 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/ 19/12 5:34pm1 BSDX07 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/20/12 3:28pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 12 12 ; It could be midnight of the next day 13 13 ; v1.6 Apr 11 2011 - Support for Scheduling Radiology Exams... 14 ; v1.7 Jun 20 2012 - Refactoring to remove transactions - many changes 14 15 ; 15 16 ; Error Reference: … … 38 39 . N $ET S $ET="D ^%ZTER B" 39 40 . S HLRESIENS=$$UTCR^BSDX35(RESNAM) 40 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen 41 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so 41 42 ; 42 43 N HLIEN,RESIEN … … 84 85 S BSDX("CLN")=HLIEN 85 86 S BSDX("ADT")=APPTTIME 86 D BSDXDEL^BSDX07(APPID) 87 S %=$$UNMAKE^BSDXAPI(.BSDX) 87 D ROLLBACK(APPID,.BSDX) 88 88 I +$G(^BSDXAPPT(APPID,0)) W "Error in deleting appointment-1",! 89 89 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-2",! 90 90 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-3",! 91 91 ; 92 ; Again for a different patient (5) 93 S DFN=5 94 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 95 N APPID S APPID=+$P(^BSDXTMP($J,1),U) 96 I 'APPID W "Error Making Appt-13" QUIT 97 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-14" 98 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-15" 99 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-16" 100 ; Now cancel that appointment 101 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note") 102 ; Now make it again 103 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 104 N APPID S APPID=+$P(^BSDXTMP($J,1),U) 105 I 'APPID W "Error Making Appt-17" QUIT 106 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-18" 107 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-19" 108 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-20" 109 ; 92 110 ; Delete appointment set for Patient 1 (not made)... needs to not crash 93 111 D 94 112 . N $ET S $ET="D ^%ZTER S $EC="""" W ""Failure to del non-existent appt"",!" 95 . D BSDXDEL^BSDX07(9999999)96 113 . N BSDX 97 114 . S BSDX("PAT")=1 98 115 . S BSDX("CLN")=HLIEN 99 116 . S BSDX("ADT")=APPTTIME 100 . S %=$$UNMAKE^BSDXAPI(.BSDX)117 . D ROLLBACK(APPID,.BSDX) 101 118 ; 102 119 ; Test for bad start date … … 141 158 D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1) 142 159 I +$P(^BSDXTMP($J,1),U,2)'=-10 W "Error in -10",! 160 ; 161 ; Test that rollback occurs properly in various places 162 N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time 163 N APPTTIME S APPTTIME=$P(TIMES,U) 164 N ENDTIME S ENDTIME=$P(TIMES,U,2) 165 S DFN=4 166 N BSDXSIMERR1 S BSDXSIMERR1=1 167 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 168 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,"")) 169 I +APPID W "Error in deleting appointment-4",! 170 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-5",! 171 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-6",! 172 ; 173 K BSDXSIMERR1 174 N BSDXSIMERR2 S BSDXSIMERR2=1 175 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 176 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,"")) 177 I +APPID W "Error in deleting appointment-7",! 178 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-8",! 179 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-9",! 180 ; 181 K BSDXSIMERR2 182 N BSDXSIMERR4 S BSDXSIMERR4=1 183 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 184 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,"")) 185 I +APPID W "Error in deleting appointment-16",! 186 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-17",! 187 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-18",! 188 ; 189 K BSDXSIMERR4 190 N BSDXSIMERR5 S BSDXSIMERR5=1 191 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 192 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,"")) 193 I +APPID W "Error in deleting appointment-19",! 194 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-20",! 195 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-21",! 143 196 QUIT 144 197 ; … … 168 221 ; ADO.net Recordset having fields: 169 222 ; AppointmentID and ErrorNumber 223 ; 224 ; NB: Specifying BSDXLEN and BSDXEND is redundant. For future programmers 225 ; to sort out 170 226 ; 171 227 ;Test lines: … … 261 317 S BSDXAPPTID=$$BSDXADD(BSDXSTART,BSDXEND,BSDXPATID,BSDXRESD,BSDXATID,BSDXRADEXAM) 262 318 I 'BSDXAPPTID D ERR(BSDXI,"-9~BSDX07 Error: Unable to add appointment to BSDX APPOINTMENT file.") Q ; no roll back needed! No appts made. 263 I BSDXNOTE]"" D BSDXWP(BSDXAPPTID,BSDXNOTE) ; TODO: check for error and rollback 319 I BSDXNOTE]"" D BSDXWP(BSDXAPPTID,BSDXNOTE) ; no error checks are made here 320 ; I don't think it's important b/c users can detect right away if the WP 321 ; filing fails. 322 ; 323 I $G(BSDXSIMERR1) D ERR(BSDXI,"-11~BSDX07 Error: Simulated Error"),ROLLBACK(BSDXAPPTID,.BSDXC) Q ; UT Line 264 324 ; 265 325 ; Only if we have a valid Hosp Loc can we make an appointment in 2/44 … … 269 329 . S BSDXERR=$$MAKE^BSDXAPI(.BSDXC) 270 330 . Q:BSDXERR 271 . ;Update RPMS Clinic availability 272 . D AVUPDT(BSDXSCD,BSDXSTART,BSDXLEN) 331 . D AVUPDT(BSDXSCD,BSDXSTART,BSDXLEN) ; Update RPMS Clinic availability 273 332 ; 274 333 ;Return Recordset … … 346 405 Q 347 406 ; 348 ERR(BSDXI,BSDXERR) ;Error processing 407 ROLLBACK(BSDXAPPTID,BSDXC) ; Private EP; Roll back appointment set 408 ; DO NOT USE except as an emergency measure - only if unforseen error occurs 409 ; Input: 410 ; Appointment ID to remove from ^BSDXAPPT 411 ; BSDXC array (see array format in $$MAKE^BSDXAPI) 412 ; NB: I am not sure whether I want to do $G to protect?? 413 ; I send the variables to this EP from the Symbol Table in ETRAP 414 D BSDXDEL^BSDX07(BSDXAPPTID) 415 S:$D(BSDXC) %=$$UNMAKE^BSDXAPI(.BSDXC) ; rtn value always 0 416 QUIT 417 ; 418 BSDXDEL(BSDXAPPTID) ;Private EP ; Deletes appointment BSDXAPPTID from ^BSDXAPPT 419 ; DO NOT USE except in emergencies to roll back an appointment set 420 N DA,DIK 421 S DIK="^BSDXAPPT(",DA=BSDXAPPTID 422 D ^DIK 423 Q 424 ; 425 ERR(BSDXI,BSDXERR) ;Error processing - different from error trap. 349 426 S BSDXI=BSDXI+1 350 427 S BSDXERR=$TR(BSDXERR,"^","~") … … 355 432 Q 356 433 ; 357 ROLLBACK(BSDXAPPTID,BSDXC) ; Private EP; Roll back appointment set358 ; DO NOT USE except as an emergency measure - only if unforseen error occurs359 ; Input:360 ; Appointment ID to remove from ^BSDXAPPT361 ; BSDXC array (see array format in $$MAKE^BSDXAPI)362 D BSDXDEL^BSDX07(BSDXAPPTID)363 S:$D(BSDXC) %=$$UNMAKE^BSDXAPI(.BSDXC) ; rtn value always 0364 QUIT365 ;366 BSDXDEL(BSDXAPPTID) ;Private EP ; Deletes appointment BSDXAPPTID from ^BSDXAPPT367 ; DO NOT USE except in emergencies to roll back an appointment set368 N DA,DIK369 S DIK="^BSDXAPPT(",DA=BSDXAPPTID370 D ^DIK371 Q372 ;373 434 ETRAP ;EP Error trap entry 374 435 N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap 375 436 D ^%ZTER 376 437 S $EC="" ; Clear Error 438 I +$G(BSDXAPPTID) D ROLLBACK(BSDXAPPTID,.BSDXC) ; Rollback if BSDXAPPTID exists 377 439 ; Log error message and send to client 378 440 I '$D(BSDXI) N BSDXI S BSDXI=0 379 441 D ERR(BSDXI,"-100~BSDX07 Error: "_$G(%ZTERZE)) 380 Q 442 Q:$Q 1_U_"Mumps Error" Q 381 443 ; 382 444 DAY ;;^SUN^MON^TUES^WEDNES^THURS^FRI^SATUR
Note:
See TracChangeset
for help on using the changeset viewer.