Ignore:
Timestamp:
Aug 30, 2010, 2:52:33 PM (14 years ago)
Author:
Sam Habiel
Message:

Better handling of divisions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/m/BMXRPC3.m

    r645 r924  
    1 BMXRPC3 ; IHS/OIT/HMW - BMX REMOTE PROCEDURE CALLS ;
     1BMXRPC3 ; IHS/OIT/HMW - BMX REMOTE PROCEDURE CALLS ;  ; 8/30/10 2:56pm
    22        ;;2.1;BMX;;Jul 26, 2009
    33        ;Mods by WV/SMH
    44        ;7/26/09 Removed references to ^AUTTSITE, an IHS file in GETFAC*
    5         ;
     5        ;8/30/10 Changed GETFCRS to return a better list of user divisions
     6    ; - Checks to see if there are any divisions
    67        ;
    78VARVAL(RESULT,VARIABLE) ;returns value of passed in variable
     
    136137        Q
    137138        ;
    138 GETFCRS(BMXFACS,BMXDUZ) ;Gets all facilities for a user - returns RECORDSET
    139         ;
    140         ;TODO: return as global array, add error checking
    141         N BMXFN,BMXN,BMXSUB,BMXRCNT
    142         S BMXDUZ=$TR(BMXDUZ,$C(13),"")
    143         S BMXDUZ=$TR(BMXDUZ,$C(10),"")
    144         S BMXDUZ=$TR(BMXDUZ,$C(9),"")
     139GETFCRS(BMXY,BMXDUZ)    ;Gets all facilities for a user - returns RECORDSET
     140        ;/mods by //smh for WV
     141        N $ET S $ET="G ERFC^BMXRPC3"
     142    N BMXFN    ; Facility Number
     143        S BMXDUZ=$TR(BMXDUZ,$C(13)) ; Strip CR,LF,tab
     144        S BMXDUZ=$TR(BMXDUZ,$C(10))
     145        S BMXDUZ=$TR(BMXDUZ,$C(9))
     146        S BMXY="T00030FACILITY_NAME^T00030FACILITY_IEN^T00002DEFAULT"_$C(30)
    145147        S BMXFN=0
    146         S BMXSUB="^VA(200,"_BMXDUZ_",2,"
    147         S BMXFACS="T00030FACILITY_NAME^T00030FACILITY_IEN^T00002MOST_RECENT_LOOKUP"_$C(30)
    148         ;F BMXN=1:1 S BMXFN=$O(^VA(200,BMXDUZ,2,BMXFN)) Q:BMXFN=""  D
    149         S BMXRCNT=0  ;cmi/maw mod 10/17/2006
    150         F BMXN=1:1 S BMXFN=$O(^VA(200,BMXDUZ,2,BMXFN)) Q:'BMXFN  D  ;IHS/ANMC/LJF 8/9/01
    151         . ;S BMXFACS=BMXFACS_$P(^DIC(4,BMXFN,0),U,1)_"^"_BMXFN_$C(30)
    152         . S BMXFACS=BMXFACS_$P(^DIC(4,BMXFN,0),U,1)_"^"_BMXFN
    153         . ;S BMXRCNT=0  ;cmi/maw orig
    154         . ;I $D(^DISV(BMXDUZ,BMXSUB)),^DISV(BMXDUZ,BMXSUB)=BMXFN S BMXRCNT=1
    155         . ;I $G(DUZ(2))=BMXFN S BMXRCNT=1  ;cmi/maw orig
    156         . S BMXRCNT=BMXRCNT+1  ;cmi/maw mod
    157         . S BMXFACS=BMXFACS_"^"_BMXRCNT_$C(30)
    158         ;//smh I BMXN=1 S BMXFN=$P(^AUTTSITE(1,0),U,1) D
    159         ;//smh . S BMXFACS=BMXFACS_$P(^DIC(4,BMXFN,0),U,1)_"^"_BMXFN_"^"_1_$C(30)
    160         S BMXFACS=BMXFACS_$C(31)
     148        F  S BMXFN=$O(^VA(200,BMXDUZ,2,BMXFN)) Q:'BMXFN  D
     149        . ; DD for ^VA(200,DUZ,2,DUZ(2)) is DUZ(2)^default. DUZ(2) is dinummed.
     150    . S BMXY=BMXY_$P(^DIC(4,BMXFN,0),U,1)_U_^VA(200,BMXDUZ,2,BMXFN,0)_$C(30)
     151    ; Crazy line: if we have no results, then use kernel's DUZ(2) set
     152    ; during sign-on
     153    I $L(BMXY,$C(30))<3 S BMXY=BMXY_$P(^DIC(4,DUZ(2),0),U,1)_U_DUZ(2)_$C(30)
     154        S BMXY=BMXY_$C(31)
    161155        Q
    162156        ;
     
    172166        I '+DUZ S BMXY=BMXY_0_"^"_0_"^"_0_$C(30)_$C(31) Q
    173167        I '+BMXFAC S BMXY=BMXY_DUZ_"^"_0_"^"_0_$C(30)_$C(31) Q
    174         I '$D(^VA(200,DUZ,2,+BMXFAC)) S BMXY=BMXY_DUZ_"^"_0_"^"_0_$C(30)_$C(31) Q
     168        ; //SMH Line below is incorrect. Facility valid if not in user profile
     169    ; if it is default kernel facility
     170    ; I '$D(^VA(200,DUZ,2,+BMXFAC)) S BMXY=BMXY_DUZ_"^"_0_"^"_0_$C(30)_$C(31) Q
    175171        S DUZ(2)=BMXFAC ;IHS/OIT/HMW SAC Exemption Applied For
    176172        S BMXFACN=$G(^DIC(4,+DUZ(2),0))
Note: See TracChangeset for help on using the changeset viewer.