Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BQISYDIV

BQISYDIV.m

Go to the documentation of this file.
BQISYDIV ;GDIT/HS/ALA-Divisions ; 16 Oct 2012  4:12 PM
 ;;2.3;ICARE MANAGEMENT SYSTEM;**3,4**;Apr 18, 2012;Build 66
 ;
FND ; EP - Find all divisions
 ; User file
 K ^XTMP("BQISYDIV")
 S ^XTMP("BQISYDIV",0)=$$FMADD^XLFDT(DT,365)_U_DT_U_"Division list"
 S N=0
 F  S N=$O(^VA(200,N)) Q:'N  D
 . I $P($G(^VA(200,N,0)),U,11)'="",$P(^VA(200,N,0),U,11)<DT Q
 . S L=0 F  S L=$O(^VA(200,N,2,L)) Q:'L  D
 .. S NAME=$P($G(^DIC(4,L,0)),U,1) I NAME="" Q
 .. I $P(^AUTTLOC(L,0),U,21)'="",$P(^AUTTLOC(L,0),U,21)<DT Q
 .. S ^XTMP("BQISYDIV",NAME)=L
 ;
 S N=0
 F  S N=$O(^AUPNPAT(N)) Q:'N  D
 . S L=0 F  S L=$O(^AUPNPAT(N,41,L)) Q:'L  D
 .. I $P(^AUPNPAT(N,41,L,0),"^",3)'="" Q
 .. S NAME=$P($G(^DIC(4,L,0)),U,1) I NAME="" Q
 .. I $P($G(^AUTTLOC(L,0)),U,21)'="",$P(^AUTTLOC(L,0),U,21)<DT Q
 .. S ^XTMP("BQISYDIV",NAME)=L
 Q
 ;
GET(DATA,FAKE) ;EP - BQI GET SITE DIVISIONS
 ; Get specific MU system parameters from the Site Parameter file
 NEW UID,II,IEN,CN,BQDIVN
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIMUSIT",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYDIV D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="I00010IEN^T00060DIVISION"_$C(30)
 ;
 S IEN=$O(^BQI(90508,0)) I IEN="" S BMXSEC="No site defined" Q
 S CN=0
 F  S CN=$O(^BQI(90508,IEN,25,CN)) Q:'CN  D
 . S BQDIVN=$P(^BQI(90508,IEN,25,CN,0),U,1)
 . S II=II+1,@DATA@(II)=BQDIVN_U_$P($G(^DIC(4,BQDIVN,0)),U,1)_$C(30)
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
UPD(DATA,PLIST) ; EP - BQI SET SITE DIVISIONS
 NEW RESULT,ERROR,LIST,BN,BQ,PDATA,NAME,VALUE,BI,BQIUPD,BQDIV
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIUSYPRM",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYDIV D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="I00010RESULT^T01024ERROR"_$C(30)
 ;
 NEW DA,DIK
 S DA(1)=1,DIK="^BQI(90508,"_DA(1)_",25,",DA=0
 F  S DA=$O(^BQI(90508,DA(1),25,DA)) Q:'DA  D ^DIK
 ;
 S PLIST=$G(PLIST,"")
 I PLIST="" D
 . S LIST="",BN=""
 . F  S BN=$O(PLIST(BN)) Q:BN=""  S LIST=LIST_PLIST(BN)
 . K PLIST
 . S PLIST=LIST
 . K LIST
 ;
 S RESULT=1
 F BQ=1:1:$L(PLIST,$C(29)) D  Q:$G(BMXSEC)'=""
 . S BQDIV=$P(PLIST,$C(29),BQ) Q:BQDIV=""
 . S DA=$O(^BQI(90508,0))
 . I $G(^BQI(90508,DA,25,0))="" S ^BQI(90508,DA,25,0)="^90508.025P^^"
 . S DA(1)=DA,DIC(0)="LNZ",DLAYGO=90508.025,DIC="^BQI(90508,"_DA(1)_",25,"
 . S X=BQDIV
 . K DO,DD D FILE^DICN
 . I Y=-1 S RESULT=-1
 ;
 S II=II+1,@DATA@(II)=RESULT_U_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
USR(DATA,FAKE) ;EP -- BQI GET USER DIVISIONS
 NEW UID
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIUSRDIV",UID))
 K @DATA
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYDIV D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D GETFCRS^BMXRPC10(.DATA,DUZ)
 Q