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

BQIPLDL.m

Go to the documentation of this file.
  1. BQIPLDL ;PRXM/HC/DLS - Delete Panel ; 14 Nov 2005 10:44 AM
  1. ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
  1. ;
  1. Q
  1. ;
  1. EN(DATA,OWNR,PLIEN) ; EP - BQI DELETE PANEL
  1. ;Description
  1. ; DELETE a panel (given an Owner IEN and a Panel IEN).
  1. ; Panel must be owned by the user.
  1. ;
  1. ;Input
  1. ; OWNR - Panel Owner IEN
  1. ; PLIEN - Panel IEN
  1. ;
  1. ;Output
  1. ; DATA - Name of global in which data is stored(^TMP("BQIPLDL"))
  1. ;
  1. N UID,X,BQII,RSLT,DA,DIK
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("BQIPLDL",UID))
  1. K @DATA
  1. ;
  1. S BQII=0
  1. ;
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLDL D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. ;
  1. D HDR
  1. ;
  1. CHKS ; Do some checks here before proceeding.
  1. ;
  1. ; Make sure that the user and owner are the same.
  1. I DUZ'=OWNR D Q:$G(BMXSEC)'=""
  1. . I $P(^BQICARE(OWNR,1,PLIEN,0),"^",13)="T" Q
  1. . S RSLT=0,BMXSEC="User Does Not Own Panel - Panel Not Deleted" G DONE
  1. ;
  1. ; Check if this panel is used as a filter
  1. NEW PLIDEN,POWNR,PPLIEN,TEXT,TEXT1
  1. S PLIDEN=OWNR_$C(26)_$P(^BQICARE(OWNR,1,PLIEN,0),"^",1)
  1. I $D(^BQICARE("AD",PLIDEN)) D Q:$G(BMXSEC)'=""
  1. . S TEXT="Panel is used as a filter for: ",TEXT1=""
  1. . S POWNR=""
  1. . F S POWNR=$O(^BQICARE("AD",PLIDEN,POWNR)) Q:POWNR="" D
  1. .. S PPLIEN=""
  1. .. F S PPLIEN=$O(^BQICARE("AD",PLIDEN,POWNR,PPLIEN)) Q:PPLIEN="" D
  1. ... S TEXT1=TEXT1_$P(^BQICARE(POWNR,1,PPLIEN,0),U,1)_" (owned by "_$P(^VA(200,POWNR,0),U,1)_")"_";"
  1. . S TEXT1=$$TKO^BQIUL1(TEXT1,";")
  1. . S BMXSEC=TEXT_TEXT1_" - Cannot delete."
  1. ;
  1. ; Remove the panel.
  1. S DA=PLIEN,DA(1)=OWNR
  1. NEW TEXT,IENS
  1. S IENS=$$IENS^DILF(.DA)
  1. S TEXT="Panel "_$$GET1^DIQ(90505.01,IENS,.01,"E")_" has been deleted."
  1. ; Send notification
  1. I $P(^BQICARE(OWNR,1,PLIEN,0),"^",13)'="T" D UPD^BQINOTF(OWNR,PLIEN,TEXT)
  1. ;
  1. S DIK="^BQICARE("_DA(1)_",1,"
  1. D ^DIK
  1. S RSLT=1
  1. ;
  1. ; Refresh panel list
  1. D EVT^BQIPLRF("BQI REFRESH PANEL LIST",$$PLID^BQIUG1(OWNR,PLIEN))
  1. ; Drop down to DONE...
  1. ;
  1. DONE ; Exit, stage right...
  1. S BQII=BQII+1,@DATA@(BQII)=RSLT_$C(30)
  1. S BQII=BQII+1,@DATA@(BQII)=$C(31)
  1. Q
  1. ;
  1. HDR ;
  1. S @DATA@(BQII)="I00001RESULT"_$C(30)
  1. Q
  1. ;
  1. ERR ;
  1. D ^%ZTER
  1. NEW Y,ERRDTM
  1. S RSLT=-1,BQII=BQII+1,@DATA@(BQII)=RSLT_$C(30)
  1. S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
  1. S BMXSEC="Recording that an error occurred at "_ERRDTM
  1. I $D(BQII),$D(DATA) S BQII=BQII+1,@DATA@(BQII)=$C(31)
  1. Q