- BQIPLDL ;PRXM/HC/DLS - Delete Panel ; 14 Nov 2005 10:44 AM
- ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
- ;
- Q
- ;
- EN(DATA,OWNR,PLIEN) ; EP - BQI DELETE PANEL
- ;Description
- ; DELETE a panel (given an Owner IEN and a Panel IEN).
- ; Panel must be owned by the user.
- ;
- ;Input
- ; OWNR - Panel Owner IEN
- ; PLIEN - Panel IEN
- ;
- ;Output
- ; DATA - Name of global in which data is stored(^TMP("BQIPLDL"))
- ;
- N UID,X,BQII,RSLT,DA,DIK
- S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
- S DATA=$NA(^TMP("BQIPLDL",UID))
- K @DATA
- ;
- S BQII=0
- ;
- NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLDL D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
- ;
- D HDR
- ;
- CHKS ; Do some checks here before proceeding.
- ;
- ; Make sure that the user and owner are the same.
- I DUZ'=OWNR D Q:$G(BMXSEC)'=""
- . I $P(^BQICARE(OWNR,1,PLIEN,0),"^",13)="T" Q
- . S RSLT=0,BMXSEC="User Does Not Own Panel - Panel Not Deleted" G DONE
- ;
- ; Check if this panel is used as a filter
- NEW PLIDEN,POWNR,PPLIEN,TEXT,TEXT1
- S PLIDEN=OWNR_$C(26)_$P(^BQICARE(OWNR,1,PLIEN,0),"^",1)
- I $D(^BQICARE("AD",PLIDEN)) D Q:$G(BMXSEC)'=""
- . S TEXT="Panel is used as a filter for: ",TEXT1=""
- . S POWNR=""
- . F S POWNR=$O(^BQICARE("AD",PLIDEN,POWNR)) Q:POWNR="" D
- .. S PPLIEN=""
- .. F S PPLIEN=$O(^BQICARE("AD",PLIDEN,POWNR,PPLIEN)) Q:PPLIEN="" D
- ... S TEXT1=TEXT1_$P(^BQICARE(POWNR,1,PPLIEN,0),U,1)_" (owned by "_$P(^VA(200,POWNR,0),U,1)_")"_";"
- . S TEXT1=$$TKO^BQIUL1(TEXT1,";")
- . S BMXSEC=TEXT_TEXT1_" - Cannot delete."
- ;
- ; Remove the panel.
- S DA=PLIEN,DA(1)=OWNR
- NEW TEXT,IENS
- S IENS=$$IENS^DILF(.DA)
- S TEXT="Panel "_$$GET1^DIQ(90505.01,IENS,.01,"E")_" has been deleted."
- ; Send notification
- I $P(^BQICARE(OWNR,1,PLIEN,0),"^",13)'="T" D UPD^BQINOTF(OWNR,PLIEN,TEXT)
- ;
- S DIK="^BQICARE("_DA(1)_",1,"
- D ^DIK
- S RSLT=1
- ;
- ; Refresh panel list
- D EVT^BQIPLRF("BQI REFRESH PANEL LIST",$$PLID^BQIUG1(OWNR,PLIEN))
- ; Drop down to DONE...
- ;
- DONE ; Exit, stage right...
- S BQII=BQII+1,@DATA@(BQII)=RSLT_$C(30)
- S BQII=BQII+1,@DATA@(BQII)=$C(31)
- Q
- ;
- HDR ;
- S @DATA@(BQII)="I00001RESULT"_$C(30)
- Q
- ;
- ERR ;
- D ^%ZTER
- NEW Y,ERRDTM
- S RSLT=-1,BQII=BQII+1,@DATA@(BQII)=RSLT_$C(30)
- S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
- S BMXSEC="Recording that an error occurred at "_ERRDTM
- I $D(BQII),$D(DATA) S BQII=BQII+1,@DATA@(BQII)=$C(31)
- Q
- BQIPLDL ;PRXM/HC/DLS - Delete Panel ; 14 Nov 2005 10:44 AM
- +1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
- +2 ;
- +3 QUIT
- +4 ;
- EN(DATA,OWNR,PLIEN) ; EP - BQI DELETE PANEL
- +1 ;Description
- +2 ; DELETE a panel (given an Owner IEN and a Panel IEN).
- +3 ; Panel must be owned by the user.
- +4 ;
- +5 ;Input
- +6 ; OWNR - Panel Owner IEN
- +7 ; PLIEN - Panel IEN
- +8 ;
- +9 ;Output
- +10 ; DATA - Name of global in which data is stored(^TMP("BQIPLDL"))
- +11 ;
- +12 NEW UID,X,BQII,RSLT,DA,DIK
- +13 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
- +14 SET DATA=$NAME(^TMP("BQIPLDL",UID))
- +15 KILL @DATA
- +16 ;
- +17 SET BQII=0
- +18 ;
- +19 ; SAC 2006 2.2.3.3.2
- NEW $ESTACK,$ETRAP
- SET $ETRAP="D ERR^BQIPLDL D UNWIND^%ZTER"
- +20 ;
- +21 DO HDR
- +22 ;
- CHKS ; Do some checks here before proceeding.
- +1 ;
- +2 ; Make sure that the user and owner are the same.
- +3 IF DUZ'=OWNR
- Begin DoDot:1
- +4 IF $PIECE(^BQICARE(OWNR,1,PLIEN,0),"^",13)="T"
- QUIT
- +5 SET RSLT=0
- SET BMXSEC="User Does Not Own Panel - Panel Not Deleted"
- GOTO DONE
- End DoDot:1
- IF $GET(BMXSEC)'=""
- QUIT
- +6 ;
- +7 ; Check if this panel is used as a filter
- +8 NEW PLIDEN,POWNR,PPLIEN,TEXT,TEXT1
- +9 SET PLIDEN=OWNR_$CHAR(26)_$PIECE(^BQICARE(OWNR,1,PLIEN,0),"^",1)
- +10 IF $DATA(^BQICARE("AD",PLIDEN))
- Begin DoDot:1
- +11 SET TEXT="Panel is used as a filter for: "
- SET TEXT1=""
- +12 SET POWNR=""
- +13 FOR
- SET POWNR=$ORDER(^BQICARE("AD",PLIDEN,POWNR))
- IF POWNR=""
- QUIT
- Begin DoDot:2
- +14 SET PPLIEN=""
- +15 FOR
- SET PPLIEN=$ORDER(^BQICARE("AD",PLIDEN,POWNR,PPLIEN))
- IF PPLIEN=""
- QUIT
- Begin DoDot:3
- +16 SET TEXT1=TEXT1_$PIECE(^BQICARE(POWNR,1,PPLIEN,0),U,1)_" (owned by "_$PIECE(^VA(200,POWNR,0),U,1)_")"_";"
- End DoDot:3
- End DoDot:2
- +17 SET TEXT1=$$TKO^BQIUL1(TEXT1,";")
- +18 SET BMXSEC=TEXT_TEXT1_" - Cannot delete."
- End DoDot:1
- IF $GET(BMXSEC)'=""
- QUIT
- +19 ;
- +20 ; Remove the panel.
- +21 SET DA=PLIEN
- SET DA(1)=OWNR
- +22 NEW TEXT,IENS
- +23 SET IENS=$$IENS^DILF(.DA)
- +24 SET TEXT="Panel "_$$GET1^DIQ(90505.01,IENS,.01,"E")_" has been deleted."
- +25 ; Send notification
- +26 IF $PIECE(^BQICARE(OWNR,1,PLIEN,0),"^",13)'="T"
- DO UPD^BQINOTF(OWNR,PLIEN,TEXT)
- +27 ;
- +28 SET DIK="^BQICARE("_DA(1)_",1,"
- +29 DO ^DIK
- +30 SET RSLT=1
- +31 ;
- +32 ; Refresh panel list
- +33 DO EVT^BQIPLRF("BQI REFRESH PANEL LIST",$$PLID^BQIUG1(OWNR,PLIEN))
- +34 ; Drop down to DONE...
- +35 ;
- DONE ; Exit, stage right...
- +1 SET BQII=BQII+1
- SET @DATA@(BQII)=RSLT_$CHAR(30)
- +2 SET BQII=BQII+1
- SET @DATA@(BQII)=$CHAR(31)
- +3 QUIT
- +4 ;
- HDR ;
- +1 SET @DATA@(BQII)="I00001RESULT"_$CHAR(30)
- +2 QUIT
- +3 ;
- ERR ;
- +1 DO ^%ZTER
- +2 NEW Y,ERRDTM
- +3 SET RSLT=-1
- SET BQII=BQII+1
- SET @DATA@(BQII)=RSLT_$CHAR(30)
- +4 SET Y=$$NOW^XLFDT()
- XECUTE ^DD("DD")
- SET ERRDTM=Y
- +5 SET BMXSEC="Recording that an error occurred at "_ERRDTM
- +6 IF $DATA(BQII)
- IF $DATA(DATA)
- SET BQII=BQII+1
- SET @DATA@(BQII)=$CHAR(31)
- +7 QUIT