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

AMHRP2P.m

Go to the documentation of this file.
AMHRP2P ; IHS/CMI/LAB - = print all visit report ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
START ;
 D NOW^%DTC S Y=X D DD^%DT S AMHDT=Y
 S Y=AMHBD D DD^%DT S AMHBDD=Y S Y=AMHED D DD^%DT S AMHEDD=Y
 S (AMHATOT,AMHSTOT,AMHFTOT,AMHPTOT,AMHPG)=0 D HEAD
 K AMHQUIT
AREA ;
 S AMHAREA="" F  S AMHAREA=$O(^XTMP("AMHRP2",AMHJOB,AMHBTH,"RECORDS",AMHAREA)) Q:AMHAREA=""!($D(AMHQUIT))  D
 .S (AMHATOT("R"),AMHATOT("AT"),AMHATOT("P"),AMHATOT("NS"))=0
 .I $Y>(IOSL-4) D HEAD Q:$D(AMHQUIT)
 .W !,"AREA:  ",$P(^AUTTAREA(AMHAREA,0),U)
 .D SU
 .Q:$D(AMHQUIT)
 .I $Y>(IOSL-5) D HEAD Q:$D(AMHQUIT)
 .W !?43,"=======",?53,"=======",?62,"=======",?73,"=======",!
 .W "AREA TOTAL:",?43,$J(AMHATOT("R"),7),?53,$J((AMHATOT("AT")/60),7,1),?62,$J(AMHATOT("P"),7),?73,$J(AMHATOT("NS"),7),!
DONE ;
 D DONE^AMHLEIN,^AMHEKL
 K ^XTMP("AMHRP2",AMHJOB,AMHBTH),AMHJOB,AMHBTH
 Q
SU ;
 S AMHSU="" F  S AMHSU=$O(^XTMP("AMHRP2",AMHJOB,AMHBTH,"RECORDS",AMHAREA,AMHSU)) Q:AMHSU=""!($D(AMHQUIT))  D
 .S (AMHSTOT("R"),AMHSTOT("AT"),AMHSTOT("P"),AMHSTOT("NS"))=0
 .I $Y>(IOSL-4) D HEAD Q:$D(AMHQUIT)
 .W !?2,"SERVICE UNIT:  ",$P(^AUTTSU(AMHSU,0),U)
 .D LOC
 .Q:$D(AMHQUIT)
 .I $Y>(IOSL-5) D HEAD Q:$D(AMHQUIT)
 .W !?43,"=======",?53,"=======",?62,"=======",?73,"=======",!
 .W ?2,"SU TOTAL:",?43,$J(AMHSTOT("R"),7),?53,$J((AMHSTOT("AT")/60),7,1),?62,$J(AMHSTOT("P"),7),?73,$J(AMHSTOT("NS"),7),!
 Q
LOC ;
 S AMHLOC="" F  S AMHLOC=$O(^XTMP("AMHRP2",AMHJOB,AMHBTH,"RECORDS",AMHAREA,AMHSU,AMHLOC)) Q:AMHLOC=""!($D(AMHQUIT))  D
 .S (AMHLTOT("R"),AMHLTOT("AT"),AMHLTOT("P"),AMHLTOT("NS"))=0
 .I $Y>(IOSL-4) D HEAD Q:$D(AMHQUIT)
 .W !?5,"FACILITY:  ",$P(^DIC(4,AMHLOC,0),U)
 .D PROV
 .Q:$D(AMHQUIT)
 .I $Y>(IOSL-5) D HEAD Q:$D(AMHQUIT)
 .W !?43,"=======",?53,"=======",?62,"=======",?73,"=======",!
 .W ?5,"FACILITY TOTAL:",?43,$J(AMHLTOT("R"),7),?53,$J((AMHLTOT("AT")/60),7,1),?62,$J(AMHLTOT("P"),7),?73,$J(AMHLTOT("NS"),7),!
 Q
PROV ;
 S AMHPROV="" F  S AMHPROV=$O(^XTMP("AMHRP2",AMHJOB,AMHBTH,"RECORDS",AMHAREA,AMHSU,AMHLOC,AMHPROV)) Q:AMHPROV=""!($D(AMHQUIT))  D
 .S (AMHPTOT("R"),AMHPTOT("AT"),AMHPTOT("P"),AMHPTOT("NS"))=0
 .I $Y>(IOSL-4) D HEAD Q:$D(AMHQUIT)
 .W !?8,"PROVIDER:  ",AMHPROV
 .D ACT
 .Q:$D(AMHQUIT)
 .I $Y>(IOSL-5) D HEAD Q:$D(AMHQUIT)
 .W !?43,"=======",?53,"=======",?62,"=======",?73,"=======",!
 .W ?8,"PROVIDER TOTAL:",?43,$J(AMHPTOT("R"),7),?53,$J((AMHPTOT("AT")/60),7,1),?62,$J(AMHPTOT("P"),7),?73,$J(AMHPTOT("NS"),7),!
 .;W ?8,"PROVIDER TOTAL:",?43,$J(AMHPTOT("R"),7),?53,$J(AMHPTOT("AT"),7),?62,$J(AMHPTOT("P"),7),!
 Q
ACT ;
 S AMHACT="" F  S AMHACT=$O(^XTMP("AMHRP2",AMHJOB,AMHBTH,"RECORDS",AMHAREA,AMHSU,AMHLOC,AMHPROV,AMHACT)) Q:AMHACT=""!($D(AMHQUIT))  D
 .I $Y>(IOSL-4) D HEAD Q:$D(AMHQUIT)
 .S AMHREC=$P(^XTMP("AMHRP2",AMHJOB,AMHBT,"RECORDS",AMHAREA,AMHSU,AMHLOC,AMHPROV,AMHACT),U),AMHAT=$P(^(AMHACT),U,2),AMHPAT=$P(^(AMHACT),U,3),AMHNS=$P(^(AMHACT),U,4)
 .W !?11,$E(AMHACT,1,29),?43,$J(AMHREC,7),?53,$J((AMHAT/60),7,1),?62,$J(AMHPAT,7),?73,$J(AMHNS,7)
 .S AMHATOT("R")=AMHATOT("R")+AMHREC,AMHSTOT("R")=AMHSTOT("R")+AMHREC,AMHLTOT("R")=AMHLTOT("R")+AMHREC,AMHPTOT("R")=AMHPTOT("R")+AMHREC
 .S AMHATOT("AT")=AMHATOT("AT")+AMHAT,AMHSTOT("AT")=AMHSTOT("AT")+AMHAT,AMHLTOT("AT")=AMHLTOT("AT")+AMHAT,AMHPTOT("AT")=AMHPTOT("AT")+AMHAT
 .S AMHATOT("P")=AMHATOT("P")+AMHPAT,AMHSTOT("P")=AMHSTOT("P")+AMHPAT,AMHLTOT("P")=AMHLTOT("P")+AMHPAT,AMHPTOT("P")=AMHPTOT("P")+AMHPAT
 .S AMHATOT("NS")=AMHATOT("NS")+AMHNS,AMHSTOT("NS")=AMHSTOT("NS")+AMHNS,AMHLTOT("NS")=AMHLTOT("NS")+AMHNS,AMHPTOT("NS")=AMHPTOT("NS")+AMHNS
 Q
 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:$D(IOF) @IOF S AMHPG=AMHPG+1
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !,$P(^VA(200,DUZ,0),U,2),?58,AMHDT,?62,"Page ",AMHPG,!
 I AMHPROG]"" S AMHLENG=28+$L($$EXTSET^XBFUNC(9002011,.02,AMHPROG))
 E  S AMHLENG=59
 W ?((80-AMHLENG)\2),"ACTIVITY REPORT FOR ",$S(AMHPROG="S":"SOCIAL SERVICES",AMHPROG="M":"MENTAL HEALTH",AMHPROG="C":"CHEMICAL DEPENDENCY or A/SA",1:"ALL PROGRAMS (MH,SS,CD,OTHER)")," PROGRAM",!
 W ?17,"RECORD DATES:  ",AMHBDD,"  TO  ",AMHEDD,!
 W "# PATS is the total number of unique, identifiable patients when",!,"a patient name was entered on the record.  # served is a tally of the ",!,"number served data value.",!
 W !?43,"# RECS",?53,"ACT TIME",?63,"# PATS",?72,"# SERVED",!?53,"(hrs)"
 W !,$TR($J(" ",80)," ","-")
 Q