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

AGGWOTH.m

Go to the documentation of this file.
AGGWOTH ;VNGT/HS/ALA-Other AGG Window RPCs ; 18 May 2010  1:32 PM
 ;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
 ;
 ;
LANG(DATA,DFN) ; EP - AGG PATIENT LANGUAGES
 ;
 NEW UID,II,AGIEN,LDA
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGWLANG",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWDISP D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S AGIEN=$$FIND1^DIC(9009068.3,"","BX","Other Languages","","","ERROR")
 I AGIEN=0 S BMXSEC="RPC Failed: Passed in window name "_DEF_" not found" Q
 ;
 S FILE=$P(^AGG(9009068.3,AGIEN,0),U,2),SECFILE=$P(^AGG(9009068.3,AGIEN,0),U,14)
 ;
 S DA(1)=DFN,LDA=$O(^AUPNPAT(DFN,86,"B"),-1) I 'LDA D  G DONE
 . S HEADR="T00040AGGLGOTH^I00010LGIEN",HDATA=""
 . S @DATA@(II)=HEADR_$C(30)
 . ;S II=II+1,@DATA@(II)=HDATA_$C(30)
 ;
 S IEN=0
 I $O(^AUPNPAT(DFN,86,LDA,5,IEN))="" D  G DONE
 . S HEADR="T00040AGGLGOTH^I00010LGIEN",HDATA=""
 . S @DATA@(II)=HEADR_$C(30)
 . ;S II=II+1,@DATA@(II)=HDATA_$C(30)
 ; 
 F  S IEN=$O(^AUPNPAT(DFN,86,LDA,5,IEN)) Q:'IEN  D
 . S DA(2)=DFN,DA(1)=LDA,DA=IEN
 . S IENS=$$IENS^DILF(.DA)
 . S HEADR="",HDATA=""
 . D REC(IENS)
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 ;
 Q
 ;
REC(IENS) ;EP
 S AGCN=0
 F  S AGCN=$O(^AGG(9009068.3,AGIEN,10,AGCN)) Q:'AGCN  D
 . I $P(^AGG(9009068.3,AGIEN,10,AGCN,0),U,11)'="" Q
 . S AGDATA=$G(^AGG(9009068.3,AGIEN,10,AGCN,0))
 . S FLD=$P($G(^AGG(9009068.3,AGIEN,10,AGCN,3)),U,1),SECFLD=$P($G(^AGG(9009068.3,AGIEN,10,AGCN,3)),U,7)
 . S TYPE=$P($G(^AGG(9009068.3,AGIEN,10,AGCN,1)),U,1)
 . S CODE=$P(AGDATA,U,7),HDR=$P(AGDATA,U,2)
 . S DEXEC=$G(^AGG(9009068.3,AGIEN,10,AGCN,8))
 . I TYPE="M" S VALUE=""
 . I TYPE="T"!(TYPE="C") D
 .. I DEXEC'="" D  Q
 ... S VAL=""
 ... I DEXEC'["DQTY" X DEXEC Q
 ... S DQTY="I" X DEXEC S VAL=VALUE_$C(28)
 ... S DQTY="E" X DEXEC S VALUE=VAL_VALUE
 .. I FLD'="" S VALUE=$$GET1^DIQ(FILE,IENS,FLD,"I")_$C(28)_$$GET1^DIQ(FILE,IENS,FLD,"E") Q
 .. S VALUE=$$GET1^DIQ(SECFILE,IENS,SECFLD,"I")_$C(28)_$$GET1^DIQ(SECFILE,IENS,SECFLD,"E")
 . I TYPE="X"!(TYPE="N") D
 .. NEW TYPE
 .. I DEXEC'="" X DEXEC Q
 .. I FLD=.001 S VALUE=IEN Q
 .. I FLD'="" S VALUE=$$GET1^DIQ(FILE,IENS,FLD,"E") Q
 .. S VALUE=$$GET1^DIQ(SECFILE,IENS,SECFLD,"E")
 . I TYPE="D" D
 .. I DEXEC'="" X DEXEC Q
 .. I FLD'="" S VALUE=$$GET1^DIQ(FILE,IENS,FLD,"I"),VALUE=$$FMTE^AGGUL1(VALUE) Q
 .. S VALUE=$$GET1^DIQ(SECFILE,IENS,SECFLD,"I"),VALUE=$$FMTE^AGGUL1(VALUE)
 . I TYPE="W" D
 .. NEW FL,FD
 .. K ARRAY S VALUE=""
 .. I DEXEC'="" X DEXEC
 .. I DEXEC="" D
 ... I FLD'="" D GETS^DIQ(FILE,DFN_",",FLD,"E","ARRAY") Q
 ... D GETS^DIQ(SECFILE,DFN_",",SECFLD,"E","ARRAY")
 .. S FL=$O(ARRAY("")) I FL="" Q
 .. S FD=$O(ARRAY(FL,DFN_",","")) I FD="" Q
 .. S AN=0,TXT=ARRAY(FL,DFN_",",FD,"E") I TXT="" Q
 .. K @TXT@("E")
 .. F  S AN=$O(@TXT@(AN)) Q:AN=""  S VALUE=VALUE_@TXT@(AN)_$C(10)
 . S HEADR=HEADR_HDR_"^"
 . S HDATA=HDATA_$G(VALUE)_"^",VALUE=""
 S HEADR=$$TKO^AGGUL1(HEADR,"^"),HDATA=$$TKO^AGGUL1(HDATA,"^")
 I II=0 S @DATA@(II)=HEADR_$C(30)
 S II=II+1,@DATA@(II)=HDATA_$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