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

AGGWCHC.m

Go to the documentation of this file.
AGGWCHC ;VNGT/HS/ALA-Return 'Choice' values for the GUI ; 08 Apr 2010  3:32 PM
 ;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
 ;
 Q
 ;
EN(DATA,VFILE,CODE) ;EP -- AGG GET WINDOW CHOICE
 ;
 ;Input
 ;  VFILE - The vfile number or name
 ;  CODE  - The parameter name
 ;
 NEW UID,II,HDR,IEN,VALUE,HELP,VFIEN,HN
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("AGGWCHC",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGWCHC D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S VFILE=$G(VFILE,"") I VFILE="" S BMXSEC="No Window selected" Q
 S VFIEN=$$FIND1^DIC(9009068.3,"","MX",VFILE,"","","ERROR")
 S CODE=$G(CODE,"") I CODE="" S BMXSEC="No code given" Q
 I $O(^AGG(9009068.3,VFIEN,10,"AC",CODE,""))="" S BMXSEC="Code does not exist for this Window" Q
 NEW DA,IENS
 S DA(2)=VFIEN,DA(1)=$O(^AGG(9009068.3,VFIEN,10,"AC",CODE,""))
 ;
 S HDR="T00020CHOICE_TEXT^T00005CHOICE_CODE^T00001VALIDATION^T00008HELP_ASSOC^T01024CHOICE_HELP"_$C(30)
 S @DATA@(II)=HDR
 ;
 I $O(^AGG(9009068.3,VFIEN,10,DA(1),5,"AC",""))="" D STD
 I $O(^AGG(9009068.3,VFIEN,10,DA(1),5,"AC",""))'="" D NST
 ;
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
 ;
NST ; Sort in designated order
 NEW ORD
 S ORD=""
 F  S ORD=$O(^AGG(9009068.3,VFIEN,10,DA(1),5,"AC",ORD)) Q:ORD=""  D
 . S IEN=""
 . F  S IEN=$O(^AGG(9009068.3,VFIEN,10,DA(1),5,"AC",ORD,IEN)) Q:IEN=""  D REC
 Q
 ;
STD ; Sort in standard order
 S IEN=0
 F  S IEN=$O(^AGG(9009068.3,VFIEN,10,DA(1),5,IEN)) Q:'IEN  D REC
 Q
 ;
REC ; Get record values
 I $P(^AGG(9009068.3,VFIEN,10,DA(1),5,IEN,0),U,5)=1 Q
 S DA=IEN,IENS=$$IENS^DILF(.DA),VALUE=""
 S VALUE=VALUE_$$GET1^DIQ(9009068.315,IENS,.01,"E")_U_$$GET1^DIQ(9009068.315,IENS,.02,"E")_U_$$GET1^DIQ(9009068.315,IENS,.03,"I")_U
 S VALUE=VALUE_$$GET1^DIQ(9009068.315,IENS,.04,"E")_U
 S HN=0,HELP=""
 F  S HN=$O(^AGG(9009068.3,VFIEN,10,DA(1),5,IEN,1,HN)) Q:'HN  D
 . S HELP=HELP_^AGG(9009068.3,VFIEN,10,DA(1),5,IEN,1,HN,0)_$C(10)
 S HELP=$$TKO^AGGUL1(HELP,$C(10))
 S VALUE=VALUE_HELP_$C(30)
 S II=II+1,@DATA@(II)=VALUE
 Q