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

APCLCP3P.m

Go to the documentation of this file.
APCLCP3P ; IHS/CMI/LAB - activity report print ;
 ;;2.0;IHS PCC SUITE;**20**;MAY 14, 2009;Build 25
 ;IHS/CMI/LAB - minutes to hours patch 5
START ;
 D NOW^%DTC S Y=X D DD^%DT S APCLDT=Y
 S APCL80S="-------------------------------------------------------------------------------"
 S APCLSUB="TOTAL^PRIM^SEC^ACT^TT"
 S Y=APCLBD D DD^%DT S APCLBDD=Y S Y=APCLED D DD^%DT S APCLEDD=Y
 S (APCLPG,APCLSU)=0
 K APCLQUIT
 I '$D(^XTMP(APCLNSP,APCLJOB,APCLBT)) D HEAD W !!,"No visits to report",! G DONE
 F  S APCLSU=$O(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU)) Q:'APCLSU!($D(APCLQUIT))  D LOC
DONE ;
 D DONE^APCLOSUT
 K ^XTMP(APCLNSP,APCLJOB,APCLBT)
 Q
LOC ;
 D HEAD,SUBHEAD Q:$D(APCLQUIT)
 F Y=1:1 S X=$P(APCLSUB,U,Y) Q:X=""  S ^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLSU,X)=0
 S APCLVAL="" F  S APCLVAL=$O(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,APCLVAL)) Q:APCLVAL'=+APCLVAL!($D(APCLQUIT))  D P
 W !!?10,"TOTAL:"
 S Z=28 F Y=1,2,3 S X=$P(APCLSUB,U,Y) Q:X=""  W ?Z,$J(^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLSU,X),7) S Z=Z+10 ;IHS/CMI/LAB - minutes to hours
 F Y=4,5 S X=$P(APCLSUB,U,Y) Q:X=""  W ?Z,$J(^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLSU,X)/60,7,2) S Z=Z+10 ;IHS/CMI/LAB - minutes to hours
 I $D(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,"NOACT")) W !!!,"* -- ",^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,"NOACT")," of the visits did not have an activity time recorded."
 D NOTE
 Q
P ;
 F Y=1:1 S X=$P(APCLSUB,U,Y) Q:X=""  S:$D(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,APCLVAL,X)) ^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLSU,X)=^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLSU,X)+^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,APCLVAL,X)
 I $Y>(IOSL-5) D HEAD,SUBHEAD Q:$D(APCLQUIT)
 I APCLSORV="APCLVLOC" S APCLZ=$E($P(^DIC(4,APCLVAL,0),U),1,26)
 I APCLSORV="APCLCODE" S G=APCLGLOB_APCLVAL_")",APCLZ=$S(APCLGLOB["ICD9":$E($P($$ICDDX^ICDEX(APCLVAL),U,4),1,26),1:$E($P(@G@(0),U,APCLPIEC),1,26))
 W !,APCLZ
 NEW Z,X S Z=28 F Y=1,2,3 S X=$P(APCLSUB,U,Y) Q:X=""  W ?Z,$J($S($D(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,APCLVAL,X)):^(X),1:0),7) S Z=Z+10 ;IHS/CMI/LAB - minutes to hours
 F Y=4,5 S X=$P(APCLSUB,U,Y) Q:X=""  W ?Z,$J($S($D(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLSU,APCLVAL,X)):^(X),1:0)/60,7,2) S Z=Z+10 ;IHS/CMI/LAB - minutes to hours
 Q
SUBHEAD ;
 Q:$D(APCLQUIT)
 I APCLSECV="APCLSU" S APCLLENG=$L($S(APCLSU:$P(^AUTTSU(APCLSU,0),U),1:"UNKNOWN/MISSING")),APCLVALP=$S(APCLSU:$P(^AUTTSU(APCLSU,0),U),1:"UNKNOWN/MISSING")
 I APCLSECV="APCLVLOC" S APCLLENG=$L($P(^DIC(4,APCLSU,0),U)),APCLVALP=$P(^DIC(4,APCLSU,0),U)
 W ?(80-($L(APCLSECS)+APCLLENG)/2),APCLSECS,":  ",APCLVALP
 W !!?28,"TOTAL",?38,"# VISITS",?48,"# VISITS"
 W !?28,"PATIENT",?38,"AS PRIM.",?48,"AS SEC.",?58,"ACTIVITY",?69,"TRAVEL"
 W !,APCLSORT,?28,"CONTACTS",?38,"PROVIDER",?48,"PROVIDER",?58,"TIME*",?69,"TIME"
 W !,APCL80S,!
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQUIT="" Q
HEAD1 ;
 W:$D(IOF) @IOF S APCLPG=APCLPG+1
 W !
 W APCLDT,?72,"Page ",APCLPG,!
 S APCLLENG=$L(APCLSORT)+$L(APCLSECS)+22+$L($P(^APCLACTG(APCLACTG,0),U)) W ?((80-APCLLENG)/2),APCLSORT," REPORT BY ",APCLSECS," FOR ",$P(^APCLACTG(APCLACTG,0),U)," STAFF",!
 W ?18,"VISIT DATES:  ",APCLBDD,"  TO  ",APCLEDD,!
 S X="" I '$D(APCLLOC) S X="All Locations"
 I $D(APCLLOC) S X="Locations: " S Y=0 F  S Y=$O(APCLLOC(Y)) Q:Y'=+Y  S X=X_$E($P(^DIC(4,Y,0),U),1,10)_"; "
 W $$CTR^APCLCP1P(X),!
 S X="" I '$D(APCLCLN) S X="All Clinics"
 I $D(APCLCLN) S X="Clinics: " S Y=0 F  S Y=$O(APCLCLN(Y)) Q:Y'=+Y  S X=X_$E($P(^DIC(40.7,Y,0),U),1,10)_"; "
 W $$CTR^APCLCP1P(X),!
 Q
NOTE ;
 I $Y>(IOSL-6) D HEAD Q:$D(APCLQUIT)
 D NOTE2^APCLCPUT
 Q