RCRCAL2 ;ALB/CMS - RC ACTION BILL LIST SORT BUILD ; 16-JUN-00
V ;;4.5;Accounts Receivable;**63,159**;MAR 20, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
Q
BLDL ; - find data required for the report
N DFN,PRCABN,PRCABN0,RCAGE,RCAMT,RCCNT,RCCUR,RCRDT,RCY
I $O(RCSPT(0)) D BLDPT G BLDLQ Q
S (RCCNT,RCRDT)=0 W !,"Searching Referred Bills for match "
F S RCRDT=$O(^PRCA(430,"AD",RCRDT)) Q:'RCRDT D
.S PRCABN=0 F S PRCABN=$O(^PRCA(430,"AD",RCRDT,PRCABN)) Q:'PRCABN D GET
BLDLQ K RCSBN,RCCAT,RCCNT,RCSI,RCSIA,RCSIF,RCSPT,RCSIL
Q
;
BLDPT ;If pt. selection use E cross-ref
N DFN,PRCABN S (RCCNT,DFN)=0
W !,"Searching TP bills for match "
F S DFN=$O(RCSPT(DFN)) Q:'DFN S PRCABN=0 D
.F S PRCABN=$O(^PRCA(430,"E",DFN,PRCABN)) Q:'PRCABN D GET
Q
;
GET ;
S PRCABN0=$G(^PRCA(430,PRCABN,0))
; - check status must be active
I $P(PRCABN0,U,8)'=16 Q
; - check referral category
S RCCAT="" D RCCAT^RCRCUTL(.RCCAT)
I '$D(RCCAT(+$P(PRCABN0,U,2))) Q
; - check division
I +$G(RCDIV(0)),'$$DIV^RCRCDIV(PRCABN) Q
; - check debtor insurance carrier
I $D(RCSI),'$$INS Q
S RCCNT=$G(RCCNT)+1 W "."
D SCRN^RCRCAL1(PRCABN)
Q
;
INS() ; Get the Insurance company and check to include
;
N PRCA,RCIN
I $G(RCSIA)="ALL" S Y=1 G INSQ
I $G(RCSIA)="NULL",$P(PRCABN0,U,9)="" S Y=1 G INSQ
I $G(RCSIA)="NULL",+$P(PRCABN0,U,9) S Y=0 G INSQ
I $O(RCSI(0)),$D(RCSI(+$P(PRCABN0,U,9))) S Y=1 G INSQ
I $O(RCSI(0)),'$D(RCSI(+$P(PRCABN0,U,9))) S Y=0 G INSQ
D DEBT^RCRCUTL(PRCABN)
I $G(PRCA("DEBTNM"))="",$G(RCSIF)='"@" S Y=0 G INSQ
I PRCA("DEBTNM")]$G(RCSIL) S Y=0 G INSQ
I $G(RCSIF)="" S Y=1 G INSQ
I $G(RCSIF)]PRCA("DEBTNM") S Y=0 G INSQ
S Y=1
INSQ Q Y
;RCRCAL2
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCRCAL2 1745 printed Dec 13, 2024@01:47:29 Page 2
RCRCAL2 ;ALB/CMS - RC ACTION BILL LIST SORT BUILD ; 16-JUN-00
V ;;4.5;Accounts Receivable;**63,159**;MAR 20, 1995
+1 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+2 QUIT
BLDL ; - find data required for the report
+1 NEW DFN,PRCABN,PRCABN0,RCAGE,RCAMT,RCCNT,RCCUR,RCRDT,RCY
+2 IF $ORDER(RCSPT(0))
DO BLDPT
GOTO BLDLQ
QUIT
+3 SET (RCCNT,RCRDT)=0
WRITE !,"Searching Referred Bills for match "
+4 FOR
SET RCRDT=$ORDER(^PRCA(430,"AD",RCRDT))
if 'RCRDT
QUIT
Begin DoDot:1
+5 SET PRCABN=0
FOR
SET PRCABN=$ORDER(^PRCA(430,"AD",RCRDT,PRCABN))
if 'PRCABN
QUIT
DO GET
End DoDot:1
BLDLQ KILL RCSBN,RCCAT,RCCNT,RCSI,RCSIA,RCSIF,RCSPT,RCSIL
+1 QUIT
+2 ;
BLDPT ;If pt. selection use E cross-ref
+1 NEW DFN,PRCABN
SET (RCCNT,DFN)=0
+2 WRITE !,"Searching TP bills for match "
+3 FOR
SET DFN=$ORDER(RCSPT(DFN))
if 'DFN
QUIT
SET PRCABN=0
Begin DoDot:1
+4 FOR
SET PRCABN=$ORDER(^PRCA(430,"E",DFN,PRCABN))
if 'PRCABN
QUIT
DO GET
End DoDot:1
+5 QUIT
+6 ;
GET ;
+1 SET PRCABN0=$GET(^PRCA(430,PRCABN,0))
+2 ; - check status must be active
+3 IF $PIECE(PRCABN0,U,8)'=16
QUIT
+4 ; - check referral category
+5 SET RCCAT=""
DO RCCAT^RCRCUTL(.RCCAT)
+6 IF '$DATA(RCCAT(+$PIECE(PRCABN0,U,2)))
QUIT
+7 ; - check division
+8 IF +$GET(RCDIV(0))
IF '$$DIV^RCRCDIV(PRCABN)
QUIT
+9 ; - check debtor insurance carrier
+10 IF $DATA(RCSI)
IF '$$INS
QUIT
+11 SET RCCNT=$GET(RCCNT)+1
WRITE "."
+12 DO SCRN^RCRCAL1(PRCABN)
+13 QUIT
+14 ;
INS() ; Get the Insurance company and check to include
+1 ;
+2 NEW PRCA,RCIN
+3 IF $GET(RCSIA)="ALL"
SET Y=1
GOTO INSQ
+4 IF $GET(RCSIA)="NULL"
IF $PIECE(PRCABN0,U,9)=""
SET Y=1
GOTO INSQ
+5 IF $GET(RCSIA)="NULL"
IF +$PIECE(PRCABN0,U,9)
SET Y=0
GOTO INSQ
+6 IF $ORDER(RCSI(0))
IF $DATA(RCSI(+$PIECE(PRCABN0,U,9)))
SET Y=1
GOTO INSQ
+7 IF $ORDER(RCSI(0))
IF '$DATA(RCSI(+$PIECE(PRCABN0,U,9)))
SET Y=0
GOTO INSQ
+8 DO DEBT^RCRCUTL(PRCABN)
+9 IF $GET(PRCA("DEBTNM"))=""
IF $GET(RCSIF)='"@"
SET Y=0
GOTO INSQ
+10 IF PRCA("DEBTNM")]$GET(RCSIL)
SET Y=0
GOTO INSQ
+11 IF $GET(RCSIF)=""
SET Y=1
GOTO INSQ
+12 IF $GET(RCSIF)]PRCA("DEBTNM")
SET Y=0
GOTO INSQ
+13 SET Y=1
INSQ QUIT Y
+1 ;RCRCAL2