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

AMHRC1P.m

Go to the documentation of this file.
AMHRC1P ; IHS/CMI/LAB - print active client list (using case open/close) ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
PRINT ;
START ;
 S AMH80D="-------------------------------------------------------------------------------"
 S AMHPG=0 D HEAD
 I '$D(^XTMP("AMHRC1",AMHJOB,AMHBTH)) W !!,"NO PATIENTS TO REPORT" G DONE
 S DFN="" K AMHQ
 S AMHNAME="" F  S AMHNAME=$O(^XTMP("AMHRC1",AMHJOB,AMHBTH,"CASES",AMHNAME)) Q:AMHNAME=""!($D(AMHQ))  D
 .S DFN=0 F  S DFN=$O(^XTMP("AMHRC1",AMHJOB,AMHBTH,"CASES",AMHNAME,DFN)) Q:DFN'=+DFN!($D(AMHQ))  D DFN
 G:$D(AMHQ) DONE
 W !!,"Total Number of Patients: ",AMHPCNT,!
 W "Total Number of Cases: ",AMHCCNT,!
DONE D DONE^AMHLEIN,^AMHEKL
 K ^XTMP("AMHRC1",AMHJOB,AMHBTH),AMHJOB,AMHBTH
 Q
DFN ;
 S AMHCASE=0 F  S AMHCASE=$O(^XTMP("AMHRC1",AMHJOB,AMHBTH,"CASES",AMHNAME,DFN,AMHCASE)) Q:AMHCASE'=+AMHCASE!($D(AMHQ))  S AMHR=^AMHPCASE(AMHCASE,0) D PRN
 Q
PRN ;
 I $Y>(IOSL-4) D HEAD Q:$D(AMHQ)
 S AMHHRCN=$S($D(^AUPNPAT(DFN,41,DUZ(2),0)):$P(^(0),U,2),1:"<none>")
 W !,$E($P(^DPT(DFN,0),U),1,15),?18,AMHHRCN
 W ?26,$P(^DPT(DFN,0),U,2) S Y=$P(^DPT(DFN,0),U,3) W ?28,$E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3)
 S Y=$P(AMHR,U) W ?38,$E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3)
 W ?48,$E($$VAL^XBDIQ1(9002011.58,AMHCASE,.08),1,12)
 S D=$P(^XTMP("AMHRC1",AMHJOB,AMHBTH,"CASES",AMHNAME,DFN,AMHCASE),U)
 W ?62,$$D(D)
 W ?72,$S(D="":"not seen",1:$$FMDIFF^XLFDT(DT,D))
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S AMHQ="" Q
HEAD1 ;
 W:$D(IOF) @IOF S AMHPG=AMHPG+1
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !,$P(^VA(200,DUZ,0),U,2),?72,"Page ",AMHPG,!
 W ?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),!
 I AMHPROG]"" S X="Program: "_$$EXTSET^XBFUNC(9002011.58,.03,AMHPROG) W $$CTR^AMHRP4P(X,80),!
 W ?10,"ACTIVE CLIENT LIST (CASE OPEN & NOT SEEN IN ",AMHDAYS," DAYS)"
PIH W !,"PATIENT NAME",?18,"CHART",?25,"SEX",?31,"DOB",?38,"CASE OPEN",?48,"PROVIDER",?62,"DATE LAST",?72,"# DAYS"
 W !?18,"NUMBER",?38,"DATE",?62,"SEEN",?72,"SINCE",!,AMH80D
 Q
D(D) ;
 I $G(D)="" Q ""
 Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)