BQIPLVEW ;VNGT/HS/ALA-Get all Views for a Panel ; 08 Jul 2009 5:51 PM
;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
;
GET(DATA,OWNR,PLIEN) ; EP -- BQI GET PANEL LAYOUTS
;Description
; This returns all displays for a panel
;Input
; OWNR - Owner of panel internal entry number
; PLIEN - Panel internal entry number
;Output
; DATA - name of global (passed by reference) in which the data
; is stored
;Expected
; DUZ - User internal entry number
;Variables used
; UID - TMP global subscript. Will be either $J or "Z" plus the
; TaskMan Task ID
;
NEW UID,II,IEN,DOR,SOR,DVALUE,SVALUE,X,SRC,TN,TYP,BQVW,SRN,BQVWS,CARE,DEF,GVALUE,MVALUE,STVCD,TEMPL,TMP
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIPLVEW",UID))
K @DATA
S II=0
S @DATA@(II)="I00010TEMPL_IEN^T00040TEMPLATE_NAME^T00001DEFAULT^T00001TYPE^T00120DISPLAY_ORDER^T00120SORT_ORDER^T00120SORT_DIRECTION"_$C(30)
;
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLVEW D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
; If user is the owner
I OWNR=DUZ D
. ; Check for templates
. S TN=0
. F S TN=$O(^BQICARE(OWNR,1,PLIEN,4,TN)) Q:'TN D
.. S TYP=$P(^BQICARE(OWNR,1,PLIEN,4,TN,0),U,2),TMPL=$P(^(0),U,1)
.. S BQVW(TYP)=$$TPN^BQILYUTL(OWNR,TMPL)
. ;
. ; Check for customized views
. I $O(^BQICARE(OWNR,1,PLIEN,20,0))'="" S BQVW("D")="C^20"
. I $O(^BQICARE(OWNR,1,PLIEN,22,0))'="" S BQVW("R")="C^22"
. I $O(^BQICARE(OWNR,1,PLIEN,25,0))'="" S BQVW("G")="C^23"
. ;
. ; Check for source views
. S TN=0
. F S TN=$O(^BQICARE(OWNR,1,PLIEN,23,TN)) Q:'TN D
.. S SRC=$P(^BQICARE(OWNR,1,PLIEN,23,TN,0),U,1)
.. S SRN=$O(^BQI(90506.5,"B",SRC,"")),TYP=$P(^BQI(90506.5,SRN,0),U,2)
.. S BQVW(TYP)="S^"_SRC
;
; If user is not the owner
I OWNR'=DUZ D
. ; Check for templates
. S TN=0
. F S TN=$O(^BQICARE(OWNR,1,PLIEN,30,DUZ,4,TN)) Q:'TN D
.. S TYP=$P(^BQICARE(OWNR,1,PLIEN,30,DUZ,4,TN,0),U,2),TMPL=$P(^(0),U,1)
.. S BQVW(TYP)=$$TPN^BQILYUTL(OWNR,TMPL)
. ;
. ; Check for customized views
. I $O(^BQICARE(OWNR,1,PLIEN,30,DUZ,20,0))'="" S BQVW("D")="C^20"
. I $O(^BQICARE(OWNR,1,PLIEN,30,DUZ,22,0))'="" S BQVW("R")="C^22"
. I $O(^BQICARE(OWNR,1,PLIEN,30,DUZ,25,0))'="" S BQVW("G")="C^23"
. ;
. ; Check for source views
. S TN=0
. F S TN=$O(^BQICARE(OWNR,1,PLIEN,30,DUZ,23,TN)) Q:'TN D
.. S SRC=$P(^BQICARE(OWNR,1,PLIEN,30,DUZ,23,TN,0),U,1)
.. S SRN=$O(^BQI(90506.5,"B",SRC,"")),TYP=$P(^BQI(90506.5,SRN,0),U,2)
.. S BQVW(TYP)="S^"_SRC
;
; Otherwise define defaults
S TMP=$NA(BQVW)
F TYP="D","R","G","A" D
. I $D(@TMP@(TYP)) D Q
.. S VALUE=@TMP@(TYP)
.. ;
.. ; If this is a template, get the template definition
.. I VALUE?.N D DEF^BQILYDEF(VALUE) Q
.. ;
.. ; If this is a source view, check for a customized view or else return the default
.. I $E(VALUE,1)="S" D
... S SRC=$P(@TMP@(TYP),U,2) I $$CVW^BQICMVW(SRC) Q
... D STND^BQILYDEF(TYP)
.. ;
.. ; If this is a customized view
.. I $E(VALUE,1)="C" D
... I TYP="D" D
.... I $$CVW^BQIPLVWC() Q
.... D STND^BQILYDEF(TYP)
... I TYP="R" D
.... I $$CVW^BQIPLRVW() Q
.... D STND^BQILYDEF(TYP)
... I TYP="G" D
.... I $$CVW^BQIGPVW() Q
.... D STND^BQILYDEF(TYP)
. D STND^BQILYDEF(TYP)
;
DONE ;
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,OWNR,PLIEN,TYPE,TEMPL,SOR,SDIR,DOR) ; EP -- BQI SAVE PANEL LAYOUTS
;Input
; OWNR - Owner IEN
; PLIEN - Panel IEN
; TYPE - Type of layout that is being saved
; TEMPL - Template name
; YEAR - GRPA Year
; DOR - The display order
; SOR - The sort order
; SDIR - The sort direction
NEW UID,II,TMPL,YEAR
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIPLVUP",UID))
S @DATA@(II)="I00010RESULT^T00100MSG^T00001HANDLER"_$C(30)
;
I $G(YEAR)="" D
. I OWNR'="",PLIEN'="" D
.. NEW DA,IENS
.. S DA(1)=$S(OWNR=DUZ:DUZ,1:OWNR)
.. S DA=PLIEN,IENS=$$IENS^DILF(.DA)
.. S YEAR=$$GET1^DIQ(90505.01,IENS,3.3,"E")
. S BQIH=$$SPM^BQIGPUTL()
. I $G(YEAR)="" S YEAR=$$GET1^DIQ(90508,BQIH_",",2,"E")
;
S TEMPL=$G(TEMPL,"")
S SOR=$G(SOR,""),SDIR=$G(SDIR,"")
S:SOR="" SOR="PN" S:SDIR="" SDIR="A"
;
S DOR=$G(DOR,"")
I DOR="" D
. S LIST="",BN=""
. F S BN=$O(DOR(BN)) Q:BN="" S LIST=LIST_DOR(BN)
. K DOR
. S DOR=LIST
. K LIST
;
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLVEW D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S RESULT=1_U_U
;
; If the template is not null, save the template
I TEMPL'="" D G FIN
. I OWNR=DUZ D
.. NEW DA,IENS,DIC
.. S DA(2)=OWNR,DA(1)=PLIEN,X=TEMPL,DIC(0)="LNZ",DIC="^BQICARE("_DA(2)_",1,"_DA(1)_",4,"
.. D ^DIC
.. S DA=+Y
.. S IENS=$$IENS^DILF(.DA)
.. S BQIUPD(90505.14,IENS,.02)=TYPE
.. D FILE^DIE("","BQIUPD","ERROR")
.. I $D(ERROR) S RESULT=-1_U_$G(ERROR("DIERR",1,"TEXT",1))_U
. I OWNR'=DUZ D
.. S DA(3)=OWNR,DA(2)=PLIEN,DA(1)=DUZ,X=TEMPL,DIC(0)="LNZ"
.. S DIC="^BQICARE("_DA(3)_",1,"_DA(2)_",30,"_DA(1)_",4,"
.. D ^DIC
.. S DA=+Y
.. S IENS=$$IENS^DILF(.DA)
.. S BQIUPD(90505.34,IENS,.02)=TYPE
.. D FILE^DIE("","BQIUPD","ERROR")
.. I $D(ERROR) S RESULT=-1_U_$G(ERROR("DIERR",1,"TEXT",1))_U
;
; If the template name is blank, then each type must be saved as customized
I TEMPL="" D
. I TYPE="R" D FIL^BQIPLRVW(OWNR,PLIEN,SOR,SDIR,DOR) Q
. I TYPE="G" D FIL^BQIGPVW(OWNR,PLIEN,YEAR,SOR,SDIR,DOR) Q
. I TYPE="D" D FIL^BQIPLVWC(OWNR,PLIEN,SOR,SDIR,DOR) Q
. S CRN=$O(^BQI(90506.5,"C",TYPE,"")) Q:CRN=""
. S CARE=$P(^BQI(90506.5,CRN,0),U,1)
. D FIL^BQICMVW(OWNR,PLIEN,CARE,SOR,SDIR,DOR)
Q
;
FIN ;
S II=II+1,@DATA@(II)=RESULT_$C(30)
S II=II+1,@DATA@(II)=$C(31)
Q
BQIPLVEW ;VNGT/HS/ALA-Get all Views for a Panel ; 08 Jul 2009 5:51 PM
+1 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
+2 ;
GET(DATA,OWNR,PLIEN) ; EP -- BQI GET PANEL LAYOUTS
+1 ;Description
+2 ; This returns all displays for a panel
+3 ;Input
+4 ; OWNR - Owner of panel internal entry number
+5 ; PLIEN - Panel internal entry number
+6 ;Output
+7 ; DATA - name of global (passed by reference) in which the data
+8 ; is stored
+9 ;Expected
+10 ; DUZ - User internal entry number
+11 ;Variables used
+12 ; UID - TMP global subscript. Will be either $J or "Z" plus the
+13 ; TaskMan Task ID
+14 ;
+15 NEW UID,II,IEN,DOR,SOR,DVALUE,SVALUE,X,SRC,TN,TYP,BQVW,SRN,BQVWS,CARE,DEF,GVALUE,MVALUE,STVCD,TEMPL,TMP
+16 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+17 SET DATA=$NAME(^TMP("BQIPLVEW",UID))
+18 KILL @DATA
+19 SET II=0
+20 SET @DATA@(II)="I00010TEMPL_IEN^T00040TEMPLATE_NAME^T00001DEFAULT^T00001TYPE^T00120DISPLAY_ORDER^T00120SORT_ORDER^T00120SORT_DIRECTION"_$CHAR(30)
+21 ;
+22 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIPLVEW D UNWIND^%ZTER"
+23 ;
+24 ; If user is the owner
+25 IF OWNR=DUZ
Begin DoDot:1
+26 ; Check for templates
+27 SET TN=0
+28 FOR
SET TN=$ORDER(^BQICARE(OWNR,1,PLIEN,4,TN))
IF 'TN
QUIT
Begin DoDot:2
+29 SET TYP=$PIECE(^BQICARE(OWNR,1,PLIEN,4,TN,0),U,2)
SET TMPL=$PIECE(^(0),U,1)
+30 SET BQVW(TYP)=$$TPN^BQILYUTL(OWNR,TMPL)
End DoDot:2
+31 ;
+32 ; Check for customized views
+33 IF $ORDER(^BQICARE(OWNR,1,PLIEN,20,0))'=""
SET BQVW("D")="C^20"
+34 IF $ORDER(^BQICARE(OWNR,1,PLIEN,22,0))'=""
SET BQVW("R")="C^22"
+35 IF $ORDER(^BQICARE(OWNR,1,PLIEN,25,0))'=""
SET BQVW("G")="C^23"
+36 ;
+37 ; Check for source views
+38 SET TN=0
+39 FOR
SET TN=$ORDER(^BQICARE(OWNR,1,PLIEN,23,TN))
IF 'TN
QUIT
Begin DoDot:2
+40 SET SRC=$PIECE(^BQICARE(OWNR,1,PLIEN,23,TN,0),U,1)
+41 SET SRN=$ORDER(^BQI(90506.5,"B",SRC,""))
SET TYP=$PIECE(^BQI(90506.5,SRN,0),U,2)
+42 SET BQVW(TYP)="S^"_SRC
End DoDot:2
End DoDot:1
+43 ;
+44 ; If user is not the owner
+45 IF OWNR'=DUZ
Begin DoDot:1
+46 ; Check for templates
+47 SET TN=0
+48 FOR
SET TN=$ORDER(^BQICARE(OWNR,1,PLIEN,30,DUZ,4,TN))
IF 'TN
QUIT
Begin DoDot:2
+49 SET TYP=$PIECE(^BQICARE(OWNR,1,PLIEN,30,DUZ,4,TN,0),U,2)
SET TMPL=$PIECE(^(0),U,1)
+50 SET BQVW(TYP)=$$TPN^BQILYUTL(OWNR,TMPL)
End DoDot:2
+51 ;
+52 ; Check for customized views
+53 IF $ORDER(^BQICARE(OWNR,1,PLIEN,30,DUZ,20,0))'=""
SET BQVW("D")="C^20"
+54 IF $ORDER(^BQICARE(OWNR,1,PLIEN,30,DUZ,22,0))'=""
SET BQVW("R")="C^22"
+55 IF $ORDER(^BQICARE(OWNR,1,PLIEN,30,DUZ,25,0))'=""
SET BQVW("G")="C^23"
+56 ;
+57 ; Check for source views
+58 SET TN=0
+59 FOR
SET TN=$ORDER(^BQICARE(OWNR,1,PLIEN,30,DUZ,23,TN))
IF 'TN
QUIT
Begin DoDot:2
+60 SET SRC=$PIECE(^BQICARE(OWNR,1,PLIEN,30,DUZ,23,TN,0),U,1)
+61 SET SRN=$ORDER(^BQI(90506.5,"B",SRC,""))
SET TYP=$PIECE(^BQI(90506.5,SRN,0),U,2)
+62 SET BQVW(TYP)="S^"_SRC
End DoDot:2
End DoDot:1
+63 ;
+64 ; Otherwise define defaults
+65 SET TMP=$NAME(BQVW)
+66 FOR TYP="D","R","G","A"
Begin DoDot:1
+67 IF $DATA(@TMP@(TYP))
Begin DoDot:2
+68 SET VALUE=@TMP@(TYP)
+69 ;
+70 ; If this is a template, get the template definition
+71 IF VALUE?.N
DO DEF^BQILYDEF(VALUE)
QUIT
+72 ;
+73 ; If this is a source view, check for a customized view or else return the default
+74 IF $EXTRACT(VALUE,1)="S"
Begin DoDot:3
+75 SET SRC=$PIECE(@TMP@(TYP),U,2)
IF $$CVW^BQICMVW(SRC)
QUIT
+76 DO STND^BQILYDEF(TYP)
End DoDot:3
+77 ;
+78 ; If this is a customized view
+79 IF $EXTRACT(VALUE,1)="C"
Begin DoDot:3
+80 IF TYP="D"
Begin DoDot:4
+81 IF $$CVW^BQIPLVWC()
QUIT
+82 DO STND^BQILYDEF(TYP)
End DoDot:4
+83 IF TYP="R"
Begin DoDot:4
+84 IF $$CVW^BQIPLRVW()
QUIT
+85 DO STND^BQILYDEF(TYP)
End DoDot:4
+86 IF TYP="G"
Begin DoDot:4
+87 IF $$CVW^BQIGPVW()
QUIT
+88 DO STND^BQILYDEF(TYP)
End DoDot:4
End DoDot:3
End DoDot:2
QUIT
+89 DO STND^BQILYDEF(TYP)
End DoDot:1
+90 ;
DONE ;
+1 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+2 QUIT
+3 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(II)
IF $DATA(DATA)
SET II=II+1
SET @DATA@(II)=$CHAR(31)
+6 QUIT
+7 ;
UPD(DATA,OWNR,PLIEN,TYPE,TEMPL,SOR,SDIR,DOR) ; EP -- BQI SAVE PANEL LAYOUTS
+1 ;Input
+2 ; OWNR - Owner IEN
+3 ; PLIEN - Panel IEN
+4 ; TYPE - Type of layout that is being saved
+5 ; TEMPL - Template name
+6 ; YEAR - GRPA Year
+7 ; DOR - The display order
+8 ; SOR - The sort order
+9 ; SDIR - The sort direction
+10 NEW UID,II,TMPL,YEAR
+11 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+12 SET DATA=$NAME(^TMP("BQIPLVUP",UID))
+13 SET @DATA@(II)="I00010RESULT^T00100MSG^T00001HANDLER"_$CHAR(30)
+14 ;
+15 IF $GET(YEAR)=""
Begin DoDot:1
+16 IF OWNR'=""
IF PLIEN'=""
Begin DoDot:2
+17 NEW DA,IENS
+18 SET DA(1)=$SELECT(OWNR=DUZ:DUZ,1:OWNR)
+19 SET DA=PLIEN
SET IENS=$$IENS^DILF(.DA)
+20 SET YEAR=$$GET1^DIQ(90505.01,IENS,3.3,"E")
End DoDot:2
+21 SET BQIH=$$SPM^BQIGPUTL()
+22 IF $GET(YEAR)=""
SET YEAR=$$GET1^DIQ(90508,BQIH_",",2,"E")
End DoDot:1
+23 ;
+24 SET TEMPL=$GET(TEMPL,"")
+25 SET SOR=$GET(SOR,"")
SET SDIR=$GET(SDIR,"")
+26 IF SOR=""
SET SOR="PN"
IF SDIR=""
SET SDIR="A"
+27 ;
+28 SET DOR=$GET(DOR,"")
+29 IF DOR=""
Begin DoDot:1
+30 SET LIST=""
SET BN=""
+31 FOR
SET BN=$ORDER(DOR(BN))
IF BN=""
QUIT
SET LIST=LIST_DOR(BN)
+32 KILL DOR
+33 SET DOR=LIST
+34 KILL LIST
End DoDot:1
+35 ;
+36 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIPLVEW D UNWIND^%ZTER"
+37 ;
+38 SET RESULT=1_U_U
+39 ;
+40 ; If the template is not null, save the template
+41 IF TEMPL'=""
Begin DoDot:1
+42 IF OWNR=DUZ
Begin DoDot:2
+43 NEW DA,IENS,DIC
+44 SET DA(2)=OWNR
SET DA(1)=PLIEN
SET X=TEMPL
SET DIC(0)="LNZ"
SET DIC="^BQICARE("_DA(2)_",1,"_DA(1)_",4,"
+45 DO ^DIC
+46 SET DA=+Y
+47 SET IENS=$$IENS^DILF(.DA)
+48 SET BQIUPD(90505.14,IENS,.02)=TYPE
+49 DO FILE^DIE("","BQIUPD","ERROR")
+50 IF $DATA(ERROR)
SET RESULT=-1_U_$GET(ERROR("DIERR",1,"TEXT",1))_U
End DoDot:2
+51 IF OWNR'=DUZ
Begin DoDot:2
+52 SET DA(3)=OWNR
SET DA(2)=PLIEN
SET DA(1)=DUZ
SET X=TEMPL
SET DIC(0)="LNZ"
+53 SET DIC="^BQICARE("_DA(3)_",1,"_DA(2)_",30,"_DA(1)_",4,"
+54 DO ^DIC
+55 SET DA=+Y
+56 SET IENS=$$IENS^DILF(.DA)
+57 SET BQIUPD(90505.34,IENS,.02)=TYPE
+58 DO FILE^DIE("","BQIUPD","ERROR")
+59 IF $DATA(ERROR)
SET RESULT=-1_U_$GET(ERROR("DIERR",1,"TEXT",1))_U
End DoDot:2
End DoDot:1
GOTO FIN
+60 ;
+61 ; If the template name is blank, then each type must be saved as customized
+62 IF TEMPL=""
Begin DoDot:1
+63 IF TYPE="R"
DO FIL^BQIPLRVW(OWNR,PLIEN,SOR,SDIR,DOR)
QUIT
+64 IF TYPE="G"
DO FIL^BQIGPVW(OWNR,PLIEN,YEAR,SOR,SDIR,DOR)
QUIT
+65 IF TYPE="D"
DO FIL^BQIPLVWC(OWNR,PLIEN,SOR,SDIR,DOR)
QUIT
+66 SET CRN=$ORDER(^BQI(90506.5,"C",TYPE,""))
IF CRN=""
QUIT
+67 SET CARE=$PIECE(^BQI(90506.5,CRN,0),U,1)
+68 DO FIL^BQICMVW(OWNR,PLIEN,CARE,SOR,SDIR,DOR)
End DoDot:1
+69 QUIT
+70 ;
FIN ;
+1 SET II=II+1
SET @DATA@(II)=RESULT_$CHAR(30)
+2 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+3 QUIT