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

APCLAAP.m

Go to the documentation of this file.
APCLAAP ; IHS/CMI/LAB - print apc report 1A ;
 ;;2.0;IHS PCC SUITE;**15**;MAY 14, 2009;Build 11
 ;CMI/TUCSON/LAB - patch 3 FY Fix
START ;
 S APCL132="__________________________________________________________________________________________________________________________________"
 S APCLMOL="OCT.,NOV.,DEC.,JAN.,FEB.,MAR.,APR.,MAY ,JUNE,JULY,AUG.,SEPT"
 S APCLLOCC=$P(^AUTTLOC(APCLLOC,0),U,10),APCLLOCP=$P(^DIC(4,APCLLOC,0),U)
 ;beginning Y2K
 ;S Y=$E(APCLFYE,1,3)_"0000" D DD^%DT S APCLFYD=Y S Y=DT D DD^%DT S APCLDT=Y ;Y2000
 S APCLFYD=APCL("FY") S Y=DT D DD^%DT S APCLDT=Y ;Y2000
 ;end Y2K
 S APCLAREA=$P(^AUTTLOC(APCLLOC,0),U,4) I APCLAREA="" S (APCLAREA,APCLAREC)="???" G SU
 I '$D(^AUTTAREA(APCLAREA,0)) S (APCLAREA,APCLAREC)="???" G SU
 S APCLAREC=$P(^AUTTAREA(APCLAREA,0),U,2),APCLAREA=$P(^AUTTAREA(APCLAREA,0),U)
SU ;
 S APCLSU=$P(^AUTTLOC(APCLLOC,0),U,5) I APCLSU="" S (APCLSU,APCLSUC)="???" G START2
 I '$D(^AUTTSU(APCLSU,0)) S (APCLSU,APCLSUC)="999" G START2
 S APCLSUC=$P(^AUTTSU(APCLSU,0),U,3),APCLSU=$P(^AUTTSU(APCLSU,0),U)
START2 S (APCLPG,APCLDISC,APCLPRIT)=0 D HEAD
 K APCLQUIT
 I APCLGRAN=0 W !!,"NO VISITS FOR THIS FISCAL YEAR",! G DONE
 F  S APCLDISC=$O(^XTMP("APCLAA",APCLJOB,APCLBT,"MODISC",APCLDISC)) Q:APCLDISC=""!($D(APCLQUIT))  D P
 G:$D(APCLQUIT) DONE
 I $Y>(IOSL-8) D HEAD G:$D(APCLQUIT) DONE
 W !!," T O T A L",?21,$J(APCLGRAN,7),?30,"100.0"
 S APCLMON="",APCLTAB=36 F APCLJ=10,11,12,1,2,3,4,5,6,7,8,9 S APCLMON=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"MONTOTALL",APCLJ)):^(APCLJ),1:0) W ?APCLTAB,$J(APCLMON,6) S APCLTAB=APCLTAB+8
 W !!,"*TOTAL PRIMARY PVDR",?21,$J(APCLPRIT,7) S APCLP=(((APCLPRIT/APCLGRAN)*100.00)+.05),APCLP=$P(APCLP,".")_"."_$E($P(APCLP,".",2))
 W ?30,$J(APCLP,5) S APCLMON="",APCLTAB=36 F APCLJ=10,11,12,1,2,3,4,5,6,7,8,9 S APCLMON=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"MONTOTPCP",APCLJ)):^(APCLJ),1:0) W ?APCLTAB,$J(APCLMON,6) S APCLTAB=APCLTAB+8
 W !
DONE D DONE^APCLOSUT
 K ^XTMP("APCLAA",APCLJOB,APCLBT)
 Q
P ;
 I $Y>(IOSL-5) D HEAD Q:$D(APCLQUIT)
 S (APCLP,APCLT)=^XTMP("APCLAA",APCLJOB,APCLBT,"DISCTOT",APCLDISC),APCLP=(((APCLP/APCLGRAN)*100.00)+.05),APCLP=$P(APCLP,".")_"."_$E($P(APCLP,".",2))
 I APCLDISC="??"!(APCLDISC="UNKNOWN") S APCLDISN="NO PROVIDER CLASS" G W
 S APCLDISN=$E($P(^DIC(7,APCLDISC,0),U),1,20) K APCLPRIM D CHKPRIM I $D(APCLPRIM) S APCLDISN=$E(APCLDISN,1,19)_"*"
W W !,APCLDISN,?22,$J(APCLT,6),?30,$J(APCLP,5)
 S APCLMON="",APCLTAB=36 F APCLJ=10,11,12,1,2,3,4,5,6,7,8,9 S APCLMON=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"MODISC",APCLDISC,APCLJ)):^(APCLJ),1:0) W ?APCLTAB,$J(APCLMON,6) S APCLTAB=APCLTAB+8 D MONTOT
 Q
 ;
MONTOT ;set up month totals for all visits and pcp visits
 S ^(APCLJ)=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"MONTOTALL",APCLJ)):^(APCLJ)+APCLMON,1:APCLMON)
 I $D(APCLPRIM) S ^(APCLJ)=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"MONTOTPCP",APCLJ)):^(APCLJ)+APCLMON,1:APCLMON)
 Q
CHKPRIM ;
 ;I $D(^APCLCNTL(1,11,"B",$P(^DIC(7,APCLDISC,9999999),U))) S APCLPRIM=1,APCLPRIT=APCLPRIT+APCLT
 I $P($G(^DIC(7,APCLDISC,9999999)),U,3)="Y" S APCLPRIM=1,APCLPRIT=APCLPRIT+APCLT
 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 APCL132,!
 W !?5,"AREA:  ",APCLAREC,"      ",APCLAREA,?50,"PCC-OUTPATIENT PATIENT CARE REPORT",?95,APCLDT,?110,"Page ",APCLPG
 W !?5,"S.U.:  ",APCLSUC,"      ",APCLSU,?58,"FISCAL YEAR ",APCLFYD
 W !?5,"FAC.:  ",APCLLOCC,"  ",APCLLOCP
 W !?24,"ALL PCC OUTPATIENT (NON-HOSPITAL) VISITS TO SERVICE LOCATION BY PRIMARY PROVIDER AND MONTH OF SERVICE",!
 W APCL132,!
 W "PRIMARY PROVIDER",?23,"YR-TO",?30,"% OF"
 W !,"   OF SERVICE",?23,"DATE",?30,"TOTAL"
 S APCLTAB=38 F APCLX=1:1:12 W ?APCLTAB,$P(APCLMOL,",",APCLX) S APCLTAB=APCLTAB+8
 W !,APCL132
 Q
 ;