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

BQIPLUTL.m

Go to the documentation of this file.
BQIPLUTL ;PRXM/HC/ALA-Panel Utilities ; 27 Dec 2006  2:20 PM
 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
 ;
 Q
 ;
SXRF ;  Set cross-reference
 ;I $G(DA(3))="" Q
 NEW V3,V2,V1
 S V3=$S($G(DA(3))'="":DA(3),1:DA(2))
 S V2=$S($G(DA(3))'="":DA(2),1:DA(1))
 S V1=$S($G(DA(3))'="":DA(1),1:DA)
 I $P($G(^BQICARE(V3,1,V2,15,V1,0)),U,1)'="PLIDEN" Q
 S ^BQICARE("AD",X,V3,V2,V1)=""
 Q
 ;
KXRF ;  Kill cross-reference
 ;I $G(DA(3))="" Q
 NEW V3,V2,V1
 S V3=$S($G(DA(3))'="":DA(3),1:DA(2))
 S V2=$S($G(DA(3))'="":DA(2),1:DA(1))
 S V1=$S($G(DA(3))'="":DA(1),1:DA)
 I $P($G(^BQICARE(V3,1,V2,15,V1,0)),U,1)'="PLIDEN" Q
 K ^BQICARE("AD",X,V3,V2,V1)
 Q
 ;
CPFL(OWNR,PLIEN) ;EP -- Contains a panel filter
 ;  Does the passed owner and panel contain a panel filter value, then lock those panels
 ;Input
 ;  OWNR = owner of the panel
 ;  PLIEN = panel ien
 NEW FIL,VALUE,POWNR,PPLIEN,TN,SUCC,PPNME
 S FIL="",SUCC=1
 F  S FIL=$O(^BQICARE(OWNR,1,PLIEN,15,"B","PLIDEN",FIL)) Q:FIL=""  D
 . I $P(^BQICARE(OWNR,1,PLIEN,15,FIL,0),U,2)'="" D  Q
 .. S VALUE=$P(^BQICARE(OWNR,1,PLIEN,15,FIL,0),U,2)
 .. S POWNR=$P(VALUE,$C(26),1),PPNME=$P(VALUE,$C(26),2) Q:PPNME=""
 .. S PPLIEN=$O(^BQICARE(POWNR,1,"B",PPNME,"")) Q:PPLIEN=""
 .. S LOCK=$$LCK^BQIPLRF(POWNR,PPLIEN)
 .. I 'LOCK S SUCC=0
 . S TN=0
 . F  S TN=$O(^BQICARE(OWNR,1,PLIEN,15,FIL,1,TN)) Q:'TN  D  Q:'SUCC
 .. S VALUE=$P(^BQICARE(OWNR,1,PLIEN,15,FIL,1,TN,0),U,1)
 .. S POWNR=$P(VALUE,$C(26),1),PPNME=$P(VALUE,$C(26),2) Q:PPNME=""
 .. S PPLIEN=$O(^BQICARE(POWNR,1,"B",PPNME,"")) Q:PPLIEN=""
 .. S LOCK=$$LCK^BQIPLRF(POWNR,PPLIEN)
 .. I 'LOCK S SUCC=0_"^"_$P(LOCK,U,2)_"^"_$G(BMXSEC)_"^"_POWNR_"^"_PPLIEN
 ;
 I 'SUCC D
 . S FIL=""
 . F  S FIL=$O(^BQICARE(OWNR,1,PLIEN,15,"B","PLIDEN",FIL)) Q:FIL=""  D
 .. I $P(^BQICARE(OWNR,1,PLIEN,15,FIL,0),U,2)'="" Q
 .. S TN=0
 .. F  S TN=$O(^BQICARE(OWNR,1,PLIEN,15,FIL,1,TN)) Q:'TN  D
 ... S VALUE=$P(^BQICARE(OWNR,1,PLIEN,15,FIL,1,TN,0),U,1)
 ... S POWNR=$P(VALUE,$C(26),1),PPNME=$P(VALUE,$C(26),2) Q:PPNME=""
 ... S PPLIEN=$O(^BQICARE(POWNR,1,"B",PPNME,"")) Q:PPLIEN=""
 ... D ULK^BQIPLRF(POWNR,PPLIEN)
 Q SUCC
 ;
CPFLU(OWNR,PLIEN) ;EP - Contains a panel filter unlock
 NEW FIL,VALUE,POWNR,PPLIEN,TN,PPNME
 S FIL=""
 F  S FIL=$O(^BQICARE(OWNR,1,PLIEN,15,"B","PLIDEN",FIL)) Q:FIL=""  D
 . I $P(^BQICARE(OWNR,1,PLIEN,15,FIL,0),U,2)'="" D  Q
 .. S VALUE=$P(^BQICARE(OWNR,1,PLIEN,15,FIL,0),U,2)
 .. S POWNR=$P(VALUE,$C(26),1),PPNME=$P(VALUE,$C(26),2) Q:PPNME=""
 .. S PPLIEN=$O(^BQICARE(POWNR,1,"B",PPNME,"")) Q:PPLIEN=""
 .. D ULK^BQIPLRF(POWNR,PPLIEN)
 . S TN=0
 . F  S TN=$O(^BQICARE(OWNR,1,PLIEN,15,FIL,1,TN)) Q:'TN  D
 .. S VALUE=$P(^BQICARE(OWNR,1,PLIEN,15,FIL,1,TN,0),U,1)
 .. S POWNR=$P(VALUE,$C(26),1),PPNME=$P(VALUE,$C(26),2) Q:PPNME=""
 .. S PPLIEN=$O(^BQICARE(POWNR,1,"B",PPNME,"")) Q:PPLIEN=""
 .. D ULK^BQIPLRF(POWNR,PPLIEN)
 Q
 ;
PFILL(OWNR,PLIEN,PLIDEN) ;EP - Lock panel filters or send a notification
 NEW TEXT,TEXT1,POWNR,PPLIEN,LOCK
 S TEXT=" who is using it as a filter.",TEXT1=""
 S POWNR=""
 F  S POWNR=$O(^BQICARE("AD",PLIDEN,POWNR)) Q:POWNR=""  D  Q:LFLG
 . S PPLIEN=""
 . F  S PPLIEN=$O(^BQICARE("AD",PLIDEN,POWNR,PPLIEN)) Q:PPLIEN=""  D  Q:LFLG
 .. S LOCK=$$LCK^BQIPLRF(POWNR,PPLIEN) Q:LOCK
 .. S LFLG=1
 .. S TEXT1=" panel "_$P(^BQICARE(POWNR,1,PPLIEN,0),U,1)_TEXT
 .. D NOT^BQIPLRF(OWNR,PLIEN,TEXT1)
 Q
 ;
PFILU(OWNR,PLIEN,PLIDEN) ;EP - Unlock panel filters locked earlier
 NEW POWNR,PPLIEN
 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 ULK^BQIPLRF(POWNR,PPLIEN)
 Q