APCDFC2 ; IHS/CMI/LAB - COUNT FORMS REPORT ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;
EP ;
S APCDSITE="" S:$D(DUZ(2)) APCDSITE=DUZ(2)
I '$D(DUZ(2)) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!! K APCDSITE Q
I 'DUZ(2) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER",!! K APCDSITE Q
D INFORM
GETDATES ;
BD ;get beginning date
W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Posting Date" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) G XIT
S APCDBD=Y
ED ;get ending date
W ! S DIR(0)="DA^"_APCDBD_":DT:EP",DIR("A")="Enter ending Posting Date: " S Y=APCDBD D DD^%DT S DIR("B")=Y,Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) G BD
S APCDED=Y
S X1=APCDBD,X2=-1 D C^%DTC S APCDSD=X
;
S APCDDEC=DUZ
SORTA ;
S DIR(0)="S^1:CLINIC TYPE;2:SERVICE CATEGORY;3:VISIT TYPE;4:INCLUDE ALL VISITS",DIR("A")="Count number of Forms Processed by",DIR("B")="4" D ^DIR K DIR
I $D(DIRUT) G BD
S APCDPROC=+Y I APCDPROC=4 S APCDSRT="" G SUB
S APCDSRT=Y(0)
SUB ;subtotal by visit date
S APCDSUBV=""
S DIR(0)="Y",DIR("A")="Subtotal by Visit Date",DIR("B")="N" KILL DA D ^DIR KILL DIR
G:$D(DIRUT) SORTA
S APCDSUBV=Y
ZIS W !! S %ZIS="PQM" D ^%ZIS
I POP G XIT
I $D(IO("Q")) G TSKMN
DRIVER ; entry point for taskman
S APCDBT=$H
S U="^"
K ^XTMP("APCDFC2",$J)
ZTSK ;
D P
S APCDET=$H
U IO
D PRINT^APCDFC2
S:$D(ZTQUEUED) ZTREQ="@"
D XIT
Q
ERR W $C(7),$C(7),!,"Must be a valid date and be Today or earlier. Time not allowed!" Q
TSKMN ;
S ZTIO=$S($D(ION):ION,1:IO) I $D(IOST)#2,IOST]"" S ZTIO=ZTIO_";"_IOST
I $G(IO("DOC"))]"" S ZTIO=ZTIO_";"_$G(IO("DOC"))
I $D(IOM)#2,IOM S ZTIO=ZTIO_";"_IOM I $D(IOSL)#2,IOSL S ZTIO=ZTIO_";"_IOSL
K ZTSAVE F %="APCDBD","APCDED","APCDSD","APCDBDD","APCDDEC","APCDSITE","APCDSRT","APCDPROC","APCDSUBV" S ZTSAVE(%)=""
S ZTCPU=$G(IOCPU),ZTRTN="DRIVER^APCDFC2",ZTDTH="",ZTDESC="PCC DE/QA COUNTS" D ^%ZTLOAD D XIT Q
;
XIT ;
D ^%ZISC
;I '$D(ZTSK) S IOP=$I D ^%ZIS U IO(0)
K ^XTMP("APCDFC2",$J)
K DIC,%DT,IO("Q"),X,Y,POP,DIRUT,ZTSK,APCDH,APCDM,APCDS,APCDTS,ZTIO
K APCD1,APCD2,APCD80S,APCDAP,APCDBD,APCDBDD,APCDBT,APCDDATE,APCDDEC,APCDDT,APCDED,APCDEDD,APCDET,APCDGOT,APCDFC,APCDVDES,APCDTDES,APCDDESU,APCDX,APCDVDAT,APCDSUBV
K APCDLENG,APCDODAT,APCDPG,APCDPROC,APCDPROV,APCDSD,APCDSITE,APCDSORT,APCDSRT,APCDSUB,APCDTOT,APCDVDFN,APCDVREC,APCDWDAT,APCDY,APCDC,APCDDFN,APCDAVG,APCDDEC
Q
;
INFORM ;
W:$D(IOF) @IOF
W !,"This report will generate a count of visits entered by you for a ",!,"date range that you specify.",!
W !,"The report can be subtotaled by CLINIC TYPE, SERVICE CATEGORY OR BY VISIT TYPE.",!
Q
;
P ; Run by posting date
S APCDODAT=APCDSD_".9999" F S APCDODAT=$O(^APCDFORM("B",APCDODAT)) Q:APCDODAT=""!((APCDODAT\1)>APCDED) S APCDDFN=$O(^APCDFORM("B",APCDODAT,"")) D V1
Q
V1 ;
S APCDC=0 F S APCDC=$O(^APCDFORM(APCDDFN,11,APCDC)) Q:APCDC'=+APCDC S APCDVDFN=$P(^APCDFORM(APCDDFN,11,APCDC,0),U) I APCDVDFN]"",$D(^AUPNVSIT(APCDVDFN,0)) D PROC
Q
PROC ;
I APCDDEC'=$P(^APCDFORM(APCDDFN,11,APCDC,0),U,2) Q
Q:$P(^APCDFORM(APCDDFN,11,APCDC,0),U,2)=""
Q:'$D(^VA(200,$P(^APCDFORM(APCDDFN,11,APCDC,0),U,2),0))
S APCDAP=$P(^VA(200,$P(^APCDFORM(APCDDFN,11,APCDC,0),U,2),0),U)
S APCDVREC=^AUPNVSIT(APCDVDFN,0)
S APCDVDAT=$P($P(APCDVREC,U),".")
Q:'$P(APCDVREC,U,9)
Q:$P(APCDVREC,U,11)
Q:'$D(^AUPNVPOV("AD",APCDVDFN))
Q:'$D(^AUPNVPRV("AD",APCDVDFN))
D @APCDPROC
D DATE
SET S ^(APCDDATE)=$S($D(^XTMP("APCDFC2",$J,APCDAP,APCDSORT,APCDDATE)):^(APCDDATE)+1,1:1)
S ^(APCDDATE)=$S($D(^XTMP("APCDFC2",$J,APCDAP,APCDSORT,"DEP COUNT",APCDDATE)):^(APCDDATE)+APCDVDES,1:APCDVDES)
Q:'APCDSUBV
S ^(APCDVDAT)=$S($D(^XTMP("APCDFC2",$J,APCDAP,APCDSORT,"VISIT DATE",APCDDATE,APCDVDAT)):^(APCDVDAT)+1,1:1)
Q
EOJ ; clean up and exit
K APCDVREC,APCDCLIN,APCDSKIP,APCD1,APCD2,APCDAP,APCDX,APCDY,APCDVDES,APCDDATE,APCDPROV,APCDSEC,APCDZ
Q
;
1 ;
S APCDCLIN=$P(APCDVREC,U,8) I APCDCLIN="" S APCDSORT="NO CLINIC ENTERED" Q
S APCDSORT=$P(^DIC(40.7,APCDCLIN,0),U)
Q
;
2 ;
K ^UTILITY("DIQ1",$J)
K DIQ,DIC,DA,DR
S DIC="^AUPNVSIT(",DR=".07",DA=APCDVDFN,DIQ(0)="E" D EN^DIQ1 K DIC,DA,DR,DIQ
S APCDSORT=^UTILITY("DIQ1",$J,9000010,APCDVDFN,.07,"E")
K ^UTILITY("DIQ1",$J)
Q
;
4 ;
S APCDSORT="NONE"
Q
3 ;TYPE
K ^UTILITY("DIQ1",$J)
K DIQ,DIC,DA,DR
S DIC="^AUPNVSIT(",DR=".03",DA=APCDVDFN,DIQ(0)="E" D EN^DIQ1 K DIC,DA,DR,DIQ
S APCDSORT=^UTILITY("DIQ1",$J,9000010,APCDVDFN,.03,"E")
K ^UTILITY("DIQ1",$J)
Q
;
DATE ;
S APCDDATE=$P(APCDODAT,".")
CALDEC ;
S APCDVDES=0
S APCDVFLE=9000010 F APCDFL=0:0 S APCDVFLE=$O(^DIC(APCDVFLE)) Q:APCDVFLE>9000010.99!(APCDVFLE'=+APCDVFLE) D
.Q:APCDVFLE=9000010.09
.Q:APCDVFLE=9000010.14
.Q:APCDVFLE=9000010.22
.Q:APCDVFLE=9000010.24
.Q:APCDVFLE=9000010.25
.Q:APCDVFLE=9000010.31
.Q:APCDVFLE=9000010.99
.S APCDVDG=^DIC(APCDVFLE,0,"GL"),APCDVIGR=APCDVDG_"""AD"",APCDVDFN,APCDEDFN)"
.S APCDEDFN="" F APCDEL=1:1 S APCDEDFN=$O(@APCDVIGR) Q:APCDEDFN'=+APCDEDFN S APCDVDES=APCDVDES+1
.Q
Q
PRINT ;EP
K APCDSUM
S APCD80S="-------------------------------------------------------------------------------",APCDPG=0
S APCDEDD=$$FMTE^XLFDT(APCDED),APCDBDD=$$FMTE^XLFDT(APCDBD)
S (APCDTOT,APCDPROV,APCDTDES)=0
K APCDQUIT
I '$D(^XTMP("APCDFC2",$J)) S APCDPROV="NONE TO REPORT" D HEAD G DONE
F S APCDPROV=$O(^XTMP("APCDFC2",$J,APCDPROV)) Q:APCDPROV=""!($D(APCDQUIT)) D HEAD Q:$D(APCDQUIT) D SORT
G:$D(APCDQUIT) DONE
;I $Y>(IOSL-5) D HEAD G:$D(APCDQUIT) DONE
;W !?42,"------",?52,"-------",?65,"------",!
;W ?5,"Grand Total for ALL Operators:",?42,$J(APCDTOT,6),?52,$J(APCDTDES,7) S APCDAVG=APCDTDES/APCDTOT W ?65,$J(APCDAVG,6,1)
;D SUMMPAGE
DONE I $D(APCDET) S APCDTS=(86400*($P(APCDET,",")-$P(APCDBT,",")))+($P(APCDET,",",2)-$P(APCDBT,",",2)),APCDH=$P(APCDTS/3600,".") S:APCDH="" APCDH=0
S APCDTS=APCDTS-(APCDH*3600),APCDM=$P(APCDTS/60,".") S:APCDM="" APCDM=0 S APCDTS=APCDTS-(APCDM*60),APCDS=APCDTS W !!,"RUN TIME (H.M.S): ",APCDH,".",APCDM,".",APCDS
I $E(IOST)="C",IO=IO(0) S DIR(0)="E" D ^DIR K DIR
W:$D(IOF) @IOF
Q
SORT ;
S (APCDSUB,APCDDESU)=0,APCDFC("DAYS",APCDPROV)=0
S APCDSORT="" F S APCDSORT=$O(^XTMP("APCDFC2",$J,APCDPROV,APCDSORT)) Q:APCDSORT=""!($D(APCDQUIT)) D SORT1
W !?42,"------",?52,"-------",?65,"------",!
W ?5,"Totals for ",APCDPROV,?42,$J(APCDSUB,6),?52,$J(APCDDESU,7),?65,$J((APCDDESU/APCDSUB),6,1)
S APCDFC("FORMS",APCDPROV)=APCDSUB
S APCDFC("AVG DEC",APCDPROV)=$J((APCDDESU/APCDSUB),6,1)
Q
SORT1 ;
I $Y>(IOSL-6) D HEAD Q:$D(APCDQUIT)
W !,$S(APCDSRT]"":APCDSORT,1:"")
S APCDDATE=0 F S APCDDATE=$O(^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,APCDDATE)) Q:APCDDATE'=+APCDDATE!($D(APCDQUIT)) D WRITE
Q
;
WRITE ;
S APCDSUM(APCDPROV,"#DAYS")=$G(APCDSUM(APCDPROV,"#DAYS"))+1
S Y=APCDDATE D DD^%DT S APCDWDAT=Y
I $Y>(IOSL-5) D HEAD Q:$D(APCDQUIT)
S APCDVDES=^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,"DEP COUNT",APCDDATE),APCDAVG=(APCDVDES/^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,APCDDATE))\1
S APCDSUM(APCDPROV,"#DEC")=$G(APCDSUM(APCDPROV,"#DEC"))+APCDVDES
W !?25,APCDWDAT,?42,$J(^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,APCDDATE),6),?52,$J(APCDVDES,7),?65,$J(APCDAVG,6)
S APCDSUM(APCDPROV,"#FORMS")=$G(APCDSUM(APCDPROV,"#FORMS"))+^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,APCDDATE)
I APCDSUBV D
. W !?27,"Visit Dates Processed:"
. S APCDVDAT=0 F S APCDVDAT=$O(^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,"VISIT DATE",APCDDATE,APCDVDAT)) Q:APCDVDAT'=+APCDVDAT!($D(APCDQUIT)) D
.. I $Y>(IOSL-5) D HEAD Q:$D(APCDQUIT)
.. W !?27,$$FMTE^XLFDT(APCDVDAT),?42,$J(^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,"VISIT DATE",APCDDATE,APCDVDAT),6)
.. Q
Q:$D(APCDQUIT)
S APCDSUB=APCDSUB+^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,APCDDATE),APCDTOT=APCDTOT+^XTMP("APCDFC2",$J,APCDPROV,APCDSORT,APCDDATE),APCDDESU=APCDDESU+APCDVDES,APCDTDES=APCDTDES+APCDVDES
S APCDFC("DAYS",APCDPROV)=APCDFC("DAYS",APCDPROV)+1
Q
SUMMPAGE ;
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCDQUIT="" Q
W:$D(IOF) @IOF S APCDPG=APCDPG+1
W !?55,$$FMTE^XLFDT(DT),?70,"Page ",APCDPG
W !?20,"SUMMARY OF FORMS KEYED BY ALL OPERATORS"
W !?15,"VISIT POSTING DATES: ",APCDBDD," TO ",APCDEDD,!
W ?22,"# days",?29,"# of",?36,"%",?45,"Avg #",?56,"Avg # dep",?68,"Avg # dep"
W !?5,"Operator",?22,"of D/E",?29,"forms",?36,"workload",?45,"forms/day",?56,"ent/day",?68,"ent/form"
W !,APCD80S
;S X="" F S X=$O(APCDFC("FORMS",X)) Q:X="" W !,X,?32,$J(APCDFC("FORMS",X),8),?40,$J((APCDFC("FORMS",X)/APCDFC("DAYS",X)),8,1),?51,$J(((APCDFC("FORMS",X)/APCDTOT)*100),8,1),?67,APCDFC("AVG DEC",X)
S X=0 F S X=$O(APCDSUM(X)) Q:X="" W !,$E(X,1,20),?22,$J(APCDSUM(X,"#DAYS"),6),?29,$J(APCDSUM(X,"#FORMS"),6),?36,$J(((APCDSUM(X,"#FORMS")/APCDTOT)*100),8,1) D
.W ?45,$J((APCDSUM(X,"#FORMS")/APCDSUM(X,"#DAYS")),8,1)
.W ?56,$J((APCDSUM(X,"#DEC")/APCDSUM(X,"#DAYS")),8,1)
.W ?67,$J((APCDSUM(X,"#DEC")/APCDSUM(X,"#FORMS")),8,1)
W !?29,"--------",!?27,$J(APCDTOT,8)
Q
HEAD I 'APCDPG G HEAD1
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCDQUIT="" Q
HEAD1 ;
W @IOF S APCDPG=APCDPG+1
W !?55,$$FMTE^XLFDT(DT),?70,"Page ",APCDPG,!
S APCDLENG=$L($P(^DIC(4,DUZ(2),0),U))
W ?((80-APCDLENG)/2),$P(^DIC(4,DUZ(2),0),U),!
S APCDLENG=37+$L(APCDSRT)
I APCDSRT]"" W ?((80-APCDLENG)/2),"NUMBER OF FORMS KEYED SUBTOTALED BY ",APCDSRT,!
I APCDSRT="" W ?29,"NUMBER OF FORMS KEYED",!
S APCDLENG=21+$L(APCDPROV)
W ?((80-APCDLENG)/2),"DATE ENTRY OPERATOR: ",APCDPROV,!
W ?15,"VISIT POSTING DATES: ",APCDBDD," TO ",APCDEDD,!
W !,APCDSRT,?25,"POSTING DATE",?40,"# FORMS",?50,"# DEP ENT",?63,"AVG # DEP ENT",!
W APCD80S,!
Q
APCDFC2 ; IHS/CMI/LAB - COUNT FORMS REPORT ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;
EP ;
+1 SET APCDSITE=""
IF $DATA(DUZ(2))
SET APCDSITE=DUZ(2)
+2 IF '$DATA(DUZ(2))
WRITE $CHAR(7),$CHAR(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!!
KILL APCDSITE
QUIT
+3 IF 'DUZ(2)
WRITE $CHAR(7),$CHAR(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER",!!
KILL APCDSITE
QUIT
+4 DO INFORM
GETDATES ;
BD ;get beginning date
+1 WRITE !
SET DIR(0)="D^:DT:EP"
SET DIR("A")="Enter beginning Posting Date"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 IF $DATA(DIRUT)
GOTO XIT
+3 SET APCDBD=Y
ED ;get ending date
+1 WRITE !
SET DIR(0)="DA^"_APCDBD_":DT:EP"
SET DIR("A")="Enter ending Posting Date: "
SET Y=APCDBD
DO DD^%DT
SET DIR("B")=Y
SET Y=""
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 IF $DATA(DIRUT)
GOTO BD
+3 SET APCDED=Y
+4 SET X1=APCDBD
SET X2=-1
DO C^%DTC
SET APCDSD=X
+5 ;
+6 SET APCDDEC=DUZ
SORTA ;
+1 SET DIR(0)="S^1:CLINIC TYPE;2:SERVICE CATEGORY;3:VISIT TYPE;4:INCLUDE ALL VISITS"
SET DIR("A")="Count number of Forms Processed by"
SET DIR("B")="4"
DO ^DIR
KILL DIR
+2 IF $DATA(DIRUT)
GOTO BD
+3 SET APCDPROC=+Y
IF APCDPROC=4
SET APCDSRT=""
GOTO SUB
+4 SET APCDSRT=Y(0)
SUB ;subtotal by visit date
+1 SET APCDSUBV=""
+2 SET DIR(0)="Y"
SET DIR("A")="Subtotal by Visit Date"
SET DIR("B")="N"
KILL DA
DO ^DIR
KILL DIR
+3 IF $DATA(DIRUT)
GOTO SORTA
+4 SET APCDSUBV=Y
ZIS WRITE !!
SET %ZIS="PQM"
DO ^%ZIS
+1 IF POP
GOTO XIT
+2 IF $DATA(IO("Q"))
GOTO TSKMN
DRIVER ; entry point for taskman
+1 SET APCDBT=$HOROLOG
+2 SET U="^"
+3 KILL ^XTMP("APCDFC2",$JOB)
ZTSK ;
+1 DO P
+2 SET APCDET=$HOROLOG
+3 USE IO
+4 DO PRINT^APCDFC2
+5 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+6 DO XIT
+7 QUIT
ERR WRITE $CHAR(7),$CHAR(7),!,"Must be a valid date and be Today or earlier. Time not allowed!"
QUIT
TSKMN ;
+1 SET ZTIO=$SELECT($DATA(ION):ION,1:IO)
IF $DATA(IOST)#2
IF IOST]""
SET ZTIO=ZTIO_";"_IOST
+2 IF $GET(IO("DOC"))]""
SET ZTIO=ZTIO_";"_$GET(IO("DOC"))
+3 IF $DATA(IOM)#2
IF IOM
SET ZTIO=ZTIO_";"_IOM
IF $DATA(IOSL)#2
IF IOSL
SET ZTIO=ZTIO_";"_IOSL
+4 KILL ZTSAVE
FOR %="APCDBD","APCDED","APCDSD","APCDBDD","APCDDEC","APCDSITE","APCDSRT","APCDPROC","APCDSUBV"
SET ZTSAVE(%)=""
+5 SET ZTCPU=$GET(IOCPU)
SET ZTRTN="DRIVER^APCDFC2"
SET ZTDTH=""
SET ZTDESC="PCC DE/QA COUNTS"
DO ^%ZTLOAD
DO XIT
QUIT
+6 ;
XIT ;
+1 DO ^%ZISC
+2 ;I '$D(ZTSK) S IOP=$I D ^%ZIS U IO(0)
+3 KILL ^XTMP("APCDFC2",$JOB)
+4 KILL DIC,%DT,IO("Q"),X,Y,POP,DIRUT,ZTSK,APCDH,APCDM,APCDS,APCDTS,ZTIO
+5 KILL APCD1,APCD2,APCD80S,APCDAP,APCDBD,APCDBDD,APCDBT,APCDDATE,APCDDEC,APCDDT,APCDED,APCDEDD,APCDET,APCDGOT,APCDFC,APCDVDES,APCDTDES,APCDDESU,APCDX,APCDVDAT,APCDSUBV
+6 KILL APCDLENG,APCDODAT,APCDPG,APCDPROC,APCDPROV,APCDSD,APCDSITE,APCDSORT,APCDSRT,APCDSUB,APCDTOT,APCDVDFN,APCDVREC,APCDWDAT,APCDY,APCDC,APCDDFN,APCDAVG,APCDDEC
+7 QUIT
+8 ;
INFORM ;
+1 IF $DATA(IOF)
WRITE @IOF
+2 WRITE !,"This report will generate a count of visits entered by you for a ",!,"date range that you specify.",!
+3 WRITE !,"The report can be subtotaled by CLINIC TYPE, SERVICE CATEGORY OR BY VISIT TYPE.",!
+4 QUIT
+5 ;
P ; Run by posting date
+1 SET APCDODAT=APCDSD_".9999"
FOR
SET APCDODAT=$ORDER(^APCDFORM("B",APCDODAT))
IF APCDODAT=""!((APCDODAT\1)>APCDED)
QUIT
SET APCDDFN=$ORDER(^APCDFORM("B",APCDODAT,""))
DO V1
+2 QUIT
V1 ;
+1 SET APCDC=0
FOR
SET APCDC=$ORDER(^APCDFORM(APCDDFN,11,APCDC))
IF APCDC'=+APCDC
QUIT
SET APCDVDFN=$PIECE(^APCDFORM(APCDDFN,11,APCDC,0),U)
IF APCDVDFN]""
IF $DATA(^AUPNVSIT(APCDVDFN,0))
DO PROC
+2 QUIT
PROC ;
+1 IF APCDDEC'=$PIECE(^APCDFORM(APCDDFN,11,APCDC,0),U,2)
QUIT
+2 IF $PIECE(^APCDFORM(APCDDFN,11,APCDC,0),U,2)=""
QUIT
+3 IF '$DATA(^VA(200,$PIECE(^APCDFORM(APCDDFN,11,APCDC,0),U,2),0))
QUIT
+4 SET APCDAP=$PIECE(^VA(200,$PIECE(^APCDFORM(APCDDFN,11,APCDC,0),U,2),0),U)
+5 SET APCDVREC=^AUPNVSIT(APCDVDFN,0)
+6 SET APCDVDAT=$PIECE($PIECE(APCDVREC,U),".")
+7 IF '$PIECE(APCDVREC,U,9)
QUIT
+8 IF $PIECE(APCDVREC,U,11)
QUIT
+9 IF '$DATA(^AUPNVPOV("AD",APCDVDFN))
QUIT
+10 IF '$DATA(^AUPNVPRV("AD",APCDVDFN))
QUIT
+11 DO @APCDPROC
+12 DO DATE
SET SET ^(APCDDATE)=$SELECT($DATA(^XTMP("APCDFC2",$JOB,APCDAP,APCDSORT,APCDDATE)):^(APCDDATE)+1,1:1)
+1 SET ^(APCDDATE)=$SELECT($DATA(^XTMP("APCDFC2",$JOB,APCDAP,APCDSORT,"DEP COUNT",APCDDATE)):^(APCDDATE)+APCDVDES,1:APCDVDES)
+2 IF 'APCDSUBV
QUIT
+3 SET ^(APCDVDAT)=$SELECT($DATA(^XTMP("APCDFC2",$JOB,APCDAP,APCDSORT,"VISIT DATE",APCDDATE,APCDVDAT)):^(APCDVDAT)+1,1:1)
+4 QUIT
EOJ ; clean up and exit
+1 KILL APCDVREC,APCDCLIN,APCDSKIP,APCD1,APCD2,APCDAP,APCDX,APCDY,APCDVDES,APCDDATE,APCDPROV,APCDSEC,APCDZ
+2 QUIT
+3 ;
1 ;
+1 SET APCDCLIN=$PIECE(APCDVREC,U,8)
IF APCDCLIN=""
SET APCDSORT="NO CLINIC ENTERED"
QUIT
+2 SET APCDSORT=$PIECE(^DIC(40.7,APCDCLIN,0),U)
+3 QUIT
+4 ;
2 ;
+1 KILL ^UTILITY("DIQ1",$JOB)
+2 KILL DIQ,DIC,DA,DR
+3 SET DIC="^AUPNVSIT("
SET DR=".07"
SET DA=APCDVDFN
SET DIQ(0)="E"
DO EN^DIQ1
KILL DIC,DA,DR,DIQ
+4 SET APCDSORT=^UTILITY("DIQ1",$JOB,9000010,APCDVDFN,.07,"E")
+5 KILL ^UTILITY("DIQ1",$JOB)
+6 QUIT
+7 ;
4 ;
+1 SET APCDSORT="NONE"
+2 QUIT
3 ;TYPE
+1 KILL ^UTILITY("DIQ1",$JOB)
+2 KILL DIQ,DIC,DA,DR
+3 SET DIC="^AUPNVSIT("
SET DR=".03"
SET DA=APCDVDFN
SET DIQ(0)="E"
DO EN^DIQ1
KILL DIC,DA,DR,DIQ
+4 SET APCDSORT=^UTILITY("DIQ1",$JOB,9000010,APCDVDFN,.03,"E")
+5 KILL ^UTILITY("DIQ1",$JOB)
+6 QUIT
+7 ;
DATE ;
+1 SET APCDDATE=$PIECE(APCDODAT,".")
CALDEC ;
+1 SET APCDVDES=0
+2 SET APCDVFLE=9000010
FOR APCDFL=0:0
SET APCDVFLE=$ORDER(^DIC(APCDVFLE))
IF APCDVFLE>9000010.99!(APCDVFLE'=+APCDVFLE)
QUIT
Begin DoDot:1
+3 IF APCDVFLE=9000010.09
QUIT
+4 IF APCDVFLE=9000010.14
QUIT
+5 IF APCDVFLE=9000010.22
QUIT
+6 IF APCDVFLE=9000010.24
QUIT
+7 IF APCDVFLE=9000010.25
QUIT
+8 IF APCDVFLE=9000010.31
QUIT
+9 IF APCDVFLE=9000010.99
QUIT
+10 SET APCDVDG=^DIC(APCDVFLE,0,"GL")
SET APCDVIGR=APCDVDG_"""AD"",APCDVDFN,APCDEDFN)"
+11 SET APCDEDFN=""
FOR APCDEL=1:1
SET APCDEDFN=$ORDER(@APCDVIGR)
IF APCDEDFN'=+APCDEDFN
QUIT
SET APCDVDES=APCDVDES+1
+12 QUIT
End DoDot:1
+13 QUIT
PRINT ;EP
+1 KILL APCDSUM
+2 SET APCD80S="-------------------------------------------------------------------------------"
SET APCDPG=0
+3 SET APCDEDD=$$FMTE^XLFDT(APCDED)
SET APCDBDD=$$FMTE^XLFDT(APCDBD)
+4 SET (APCDTOT,APCDPROV,APCDTDES)=0
+5 KILL APCDQUIT
+6 IF '$DATA(^XTMP("APCDFC2",$JOB))
SET APCDPROV="NONE TO REPORT"
DO HEAD
GOTO DONE
+7 FOR
SET APCDPROV=$ORDER(^XTMP("APCDFC2",$JOB,APCDPROV))
IF APCDPROV=""!($DATA(APCDQUIT))
QUIT
DO HEAD
IF $DATA(APCDQUIT)
QUIT
DO SORT
+8 IF $DATA(APCDQUIT)
GOTO DONE
+9 ;I $Y>(IOSL-5) D HEAD G:$D(APCDQUIT) DONE
+10 ;W !?42,"------",?52,"-------",?65,"------",!
+11 ;W ?5,"Grand Total for ALL Operators:",?42,$J(APCDTOT,6),?52,$J(APCDTDES,7) S APCDAVG=APCDTDES/APCDTOT W ?65,$J(APCDAVG,6,1)
+12 ;D SUMMPAGE
DONE IF $DATA(APCDET)
SET APCDTS=(86400*($PIECE(APCDET,",")-$PIECE(APCDBT,",")))+($PIECE(APCDET,",",2)-$PIECE(APCDBT,",",2))
SET APCDH=$PIECE(APCDTS/3600,".")
IF APCDH=""
SET APCDH=0
+1 SET APCDTS=APCDTS-(APCDH*3600)
SET APCDM=$PIECE(APCDTS/60,".")
IF APCDM=""
SET APCDM=0
SET APCDTS=APCDTS-(APCDM*60)
SET APCDS=APCDTS
WRITE !!,"RUN TIME (H.M.S): ",APCDH,".",APCDM,".",APCDS
+2 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
SET DIR(0)="E"
DO ^DIR
KILL DIR
+3 IF $DATA(IOF)
WRITE @IOF
+4 QUIT
SORT ;
+1 SET (APCDSUB,APCDDESU)=0
SET APCDFC("DAYS",APCDPROV)=0
+2 SET APCDSORT=""
FOR
SET APCDSORT=$ORDER(^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT))
IF APCDSORT=""!($DATA(APCDQUIT))
QUIT
DO SORT1
+3 WRITE !?42,"------",?52,"-------",?65,"------",!
+4 WRITE ?5,"Totals for ",APCDPROV,?42,$JUSTIFY(APCDSUB,6),?52,$JUSTIFY(APCDDESU,7),?65,$JUSTIFY((APCDDESU/APCDSUB),6,1)
+5 SET APCDFC("FORMS",APCDPROV)=APCDSUB
+6 SET APCDFC("AVG DEC",APCDPROV)=$JUSTIFY((APCDDESU/APCDSUB),6,1)
+7 QUIT
SORT1 ;
+1 IF $Y>(IOSL-6)
DO HEAD
IF $DATA(APCDQUIT)
QUIT
+2 WRITE !,$SELECT(APCDSRT]"":APCDSORT,1:"")
+3 SET APCDDATE=0
FOR
SET APCDDATE=$ORDER(^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,APCDDATE))
IF APCDDATE'=+APCDDATE!($DATA(APCDQUIT))
QUIT
DO WRITE
+4 QUIT
+5 ;
WRITE ;
+1 SET APCDSUM(APCDPROV,"#DAYS")=$GET(APCDSUM(APCDPROV,"#DAYS"))+1
+2 SET Y=APCDDATE
DO DD^%DT
SET APCDWDAT=Y
+3 IF $Y>(IOSL-5)
DO HEAD
IF $DATA(APCDQUIT)
QUIT
+4 SET APCDVDES=^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,"DEP COUNT",APCDDATE)
SET APCDAVG=(APCDVDES/^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,APCDDATE))\1
+5 SET APCDSUM(APCDPROV,"#DEC")=$GET(APCDSUM(APCDPROV,"#DEC"))+APCDVDES
+6 WRITE !?25,APCDWDAT,?42,$JUSTIFY(^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,APCDDATE),6),?52,$JUSTIFY(APCDVDES,7),?65,$JUSTIFY(APCDAVG,6)
+7 SET APCDSUM(APCDPROV,"#FORMS")=$GET(APCDSUM(APCDPROV,"#FORMS"))+^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,APCDDATE)
+8 IF APCDSUBV
Begin DoDot:1
+9 WRITE !?27,"Visit Dates Processed:"
+10 SET APCDVDAT=0
FOR
SET APCDVDAT=$ORDER(^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,"VISIT DATE",APCDDATE,APCDVDAT))
IF APCDVDAT'=+APCDVDAT!($DATA(APCDQUIT))
QUIT
Begin DoDot:2
+11 IF $Y>(IOSL-5)
DO HEAD
IF $DATA(APCDQUIT)
QUIT
+12 WRITE !?27,$$FMTE^XLFDT(APCDVDAT),?42,$JUSTIFY(^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,"VISIT DATE",APCDDATE,APCDVDAT),6)
+13 QUIT
End DoDot:2
End DoDot:1
+14 IF $DATA(APCDQUIT)
QUIT
+15 SET APCDSUB=APCDSUB+^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,APCDDATE)
SET APCDTOT=APCDTOT+^XTMP("APCDFC2",$JOB,APCDPROV,APCDSORT,APCDDATE)
SET APCDDESU=APCDDESU+APCDVDES
SET APCDTDES=APCDTDES+APCDVDES
+16 SET APCDFC("DAYS",APCDPROV)=APCDFC("DAYS",APCDPROV)+1
+17 QUIT
SUMMPAGE ;
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET APCDQUIT=""
QUIT
+2 IF $DATA(IOF)
WRITE @IOF
SET APCDPG=APCDPG+1
+3 WRITE !?55,$$FMTE^XLFDT(DT),?70,"Page ",APCDPG
+4 WRITE !?20,"SUMMARY OF FORMS KEYED BY ALL OPERATORS"
+5 WRITE !?15,"VISIT POSTING DATES: ",APCDBDD," TO ",APCDEDD,!
+6 WRITE ?22,"# days",?29,"# of",?36,"%",?45,"Avg #",?56,"Avg # dep",?68,"Avg # dep"
+7 WRITE !?5,"Operator",?22,"of D/E",?29,"forms",?36,"workload",?45,"forms/day",?56,"ent/day",?68,"ent/form"
+8 WRITE !,APCD80S
+9 ;S X="" F S X=$O(APCDFC("FORMS",X)) Q:X="" W !,X,?32,$J(APCDFC("FORMS",X),8),?40,$J((APCDFC("FORMS",X)/APCDFC("DAYS",X)),8,1),?51,$J(((APCDFC("FORMS",X)/APCDTOT)*100),8,1),?67,APCDFC("AVG DEC",X)
+10 SET X=0
FOR
SET X=$ORDER(APCDSUM(X))
IF X=""
QUIT
WRITE !,$EXTRACT(X,1,20),?22,$JUSTIFY(APCDSUM(X,"#DAYS"),6),?29,$JUSTIFY(APCDSUM(X,"#FORMS"),6),?36,$JUSTIFY(((APCDSUM(X,"#FORMS")/APCDTOT)*100),8,1)
Begin DoDot:1
+11 WRITE ?45,$JUSTIFY((APCDSUM(X,"#FORMS")/APCDSUM(X,"#DAYS")),8,1)
+12 WRITE ?56,$JUSTIFY((APCDSUM(X,"#DEC")/APCDSUM(X,"#DAYS")),8,1)
+13 WRITE ?67,$JUSTIFY((APCDSUM(X,"#DEC")/APCDSUM(X,"#FORMS")),8,1)
End DoDot:1
+14 WRITE !?29,"--------",!?27,$JUSTIFY(APCDTOT,8)
+15 QUIT
HEAD IF 'APCDPG
GOTO HEAD1
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET APCDQUIT=""
QUIT
HEAD1 ;
+1 WRITE @IOF
SET APCDPG=APCDPG+1
+2 WRITE !?55,$$FMTE^XLFDT(DT),?70,"Page ",APCDPG,!
+3 SET APCDLENG=$LENGTH($PIECE(^DIC(4,DUZ(2),0),U))
+4 WRITE ?((80-APCDLENG)/2),$PIECE(^DIC(4,DUZ(2),0),U),!
+5 SET APCDLENG=37+$LENGTH(APCDSRT)
+6 IF APCDSRT]""
WRITE ?((80-APCDLENG)/2),"NUMBER OF FORMS KEYED SUBTOTALED BY ",APCDSRT,!
+7 IF APCDSRT=""
WRITE ?29,"NUMBER OF FORMS KEYED",!
+8 SET APCDLENG=21+$LENGTH(APCDPROV)
+9 WRITE ?((80-APCDLENG)/2),"DATE ENTRY OPERATOR: ",APCDPROV,!
+10 WRITE ?15,"VISIT POSTING DATES: ",APCDBDD," TO ",APCDEDD,!
+11 WRITE !,APCDSRT,?25,"POSTING DATE",?40,"# FORMS",?50,"# DEP ENT",?63,"AVG # DEP ENT",!
+12 WRITE APCD80S,!
+13 QUIT