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

ABPAAR1E.m

Go to the documentation of this file.
ABPAAR1E ;COMPILE PAYMENTS FOR UTILIZATION RPT;[ 06/27/91  1:48 PM ]
 ;;1.4;AO PVT-INS TRACKING;*0*;IHS-OKC/KJR;JULY 25, 1991
ABORT W *7,!!,"<<< SORRY, ACCESS DENIED!!! >>>" G ZTLEND
ADJUST S R=BDT,ABPA("TRAN")=0 F J=0:0 D  Q:+R=0
 .S R=$O(^ABPACHKS("SP",1,R)) Q:+R=0!(+R>(EDT+.9999))
 .S RR=0 F K=0:0 D  Q:+RR=0
 ..S RR=$O(^ABPACHKS("SP",1,R,RR)) Q:+RR=0
 ..S RRR=0 F L=0:0 D  Q:+RRR=0
 ...S RRR=$O(^ABPACHKS("SP",1,R,RR,RRR)) Q:+RRR=0
 ...S ABPACLDT=$P($P(^ABPACHKS(1,"I",RR,"C",RRR,0),"^",2),".")
 ...Q:$D(^ABPACHKS(1,"I",RR,"C",RRR,"SP","B",R))=0
 ...S DA=$O(^ABPACHKS(1,"I",RR,"C",RRR,"SP","B",R,"")) Q:+DA'>0
 ...Q:$D(^ABPACHKS(1,"I",RR,"C",RRR,"SP",DA,0))'=1
 ...S ABPASP=$P(^ABPACHKS(1,"I",RR,"C",RRR,"SP",DA,0),"^",2)
 ...I ABPASP="T" D  Q
 ....S ABPA("TRAN")=ABPA("TRAN")+^ABPACHKS("SP",1,R,RR,RRR)
 ....I ABPACLDT'<BDT&(ABPACLDT'>EDT) D
 .....S ABPA("UPAMT")=ABPA("UPAMT")+^ABPACHKS("SP",1,R,RR,RRR)
 ...I ABPASP="R" D  Q
 ....S ABPA("REF")=ABPA("REF")+^ABPACHKS("SP",1,R,RR,RRR)
 ....I ABPACLDT'<BDT&(ABPACLDT'>EDT) D
 .....S ABPA("UPAMT")=ABPA("UPAMT")+^ABPACHKS("SP",1,R,RR,RRR)
 S ^%ZTSK(ZTSK,0,"ABPA(","UPAMT")=ABPA("UPAMT")
 S ^%ZTSK(ZTSK,0,"ABPA(","TRAN")=ABPA("TRAN")
 S ^%ZTSK(ZTSK,0,"ABPA(","REF")=ABPA("REF")
 ;
ZTLOAD S PRINTNOW=0,MTH=+$E(DT,4,5) D  I 'AUTO S PRINTNOW=1
 .S ABPA("LD")=$P("31^28^31^30^31^30^31^31^30^31^30^31","^",MTH)
 I AUTO&(+$E(DT,6,7)=ABPA("LD")) S PRINTNOW=1
 I AUTO&(MTH=2)&(+$E(DT,6,7)=29) S PRINTNOW=1
 I PRINTNOW D
 .I $D(ABPA("IO"))'=1 S ABPA("IO")=+IO
 .I +DUZ(2)'>0 S DUZ(2)=$O(^ABPAFAC(+DUZ(2)))
 .S ZTRTN="START^ABPAAR1D",ZTDTH=$H,ZTIO=ABPA("IO"),ZTSAVE("ABPA(")=""
 .S ZTSAVE("BDT")="",ZTSAVE("EDT")="",ZTSAVE("FAC")=""
 .S ZTDESC="PRINT PVT INS UTILILIZATION REPORT" D ^%ZTLOAD
ZTLEND K BDT,EDT,FAC,FC,IPD,IPV,LBL,OPD,OPV,ZTRTN,ZTDTH,ZTIO,ZTSAVE
 F I=1:1:13 K @("P"_I)
 K R,RR,RRR,RRRR,SITENAME,VD,VT,PTOT,J,I,TEMP,ABPA,PRINTNOW
 Q
 ;
PRINT K ABPA("HD") S ABPA("HD",1)=ABPATLE,ABPA("HD",2)=$P(XQO,"^",2)
 D ^ABPAHD S ZTSK=0,FOUND=0 F J=0:0 D  Q:+ZTSK=0
 .S ZTSK=$O(^%ZTSK(ZTSK)) Q:+ZTSK=0
 .Q:$D(^%ZTSK(ZTSK,0))'=11  S DATA=(^(0))
 .Q:$P(DATA,"^")'="R0"  Q:$P(DATA,"^",2)'="ABPAAR1B"
 .Q:$D(^%ZTSK(ZTSK,0,"AUTO"))'=1  Q:^("AUTO")'=1
 .Q:$D(^%ZTSK(ZTSK,0,"ABPA(","RPTYP"))'=1
 .Q:^("RPTYP")'=ABPA("RPTYP")
 .S FOUND=ZTSK,ABPA("TASK")=ZTSK,BDT=^%ZTSK(ZTSK,0,"BDT")
 .S EDT=^%ZTSK(ZTSK,0,"EDT"),FAC=^%ZTSK(ZTSK,0,"FAC")
 .I $D(^%ZTSK(ZTSK,0,"ABPA(","UPAMT"))=1 S ABPA("UPAMT")=^("UPAMT")
 .I $D(^%ZTSK(ZTSK,0,"ABPA(","TRAN"))=1 S ABPA("TRAN")=^("TRAN")
 .I $D(^%ZTSK(ZTSK,0,"ABPA(","REF"))=1 S ABPA("REF")=^("REF")
 W !!! K ABPA("IO") F J=0:0 D  Q:$D(ABPA("IO"))=1!(POP)
 .K %IS,IOP S %IS="NP",%IS("A")="Select PRINTER: " D ^%ZIS
 .Q:POP  I $E(IOST,1)'="P" D  Q
 ..W *7,?5,"<<< NOT A PRINTER DEVICE >>>"
 .S ABPA("IO")=+IO
 I FOUND&($D(ABPA("IO"))=1) W !! D WAIT^DICD G START^ABPAAR1D
 G ZTLEND