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

ABPAAR1C.m

Go to the documentation of this file.
ABPAAR1C ;COMPILE PAYMENTS FOR UTILIZATION RPT;[ 05/30/91  4:14 PM ]
 ;;1.4;AO PVT-INS TRACKING;*0*;IHS-OKC/KJR;JULY 25, 1991
ABORT W *7,!!,"<<< SORRY, ACCESS DENIED!!! >>>" Q
R0 S R=BDT-1,ABPA("TASK")=ZTSK,ABPA("UPAMT")=0,ABPA("REF")=0
NXTR S R=$O(^ABPVAO("BD",R)) G SZTSK:+R=0,SZTSK:+R>+EDT S RR=0
NXTRR S RR=$O(^ABPVAO("BD",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("BD",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 NOCHECK=1 I $P(^ABPVAO(RR,"P",RRR,0),"^",6)]"" S NOCHECK=0
 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 CLAIMS
 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
 I NOCHECK D  G NXTRRRR
 .S X=+^ABPVAO(RR,"P",RRR,"A",RRRR,0),P10=P10+X,X=X*-1
 .S ABPA("UPAMT")=ABPA("UPAMT")+X,ABPA("REF")=ABPA("REF")+X
 S P10=P10+(+^ABPVAO(RR,"P",RRR,"A",RRRR,0)) G NXTRRRR
CLAIMS S CDT=0 F I=0:0 D  Q:+CDT=0
 .S CDT=$O(^ABPVAO(RR,"P",RRR,"D",CDT)) Q:+CDT=0
 .Q:$D(^ABPVAO(RR,"P",RRR,"D",CDT,0))'=1
 .S CDFN=$P(^ABPVAO(RR,"P",RRR,"D",CDT,0),"^",2) Q:+CDFN=0
 .Q:$D(^ABPVAO(RR,1,CDFN,0))'=1
 .S VT=$P(^ABPVAO(RR,1,CDFN,0),"^",4)
 .I (VT'="O")&(VT'="I")&(VT'="D") Q
 .I (VT="O")!(VT="D") D  Q
 ..S P9=P9+$P(^ABPVAO(RR,1,CDFN,0),"^",5),P15=P15+1
 .S P8=P8+$P(^ABPVAO(RR,1,CDFN,0),"^",5),P13=P13+1
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 UNDIST
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
 ;
UNDIST S R=0 F J=0:0 D  Q:+R=0
 .S R=$O(^ABPACHKS("RB",1,R)) Q:+R=0
 .S RR=0 F K=0:0 D  Q:+RR=0
 ..S RR=$O(^ABPACHKS("RB",1,R,RR)) Q:+RR=0
 ..S ABPACLDT=$P($P(^ABPACHKS(1,"I",R,"C",RR,0),"^",2),".")
 ..I ABPACLDT<BDT!(ABPACLDT>EDT) Q
 ..S ABPA("UPAMT")=ABPA("UPAMT")+(^ABPACHKS("RB",1,R,RR))
 S R=EDT+.9999 F I=0:0 D  Q:+R=0
 .S R=$O(^ABPACHKS("SP",1,R)) Q:+R=0
 .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),".")
 ...I ABPACLDT<BDT!(ABPACLDT>EDT) Q
 ...S ABPA("UPAMT")=ABPA("UPAMT")+^ABPACHKS("SP",1,R,RR,RRR)
ADJUST G ADJUST^ABPAAR1E