Changeset 1463 for Scheduling


Ignore:
Timestamp:
Jun 28, 2012, 6:54:30 PM (12 years ago)
Author:
Sam Habiel
Message:

Moved some unit tests around; Unit tests for BSDX25; minor refactoring for BSDX25

Location:
Scheduling/trunk/m
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/m/BSDX25.m

    r1187 r1463  
    1 BSDX25  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 4/28/11 10:24am
    2         ;;1.6T2;BSDX;;May 16, 2011
     1BSDX25  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/28/12 11:45am
     2        ;;1.6;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL
    44        ;
     
    77        ;
    88        ;
    9 UT      ; Unit Tests
    10         ; Make appointment, checkin, then uncheckin
    11         N ZZZ
    12         N APPTTIME S APPTTIME=$E($$NOW^XLFDT(),1,12)
    13         D APPADD^BSDX07(.ZZZ,APPTTIME,APPTTIME+.0001,3,"Dr Office",30,"Sam's Note",1)
    14         N APPTID S APPTID=+^BSDXTMP($J,1)
    15         N HL S HL=$$GET1^DIQ(9002018.4,APPTID,".07:.04","I")
    16         D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
    17         IF '$P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 1",!
    18         IF '+$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 2",!
    19         D RMCI^BSDX25(.ZZZ,APPTID)
    20         IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN UNCHECKIN 1",!
    21         IF $G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN UNCHECKIN 2",!
    22         D RMCI^BSDX25(.ZZZ,APPTID)  ; again, test sanity in repeat
    23         IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN UNCHECKIN 1",!
    24         IF $G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN UNCHECKIN 2",!
    25         ; now test various error conditions
    26         ; Test Error 1
    27         D RMCI^BSDX25(.ZZZ,)
    28         IF +^BSDXTMP($J,1)'=-1 WRITE "ERROR IN ETest 1",!
    29         ; Test Error 2
    30         D RMCI^BSDX25(.ZZZ,234987234398)
    31         IF +^BSDXTMP($J,1)'=-2 WRITE "ERROR IN Etest 2",!
    32         ; Tests for 3 to 5 difficult to produce
    33         ; Error tests follow: Mumps error test; Transaction restartability
    34         N bsdxdie S bsdxdie=1
    35         D RMCI^BSDX25(.ZZZ,APPTID)
    36         IF +^BSDXTMP($J,1)'=-20 WRITE "ERROR IN Etest 3",!
    37         K bsdxdie
    38         N bsdxrestart S bsdxrestart=1
    39         D RMCI^BSDX25(.ZZZ,APPTID)
    40         IF +^BSDXTMP($J,1)'=0 WRITE "Error in Etest 4",!
    41         QUIT
    429CHECKIND(BSDXY,BSDXAPTID,BSDXCDT,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG) ;EP
    4310        ;Entry point for debugging
     
    4613        Q
    4714        ;
    48 CHECKIN(BSDXY,BSDXAPTID,BSDXCDT)        ; ,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG)       ;EP Check in appointment
     15CHECKIN(BSDXY,BSDXAPTID,BSDXCDT) ;Private EP Check in appointment
     16        ; Old additional vars: ,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG)
    4917        ; Private to GUI; use BSDXAPI for general API to checkin patients
    5018        ; Parameters:
     
    6331        ; - 0 if all okay
    6432        ; - Another number or text if not
    65        
    66         N BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXI,BSDXZ,BSDXIENS,BSDXVEN
     33        ;
     34        N BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXZ,BSDXIENS,BSDXVEN
     35        ;
     36        ; Turn off SDAM Appointment Events BSDX Protocol Processing
    6737        N BSDXNOEV
    6838        S BSDXNOEV=1 ;Don't execute protocol
    6939        ;
    70         D ^XBKVAR S X="ERROR^BSDX25",@^%ZOSF("TRAP")
    71         S BSDXI=0
     40        ; Set min DUZ vars
     41        D ^XBKVAR
     42        ;
     43        ; $ET
     44        N $ET S $ET="G ERROR^BSDX25"
     45        ;
     46        N BSDXI S BSDXI=0
    7247        K ^BSDXTMP($J)
    7348        S BSDXY="^BSDXTMP("_$J_")"
     
    7853        ;S:BSDXCDT["@0000" BSDXCDT=$P(BSDXCDT,"@")
    7954        ;S %DT="T",X=BSDXCDT D ^%DT S BSDXCDT=Y
    80            S BSDXCDT=+BSDXCDT  ; Strip off zeros if C# sends them
     55        S BSDXCDT=+BSDXCDT  ; Strip off zeros if C# sends them
    8156        I BSDXCDT=-1 D ERR(70) Q
    8257        I BSDXCDT>$$NOW^XLFDT S BSDXCDT=$$NOW^XLFDT
     
    128103        ; -4~DB has corruption. Call Tech Support. (Resource ID in BSDXAPPT doesnt exist in BSDXRES)
    129104        ; -5~BSDXAPI Error. Message depends on error.
    130         ; -20~Mumps Error
     105        ; -100~Mumps Error
    131106        ;
    132107        N BSDXNOEV S BSDXNOEV=1 ;Don't execute protocol
     
    159134        ; Now, remove checkin from PIMS files 2/44
    160135        N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0)
    161         N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN
    162         N BSDXSTART S BSDXSTART=$P(BSDXNOD,U)   ; Start Date
     136        N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN
     137        N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Start Date
    163138        N BSDXSC1 S BSDXSC1=$P(BSDXNOD,U,7) ; Resource ID
    164139        ;
     
    225200ERROR   ;
    226201        S $ETRAP="D ^%ZTER HALT"  ; Emergency Error Trap for the wise
    227            ; Rollback, otherwise ^XTER will be empty from future rollback
    228            I $TL>0 TROLLBACK
    229            D ^%ZTER
    230            S $EC=""  ; Clear Error
    231            ; Log error message and send to client
    232         D ERR("-20~Mumps Error")
     202        ; Rollback, otherwise ^XTER will be empty from future rollback
     203        I $TL>0 TROLLBACK
     204        D ^%ZTER
     205        S $EC=""  ; Clear Error
     206        ; Log error message and send to client
     207        D ERR("-100~Mumps Error")
    233208        Q
    234209        ;
  • Scheduling/trunk/m/BSDXUT.m

    r1462 r1463  
    1 BSDXUT ; VEN/SMH - Unit Tests for Scheduling GUI ; 6/27/12 4:18pm
     1BSDXUT ; VEN/SMH - Unit Tests for Scheduling GUI ; 6/28/12 10:14am
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL
     
    239239        QUIT
    240240        ;
    241 UT08    ; Unit Tests for BSDX08; Must have patients 1,2,3,4,5 defined in system
    242         N RESNAM S RESNAM="UTCLINIC"
    243         N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
    244         D
    245         . N $ET S $ET="D ^%ZTER B"
    246         . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
    247         . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
    248         ;
    249         N HLIEN,RESIEN
    250         S HLIEN=$P(HLRESIENS,U)
    251         S RESIEN=$P(HLRESIENS,U,2)
    252         ;
    253         ; Get start and end times
    254         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    255         N APPTTIME S APPTTIME=$P(TIMES,U)
    256         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    257         ;
    258         ; Test 1: Make normal appointment and cancel it. See if every thing works
    259         N ZZZ,DFN
    260         S DFN=3
    261         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    262         S APPID=+$P(^BSDXTMP($J,1),U)
    263         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
    264         I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1",!
    265         I $O(^SC(HLIEN,"S",APPTTIME,1,0))]"" W "Error in Cancellation-2",!
    266         I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="PC" W "Error in Cancellation-3",!
    267         I ^DPT(DFN,"S",APPTTIME,"R")'="Sam's Cancel Note" W "Error in Cancellation-4",!
    268         ;
    269         ; Test 2: Check for -1 -- TODO: Fix later... Can't do right now automatically
    270         ; Make appt
    271         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    272         ; Lock the node in another job
    273         S APPID=+$P(^BSDXTMP($J,1),U)
    274         ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
    275         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
    276         ;
    277         ; Test 3: Check for -100
    278         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    279         N APPTTIME S APPTTIME=$P(TIMES,U)
    280         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    281         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    282         S APPID=+$P(^BSDXTMP($J,1),U)
    283         N BSDXDIE1 S BSDXDIE1=1
    284         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
    285         I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
    286         K BSDXDIE1
    287         ;
    288         ; Test 3.5: Check for -100 with an appointment to rollback.
    289         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    290         N APPTTIME S APPTTIME=$P(TIMES,U)
    291         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    292         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    293         S APPID=+$P(^BSDXTMP($J,1),U)
    294         N BSDXDIE2 S BSDXDIE2=1
    295         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
    296         I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100-1",!
    297         I $P(^BSDXAPPT(APPID,0),U,12)'="" W "Error in -100-2",!
    298         K BSDXDIE2
    299         ; Test 4: Restartable transaction -- retired in V 1.7
    300         ; Test 5: for invalid Appointment ID (-2 and -3)
    301         D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
    302         I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
    303         D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
    304         I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
    305         ; More unit Tests
    306         ;
    307         ; Test 6: for Cancelling walkin and checked-in appointments
    308         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    309         N APPTTIME S APPTTIME=$P(TIMES,U)
    310         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    311         S DFN=4
    312         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
    313         S APPID=+$P(^BSDXTMP($J,1),U)
    314         I APPID=0 W "Error in test 6",!
    315         D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
    316         D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
    317         I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
    318         ;
    319         ; Test 7: for cancelling walkin and checked-in appointments
    320         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    321         N APPTTIME S APPTTIME=$P(TIMES,U)
    322         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    323         S DFN=4
    324         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
    325         S APPID=+$P(^BSDXTMP($J,1),U)
    326         I APPID=0 W "Error in test 6",!
    327         D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
    328         S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
    329         D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
    330         I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
    331         ;
    332         ; Unlinked Clinic Tests
    333         N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
    334         N RESIEN
    335         D
    336         . N $ET S $ET="D ^%ZTER B"
    337         . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
    338         . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
    339         ;
    340         ; Get start and end times
    341         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    342         N APPTTIME S APPTTIME=$P(TIMES,U)
    343         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    344         ;
    345         ; Test 1: Make normal appointment and cancel it. See if every thing works
    346         N ZZZ,DFN
    347         S DFN=3
    348         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    349         S APPID=+$P(^BSDXTMP($J,1),U)
    350         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
    351         I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
    352         ;
    353         ; Test 6: for Cancelling walkin and checked-in appointments
    354         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    355         N APPTTIME S APPTTIME=$P(TIMES,U)
    356         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    357         S DFN=4
    358         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
    359         S APPID=+$P(^BSDXTMP($J,1),U)
    360         I APPID=0 W "Error in test 6",!
    361         D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
    362         D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
    363         I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
    364         ;
    365         ; Test 7: for cancelling walkin and checked-in appointments
    366         N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
    367         N APPTTIME S APPTTIME=$P(TIMES,U)
    368         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    369         S DFN=5
    370         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
    371         S APPID=+$P(^BSDXTMP($J,1),U)
    372         I APPID=0 W "Error in test 6",!
    373         D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
    374         S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
    375         D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
    376         I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
    377         QUIT
    378         ;
    379241UTCR(RESNAM) ; $$ - Create Unit Test Clinic and Resource Pair ; Private
    380242 ; Input: Resource Name By Value
  • Scheduling/trunk/m/BSDXUT1.m

    r1462 r1463  
    1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/27/12 4:59pm
     1BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/28/12 10:17am
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     4        ;
     5UT08    ; Unit Tests for BSDX08; Must have patients 1,2,3,4,5 defined in system
     6        N RESNAM S RESNAM="UTCLINIC"
     7        N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
     8        D
     9        . N $ET S $ET="D ^%ZTER B"
     10        . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
     11        . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     12        ;
     13        N HLIEN,RESIEN
     14        S HLIEN=$P(HLRESIENS,U)
     15        S RESIEN=$P(HLRESIENS,U,2)
     16        ;
     17        ; Get start and end times
     18        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     19        N APPTTIME S APPTTIME=$P(TIMES,U)
     20        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     21        ;
     22        ; Test 1: Make normal appointment and cancel it. See if every thing works
     23        N ZZZ,DFN
     24        S DFN=3
     25        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     26        S APPID=+$P(^BSDXTMP($J,1),U)
     27        D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
     28        I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1",!
     29        I $O(^SC(HLIEN,"S",APPTTIME,1,0))]"" W "Error in Cancellation-2",!
     30        I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="PC" W "Error in Cancellation-3",!
     31        I ^DPT(DFN,"S",APPTTIME,"R")'="Sam's Cancel Note" W "Error in Cancellation-4",!
     32        ;
     33        ; Test 2: Check for -1 -- TODO: Fix later... Can't do right now automatically
     34        ; Make appt
     35        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     36        ; Lock the node in another job
     37        S APPID=+$P(^BSDXTMP($J,1),U)
     38        ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
     39        D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
     40        ;
     41        ; Test 3: Check for -100
     42        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     43        N APPTTIME S APPTTIME=$P(TIMES,U)
     44        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     45        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     46        S APPID=+$P(^BSDXTMP($J,1),U)
     47        N BSDXDIE1 S BSDXDIE1=1
     48        D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
     49        I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
     50        K BSDXDIE1
     51        ;
     52        ; Test 3.5: Check for -100 with an appointment to rollback.
     53        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     54        N APPTTIME S APPTTIME=$P(TIMES,U)
     55        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     56        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     57        S APPID=+$P(^BSDXTMP($J,1),U)
     58        N BSDXDIE2 S BSDXDIE2=1
     59        D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
     60        I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100-1",!
     61        I $P(^BSDXAPPT(APPID,0),U,12)'="" W "Error in -100-2",!
     62        K BSDXDIE2
     63        ; Test 4: Restartable transaction -- retired in V 1.7
     64        ; Test 5: for invalid Appointment ID (-2 and -3)
     65        D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
     66        I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
     67        D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
     68        I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
     69        ; More unit Tests
     70        ;
     71        ; Test 6: for Cancelling walkin and checked-in appointments
     72        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     73        N APPTTIME S APPTTIME=$P(TIMES,U)
     74        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     75        S DFN=4
     76        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
     77        S APPID=+$P(^BSDXTMP($J,1),U)
     78        I APPID=0 W "Error in test 6",!
     79        D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
     80        D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
     81        I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
     82        ;
     83        ; Test 7: for cancelling walkin and checked-in appointments
     84        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     85        N APPTTIME S APPTTIME=$P(TIMES,U)
     86        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     87        S DFN=4
     88        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
     89        S APPID=+$P(^BSDXTMP($J,1),U)
     90        I APPID=0 W "Error in test 6",!
     91        D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
     92        S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
     93        D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
     94        I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
     95        ;
     96        ; Unlinked Clinic Tests
     97        N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
     98        N RESIEN
     99        D
     100        . N $ET S $ET="D ^%ZTER B"
     101        . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
     102        . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     103        ;
     104        ; Get start and end times
     105        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     106        N APPTTIME S APPTTIME=$P(TIMES,U)
     107        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     108        ;
     109        ; Test 1: Make normal appointment and cancel it. See if every thing works
     110        N ZZZ,DFN
     111        S DFN=3
     112        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     113        S APPID=+$P(^BSDXTMP($J,1),U)
     114        D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
     115        I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
     116        ;
     117        ; Test 6: for Cancelling walkin and checked-in appointments
     118        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     119        N APPTTIME S APPTTIME=$P(TIMES,U)
     120        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     121        S DFN=4
     122        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
     123        S APPID=+$P(^BSDXTMP($J,1),U)
     124        I APPID=0 W "Error in test 6",!
     125        D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
     126        D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
     127        I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
     128        ;
     129        ; Test 7: for cancelling walkin and checked-in appointments
     130        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     131        N APPTTIME S APPTTIME=$P(TIMES,U)
     132        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     133        S DFN=5
     134        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
     135        S APPID=+$P(^BSDXTMP($J,1),U)
     136        I APPID=0 W "Error in test 6",!
     137        D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
     138        S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
     139        D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
     140        I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
     141        QUIT
    4142        ;
    5143UT29 ; Unit Test for BSDX29
Note: See TracChangeset for help on using the changeset viewer.