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

AGGETRIG.m

Go to the documentation of this file.
AGGETRIG ;VNGT/HS/ALA - Eligibility Triggers ; 24 May 2010  4:51 PM
 ;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
 ;
 ;
INIT(DATA,DFN) ; EP -- AGG PATIENT ELIG TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGGPTCLB,AGGPTELG,AGGPTTRI,AGGPTBLQ,AGGPTTRQ
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGETRIG",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGETRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S SOURCE="AGGPTCLB",TYPE="T",ABLE="Y",REQ="Y"
 S DVAL=$$TBL^AGGWDEF(9999999.25,"INDIAN/ALASKA NATIVE")
 S AGGPTCLB=$$GET1^DIQ(9000001,DFN_",",1111,"I")
 I AGGPTCLB="" S VALUE=DVAL
 I AGGPTCLB'="" S VALUE=AGGPTCLB_$C(28)_$$GET1^DIQ(9000001,DFN_",",1111,"E")
 S AGGPTCLB=VALUE
 S REQ="Y",HELP="" D UP
 ; 
 K AGOPT
 F AG=2,3,9 S AGOPT(AG-1)=$P(^AGFAC(DUZ(2),0),U,AG)
 ;
 S SOURCE="AGGPTELG",ABLE="Y",TYPE="C",REQ="",CLEAR="",HELP="" D
 . S AGGPTELG=$$GET1^DIQ(9000001,DFN_",",1112,"I")
 . I AGGPTELG'="" S AGGPTELG=AGGPTELG_$C(28)_$$GET1^DIQ(9000001,DFN_",",1112,"E")
 . S VALUE=AGGPTELG D UP
 ;
 I AGGPTCLB'=DVAL D  G XINIT
 . ;
 . ;S SOURCE="AGGPTBLQ",ABLE="N",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="NONE" D UP
 . ;S SOURCE="AGGPTTRQ",ABLE="N",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="NONE" D UP
 . ;S SOURCE="AGGPTTRI",ABLE="N",TYPE="T",REQ="",CLEAR="",HELP="",VALUE="" D UP
 . ;S SOURCE="AGGPTTEN",ABLE="N",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="" D UP
 . ;S SOURCE="OTHTRIB",ABLE="N",TYPE="M",REQ="",CLEAR="OTHTRIB",HELP="",VALUE="" D UP
 ;
 ;
 S SOURCE="OTHTRIB",ABLE=$S(AGOPT(8)="Y":"Y",1:"N"),TYPE="M",VALUE="",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="OTHER TRIBES is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 . S HELP=""
 S SOURCE="AGGPTTEN",ABLE=$S(AGOPT(2)="Y":"Y",1:"N"),TYPE="X",VALUE="",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="TRIBAL ENROLLMENT NUMBER is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 . S HELP=""
 S SOURCE="AGGPTTRQ",ABLE=$S(AGOPT(1)="Y":"Y",1:"N"),TYPE="X",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 . S HELP=""
 . S AGGPTTRQ=$$GET1^DIQ(9000001,DFN_",",1109,"E"),VALUE=AGGPTTRQ
 S SOURCE="AGGPTTRI",ABLE="Y",TYPE="T",REQ="",CLEAR="",HELP="" D
 . S AGGPTTRI=$$GET1^DIQ(9000001,DFN_",",1108,"I")
 . I AGGPTTRI'="" S AGGPTTRI=AGGPTTRI_$C(28)_$$GET1^DIQ(9000001,DFN_",",1108,"E")
 . S VALUE=AGGPTTRI D UP
 S SOURCE="AGGPTBLQ",ABLE="Y",TYPE="X",REQ="",CLEAR="",HELP="" D
 . S AGGPTBLQ=$$GET1^DIQ(9000001,DFN_",",1110,"E")
 . S VALUE=AGGPTBLQ D UP
 ;
XINIT S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
INITOTH(DATA,AGGOTTRI) ; EP -- AGG OTH TRB INIT TRIG
 NEW UID,II,VALUE,SOURCE,ABLE,TYPE,CLEAR,REQ,HELP,HDR
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGETRIG",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGETRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 ;
 I $P($G(^AGFAC(DUZ(2),0)),U,2)'="Y"!($G(AGGOTTRI)="") S SOURCE="AGGOTTRQ",VALUE="",ABLE="N",TYPE="X",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 ;
 ;I $P($G(^AGFAC(DUZ(2),0)),U,2)'="Y" S SOURCE="AGGOTTRQ",VALUE="",ABLE="N",TYPE="X",CLEAR="",REQ="" D  D UP
 ;. I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
CLASS(DATA,AGGPTCLB) ; EP -- AGG PATIENT CLASS TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,CLBEN,AGOPT,AG
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGETRIG",UID))
 K @DATA
 S II=0
 S AGGPTCLB=$G(AGGPTCLB)
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGETRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 ;
 F AG=2,3,9 S AGOPT(AG-1)=$P(^AGFAC(DUZ(2),0),U,AG)
 ;
 S CLBEN=$P($$TBL^AGGWDEF(9999999.25,"INDIAN/ALASKA NATIVE"),$C(28))  ;Get Classification IEN
 ;
 S SOURCE="AGGPTTEN",ABLE=$S(AGOPT(2)="Y":"Y",1:"N"),TYPE="X",VALUE="",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="TRIBAL ENROLLMENT NUMBER is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 . S HELP=""
 ;
 S SOURCE="OTHTRIB",ABLE=$S(AGOPT(8)="Y":"Y",1:"N"),TYPE="M",VALUE="",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="OTHER TRIBES is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 . S HELP=""
 ;
 I AGGPTCLB'=CLBEN D  G XCLASS
 . ;
 . S SOURCE="AGGPTBLQ",ABLE="Y",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="NONE" D UP
 . S SOURCE="AGGPTTRQ",ABLE=$S(AGOPT(1)="Y":"Y",1:"N"),TYPE="X",VALUE="NONE",CLEAR="",REQ="" D  D UP
 .. I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 .. S HELP=""
 . ;
 . S SOURCE="AGGPTTRI",ABLE="Y",TYPE="T",REQ="",CLEAR="",HELP="" D  D UP
 .. S VALUE=$O(^AUTTTRI("B","NON-INDIAN(NONFEDERALLY RECOGN",""))
 .. I VALUE'="" S VALUE=VALUE_$C(28)_"NON-INDIAN(NONFEDERALLY RECOGN"
 ;
 I AGGPTCLB=CLBEN D
 . ;
 . S SOURCE="AGGPTTRQ",ABLE=$S(AGOPT(1)="Y":"Y",1:"N"),TYPE="X",VALUE="",CLEAR="",REQ="" D  D UP
 .. I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 .. S HELP=""
 . ;
 . S SOURCE="AGGPTTRI",ABLE="Y",TYPE="T",REQ="",CLEAR="",HELP="",VALUE="" D UP
 . ;
 . S SOURCE="AGGPTBLQ",ABLE="Y",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="" D UP
 ;
XCLASS S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
NCLASS(DATA,AGGPTCLB) ; EP -- AGG NEW PATIENT CLASS TRIG
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,CLBEN,AGOPT,AG
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGETRIG",UID))
 K @DATA
 S II=0
 S AGGPTCLB=$G(AGGPTCLB)
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGETRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 ;
 F AG=2,3,9 S AGOPT(AG-1)=$P(^AGFAC(DUZ(2),0),U,AG)
 ;
 S CLBEN=$P($$TBL^AGGWDEF(9999999.25,"INDIAN/ALASKA NATIVE"),$C(28))  ;Get Classification IEN
 ;
 S SOURCE="AGGPTTEN",ABLE=$S(AGOPT(2)="Y":"Y",1:"N"),TYPE="X",VALUE="",CLEAR="",REQ="" D  D UP
 . I ABLE="N" S HELP="TRIBAL ENROLLMENT NUMBER is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 . S HELP=""
 ;
 I AGGPTCLB'=CLBEN D  G XNCLASS
 . ;
 . S SOURCE="AGGPTBLQ",ABLE="Y",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="NONE" D UP
 . S SOURCE="AGGPTTRQ",ABLE=$S(AGOPT(1)="Y":"Y",1:"N"),TYPE="X",VALUE="NONE",CLEAR="",REQ="" D  D UP
 .. I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 .. S HELP=""
 . ;
 . S SOURCE="AGGPTTRI",ABLE="Y",TYPE="T",REQ="",CLEAR="",HELP="" D  D UP
 .. S VALUE=$O(^AUTTTRI("B","NON-INDIAN(NONFEDERALLY RECOGN",""))
 .. I VALUE'="" S VALUE=VALUE_$C(28)_"NON-INDIAN(NONFEDERALLY RECOGN"
 ;
 I AGGPTCLB=CLBEN D
 . ;
 . S SOURCE="AGGPTTRQ",ABLE=$S(AGOPT(1)="Y":"Y",1:"N"),TYPE="X",VALUE="",CLEAR="",REQ="" D  D UP
 .. I ABLE="N" S HELP="TRIBAL BLOOD QUANTUM is not turned on for "_$P(^DIC(4,DUZ(2),0),U,1) Q
 .. S HELP=""
 . ;
 . S SOURCE="AGGPTTRI",ABLE="Y",TYPE="T",REQ="",CLEAR="",HELP="",VALUE="" D UP
 . ;
 . S SOURCE="AGGPTBLQ",ABLE="Y",TYPE="X",REQ="",CLEAR="",HELP="",VALUE="" D UP
 ;
XNCLASS S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
OTRB(DATA,AGGOTTRI,AGGOTTRQ) ; EP -- AGG OTHER TRIBE TRIGGER
 NEW UID,II,VALUE,SOURCE,HELP,TYPE,ABLE,HDR
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGETRIG",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGETRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 ;
 ;Quit if quantum entry is disabled
 I $$GET1^DIQ(9009061,DUZ(2)_",",1,"I")="N" G XOTRB
 ;
 ;No Other Tribe - Disable Quantum
 I $G(AGGOTTRI)="" D  G XOTRB
 . S SOURCE="AGGOTTRQ",ABLE="N",HELP="",VALUE="",TYPE="X",CLEAR="AGGPTTRQ",REQ="" D UP
 ;
 ;Other Tribe - Enable Quantum
 I $G(AGGOTTRI)]"" D
 . S SOURCE="AGGOTTRQ",ABLE="Y",HELP="",VALUE=$G(AGGOTTRQ),TYPE="X",CLEAR="",REQ="" D UP
 ;
XOTRB S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
HDR ;
 S HDR="T00008SOURCE^T00001CODE_TYPE^T01024PARMS^T00001ABLE_FLAG^T00001REQ_OPT^T00100CLEAR_FIELDS^T00200HELP_TEXT"
 Q
 ;
UP ;
 S II=II+1,@DATA@(II)=SOURCE_U_TYPE_U_VALUE_U_ABLE_U_$G(REQ)_U_$G(CLEAR)_U_HELP_$C(30)
 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