Ignore:
Timestamp:
Jul 5, 2012, 7:42:34 PM (12 years ago)
Author:
Sam Habiel
Message:

BSDX25 refactoring is done; moved PIMS availability change logic from BSDX07 and BSDX08 to BSDXAPI*.m. Calling these has moved from BSDX07 and BSDX08 to 1926MAKE and 1926CANCELBSDXAPI.

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:49am
     1BSDX08  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 7/5/12 12:39pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    1616        ; 3120625 VEN/SMH v1.7
    1717        ;  - Transactions removed. Code refactored to work w/o txns.
     18        ;  - Moved AVUPDT to AVUPDTCN in BSDXAPI1. BSDXAPI takes care of calling
     19        ;    that.
    1820        ;
    1921        ; Error Reference:
     
    128130        ; If error happens, must rollback ^BSDXAPPT
    129131        I BSDXLOC D  QUIT:BSDXERR
    130         . N BSDXLEN S BSDXLEN=$$APPLEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) ; appt length
    131132        . S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) ; Cancel through BSDXAPI
    132133        . ; Rollback BSDXAPPT if error occurs
    133         . ; TODO: If an M error occurs in BSDXAPI, ETRAP gets called, ^BSDXTMP is
    134         . ;       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???
    137134        . 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         ;
    142135        ;
    143136        L -^BSDXAPPT(BSDXAPTID)
     
    146139        S BSDXI=BSDXI+1
    147140        S ^BSDXTMP($J,BSDXI)=$C(31)
    148         Q
    149         ;
    150 AVUPDT(BSDXSCD,BSDXSTART,BSDXLEN)       ;Update Legacy PIMS Clinic availability
    151         ;See SDCNP0
    152         N SD,S  ; Start Date
    153         S (SD,S)=BSDXSTART
    154         N I ; Clinic IEN in 44
    155         S I=BSDXSCD
    156         ; 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 Begins
    161         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, 8am
    164         N SB ; ?? Who knows? Day Start - 1 divided by 100.
    165         S SB=STARTDAY-1/100
    166         S X=$P(SL,U,6) ; Now X is Display increments per hour
    167         N HSI ; Slots per hour, try 1
    168         S HSI=$S(X:X,1:4) ; if defined, use it; otherwise, 4
    169         N SI ; Slots per hour, try 2
    170         S SI=$S(X="":4,X<3:4,X:X,1:4) ; If slots "", or less than 3, then 4
    171         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 GUI
    176         S S=^SC(I,"ST",SD\1,1) ; reusing var again; S now Day Pattern from PIMS
    177         N Y ; Hours since start of Date
    178         S Y=SD#1-SB*100 ;SD#1=FM Time portion; -SB minus start of day; conv to hrs
    179         N ST  ; ??
    180         ; Y#1 -> Minutes; *SI -> * Slots per hour; \.6 trunc min to hour
    181         ; Y\1 -> Hours since start of day; * SI: * slots
    182         S ST=Y#1*SI\.6+(Y\1*SI)
    183         N SS ; how many slots are supposed to be taken by appointment
    184         S SS=SL*HSI/60 ; (nb: try SL: 30 min; HSI: 4 slots)
    185         N I
    186         I Y'<1 D  ; If Hours since start of Date is greater than 1
    187         . ; loop through pattern. Tired of documenting.
    188         . F I=ST+ST:SDDIF D  Q:Y=""  Q:SS'>0
    189         . . 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-1
    192         . . Q:SS'>0
    193         S ^SC(BSDXSCD,"ST",SD\1,1)=S  ; new pattern; global set
    194141        Q
    195142        ;
     
    254201        ;
    255202ERR(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
    256205        S BSDXI=BSDXI+1
    257206        S BSDXERR=$TR(BSDXERR,"^","~")
     
    265214        N $ET S $ET="D ^%ZTER HALT"  ; Emergency Error Trap
    266215        D ^%ZTER
    267         S $EC=""  ; Clear Error
    268216        ; 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.
    270219        D:$G(BSDXAPTID) ROLLBACK(BSDXAPTID)
    271220        ; Log error message and send to client
Note: See TracChangeset for help on using the changeset viewer.