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

APCLCP1P.m

Go to the documentation of this file.
APCLCP1P ; IHS/CMI/LAB - tally activity ; 
 ;;2.0;IHS PCC SUITE;**11,20**;MAY 14, 2009;Build 25
 ;IHS/CMI/LAB - patch 4 file 200 fix
START ;
 S APCL80S="-------------------------------------------------------------------------------"
 D NOW^%DTC S Y=X D DD^%DT S APCLDT=Y
 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,APCLAP)=0
 K APCLQUIT
 I '$D(^XTMP(APCLNSP,APCLJOB,APCLBT)) D HEAD W !!,"No visits to report",! G DONE
 F  S APCLAP=$O(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLAP)) Q:APCLAP'=+APCLAP!($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",APCLAP,X)=0
 S APCLVAL="" F  S APCLVAL=$O(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLAP,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",APCLAP,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",APCLAP,X)/60,7,2) S Z=Z+10 ;IHS/CMI/LAB - minutes to hours
 I $D(^XTMP(APCLNSP,APCLJOB,APCLBT,APCLAP,"NOACT")) W !!!,"* -- ",^XTMP(APCLNSP,APCLJOB,APCLBT,APCLAP,"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,APCLAP,APCLVAL,X)) ^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLAP,X)=^XTMP(APCLNSP,APCLJOB,APCLBT,"SUBTOTAL",APCLAP,X)+^XTMP(APCLNSP,APCLJOB,APCLBT,APCLAP,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
 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,APCLAP,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,APCLAP,APCLVAL,X)):^(X),1:0)/60,7,2) S Z=Z+10 ;IHS/CMI/LAB - minutes to hours
 Q
SUBHEAD ;
 Q:$D(APCLQUIT)
 S APCLLENG=$L($S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,APCLAP,0),U),1:$P(^DIC(16,APCLAP,0),U))) ;IHS/CMI/LAB - file 200 fix
 W ?(80-(11+APCLLENG)/2),"PROVIDER:  ",$S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,APCLAP,0),U),1:$P(^DIC(16,APCLAP,0),U))
 W !!?28,"TOTAL",?38,"# CONTS",?48,"# CONTS"
 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($P(^APCLACTG(APCLACTG,0),U))
 W ?(80-(33+APCLLENG)/2),"PRIMARY DX REPORT BY PROVIDER ",$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(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(X),!
 Q
NOTE ;
 I $Y>(IOSL-6) D HEAD Q:$D(APCLQUIT)
 D NOTE^APCLCPUT
 Q
CTR(X,Y) ;EP - Center X in a field Y wide.
 Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
 ;----------