Changeset 1076 for Scheduling/trunk/m/BSDX08.m
- Timestamp:
- Jan 24, 2011, 9:21:52 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX08.m
r1041 r1076 1 1 BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 12:35pm 2 2 ;;1.42;BSDX;;Dec 07, 2010 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 ; 4 ; Original by HMW. New Written by Sam Habiel. Licensed under LGPL. 5 ; 6 ; Change History 7 ; 3101022 UJO/SMH v1.42 8 ; - Transaction now restartable. Thanks to 9 ; --> Zach Gonzalez and Rick Marshall for fix. 10 ; - Extra TROLLBACK in Lock Statement when lock fails. 11 ; --> Removed--Rollback is already in ERR tag. 12 ; - Added new statements to old SD code in AVUPDT to obviate 13 ; --> need to restore variables in transaction 14 ; - Refactored this chunk of code. Don't really know whether it 15 ; --> worked in the first place. Waiting for bug report to know. 16 ; - Refactored all of APPDEL. 17 ; 18 ; Error Reference: 19 ; -1~BSDX08: Appt record is locked. Please contact technical support. 20 ; -2~BSDX08: Invalid Appointment ID 21 21 ; -3~BSDX08: Invalid Appointment ID 22 23 24 25 26 27 28 22 ; -4~BSDX08: Cancelled appointment does not have a Resouce ID 23 ; -5~BSDX08: Resouce ID does not exist in BSDX RESOURCE 24 ; -6~BSDX08: Invalid Hosp Location stored in Database 25 ; -7~BSDX08: Patient does not have an appointment in PIMS Clinic 26 ; -8^BSDX08: Unable to find associated PIMS appointment for this patient 27 ; -9^BSDX08: BSDXAPI returned an error: (error) 28 ; -100~BSDX08 Error: (Mumps Error) 29 29 ; 30 30 APPDELD(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP … … 34 34 ; 35 35 UT ; Unit Tests 36 ; Test 1: Make normal appointment and cancel it. See if every thing works 37 N ZZZ 38 D APPADD^BSDX07(.ZZZ,3110123.2,3110123.3,4,"Dr Office",10,"Sam's Note",1) 39 S APPID=+$P(^BSDXTMP($J,1),U) 40 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note") 41 I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1" 42 I $O(^SC(2,"S",3110123.2,1,0))]"" W "Error in Cancellation-2" 43 I $P(^DPT(4,"S",3110123.2,0),U,2)'="PC" W "Error in Cancellation-3" 44 I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4" 45 ; 46 ; Test 2: Check for -1 47 ; Make appt 48 D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1) 49 ; Lock the node in another job 50 S APPID=+$P(^BSDXTMP($J,1),U) 51 ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10 52 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note") 53 ; 54 ; Test 3: Check for -100 55 S bsdxdie=1 56 D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1) 57 S APPID=+$P(^BSDXTMP($J,1),U) 58 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons") 59 I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",! 60 K bsdxdie 61 ; 62 ; Test 4: Restartable transaction 63 S bsdxrestart=1 64 D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1) 65 S APPID=+$P(^BSDXTMP($J,1),U) 66 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons") 67 I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",! 68 ; 69 ; Test 5: for invalid Appointment ID (-2 and -3) 70 D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons") 71 I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",! 72 D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons") 73 I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",! 74 QUIT 36 ; Test 1: Make normal appointment and cancel it. See if every thing works 37 N ZZZ 38 D APPADD^BSDX07(.ZZZ,3110123.2,3110123.3,4,"Dr Office",10,"Sam's Note",1) 39 S APPID=+$P(^BSDXTMP($J,1),U) 40 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note") 41 I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1" 42 I $O(^SC(2,"S",3110123.2,1,0))]"" W "Error in Cancellation-2" 43 I $P(^DPT(4,"S",3110123.2,0),U,2)'="PC" W "Error in Cancellation-3" 44 I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4" 45 ; 46 ; Test 2: Check for -1 47 ; Make appt 48 D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1) 49 ; Lock the node in another job 50 S APPID=+$P(^BSDXTMP($J,1),U) 51 ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10 52 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note") 53 ; 54 ; Test 3: Check for -100 55 S bsdxdie=1 56 D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1) 57 S APPID=+$P(^BSDXTMP($J,1),U) 58 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons") 59 I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",! 60 K bsdxdie 61 ; 62 ; Test 4: Restartable transaction 63 S bsdxrestart=1 64 D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1) 65 S APPID=+$P(^BSDXTMP($J,1),U) 66 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons") 67 I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",! 68 ; 69 ; Test 5: for invalid Appointment ID (-2 and -3) 70 D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons") 71 I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",! 72 D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons") 73 I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",! 74 ; 75 ; Test 6: for Cancelling walkin and checked-in appointments. 76 S BSDXSTART=$E($$NOW^XLFDT,1,12),BSDXEND=BSDXSTART+.0001 77 D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) 78 S APPID=+$P(^BSDXTMP($J,1),U) 79 B 80 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) 81 B 82 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") 83 QUIT 75 84 ; Lock the node in another job for testing. 76 85 UTL(APPID) L +^BSDXAPPT(APPID) HANG 10 QUIT
Note:
See TracChangeset
for help on using the changeset viewer.