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

AMHRAT2P.m

Go to the documentation of this file.
AMHRAT2P ; IHS/CMI/LAB - print all visit report ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
START ;
 S AMHR132S="",$P(AMHR132S,"-",132)=""
 D NOW^%DTC S Y=X D DD^%DT S AMHRDT=Y
 D COVPAGE^AMHRPTCP
 S (AMHRPG,AMHSORT)=0 D HEAD
 K AMHRQUIT
 F  S AMHSORT=$O(^XTMP("AMHRAT2",AMHJOB,AMHBTH,AMHSORT)) Q:AMHSORT=""!($D(AMHRQUIT))  D SORT
 G:$D(AMHRQUIT) DONE
 I $Y>(IOSL-5) D HEAD G:$D(AMHRQUIT) DONE
 W !?5,"TOTALS:" S AMHRTAB=18
 F A="C","S","M" S AMHRTAB=AMHRTAB+5 D
 .F B="REC TOTAL","PATIENT TOTAL","TIME TOTAL" D:B="TIME TOTAL"  W ?AMHRTAB,$S($D(AMHRTOT(A,B)):$J(AMHRTOT(A,B),7),1:$J(".",7)) S AMHRTAB=AMHRTAB+11
 ..Q:'$D(AMHRTOT(A,B))
 ..S X=AMHRTOT(A,B),X=$J((X/60),1,1),AMHRTOT(A,B)=X
 ..Q
 .Q
 I $Y>(IOSL-5) D HEAD G:$D(AMHRQUIT) DONE
 W !!,"**** Patient Count TOTAL is not an unduplicated count.",!
DONE ;
 D DONE^AMHLEIN,^AMHEKL
 K ^XTMP("AMHRAT2",AMHJOB,AMHBTH)
 Q
SORT ;
 I $Y>(IOSL-5) D HEAD Q:$D(AMHRQUIT)
 W !,$E(AMHSORT,1,20) S AMHRTAB=18
 F A="C","S","M" S AMHRTAB=AMHRTAB+5 D
 .F B="REC TOTAL","PATIENT TOTAL","TIME TOTAL" D TOTALS D:B="TIME TOTAL"  W ?AMHRTAB,$S($D(^XTMP("AMHRAT2",AMHJOB,AMHBTH,AMHSORT,A,B)):$J(^(B),7),1:$J(".",7)) S AMHRTAB=AMHRTAB+11
 ..Q:'$D(^XTMP("AMHRAT2",AMHJOB,AMHBTH,AMHSORT,A,B))
 ..S X=^XTMP("AMHRAT2",AMHJOB,AMHBTH,AMHSORT,A,B),X=$J((X/60),1,1),^(B)=X
 ..Q
 .Q
 Q
TOTALS ;
 Q:'$D(^XTMP("AMHRAT2",AMHJOB,AMHBTH,AMHSORT,A,B))
 S:'$D(AMHRTOT(A,B)) AMHRTOT(A,B)=0 S AMHRTOT(A,B)=AMHRTOT(A,B)+^XTMP("AMHRAT2",AMHJOB,AMHBTH,AMHSORT,A,B)
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S AMHRQUIT="" Q
HEAD1 ;
 W:$D(IOF) @IOF S AMHRPG=AMHRPG+1
 W ?50,"MENTAL HEALTH AND SOCIAL SERVICE",?100,AMHRDT,?123,"Page ",AMHRPG,!
 S AMHRLENG=62+$L(AMHTITL) W ?((132-AMHRLENG)/2),"ACTIVITY TIME, PATIENT AND RECORD COUNT REPORT BY PROGRAM AND ",AMHTITL,!
 W ?45,"RECORD DATES:  ",AMHBDD,"  TO  ",AMHEDD,!
 W !?20,"SOCIAL SERVICES AND MENTAL HEALTH COMB",?69,"SOCIAL SERVICE",?104,"MENTAL HEALTH",!
 W ?23,"NO. OF",?34,"NO. OF",?46,"TOTAL",?62,"NO. OF",?73,"NO. OF",?85,"TOTAL",?99,"NO. OF",?109,"NO. OF",?121,"TOTAL",!
 W $E(AMHHD1,1,20),?23,"RECORDS",?34,"PATIENTS",?44,"ACTIV TIME",?62,"RECORDS",?73,"PATIENTS",?83,"ACTIV TIME",?99,"RECORDS",?109,"PATIENTS",?119,"ACTIV TIME",!
 W AMHR132S,!