VistA-WorldVistAEHR/r/ACCOUNTS_RECEIVABLE-PRCA-PR.../RCRCBL1.m

62 lines
2.3 KiB
Mathematica

RCRCBL1 ;ALB/CMS - EOB PROCESSING LIST BUILD ; 09/02/97
V ;;4.5;Accounts Receivable;**63,159**;Mar 20, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
BLDL ; build active list for EOB processing list
; Returns: TMP("RCRCBL", TMP("RCRCBLBX" and VALMCNT
;
K ^TMP("RCRCBL",$J,"B")
;
N CNT,PRCABN,PRCATN,RCCNT,RCY
S (RCCNT,CNT,PRCABN,PRCATN)=0
F S PRCABN=$O(^PRCA(433,"AEOB",PRCABN)) Q:'PRCABN D
.I +$G(RCDIV(0)),'$$DIV^RCRCDIV(PRCABN) Q
.S PRCATN=0 F S PRCATN=$O(^PRCA(433,"AEOB",PRCABN,PRCATN)) Q:'PRCATN D
..S RCCNT=$G(RCCNT)+1
..D SCRN(PRCATN,RCCNT,PRCABN)
..QUIT
;
;Add findings to list sorted by Pt. Name then Activation date
D RESL
;
BLDLQ K RCSTN,RCSI,RCSIF,RCSIL,RCRCI Q
;
SCRN(PRCATN,RCCNT,PRCABN) ;
; add bill to screen list "B" sort (must Re Sequence List after)
; Send: PRCATN,RCCNT,PRCABN
I '$G(^PRCA(433,+$G(PRCATN),0)) G SCRNQ
N PRCA,RCY,RCBN0,RCTN0,RCTN1,X,Y S X=""
S RCTN0=$G(^PRCA(433,+PRCATN,0))
S RCTN1=$G(^PRCA(433,+PRCATN,1))
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=+$P(RCTN0,U,1),X=$$SETFLD^VALM1(RCY,X,"TRAN")
S RCY=$G(PRCA("DEBTNM")),X=$$SETFLD^VALM1(RCY,X,"DEBTOR")
S RCY=$$DATE(+$P(RCTN1,U,9)),X=$$SETFLD^VALM1(RCY,X,"DATE")
S RCY=+$P(RCTN1,U,5),X=$$SETFLD^VALM1($J(+RCY,9,2),X,"AMOUNT")
S ^TMP("RCRCBL",$J,"B",$G(PRCA("DEBTNM"),"UNK"),$P($G(^DPT(+$P(RCBN0,U,7),0),"UNK"),U,1),+PRCATN)=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 PRCATN,RCDBT,RCPT,X,Y
I '$D(^TMP("RCRCBL",$J,"B")) G RESLQ
S VALMCNT=0
S RCDBT="" F S RCDBT=$O(^TMP("RCRCBL",$J,"B",RCDBT)) Q:RCDBT="" S RCPT="" F S RCPT=$O(^TMP("RCRCBL",$J,"B",RCDBT,RCPT)) Q:RCPT="" D
.S PRCATN=0 F S PRCATN=$O(^TMP("RCRCBL",$J,"B",RCDBT,RCPT,PRCATN)) Q:'PRCATN D
..S VALMCNT=VALMCNT+1
..S X=^TMP("RCRCBL",$J,"B",RCDBT,RCPT,PRCATN)
..S RCY=VALMCNT,X=$$SETFLD^VALM1(RCY,X,"NUMBER")
..S ^TMP("RCRCBL",$J,VALMCNT,0)=X
..S ^TMP("RCRCBL",$J,"IDX",VALMCNT,VALMCNT)=""
..S ^TMP("RCRCBLX",$J,VALMCNT)=VALMCNT_U_PRCATN
..D FLDCTRL^VALM10(VALMCNT)
RESLQ Q
;RCRCBL1