RCRCAL1 ;ALB/CMS - TP REFERRAL ACTION LIST BUILD ; 09/02/97
V ;;4.5;Accounts Receivable;**63**;Mar 20, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
BLDL ; build active list for third party referral action list
; Send: RCSBN or RCS* sort variables in RCRCALB
; Returns: TMP("RCRCAL", TMP("RCRCALPT", TMP("RCRCALBX and VALMCNT
;
K ^TMP("RCRCAL",$J,"B")
I '$O(RCSBN(0)) D BLDL^RCRCAL2
;
N CNT,PRCABN,RCCNT,RCY
S (RCCNT,CNT,PRCABN)=0
F S PRCABN=$O(RCSBN(PRCABN)) Q:'PRCABN D
.S CNT=RCSBN(PRCABN)
.S RCCNT=$G(RCCNT)+1
.D SCRN(PRCABN,RCCNT)
.QUIT
;
;Add findings to list sorted by Pt. Name then Activation date
D RESL
;
BLDLQ K RCSBN,RCSI,RCSIF,RCSIL,RCRCI Q
;
SCRN(PRCABN,RCCNT) ;
; add bill to screen list "B" sort (must Re Sequence List after)
; Send: PRCABN,RCCNT
I '$G(^PRCA(430,+$G(PRCABN),0)) G SCRNQ
N PRCA,RCY,RCBN0,X,Y S X=""
S RCBN0=$G(^PRCA(430,+PRCABN,0))
D BNVAR^RCRCUTL(PRCABN),DEBT^RCRCUTL(PRCABN)
S RCY=$G(RCCNT),X=$$SETFLD^VALM1(RCY,X,"NUMBER")
S RCY=$P($G(^DPT(+$P(RCBN0,U,7),0),"UNK"),U,1),X=$$SETFLD^VALM1(RCY,X,"PATIENT")
S RCY=$P($P(RCBN0,U,1),"-",2),X=$$SETFLD^VALM1(RCY,X,"BILL")
S RCY=$S($$REFST^RCRCUTL(PRCABN):"r",$$RETN^RCRCUTL(PRCABN):"x",1:""),X=$$SETFLD^VALM1(RCY,X,"REFER")
S RCY=$S($$HD^RCRCUIB(PRCABN):"*",1:""),X=$$SETFLD^VALM1(RCY,X,"CATCHOLD")
S RCY=$P($G(PRCA("CAT")),U,3),X=$$SETFLD^VALM1(RCY,X,"CAT")
S RCY=$S($$MINS^RCRCUIB(PRCABN):"+",1:""),X=$$SETFLD^VALM1(RCY,X,"MULTIIN")
S RCY=$G(PRCA("DEBTNM")),X=$$SETFLD^VALM1(RCY,X,"DEBTOR")
S RCY=$$DATE($P(RCBN0,U,10)),X=$$SETFLD^VALM1(RCY,X,"DATE")
S RCY=$$BILL^RCJIBFN2(PRCABN)
S X=$$SETFLD^VALM1($J(+$P(RCY,U,1),9,2),X,"ORIGAMT")
S X=$$SETFLD^VALM1($J(+$P(RCY,U,3),10,2),X,"CURAMT")
S ^TMP("RCRCAL",$J,"B",$P($G(^DPT(+$P(RCBN0,U,7),0),"UNK"),U,1),+PRCABN)=X
SCRNQ Q
;
DATE(X) ; date in external format
N Y S Y="" I X?7N.E S Y=$$FMTE^XLFDT(X,"5ZD")
Q Y
;
RESL ;Build or Rebuild and sequence List with added or subtracted bill
N PRCABN,RCPT,X,Y
I '$D(^TMP("RCRCAL",$J,"B")) G RESLQ
S VALMCNT=0
S RCPT="" F S RCPT=$O(^TMP("RCRCAL",$J,"B",RCPT)) Q:RCPT="" D
.S PRCABN=0 F S PRCABN=$O(^TMP("RCRCAL",$J,"B",RCPT,PRCABN)) Q:'PRCABN D
..S VALMCNT=VALMCNT+1
..S X=^TMP("RCRCAL",$J,"B",RCPT,PRCABN)
..S RCY=VALMCNT,X=$$SETFLD^VALM1(RCY,X,"NUMBER")
..S ^TMP("RCRCAL",$J,VALMCNT,0)=X
..S ^TMP("RCRCAL",$J,"IDX",VALMCNT,VALMCNT)=""
..S ^TMP("RCRCALX",$J,VALMCNT)=VALMCNT_U_PRCABN
..S ^TMP("RCRCALPT",$J,VALMCNT)=+$P(^PRCA(430,PRCABN,0),U,7)
..D FLDCTRL^VALM10(VALMCNT)
RESLQ Q
;RCRCAL1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCRCAL1 2615 printed Dec 13, 2024@01:47:28 Page 2
RCRCAL1 ;ALB/CMS - TP REFERRAL ACTION LIST BUILD ; 09/02/97
V ;;4.5;Accounts Receivable;**63**;Mar 20, 1995
+1 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+2 ;
BLDL ; build active list for third party referral action list
+1 ; Send: RCSBN or RCS* sort variables in RCRCALB
+2 ; Returns: TMP("RCRCAL", TMP("RCRCALPT", TMP("RCRCALBX and VALMCNT
+3 ;
+4 KILL ^TMP("RCRCAL",$JOB,"B")
+5 IF '$ORDER(RCSBN(0))
DO BLDL^RCRCAL2
+6 ;
+7 NEW CNT,PRCABN,RCCNT,RCY
+8 SET (RCCNT,CNT,PRCABN)=0
+9 FOR
SET PRCABN=$ORDER(RCSBN(PRCABN))
if 'PRCABN
QUIT
Begin DoDot:1
+10 SET CNT=RCSBN(PRCABN)
+11 SET RCCNT=$GET(RCCNT)+1
+12 DO SCRN(PRCABN,RCCNT)
+13 QUIT
End DoDot:1
+14 ;
+15 ;Add findings to list sorted by Pt. Name then Activation date
+16 DO RESL
+17 ;
BLDLQ KILL RCSBN,RCSI,RCSIF,RCSIL,RCRCI
QUIT
+1 ;
SCRN(PRCABN,RCCNT) ;
+1 ; add bill to screen list "B" sort (must Re Sequence List after)
+2 ; Send: PRCABN,RCCNT
+3 IF '$GET(^PRCA(430,+$GET(PRCABN),0))
GOTO SCRNQ
+4 NEW PRCA,RCY,RCBN0,X,Y
SET X=""
+5 SET RCBN0=$GET(^PRCA(430,+PRCABN,0))
+6 DO BNVAR^RCRCUTL(PRCABN)
DO DEBT^RCRCUTL(PRCABN)
+7 SET RCY=$GET(RCCNT)
SET X=$$SETFLD^VALM1(RCY,X,"NUMBER")
+8 SET RCY=$PIECE($GET(^DPT(+$PIECE(RCBN0,U,7),0),"UNK"),U,1)
SET X=$$SETFLD^VALM1(RCY,X,"PATIENT")
+9 SET RCY=$PIECE($PIECE(RCBN0,U,1),"-",2)
SET X=$$SETFLD^VALM1(RCY,X,"BILL")
+10 SET RCY=$SELECT($$REFST^RCRCUTL(PRCABN):"r",$$RETN^RCRCUTL(PRCABN):"x",1:"")
SET X=$$SETFLD^VALM1(RCY,X,"REFER")
+11 SET RCY=$SELECT($$HD^RCRCUIB(PRCABN):"*",1:"")
SET X=$$SETFLD^VALM1(RCY,X,"CATCHOLD")
+12 SET RCY=$PIECE($GET(PRCA("CAT")),U,3)
SET X=$$SETFLD^VALM1(RCY,X,"CAT")
+13 SET RCY=$SELECT($$MINS^RCRCUIB(PRCABN):"+",1:"")
SET X=$$SETFLD^VALM1(RCY,X,"MULTIIN")
+14 SET RCY=$GET(PRCA("DEBTNM"))
SET X=$$SETFLD^VALM1(RCY,X,"DEBTOR")
+15 SET RCY=$$DATE($PIECE(RCBN0,U,10))
SET X=$$SETFLD^VALM1(RCY,X,"DATE")
+16 SET RCY=$$BILL^RCJIBFN2(PRCABN)
+17 SET X=$$SETFLD^VALM1($JUSTIFY(+$PIECE(RCY,U,1),9,2),X,"ORIGAMT")
+18 SET X=$$SETFLD^VALM1($JUSTIFY(+$PIECE(RCY,U,3),10,2),X,"CURAMT")
+19 SET ^TMP("RCRCAL",$JOB,"B",$PIECE($GET(^DPT(+$PIECE(RCBN0,U,7),0),"UNK"),U,1),+PRCABN)=X
SCRNQ QUIT
+1 ;
DATE(X) ; date in external format
+1 NEW Y
SET Y=""
IF X?7N.E
SET Y=$$FMTE^XLFDT(X,"5ZD")
+2 QUIT Y
+3 ;
RESL ;Build or Rebuild and sequence List with added or subtracted bill
+1 NEW PRCABN,RCPT,X,Y
+2 IF '$DATA(^TMP("RCRCAL",$JOB,"B"))
GOTO RESLQ
+3 SET VALMCNT=0
+4 SET RCPT=""
FOR
SET RCPT=$ORDER(^TMP("RCRCAL",$JOB,"B",RCPT))
if RCPT=""
QUIT
Begin DoDot:1
+5 SET PRCABN=0
FOR
SET PRCABN=$ORDER(^TMP("RCRCAL",$JOB,"B",RCPT,PRCABN))
if 'PRCABN
QUIT
Begin DoDot:2
+6 SET VALMCNT=VALMCNT+1
+7 SET X=^TMP("RCRCAL",$JOB,"B",RCPT,PRCABN)
+8 SET RCY=VALMCNT
SET X=$$SETFLD^VALM1(RCY,X,"NUMBER")
+9 SET ^TMP("RCRCAL",$JOB,VALMCNT,0)=X
+10 SET ^TMP("RCRCAL",$JOB,"IDX",VALMCNT,VALMCNT)=""
+11 SET ^TMP("RCRCALX",$JOB,VALMCNT)=VALMCNT_U_PRCABN
+12 SET ^TMP("RCRCALPT",$JOB,VALMCNT)=+$PIECE(^PRCA(430,PRCABN,0),U,7)
+13 DO FLDCTRL^VALM10(VALMCNT)
End DoDot:2
End DoDot:1
RESLQ QUIT
+1 ;RCRCAL1