Changeset 1114 for Scheduling/trunk


Ignore:
Timestamp:
Mar 27, 2011, 8:51:38 AM (14 years ago)
Author:
Sam Habiel
Message:

BSDX25, now past Unit Tests

File:
1 edited

Legend:

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

    r1113 r1114  
    1 BSDX25  ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 3/15/11 8:15pm
     1BSDX25  ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 3/16/11 1:07am
    22        ;;1.5V2;BSDX;;Mar 03, 2011
    3            ;
    4            ; Change Log:
    5            ; 3110106: SMH -> Changed Check-in EP - Removed unused paramters. Will change C#
    6         ;
    7         ;
     3        ;
     4        ; Change Log:
     5        ; 3110106: SMH -> Changed Check-in EP - Removed unused paramters. Will change C#
     6        ;
     7        ;
     8UT ; Unit Tests
     9 ; Make appointment, checkin, then uncheckin
     10        N ZZZ
     11        N APPTTIME S APPTTIME=$E($$NOW^XLFDT(),1,12)
     12        D APPADD^BSDX07(.ZZZ,APPTTIME,APPTTIME+.0001,3,"Dr Office",30,"Sam's Note",1)
     13        N APPTID S APPTID=+^BSDXTMP($J,1)
     14        N HL S HL=$$GET1^DIQ(9002018.4,APPTID,".07:.04","I")
     15        D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
     16        IF '$P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 1",!
     17        IF '+$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 2",!
     18        D RMCI^BSDX25(.ZZZ,APPTID)
     19        IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN UNCHECKIN 1",!
     20        IF $G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN UNCHECKIN 2",!
     21        D RMCI^BSDX25(.ZZZ,APPTID)  ; again, test sanity in repeat
     22        IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN UNCHECKIN 1",!
     23        IF $G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN UNCHECKIN 2",!
     24        ; now test various error conditions
     25        ; Test Error 1
     26        D RMCI^BSDX25(.ZZZ,)
     27        IF +^BSDXTMP($J,1)'=-1 WRITE "ERROR IN ETest 1",!
     28        ; Test Error 2
     29        D RMCI^BSDX25(.ZZZ,234987234398)
     30        IF +^BSDXTMP($J,1)'=-2 WRITE "ERROR IN Etest 2",!
     31        ; Tests for 3 to 5 difficult to produce
     32        ; Error tests follow: Mumps error test; Transaction restartability
     33        N bsdxdie S bsdxdie=1
     34        D RMCI^BSDX25(.ZZZ,APPTID)
     35        IF +^BSDXTMP($J,1)'=-20 WRITE "ERROR IN Etest 3",!
     36        K bsdxdie
     37        N bsdxrestart S bsdxrestart=1
     38        D RMCI^BSDX25(.ZZZ,APPTID)
     39        IF +^BSDXTMP($J,1)'=0 WRITE "Error in Etest 4",!
     40        QUIT
    841CHECKIND(BSDXY,BSDXAPTID,BSDXCDT,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG) ;EP
    942        ;Entry point for debugging
     
    1447CHECKIN(BSDXY,BSDXAPTID,BSDXCDT)        ; ,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG)       ;EP Check in appointment
    1548        ; Private to GUI; use BSDXAPI for general API to checkin patients
    16            ; Parameters:
    17            ; BSDXY: Global Out
    18            ; BSDXAPTID: Appointment ID in ^BSDXAPPT
    19            ; BSDXCDT: Checkin Date --> Changed
    20            ; BSDXCC: Clinic Stop IEN (not used)
    21            ; BSDXPRV: Provider IEN (not used)
    22            ; BSDXROU: Print Routing Slip? (not used)
    23            ; BSDXVCL: PCC+ Clinic IEN (not used)
    24            ; BSDXVFM: PCC+ Form IEN (not used)
    25            ; BSDXOG: PCC+ Outguide (true or false)
    26            ;
    27            ; Output:
    28            ; ADO.net table with 1 column ErrorID, 1 row result
    29            ; - 0 if all okay
    30            ; - Another number or text if not
     49        ; Parameters:
     50        ; BSDXY: Global Out
     51        ; BSDXAPTID: Appointment ID in ^BSDXAPPT
     52        ; BSDXCDT: Checkin Date --> Changed
     53        ; BSDXCC: Clinic Stop IEN (not used)
     54        ; BSDXPRV: Provider IEN (not used)
     55        ; BSDXROU: Print Routing Slip? (not used)
     56        ; BSDXVCL: PCC+ Clinic IEN (not used)
     57        ; BSDXVFM: PCC+ Form IEN (not used)
     58        ; BSDXOG: PCC+ Outguide (true or false)
     59        ;
     60        ; Output:
     61        ; ADO.net table with 1 column ErrorID, 1 row result
     62        ; - 0 if all okay
     63        ; - Another number or text if not
    3164       
    3265        N BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXI,BSDXZ,BSDXIENS,BSDXVEN
     
    6093        ;
    6194        S BSDXI=BSDXI+1
    62         ;S ^BSDXTMP($J,BSDXI)="-1"_$C(30)
    6395        S ^BSDXTMP($J,BSDXI)="0"_$C(30)
    6496        S BSDXI=BSDXI+1
     
    88120        ; Record set with Column ERRORID; value of 0 AOK; other value
    89121        ;  --> means that something went wrong
    90         ;
     122        ;
     123        ; Error Reference:
     124        ; -1~Invalid Appointment ID (not passed)
     125        ; -2~Invalid Appointment ID (Doesn't exist in ^BSDXAPPT)
     126        ; -3~DB has corruption. Call Tech Support. (Resource ID doesn't exist in BSDXAPPT)
     127        ; -4~DB has corruption. Call Tech Support. (Resource ID in BSDXAPPT doesnt exist in BSDXRES)
     128        ; -5~BSDXAPI Error. Message depends on error.
     129        ; -20~Mumps Error
     130        ;
    91131        N BSDXNOEV S BSDXNOEV=1 ;Don't execute protocol
    92132        ;
     
    101141        S ^BSDXTMP($J,BSDXI)="T00020ERRORID"_$C(30) ; Header of ADO recordset
    102142        ;
    103         TSTART ():SERIAL ; Perform Autolocking
     143        TSTART (BSDXI):SERIAL ; Perform Autolocking
     144        ;
     145        ;;;test
     146        I $g(bsdxdie) S X=8/0
     147        ;;;
     148        I $g(bsdxrestart) k bsdxrestart TRESTART
     149        ;;;test
    104150        ;
    105151        ; Check for Appointment ID (passed and exists in file)
    106         I '+BSDXAPTID D ERR("1~Invalid Appointment ID") QUIT
    107         I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR("2~Invalid Appointment ID") QUIT
     152        I '+$G(BSDXAPPTID) D ERR("-1~Invalid Appointment ID") QUIT
     153        I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-2~Invalid Appointment ID") QUIT
    108154        ;
    109155        ; Remove checkin from BSDX APPOINTMENT entry
    110         D BSDXCHK(BSDXAPTID,"@")
     156        D BSDXCHK(BSDXAPPTID,"@")
    111157        ;
    112158        ; Now, remove checkin from PIMS files 2/44
    113         N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPTID,0)
     159        N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0)
    114160        N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN
    115161        N BSDXSTART S BSDXSTART=$P(BSDXNOD,U)   ; Start Date
     
    117163        ;
    118164        ; If the resource doesn't exist, error out. DB is corrupt.
    119         I BSDXSC1]"" D ERR("3~DB has corruption. Call Tech Support.") QUIT
    120         I $D(^BSDXRES(BSDXSC1,0)) D ERR("4~DB has corruption. Call Tech Support.") QUIT
     165        I 'BSDXSC1 D ERR("-3~DB has corruption. Call Tech Support.") QUIT
     166        I '$D(^BSDXRES(BSDXSC1,0)) D ERR("-4~DB has corruption. Call Tech Support.") QUIT
    121167        ;
    122168        N BSDXNOD S BSDXNOD=^BSDXRES(BSDXSC1,0) ; Resource 0 node
     
    124170        ;
    125171        N BSDXZ ; Scratch variable to hold error message
    126         I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI(BSDXPAT,BSDXSC1,BSDXSTART)
    127         I +$G(BSDXZ) D ERR("5~"_$P(BSDXZ,U,2)) QUIT
     172        I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
     173        I +$G(BSDXZ) D ERR("-5~"_$P(BSDXZ,U,2)) QUIT
    128174        ;
    129175        TCOMMIT  ; Save Data into Globals
     
    173219        Q:BSDXRESN=""
    174220        S BSDXRESN=$P(BSDXRESN,"^")
    175         ;D EVENT^BSDX23("SCHEDULE-"_BSDXRESN,"","","")
    176221        D EVENT^BMXMEVN("BSDX SCHEDULE",BSDXRESN)
    177222        Q
    178223        ;
    179224ERROR   ;
     225        S $ETRAP="D ^%ZTER HALT"  ; Emergency Error Trap for the wise
     226    ; Rollback, otherwise ^XTER will be empty from future rollback
     227    I $TL>0 TROLLBACK
     228    D ^%ZTER
     229    S $EC=""  ; Clear Error
     230    ; Log error message and send to client
    180231        D ERR("-20~Mumps Error")
    181232        Q
     
    183234ERR(BSDXERR)    ;Error processing
    184235        I $TLEVEL>0 TROLLBACK
    185         S BSDXERR=$TEXT(+0)_":"_$GET(BSDXERR) ; Append Routine Name
    186         S BSDXI=BSDXI+1
     236        S BSDXERR=$G(BSDXERR)
     237        S BSDXERR=$P(BSDXERR,"~")_"~"_$TEXT(+0)_":"_$P(BSDXERR,"~",2) ; Append Routine Name
     238        S BSDXI=$G(BSDXI)+1
    187239        S ^BSDXTMP($J,BSDXI)=BSDXERR_$C(30)
    188240        S BSDXI=BSDXI+1
Note: See TracChangeset for help on using the changeset viewer.