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

ABPAADR1.m

Go to the documentation of this file.
ABPAADR1 ;COMPILE PAYMENTS FOR DISTRIBUTION RPT;[ 06/27/91  2:11 PM ]
 ;;1.4;AO PVT-INS TRACKING;*0*;IHS-OKC/KJR;JULY 25, 1991
 ;KEY VARIABLES: R    = BATCH DATE
 ;               RR   = PATIENT DFN
 ;               RRR  = PAYMENT DFN WITHIN PATIENT RECORD
 ;               RRRR = PAYMENT AMOUNT DFN WITHIN PATIENT NODE
 ;
 G ABORT
R0 S R=BDT-1,ABPA("TASK")=ZTSK
NXTR S R=$O(^ABPVAO("DP",R)) G SZTSK:+R=0,SZTSK:+R>+EDT S RR=0
NXTRR S RR=$O(^ABPVAO("DP",R,RR)) G:+RR=0 NXTR
 I $D(^ABPVAO(RR,0))=0 G NXTRR
 I $D(^ABPVAO(RR,0))=10 G NXTRR
 I +FAC>0 I +$P(^ABPVAO(RR,0),"^",2)'=+FAC G NXTRR
 S FC=$P(^ABPVAO(RR,0),"^",2),RRR=0
NXTRRR S RRR=$O(^ABPVAO("DP",R,RR,RRR)) G:+RRR=0 NXTRR
 I $D(^ABPVAO(RR,"P",RRR,0))=0 G NXTRRR
 I $D(^ABPVAO(RR,"P",RRR,0))=10 G NXTRRR
 S RRRR=0 F I=1:1:15 S @("P"_I)=0
NXTRRRR S RRRR=$O(^ABPVAO(RR,"P",RRR,"A",RRRR)) G:+RRRR=0 STEMP
 I $D(^ABPVAO(RR,"P",RRR,"A",RRRR,0))'=1 G NXTRRRR
 I $P(^ABPVAO(RR,"P",RRR,"A",RRRR,0),"^",2)'="S" G NXTRRRR
 S P10=P10+(+$P(^ABPVAO(RR,"P",RRR,"A",RRRR,0),"^")) G NXTRRRR
STEMP S:$D(TEMP(ZTSK,FC))=0 TEMP(ZTSK,FC)="0^0^0^0^0^0^0^0^0^0^0^0^0^0^0"
 F P=1:1:15 S $P(TEMP(ZTSK,FC),"^",P)=$P(TEMP(ZTSK,FC),"^",P)+@("P"_P)
 G NXTRRR
 ;
SZTSK S FC=0
NXTFC S FC=$O(TEMP(ZTSK,FC)) G:+FC=0 ZTLOAD
SSITE I $D(^DIC(4,FC,0))'=1 S SITENAME="UNDEFINED FACILITY" G SET1
 S SITENAME=$P(^DIC(4,FC,0),"^",1)
SET1 S ^%ZTSK(ZTSK,SITENAME)=TEMP(ZTSK,FC),^%ZTSK(ZTSK,"SITE",SITENAME)=""
 G NXTFC
 ;
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="MAIN^ABPAADR2",ZTDTH=$H,ZTIO=ABPA("IO"),ZTSAVE("ABPA(")=""
 .S ZTSAVE("BDT")="",ZTSAVE("EDT")="",ZTSAVE("FAC")=""
 .S ZTDESC="PRINT PVT INS DISTRIBUTION 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
 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)'="ABPAADR1"
 .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")
 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 MAIN^ABPAADR2
 G ZTLEND
 ;
ABORT W *7,!!,"<<< SORRY, ACCESS DENIED!!! >>>" G ZTLEND