AMHFCP ; IHS/CMI/LAB - PRINT FORMS COUNT REPORT ;
;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
START ;
S AMH80S="-------------------------------------------------------------------------------",AMHPG=0
S Y=AMHBD D DD^%DT S AMHBDD=Y S Y=AMHED D DD^%DT S AMHEDD=Y
S (AMHTOT,AMHPROV,AMHTDES)=0
K AMHQUIT
I '$D(^XTMP("AMHFC",$J)) S AMHPROV="NONE TO REPORT" D HEAD G DONE
F S AMHPROV=$O(^XTMP("AMHFC",$J,AMHPROV)) Q:AMHPROV=""!($D(AMHQUIT)) D HEAD Q:$D(AMHQUIT) D SORT
G:$D(AMHQUIT) DONE
I $Y>(IOSL-5) D HEAD G:$D(AMHQUIT) DONE
W !?42,"------",!
W ?5,"Grand Total for ALL Operators:",?42,$J(AMHTOT,6)
D SUMMPAGE
DONE I $D(AMHET) S AMHTS=(86400*($P(AMHET,",")-$P(AMHBT,",")))+($P(AMHET,",",2)-$P(AMHBT,",",2)),AMHH=$P(AMHTS/3600,".") S:AMHH="" AMHH=0
S AMHTS=AMHTS-(AMHH*3600),AMHM=$P(AMHTS/60,".") S:AMHM="" AMHM=0 S AMHTS=AMHTS-(AMHM*60),AMHS=AMHTS W !!,"RUN TIME (H.M.S): ",AMHH,".",AMHM,".",AMHS
I $E(IOST)="C",IO=IO(0) S DIR(0)="E" D ^DIR K DIR
W:$D(IOF) @IOF
Q
SORT ;
S (AMHSUB,AMHDESU)=0,AMHFC("DAYS",AMHPROV)=0
S AMHDATE=0 F S AMHDATE=$O(^XTMP("AMHFC",$J,AMHPROV,AMHDATE)) Q:AMHDATE'=+AMHDATE!($D(AMHQUIT)) D WRITE
W !?42,"------",!
W ?5,"Totals for ",AMHPROV,?42,$J(AMHSUB,6)
S AMHFC("FORMS",AMHPROV)=AMHSUB
Q
WRITE ;
S Y=AMHDATE D DD^%DT S AMHWDAT=Y
I $Y>(IOSL-5) D HEAD Q:$D(AMHQUIT)
W ?25,AMHWDAT,?42,$J(^XTMP("AMHFC",$J,AMHPROV,AMHDATE),6),!
S AMHSUB=AMHSUB+^XTMP("AMHFC",$J,AMHPROV,AMHDATE),AMHTOT=AMHTOT+^XTMP("AMHFC",$J,AMHPROV,AMHDATE)
S AMHFC("DAYS",AMHPROV)=AMHFC("DAYS",AMHPROV)+1
Q
SUMMPAGE ;
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S AMHQUIT="" Q
W:$D(IOF) @IOF S AMHPG=AMHPG+1
W !?58,AMHDT,?70,"Page ",AMHPG
W !?20,"SUMMARY OF FORMS KEYED BY ALL OPERATORS"
W !?15,"BH RECORD POSTING DATES: ",AMHBDD," TO ",AMHEDD,!
W !?35,"No. of",?43,"Forms",?53,"% of"
W !?11,"Operator",?35,"Forms",?43,"per day",?53,"Workload"
W !,AMH80S
S X="" F S X=$O(AMHFC("FORMS",X)) Q:X="" W !,X,?32,$J(AMHFC("FORMS",X),8),?40,$J((AMHFC("FORMS",X)/AMHFC("DAYS",X)),8,1),?51,$J(((AMHFC("FORMS",X)/AMHTOT)*100),8,1)
;S X="" F S X=$O(AMHFC("FORMS",X)) Q:X="" W !,X,?32,$J(AMHFC("FORMS",X),8),?40,$J((AMHFC("FORMS",X)/AMHFC("DAYS",X)),8,1),?51,$J(((AMHFC("FORMS",X)/AMHTOT)*100),8,1)
W !?35,"--------",!?32,$J(AMHTOT,8)
Q
HEAD I 'AMHPG G HEAD1
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S AMHQUIT="" Q
HEAD1 ;
W @IOF S AMHPG=AMHPG+1
W !?58,AMHDT,?70,"Page ",AMHPG,!
S AMHLENG=$L($P(^DIC(4,DUZ(2),0),U))
W ?((80-AMHLENG)/2),$P(^DIC(4,DUZ(2),0),U),!
W ?29,"NUMBER OF FORMS KEYED",!
S AMHLENG=21+$L(AMHPROV)
W ?((80-AMHLENG)/2),"DATE ENTRY OPERATOR: ",AMHPROV,!
W ?15,"BH RECORD POSTING DATES: ",AMHBDD," TO ",AMHEDD,!
W !?25,"POSTING DATE",?40,"# FORMS",!
W AMH80S,!
Q
AMHFCP ; IHS/CMI/LAB - PRINT FORMS COUNT REPORT ;
+1 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
START ;
+1 SET AMH80S="-------------------------------------------------------------------------------"
SET AMHPG=0
+2 SET Y=AMHBD
DO DD^%DT
SET AMHBDD=Y
SET Y=AMHED
DO DD^%DT
SET AMHEDD=Y
+3 SET (AMHTOT,AMHPROV,AMHTDES)=0
+4 KILL AMHQUIT
+5 IF '$DATA(^XTMP("AMHFC",$JOB))
SET AMHPROV="NONE TO REPORT"
DO HEAD
GOTO DONE
+6 FOR
SET AMHPROV=$ORDER(^XTMP("AMHFC",$JOB,AMHPROV))
IF AMHPROV=""!($DATA(AMHQUIT))
QUIT
DO HEAD
IF $DATA(AMHQUIT)
QUIT
DO SORT
+7 IF $DATA(AMHQUIT)
GOTO DONE
+8 IF $Y>(IOSL-5)
DO HEAD
IF $DATA(AMHQUIT)
GOTO DONE
+9 WRITE !?42,"------",!
+10 WRITE ?5,"Grand Total for ALL Operators:",?42,$JUSTIFY(AMHTOT,6)
+11 DO SUMMPAGE
DONE IF $DATA(AMHET)
SET AMHTS=(86400*($PIECE(AMHET,",")-$PIECE(AMHBT,",")))+($PIECE(AMHET,",",2)-$PIECE(AMHBT,",",2))
SET AMHH=$PIECE(AMHTS/3600,".")
IF AMHH=""
SET AMHH=0
+1 SET AMHTS=AMHTS-(AMHH*3600)
SET AMHM=$PIECE(AMHTS/60,".")
IF AMHM=""
SET AMHM=0
SET AMHTS=AMHTS-(AMHM*60)
SET AMHS=AMHTS
WRITE !!,"RUN TIME (H.M.S): ",AMHH,".",AMHM,".",AMHS
+2 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
SET DIR(0)="E"
DO ^DIR
KILL DIR
+3 IF $DATA(IOF)
WRITE @IOF
+4 QUIT
SORT ;
+1 SET (AMHSUB,AMHDESU)=0
SET AMHFC("DAYS",AMHPROV)=0
+2 SET AMHDATE=0
FOR
SET AMHDATE=$ORDER(^XTMP("AMHFC",$JOB,AMHPROV,AMHDATE))
IF AMHDATE'=+AMHDATE!($DATA(AMHQUIT))
QUIT
DO WRITE
+3 WRITE !?42,"------",!
+4 WRITE ?5,"Totals for ",AMHPROV,?42,$JUSTIFY(AMHSUB,6)
+5 SET AMHFC("FORMS",AMHPROV)=AMHSUB
+6 QUIT
WRITE ;
+1 SET Y=AMHDATE
DO DD^%DT
SET AMHWDAT=Y
+2 IF $Y>(IOSL-5)
DO HEAD
IF $DATA(AMHQUIT)
QUIT
+3 WRITE ?25,AMHWDAT,?42,$JUSTIFY(^XTMP("AMHFC",$JOB,AMHPROV,AMHDATE),6),!
+4 SET AMHSUB=AMHSUB+^XTMP("AMHFC",$JOB,AMHPROV,AMHDATE)
SET AMHTOT=AMHTOT+^XTMP("AMHFC",$JOB,AMHPROV,AMHDATE)
+5 SET AMHFC("DAYS",AMHPROV)=AMHFC("DAYS",AMHPROV)+1
+6 QUIT
SUMMPAGE ;
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET AMHQUIT=""
QUIT
+2 IF $DATA(IOF)
WRITE @IOF
SET AMHPG=AMHPG+1
+3 WRITE !?58,AMHDT,?70,"Page ",AMHPG
+4 WRITE !?20,"SUMMARY OF FORMS KEYED BY ALL OPERATORS"
+5 WRITE !?15,"BH RECORD POSTING DATES: ",AMHBDD," TO ",AMHEDD,!
+6 WRITE !?35,"No. of",?43,"Forms",?53,"% of"
+7 WRITE !?11,"Operator",?35,"Forms",?43,"per day",?53,"Workload"
+8 WRITE !,AMH80S
+9 SET X=""
FOR
SET X=$ORDER(AMHFC("FORMS",X))
IF X=""
QUIT
WRITE !,X,?32,$JUSTIFY(AMHFC("FORMS",X),8),?40,$JUSTIFY((AMHFC("FORMS",X)/AMHFC("DAYS",X)),8,1),?51,$JUSTIFY(((AMHFC("FORMS",X)/AMHTOT)*100),8,1)
+10 ;S X="" F S X=$O(AMHFC("FORMS",X)) Q:X="" W !,X,?32,$J(AMHFC("FORMS",X),8),?40,$J((AMHFC("FORMS",X)/AMHFC("DAYS",X)),8,1),?51,$J(((AMHFC("FORMS",X)/AMHTOT)*100),8,1)
+11 WRITE !?35,"--------",!?32,$JUSTIFY(AMHTOT,8)
+12 QUIT
HEAD IF 'AMHPG
GOTO HEAD1
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET AMHQUIT=""
QUIT
HEAD1 ;
+1 WRITE @IOF
SET AMHPG=AMHPG+1
+2 WRITE !?58,AMHDT,?70,"Page ",AMHPG,!
+3 SET AMHLENG=$LENGTH($PIECE(^DIC(4,DUZ(2),0),U))
+4 WRITE ?((80-AMHLENG)/2),$PIECE(^DIC(4,DUZ(2),0),U),!
+5 WRITE ?29,"NUMBER OF FORMS KEYED",!
+6 SET AMHLENG=21+$LENGTH(AMHPROV)
+7 WRITE ?((80-AMHLENG)/2),"DATE ENTRY OPERATOR: ",AMHPROV,!
+8 WRITE ?15,"BH RECORD POSTING DATES: ",AMHBDD," TO ",AMHEDD,!
+9 WRITE !?25,"POSTING DATE",?40,"# FORMS",!
+10 WRITE AMH80S,!
+11 QUIT