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

BQIPLFLD.m

Go to the documentation of this file.
BQIPLFLD ;VNGT/HS/ALA-Panel Folders ; 13 Jul 2011  9:52 AM
 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
 ;
 ;
GET(DATA,OWNR) ;EP -- BQI GET PANEL CATEGORIES
 ;
 NEW UID,II,X,MIEN,SOURCE,PARMS,PIEN,NAME,PTYP,VALUE,PMIEN
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPLFLD",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLFLD D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="I00010IEN^T00030NAME^T00030COLOR"_$C(30)
 I $G(OWNR)="" S OWNR=DUZ
 S IEN=0
 F  S IEN=$O(^BQICARE(OWNR,17,IEN)) Q:'IEN  D
 . S II=II+1,@DATA@(II)=IEN_U_^BQICARE(OWNR,17,IEN,0)_$C(30)
 ;
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,TYPE,IEN,PARMS) ;  EP - BQI SET PANEL CATEGORIES
 ;
 ;Input
 ;  OWNR  - User who signed onto iCare
 ;  TYPE  - A=Add, E=Edit, D=Delete
 ;  PARMS - Parameters for the source
 ;
 NEW UID,II,X,MIEN,PIEN,PMIEN,VALUE,PDATA,ALDA,QFL,BQ,NAME,MVAL,BQII,PPIEN
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPLFLG",UID))
 K @DATA
 ;
 S II=0,PARMS=$G(PARMS,"") I $G(OWNR)="" S OWNR=DUZ
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLFLD D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="I00010RESULT"_$C(30)
 ;
 I TYPE="A" D ADD
 I TYPE="D" D DEL
 I TYPE="E" D EDT
 S RESULT=1
 I $D(ERROR) S RESULT=-1
 S II=II+1,@DATA@(II)=RESULT_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ADD ;
 NEW PDATA,BQ,NAME,VALUE,IENS,BQIUPD,COLOR
 F BQ=1:1:$L(PARMS,$C(28)) D
 . S PDATA=$P(PARMS,$C(28),BQ) Q:PDATA=""
 . S PNAME=$P(PDATA,"=",1),VALUE=$P(PDATA,"=",2,99)
 . S @PNAME=VALUE
 NEW DA,DIC,DLAYGO
 S DA(1)=OWNR
 S DIC="^BQICARE("_DA(1)_",17,",DLAYGO=90505.017,DIC(0)="LMNZ"
 I $G(^BQICARE(OWNR,17,0))="" S ^BQICARE(OWNR,17,0)="^90505.017^^"
 S X=NAME D ^DIC S DA=+Y
 S IENS=$$IENS^DILF(.DA)
 S BQIUPD(90505.017,IENS,.01)=NAME
 S BQIUPD(90505.017,IENS,.02)=COLOR
 D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
DEL ;
 NEW NAME,DA,DIK,BN
 S NAME=$P(^BQICARE(OWNR,17,IEN,0),U,1)
 S DA(1)=OWNR,DA=IEN,DIK="^BQICARE("_DA(1)_",17,"
 D ^DIK
 S BN=0
 F  S BN=$O(^BQICARE(OWNR,1,BN)) Q:'BN  D
 . I $P($G(^BQICARE(OWNR,1,BN,2)),U,2)=IEN S $P(^BQICARE(OWNR,1,BN,2),U,2)=""
 Q
 ;
EDT ;
 NEW PDATA,BQ,BN,NAME,VALUE,DA,BQIUPD,ONAME
 F BQ=1:1:$L(PARMS,$C(28)) D
 . S PDATA=$P(PARMS,$C(28),BQ) Q:PDATA=""
 . S NAME=$P(PDATA,"=",1),VALUE=$P(PDATA,"=",2,99)
 . S DA(1)=OWNR,DA=IEN,IENS=$$IENS^DILF(.DA)
 . I NAME="NAME" S BQIUPD(90505.017,IENS,.01)=VALUE
 . I NAME="COLOR" S BQIUPD(90505.017,IENS,.02)=VALUE
 S ONAME=$P(^BQICARE(OWNR,17,IEN,0),U,1)
 D FILE^DIE("","BQIUPD","ERROR")
 ;S NAME=$P(^BQICARE(OWNR,17,IEN,0),U,1)
 ;S BN=0
 ;F  S BN=$O(^BQICARE(OWNR,1,BN)) Q:'BN  D
 ;. I $P($G(^BQICARE(OWNR,1,BN,2)),U,2)=ONAME S $P(^BQICARE(OWNR,1,BN,2),U,2)=NAME
 Q