ABPAAGE2 ;PRINT DETAILED OPEN ITEMS; [ 05/20/91 9:11 AM ]
;;1.4;AO PVT-INS TRACKING;*0*;IHS-OKC/KJR;JULY 25, 1991
W !!?5,"<<< NOT AN ENTRY POINT - ACCESS DENIED >>>" G END
;--------------------------------------------------------------------
INIT ;PROCEDURE TO INITIALIZE TEMPORARY LOCAL VARIABLES
K ABPA("HD") S FRDT=+$E(BDT,4,5)_"/"_+$E(BDT,6,7)_"/"_+$E(BDT,2,3)
S TODT=+$E(EDT,4,5)_"/"_+$E(EDT,6,7)_"/"_+$E(EDT,2,3)
S ABPA("HD",4)="Claims submitted between "_FRDT_" and "_TODT
S (ABPAPG,GCNT,GTOT)=0,ZTNN=ZTSK,ZTSK=ZTN
D ^ABPAPRT I $D(A("PRINT",16))=1 W @(A("PRINT",16))
Q
;--------------------------------------------------------------------
GETDATA ;PROCEDURE TO GET COMPILED DATA FROM THE %ZTSK NODE
S P=0 F I=0:0 D Q:P=""
.S P=$O(^%ZTSK(ZTSK,"INSURER",P)) Q:P=""
.S R=0 F M=0:0 D Q:+R=0
..S R=$O(^%ZTSK(ZTSK,"INSURER",P,R)) Q:+R=0
..Q:$D(^%ZTSK(ZTSK,"AGING",R))'=10 S ABPA("HD",1)=P
..Q:+$D(^AUTNINS(R,0))'=1 S DATA=^(0)
..F J=2:1:5 S ABPA("I"_J)=$P(DATA,"^",J)
..I $D(^DIC(5,ABPA("I4"),0))=1 S ABPA("I4")=$P(^(0),"^",2)
..S ABPA("HD",2)=ABPA("I2"),ABPA("HD",3)=ABPA("I3")_", "_ABPA("I4")
..S ABPA("HD",3)=ABPA("HD",3)_" "_ABPA("I5")
..D ^ABPAACHD S (RR,ICNT,ITOT,NEW)=0 F J=0:0 D Q:RR=""
...S RR=$O(^%ZTSK(ZTSK,"AGING",R,RR))
...I RR="" D Q
....W !?77,"--------",?119,"---------",!?77,$J(ICNT,8)
....S GCNT=GCNT+ICNT W ?118,"$",$J(ITOT,9,2) I $Y>57 D ^ABPAACHD
...S NEW=1,RRR=0 F K=0:0 D Q:RRR=""
....S RRR=$O(^%ZTSK(ZTSK,"AGING",R,RR,RRR)) Q:RRR=""
....S RRRR=0 F L=0:0 D Q:+RRRR=0
.....S RRRR=$O(^%ZTSK(ZTSK,"AGING",R,RR,RRR,RRRR)) Q:+RRRR=0
.....S DATA=^%ZTSK(ZTSK,"AGING",R,RR,RRR,RRRR),ICNT=ICNT+1
.....S SSN=$P(DATA,"^"),PNO=$P(DATA,"^",2),DOS=$P(DATA,"^",3)
.....S DOS=+$E(DOS,4,5)_"/"_+$E(DOS,6,7)_"/"_+$E(DOS,2,3)
.....S FAC=$P(DATA,"^",4),AMT=$P(DATA,"^",5)
.....S ITOT=ITOT+AMT,GTOT=GTOT+AMT
.....I NEW W !!,RRR,?32,SSN,?45,$J(PNO,30) S NEW=0
.....W:$X>77 ! W ?77,$J(DOS,8),?87,FAC,?119,$J(AMT,9,2)
.....I $Y>57 D
......D ^ABPAACHD S RTMP=RRRR
......S RTMP=$O(^%ZTSK(ZTSK,"AGING",R,RR,RRR,RTMP)) I +RTMP>0 D
.......W !,RRR,?32,SSN,?45,$J(PNO,30)
K ABPA("HD"),ABPA("RTYP") S ABPA("HD",1)="OPEN ITEMS SUMMARY"
S ABPA("RTYP")="" D ^ABPAACHD S X=GTOT D COMMA^%DTC S GTOT=X
W !!!!! S X="Summary for "_$P(^DIC(4,DUZ(2),0),"^")_": "
S X=X_GCNT_" claims for $"_GTOT W ?(131-$L(X)),X
W @IOF I $D(A("PRINT",10))=1 W @(A("PRINT",10))
X ^%ZIS("C")
Q
;---------------------------------------------------------------------
END ;PROCEDURE TO KILL ALL TEMPORARY LOCAL VARIABLES
K X,Y,ABPA("HD"),I,J,ABPAPG,K,L,R,RR,RRR,RRRRDOS,AGE,AMT,ZTN,P
K ITOT,GTOT,OHRN,RTMP,FRDT,TODT,GCNT,ICNT
Q
;--------------------------------------------------------------------
MAIN ;ENTRY POINT - CALLED BY TASK MANAGER
D INIT,GETDATA,END
Q
ABPAAGE2 ;PRINT DETAILED OPEN ITEMS; [ 05/20/91 9:11 AM ]
+1 ;;1.4;AO PVT-INS TRACKING;*0*;IHS-OKC/KJR;JULY 25, 1991
+2 WRITE !!?5,"<<< NOT AN ENTRY POINT - ACCESS DENIED >>>"
GOTO END
+3 ;--------------------------------------------------------------------
INIT ;PROCEDURE TO INITIALIZE TEMPORARY LOCAL VARIABLES
+1 KILL ABPA("HD")
SET FRDT=+$EXTRACT(BDT,4,5)_"/"_+$EXTRACT(BDT,6,7)_"/"_+$EXTRACT(BDT,2,3)
+2 SET TODT=+$EXTRACT(EDT,4,5)_"/"_+$EXTRACT(EDT,6,7)_"/"_+$EXTRACT(EDT,2,3)
+3 SET ABPA("HD",4)="Claims submitted between "_FRDT_" and "_TODT
+4 SET (ABPAPG,GCNT,GTOT)=0
SET ZTNN=ZTSK
SET ZTSK=ZTN
+5 DO ^ABPAPRT
IF $DATA(A("PRINT",16))=1
WRITE @(A("PRINT",16))
+6 QUIT
+7 ;--------------------------------------------------------------------
GETDATA ;PROCEDURE TO GET COMPILED DATA FROM THE %ZTSK NODE
+1 SET P=0
FOR I=0:0
Begin DoDot:1
+2 SET P=$ORDER(^%ZTSK(ZTSK,"INSURER",P))
IF P=""
QUIT
+3 SET R=0
FOR M=0:0
Begin DoDot:2
+4 SET R=$ORDER(^%ZTSK(ZTSK,"INSURER",P,R))
IF +R=0
QUIT
+5 IF $DATA(^%ZTSK(ZTSK,"AGING",R))'=10
QUIT
SET ABPA("HD",1)=P
+6 IF +$DATA(^AUTNINS(R,0))'=1
QUIT
SET DATA=^(0)
+7 FOR J=2:1:5
SET ABPA("I"_J)=$PIECE(DATA,"^",J)
+8 IF $DATA(^DIC(5,ABPA("I4"),0))=1
SET ABPA("I4")=$PIECE(^(0),"^",2)
+9 SET ABPA("HD",2)=ABPA("I2")
SET ABPA("HD",3)=ABPA("I3")_", "_ABPA("I4")
+10 SET ABPA("HD",3)=ABPA("HD",3)_" "_ABPA("I5")
+11 DO ^ABPAACHD
SET (RR,ICNT,ITOT,NEW)=0
FOR J=0:0
Begin DoDot:3
+12 SET RR=$ORDER(^%ZTSK(ZTSK,"AGING",R,RR))
+13 IF RR=""
Begin DoDot:4
+14 WRITE !?77,"--------",?119,"---------",!?77,$JUSTIFY(ICNT,8)
+15 SET GCNT=GCNT+ICNT
WRITE ?118,"$",$JUSTIFY(ITOT,9,2)
IF $Y>57
DO ^ABPAACHD
End DoDot:4
QUIT
+16 SET NEW=1
SET RRR=0
FOR K=0:0
Begin DoDot:4
+17 SET RRR=$ORDER(^%ZTSK(ZTSK,"AGING",R,RR,RRR))
IF RRR=""
QUIT
+18 SET RRRR=0
FOR L=0:0
Begin DoDot:5
+19 SET RRRR=$ORDER(^%ZTSK(ZTSK,"AGING",R,RR,RRR,RRRR))
IF +RRRR=0
QUIT
+20 SET DATA=^%ZTSK(ZTSK,"AGING",R,RR,RRR,RRRR)
SET ICNT=ICNT+1
+21 SET SSN=$PIECE(DATA,"^")
SET PNO=$PIECE(DATA,"^",2)
SET DOS=$PIECE(DATA,"^",3)
+22 SET DOS=+$EXTRACT(DOS,4,5)_"/"_+$EXTRACT(DOS,6,7)_"/"_+$EXTRACT(DOS,2,3)
+23 SET FAC=$PIECE(DATA,"^",4)
SET AMT=$PIECE(DATA,"^",5)
+24 SET ITOT=ITOT+AMT
SET GTOT=GTOT+AMT
+25 IF NEW
WRITE !!,RRR,?32,SSN,?45,$JUSTIFY(PNO,30)
SET NEW=0
+26 IF $X>77
WRITE !
WRITE ?77,$JUSTIFY(DOS,8),?87,FAC,?119,$JUSTIFY(AMT,9,2)
+27 IF $Y>57
Begin DoDot:6
+28 DO ^ABPAACHD
SET RTMP=RRRR
+29 SET RTMP=$ORDER(^%ZTSK(ZTSK,"AGING",R,RR,RRR,RTMP))
IF +RTMP>0
Begin DoDot:7
+30 WRITE !,RRR,?32,SSN,?45,$JUSTIFY(PNO,30)
End DoDot:7
End DoDot:6
End DoDot:5
IF +RRRR=0
QUIT
End DoDot:4
IF RRR=""
QUIT
End DoDot:3
IF RR=""
QUIT
End DoDot:2
IF +R=0
QUIT
End DoDot:1
IF P=""
QUIT
+31 KILL ABPA("HD"),ABPA("RTYP")
SET ABPA("HD",1)="OPEN ITEMS SUMMARY"
+32 SET ABPA("RTYP")=""
DO ^ABPAACHD
SET X=GTOT
DO COMMA^%DTC
SET GTOT=X
+33 WRITE !!!!!
SET X="Summary for "_$PIECE(^DIC(4,DUZ(2),0),"^")_": "
+34 SET X=X_GCNT_" claims for $"_GTOT
WRITE ?(131-$LENGTH(X)),X
+35 WRITE @IOF
IF $DATA(A("PRINT",10))=1
WRITE @(A("PRINT",10))
+36 XECUTE ^%ZIS("C")
+37 QUIT
+38 ;---------------------------------------------------------------------
END ;PROCEDURE TO KILL ALL TEMPORARY LOCAL VARIABLES
+1 KILL X,Y,ABPA("HD"),I,J,ABPAPG,K,L,R,RR,RRR,RRRRDOS,AGE,AMT,ZTN,P
+2 KILL ITOT,GTOT,OHRN,RTMP,FRDT,TODT,GCNT,ICNT
+3 QUIT
+4 ;--------------------------------------------------------------------
MAIN ;ENTRY POINT - CALLED BY TASK MANAGER
+1 DO INIT
DO GETDATA
DO END
+2 QUIT