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

AMHLEDV1.m

Go to the documentation of this file.
AMHLEDV1 ; IHS/CMI/LAB - ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**5**;JUN 02, 2010;Build 18
 ;
 ;
 ;
GATHER ;EP
 K AMHQUIT,^TMP("AMHPATV",$J) S AMHRCNT=0
 D GETRECS
EOJ K AMHQUIT,AMHPG,AMHREC,AMHV,AMHP,Y,AMHPREC,AMHHRN,X,Y,Z,%,AMHX,AMHSD,AMHODAT,AMHX,I,L,V,AMHRS,AMHPATV
 Q
GETRECS ;
 S (AMHRCNT,AMHV)=0 F  S AMHV=$O(AMHPATV(AMHV)) Q:AMHV=""  D
 .S AMHRCNT=AMHRCNT+1,AMHRS=AMHRCNT,^TMP("AMHPATV",$J,"IDX",AMHRCNT,AMHRCNT)=AMHV,AMHREC=^AMHREC(AMHV,0) D REC S ^TMP("AMHPATV",$J,AMHRCNT,0)=AMHX
 .Q
 Q
 ;
REC ;
 S AMHX=$J(AMHRS,3)_" " S X=$$PPINI^AMHUTIL(AMHV),X=$$LBLK(X,3) S AMHX=AMHX_X_" "_$$FMTE^XLFDT($P(AMHREC,U)),AMHX=$$RBLK(AMHX,28)
 S X=$E($$VAL^XBDIQ1(9002011,AMHV,.07),1,6),X=$$RBLK(X,8)
 S AMHX=AMHX_X
 S X=$P(AMHREC,U,4) I X]"" S X=$E($P(^DIC(4,X,0),U),1,8),X=$$RBLK(X,10)
 S AMHX=AMHX_X
 S AMHX=AMHX_$$VAL^XBDIQ1(9002011,AMHV,.06)
 S AMHX=$$RBLK(AMHX,51)
 S AMHP=$O(^AMHRPRO("AD",AMHV,0)) I AMHP="" S X="   <No Problems recorded.>",X=$$RBLK(X,29),AMHX=AMHX_X Q
 D GETPROB
 Q
GETPROB ;
 S AMHP=$O(^AMHRPRO("AD",AMHV,0)),AMHPREC=^AMHRPRO(AMHP,0)
 S X=$P(^AMHPROB($P(AMHPREC,U),0),U),X=$$LBLK(X,6)_" "
 S X=X_$$GET1^DIQ(9002011.01,AMHP,.04)
 S AMHX=AMHX_X
 Q
RBLK(V,L) ;left blank fill
 NEW %,I
 S %=$L(V),Z=L-% F I=1:1:Z S V=V_" "
 Q V
LBLK(V,L) ;left blank fill
 NEW %,I
 S %=$L(V),Z=L-% F I=1:1:Z S V=" "_V
 Q V