AMHBHRP2 ; IHS/CMI/LAB - behavioral health display for GUI ;
;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
;
;
;
TEST ;
D SUICSTND(.RETVAL,"01/01/1900","12/31/2005","")
Q
SUICSTND(AMHARRAY,AMHBD,AMHED,AMHCOMM) ;EP - AMHBH RPT SUICIDE STANDARD
S JOB=$J,AMHGUI=1,XWBWRAP=1
S ZTIO="",ZTQUEUED=1
S AMHARRAY="^XTMP(""AMHRPT"","_$J_")"
I $G(AMHBD)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid beginning date passed" D KILL Q
D DT^DILF("X",AMHBD,.AMHBD)
I $G(AMHBD)=-1 S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid beginning date passed" D KILL Q
I $G(AMHED)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid ending date passed" D KILL Q
D DT^DILF("X",AMHED,.AMHED)
I $G(AMHED)=-1 S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid ending date passed" D KILL Q
I $G(AMHCOMM),'$D(^AUTTCOM(AMHCOMM,0)) S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid IEN of community entry passed" D KILL Q
I AMHCOMM S AMHCOMM(AMHCOMM)=""
I 'AMHCOMM K AMHCOMM
K ^XTMP("AMHRPT",JOB)
S ^XTMP("AMHRPTRUN",JOB)=""
D ^XBKSET
S AMHSD=$$FMADD^XLFDT(AMHBD,-1)_".9999"
D PROC^AMHRPSU1
;S ZTRTN="TSK^AMHBHRP2",ZTIO="",ZTDESC="AMH SUICIDE STANDARD REPORT",ZTSAVE("AMH*")="",ZTSAVE("JOB")="",ZTDTH=$H D ^%ZTLOAD
;F I=1:1:120 Q:$G(^XTMP("AMHRPTRUN",$J))="DONE" H 1
;D KILL
;Q
;
TSK ;
D ^XBKSET
S ^XTMP("AMHRPTRUN",JOB)="START"
D GUIR^XBLM("PRINT^AMHRPSU1","^XTMP(""AMHRPT"",JOB)")
S ^XTMP("AMHRPT",JOB,.5)=$O(^XTMP("AMHRPT",JOB,""),-1)+1
S ^XTMP("AMHRPTRUN",JOB)="DONE"
D KILL
Q
;
KILL ;
K AMHOA,AMHBT,AMHTOT
K AMHCTR,AMHGUI,AMHSF,DIC,JOB,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
D EOJ^AMHRPSU1
Q
AMHBHRP2 ; IHS/CMI/LAB - behavioral health display for GUI ;
+1 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
+2 ;
+3 ;
+4 ;
TEST ;
+1 DO SUICSTND(.RETVAL,"01/01/1900","12/31/2005","")
+2 QUIT
SUICSTND(AMHARRAY,AMHBD,AMHED,AMHCOMM) ;EP - AMHBH RPT SUICIDE STANDARD
+1 SET JOB=$JOB
SET AMHGUI=1
SET XWBWRAP=1
+2 SET ZTIO=""
SET ZTQUEUED=1
+3 SET AMHARRAY="^XTMP(""AMHRPT"","_$JOB_")"
+4 IF $GET(AMHBD)=""
SET ^XTMP("AMHRPT",JOB,.5)=2
SET ^XTMP("AMHRPT",JOB,1)="Invalid beginning date passed"
DO KILL
QUIT
+5 DO DT^DILF("X",AMHBD,.AMHBD)
+6 IF $GET(AMHBD)=-1
SET ^XTMP("AMHRPT",JOB,.5)=2
SET ^XTMP("AMHRPT",JOB,1)="Invalid beginning date passed"
DO KILL
QUIT
+7 IF $GET(AMHED)=""
SET ^XTMP("AMHRPT",JOB,.5)=2
SET ^XTMP("AMHRPT",JOB,1)="Invalid ending date passed"
DO KILL
QUIT
+8 DO DT^DILF("X",AMHED,.AMHED)
+9 IF $GET(AMHED)=-1
SET ^XTMP("AMHRPT",JOB,.5)=2
SET ^XTMP("AMHRPT",JOB,1)="Invalid ending date passed"
DO KILL
QUIT
+10 IF $GET(AMHCOMM)
IF '$DATA(^AUTTCOM(AMHCOMM,0))
SET ^XTMP("AMHRPT",JOB,.5)=2
SET ^XTMP("AMHRPT",JOB,1)="Invalid IEN of community entry passed"
DO KILL
QUIT
+11 IF AMHCOMM
SET AMHCOMM(AMHCOMM)=""
+12 IF 'AMHCOMM
KILL AMHCOMM
+13 KILL ^XTMP("AMHRPT",JOB)
+14 SET ^XTMP("AMHRPTRUN",JOB)=""
+15 DO ^XBKSET
+16 SET AMHSD=$$FMADD^XLFDT(AMHBD,-1)_".9999"
+17 DO PROC^AMHRPSU1
+18 ;S ZTRTN="TSK^AMHBHRP2",ZTIO="",ZTDESC="AMH SUICIDE STANDARD REPORT",ZTSAVE("AMH*")="",ZTSAVE("JOB")="",ZTDTH=$H D ^%ZTLOAD
+19 ;F I=1:1:120 Q:$G(^XTMP("AMHRPTRUN",$J))="DONE" H 1
+20 ;D KILL
+21 ;Q
+22 ;
TSK ;
+1 DO ^XBKSET
+2 SET ^XTMP("AMHRPTRUN",JOB)="START"
+3 DO GUIR^XBLM("PRINT^AMHRPSU1","^XTMP(""AMHRPT"",JOB)")
+4 SET ^XTMP("AMHRPT",JOB,.5)=$ORDER(^XTMP("AMHRPT",JOB,""),-1)+1
+5 SET ^XTMP("AMHRPTRUN",JOB)="DONE"
+6 DO KILL
+7 QUIT
+8 ;
KILL ;
+1 KILL AMHOA,AMHBT,AMHTOT
+2 KILL AMHCTR,AMHGUI,AMHSF,DIC,JOB,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
+3 DO EOJ^AMHRPSU1
+4 QUIT