AMHRPTCP ; IHS/CMI/LAB - generic report cover page ;
;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
;
COVPAGE ;EP
W:$D(IOF) @IOF
I '$G(AMHSUIC) W !!!?20,"BEHAVIORAL HEALTH RECORD LISTING"
I $G(AMHSUIC) W !!!?20,"Aggregate Suicide Data Report - Selected Variables"
W !!,"REPORT REQUESTED BY: ",$P(^VA(200,DUZ,0),U)
W !!,"The following visit listing contains BH visits selected based on the",!,"following criteria:",!
SHOW ;
W !?28,"RECORD SELECTION CRITERIA"
I $G(AMHRPTC)'=7 W !!,"Encounter Date range: ",AMHBDD," to ",AMHEDD,!
I '$D(^AMHTRPT(AMHRPT,11)) G SHOWP
S AMHI=0 F S AMHI=$O(^AMHTRPT(AMHRPT,11,AMHI)) Q:AMHI'=+AMHI D
.I $Y>(IOSL-4) D PAUSE^AMHRPTU W @IOF
.K AMHQ W !,$P(^AMHSORT(AMHI,0),U),": "
.S Y=0,C=0 F S Y=$O(^AMHTRPT(AMHRPT,11,AMHI,11,"B",Y)) S C=C+1 Q:Y=""!($D(AMHQ)) W:C'=1 " ; " S X=Y X:$D(^AMHSORT(AMHI,2)) ^(2) W X
SHOWP ;
I $Y>(IOSL-4) D PAUSE^AMHRPTU W @IOF
I $D(AMHRPTC) W !!,"Report Type: ",$P(^AMHRCNT(AMHRPTC,0),U,6)
I '$D(^AMHTRPT(AMHRPT,12)) G PAUSE
W !!?29,"PRINT FIELD SELECTION",!
S AMHI=0 F S AMHI=$O(^AMHTRPT(AMHRPT,12,AMHI)) Q:AMHI'=+AMHI S AMHCRIT=$P(^AMHTRPT(AMHRPT,12,AMHI,0),U) D
.I $Y>(IOSL-4) D PAUSE^AMHRPTU W:$D(IOF) @IOF
.W !,$P(^AMHSORT(AMHCRIT,0),U)," (" S X=$O(^AMHTRPT(AMHRPT,12,"B",AMHCRIT,"")) W $P(^AMHTRPT(AMHRPT,12,X,0),U,2),")"
W !," TOTAL column width: ",AMHTCW
I $Y>(IOSL-5) D PAUSE^AMHRPTU W:$D(IOF) @IOF
SORT ;
I $G(AMHSORT)]"" W !!,"Records will be sorted by: ",$P(^AMHSORT(AMHSORT,0),U),!
I $G(AMHSPAG) W !,"Each ",$P(^AMHSORT(AMHSORT,0),U)," will be on a separate page.",!
I $Y>(IOSL-4) D PAUSE^AMHRPTU W:$D(IOF) @IOF
I '$D(^XTMP("AMHRPT",AMHJOB,AMHBTH)) W !!,"NO VISITS TO REPORT.",!
PAUSE D PAUSE^AMHRPTU
Q
AMHRPTCP ; IHS/CMI/LAB - generic report cover page ;
+1 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
+2 ;
COVPAGE ;EP
+1 IF $DATA(IOF)
WRITE @IOF
+2 IF '$GET(AMHSUIC)
WRITE !!!?20,"BEHAVIORAL HEALTH RECORD LISTING"
+3 IF $GET(AMHSUIC)
WRITE !!!?20,"Aggregate Suicide Data Report - Selected Variables"
+4 WRITE !!,"REPORT REQUESTED BY: ",$PIECE(^VA(200,DUZ,0),U)
+5 WRITE !!,"The following visit listing contains BH visits selected based on the",!,"following criteria:",!
SHOW ;
+1 WRITE !?28,"RECORD SELECTION CRITERIA"
+2 IF $GET(AMHRPTC)'=7
WRITE !!,"Encounter Date range: ",AMHBDD," to ",AMHEDD,!
+3 IF '$DATA(^AMHTRPT(AMHRPT,11))
GOTO SHOWP
+4 SET AMHI=0
FOR
SET AMHI=$ORDER(^AMHTRPT(AMHRPT,11,AMHI))
IF AMHI'=+AMHI
QUIT
Begin DoDot:1
+5 IF $Y>(IOSL-4)
DO PAUSE^AMHRPTU
WRITE @IOF
+6 KILL AMHQ
WRITE !,$PIECE(^AMHSORT(AMHI,0),U),": "
+7 SET Y=0
SET C=0
FOR
SET Y=$ORDER(^AMHTRPT(AMHRPT,11,AMHI,11,"B",Y))
SET C=C+1
IF Y=""!($DATA(AMHQ))
QUIT
IF C'=1
WRITE " ; "
SET X=Y
IF $DATA(^AMHSORT(AMHI,2))
XECUTE ^(2)
WRITE X
End DoDot:1
SHOWP ;
+1 IF $Y>(IOSL-4)
DO PAUSE^AMHRPTU
WRITE @IOF
+2 IF $DATA(AMHRPTC)
WRITE !!,"Report Type: ",$PIECE(^AMHRCNT(AMHRPTC,0),U,6)
+3 IF '$DATA(^AMHTRPT(AMHRPT,12))
GOTO PAUSE
+4 WRITE !!?29,"PRINT FIELD SELECTION",!
+5 SET AMHI=0
FOR
SET AMHI=$ORDER(^AMHTRPT(AMHRPT,12,AMHI))
IF AMHI'=+AMHI
QUIT
SET AMHCRIT=$PIECE(^AMHTRPT(AMHRPT,12,AMHI,0),U)
Begin DoDot:1
+6 IF $Y>(IOSL-4)
DO PAUSE^AMHRPTU
IF $DATA(IOF)
WRITE @IOF
+7 WRITE !,$PIECE(^AMHSORT(AMHCRIT,0),U)," ("
SET X=$ORDER(^AMHTRPT(AMHRPT,12,"B",AMHCRIT,""))
WRITE $PIECE(^AMHTRPT(AMHRPT,12,X,0),U,2),")"
End DoDot:1
+8 WRITE !," TOTAL column width: ",AMHTCW
+9 IF $Y>(IOSL-5)
DO PAUSE^AMHRPTU
IF $DATA(IOF)
WRITE @IOF
SORT ;
+1 IF $GET(AMHSORT)]""
WRITE !!,"Records will be sorted by: ",$PIECE(^AMHSORT(AMHSORT,0),U),!
+2 IF $GET(AMHSPAG)
WRITE !,"Each ",$PIECE(^AMHSORT(AMHSORT,0),U)," will be on a separate page.",!
+3 IF $Y>(IOSL-4)
DO PAUSE^AMHRPTU
IF $DATA(IOF)
WRITE @IOF
+4 IF '$DATA(^XTMP("AMHRPT",AMHJOB,AMHBTH))
WRITE !!,"NO VISITS TO REPORT.",!
PAUSE DO PAUSE^AMHRPTU
+1 QUIT