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

AGGWTRIG.m

Go to the documentation of this file.
AGGWTRIG ;VNGT/HS/ALA - Window Triggers ; 07 Apr 2010  7:09 PM
 ;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
 ;
FORM(LNM,FNM,MNM) ;EP - Format Name
 NEW NAME
 S NAME=LNM_","_FNM_" "_MNM
 K DG20NAME S DG20NAME=X,(X,DG20NAME)=$$FORMAT^DPTNAME(.DG20NAME,3,30)
 K:'$L(X) X,DG20NAME S:$D(X) DGNEWVAL=X
 Q
 ;
HDR ;
 S HDR="T00008SOURCE^T00001CODE_TYPE^T01024PARMS^T00001ABLE_FLAG^T00100CLEAR_FIELDS^T00200HELP_TEXT^T00001VISIBLE"
 Q
 ;
VET(DATA,DFN,AGGPTVET) ; EP -- AGG VETERAN TRIGGER
 ; Input
 ;   DFN      - Patient IEN
 ;   AGGPTVET - Value of VETERAN (Y/N)?
 ;
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRVET",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S AGGPTVET=$G(AGGPTVET)
 I AGGPTVET="" S AGGPTVET=$$GET1^DIQ(2,DFN_",",1901,"I")
 S AGE=$$AGE^AGGAGE(DFN) I AGE<17 S AGGPTVET="N"
 S SOURCE="AGGPTVET"
 F  S SOURCE=$O(^AGG(9009068.3,5,10,"AC",SOURCE)) Q:SOURCE=""  D
 . S IEN=""
 . F  S IEN=$O(^AGG(9009068.3,5,10,"AC",SOURCE,IEN)) Q:IEN=""  D
 .. S HELP="",VALUE="",TYPE=$P($G(^AGG(9009068.3,5,10,IEN,1)),U,1)
 .. S ABLE=$S(AGGPTVET="Y":"Y",1:"N") I ABLE="N" S CLEAR=SOURCE
 .. D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
CLM(DATA,DFN,AGGVCLMN) ; EP - AGG VET CLAIM TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGVTCLM",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 I $G(AGGVCLMN)="SS" S VALUE=$P(^DPT(DFN,0),U,9)
 I $G(AGGVCLMN)'="SS" S VALUE=$G(AGGVCLMN)
 S SOURCE="AGGVCLMN",HELP="",TYPE="X",ABLE="Y" D UP
 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
 ;
UP ;
 S II=II+1,@DATA@(II)=SOURCE_U_TYPE_U_VALUE_U_ABLE_U_$G(CLEAR)_U_HELP_U_$G(VISIBLE)_$C(30)
 Q
 ;
GRP(DATA,DEF,GROUP) ; EP -- AGG INSUR GROUP TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGWIEN,FILE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRGRP",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S AGWIEN=$$FIND1^DIC(9009068.3,"","BX",DEF,"","","ERROR")
 S FILE=$P(^AGG(9009068.3,AGWIEN,0),U,2)
 S SOURCE=$S(FILE=9000004:"AGGMDGRN",1:"AGGPIGRN")
 S ABLE="Y",HELP="",VALUE="",TYPE="X"
 I $G(GROUP)'="" S VALUE=$P($G(^AUTNEGRP(GROUP,0)),U,2)
 D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
MIG(DATA,MGRNT) ;EP -- AGG MIGRNT TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGWIEN,FILE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRMIG",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S AGWIEN=$$FIND1^DIC(9009068.3,"","BX","Other Patient","","","ERROR")
 S SOURCE="AGGMGTYP",IEN=$O(^AGG(9009068.3,AGWIEN,10,"AC",SOURCE,""))
 S TYPE=$P($G(^AGG(9009068.3,AGWIEN,10,IEN,1)),"^",1)
 S ABLE=$S($G(MGRNT)="Y":"Y",1:"N"),HELP="",VALUE=""
 I TYPE="C"!(TYPE="K") D
 . S CIEN=0
 . F  S CIEN=$O(^AGG(9009068.3,AGWIEN,10,IEN,5,CIEN)) Q:'CIEN  D
 .. NEW CDATA
 .. S CDATA=^AGG(9009068.3,AGWIEN,10,IEN,5,CIEN,0)
 .. S VALUE=VALUE_$P(CDATA,U,2)_$C(29)_$P(CDATA,U,1)_$C(28)
 . S VALUE=$$TKO^AGGUL1(VALUE,$C(28))
 D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
HOM(DATA,HMLS) ;EP -- AGG HOMELESS TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGWIEN,FILE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRHMLS",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S AGWIEN=$$FIND1^DIC(9009068.3,"","BX","Other Patient","","","ERROR")
 S SOURCE="AGGHMTYP",IEN=$O(^AGG(9009068.3,AGWIEN,10,"AC",SOURCE,""))
 S TYPE=$P($G(^AGG(9009068.3,AGWIEN,10,IEN,1)),"^",1)
 S ABLE=$S($G(HMLS)="Y":"Y",1:"N"),HELP="",VALUE=""
 I TYPE="C"!(TYPE="K") D
 . S CIEN=0
 . F  S CIEN=$O(^AGG(9009068.3,AGWIEN,10,IEN,5,CIEN)) Q:'CIEN  D
 .. NEW CDATA
 .. S CDATA=^AGG(9009068.3,AGWIEN,10,IEN,5,CIEN,0)
 .. S VALUE=VALUE_$P(CDATA,U,2)_$C(29)_$P(CDATA,U,1)_$C(28)
 . S VALUE=$$TKO^AGGUL1(VALUE,$C(28))
 D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
COMM(DATA,DFN,COMM) ;EP - AGG COMMUNITY TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGWIEN,FILE,DTMV,PCOMM,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRCOMM",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S DTMV=$O(^AUPNPAT(DFN,51,"A"),-1)
 I +DTMV'=0 S PCOMM=$P(^AUPNPAT(DFN,51,DTMV,0),U,3)
 S SOURCE="AGGPTCDT",TYPE="D",ABLE="Y" D
 . I $G(PCOMM)="" S CLEAR="",HELP="",VALUE="" D UP Q
 . I $G(PCOMM)=COMM S CLEAR="",HELP="",VALUE="" D UP Q
 . S CLEAR="AGGPTCDT",HELP="",VALUE="" D UP
 S SOURCE="AGGCMCNY",TYPE="X",HELP="",ABLE="Y",VALUE="",CLEAR=""
 I $G(COMM)'="" S VALUE=$$GET1^DIQ(9999999.05,COMM_",",.02,"E") D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
DTM(DATA,DFN,DATE) ;EP - AGG DATE MOVED TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGWIEN,FILE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRDTM",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 I DATE?.A S DATE=$$UP^XLFSTR(DATE)
 I $E(DATE,1,1)="B" S DATE=$P(^DPT(DFN,0),U,3)
 I $E(DATE,1,1)="T" S DATE=DT
 S DATE=$$DATE^AGGUL1(DATE),DATE=$$FMTE^AGGUL1(DATE)
 S SOURCE="AGGPTCDT",TYPE="D",ABLE="Y",CLEAR="",HELP="Enter 'B' for at birth, TODAY or any date format",VALUE=DATE
 D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
MEM(DATA,DFN,AGGPIIEN,PINUM) ;EP - AGG POLICY MEMBER NUMBER TRIG
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,MBNUM,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGPINMB",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 ;
 I $G(AGGPIIEN)'="" D
 . NEW IENS,DA
 . S DA(1)=DFN,DA=AGGPIIEN,IENS=$$IENS^DILF(.DA)
 . S MBNUM=$$GET1^DIQ(9000006.11,IENS,21,"E")
 I $G(PINUM)'="",$G(MBNUM)="" S SOURCE="AGGPIMBN",TYPE="X",ABLE="Y",CLEAR="",HELP="",VALUE=PINUM D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
CTY(DATA,DFN,AGGPTCTY) ;EP - AGG CITY COMMUNITY TRIGGER
 NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGWIEN,FILE,VISIBLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGTRCOMM",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWTRIG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 S @DATA@(II)=HDR_$C(30)
 S CTY=$$GET1^DIQ(2,DFN_",",.114,"E")
 I CTY'="",CTY'=$G(AGGPTCTY) D
 . S SOURCE="AGGPTCOM",TYPE="D",ABLE="Y",CLEAR="AGGPTCOM",HELP="",VALUE="" D UP
 . ;S SOURCE="AGGPTCDT",TYPE="D",ABLE="Y",CLEAR="AGGPTCDT",HELP="",VALUE="" D UP
 . S SOURCE="AGGCMCNY",TYPE="X",ABLE="Y",CLEAR="AGGCMCNY",HELP="",VALUE="" D UP
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q