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

RCDPEAA4.m

Go to the documentation of this file.
  1. RCDPEAA4 ;AITC/CJE - AUTO POST AWAITING RESOLUTION (APAR) - LIST OF UNPOSTED EEOBS ;Jun 06, 2014@19:11:19
  1. ;;4.5;Accounts Receivable;**321**;;Build 48;Build 99
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. BLD(P1,P2,RCPROG) ;EP from RCDPEAA1
  1. ; Build,SORT and output the EEOB list to be displayed on APAR
  1. ; screen
  1. ; Input: P1 - "RCDPE_APAR_EEOB_PASS1"
  1. ; P2 - "RCDPE_APAR_EEOB_PASS2"
  1. ; RCPROG - "RCDPE-APAR_EEOB_WL"
  1. ; ^TMP($J,P1,ERAIEN) - Global array of all the ERA records that
  1. ; passed the filter criteria
  1. ; Output: ^TMP($J,P2,A1,A2) - B1^B2^B3^B4^B5^B6^B7^B8^B9
  1. ; See ERALINES for detail
  1. ; VALMCNT - Total number of lines in the listman body
  1. N AMTPST,AUTOPDT,BALANCE,ERAIEN,I34441,I344491,IENS,OSEQ,RCDA1,RCDT,RCPT,RCSEQ,RCT,REASON
  1. N TOTPOSTD,XX,YY
  1. S (RCT,TOTPOSTD,BALANCE,VALMCNT)=0
  1. S ERAIEN=0
  1. ;
  1. ; 2nd Pass get the data and sort the lines EEOB data lines to be displayed
  1. F D Q:'ERAIEN
  1. . S ERAIEN=$O(^TMP($J,P1,ERAIEN))
  1. . Q:'ERAIEN
  1. . S RCSEQ=0
  1. . F D Q:'RCSEQ
  1. . . S RCSEQ=$O(^RCY(344.49,ERAIEN,1,"B",RCSEQ))
  1. . . Q:'RCSEQ
  1. . . Q:RCSEQ#1'=0
  1. . . S RCDA1=+$O(^RCY(344.49,ERAIEN,1,"B",RCSEQ,0))
  1. . . Q:'RCDA1
  1. . . S I344491=RCDA1_","_ERAIEN_"," ; IENS for subfile 344.491
  1. . . S AMTPST=$$GET1^DIQ(344.491,I344491,.03,"I") ; Amount to post on Receipt
  1. . . Q:+AMTPST=0 ; Ignore zero value lines
  1. . . S OSEQ=$$GET1^DIQ(344.491,I344491,.09,"E") ; Original ERA sequence #s
  1. . . S I34441=+OSEQ_","_ERAIEN_"," ; IENS for subfile 344.41
  1. . . S RCPT=$$GET1^DIQ(344.41,I34441,.25,"I") ; Internal Receipt IEN (file 344)
  1. . . S REASON=$$GET1^DIQ(344.41,I34441,5) ; External Auto-Post Reject Reason
  1. . . ;
  1. . . ; If we have a receipt, add the Amount to Post to the total posted amount
  1. . . S:RCPT'="" TOTPOSTD=TOTPOSTD+AMTPST
  1. . . ;
  1. . . ; If we have don't have a receipt, calculate the unposted balance
  1. . . I RCPT="" D
  1. . . . S XX=$$GET1^DIQ(344.49,ERAIEN_",",.03,"I") ; Total Payment Received
  1. . . . S BALANCE=XX-TOTPOSTD
  1. . . ;
  1. . . ; Only display EEOBs that do not have a receipt and aren't marked for auto-post
  1. . . S YY=$$GET1^DIQ(344.41,I34441,6,"I") ; Mark for Auto-Post flag of the ERA detail ln
  1. . . I RCPT="",'YY D
  1. . . . S RCT=RCT+1
  1. . . . S XX=$$GET1^DIQ(344.4,ERAIEN_",",.01,"I") ; ERA Number
  1. . . . S $P(RCARRY(RCT),"^",1)=XX
  1. . . . S $P(RCARRY(RCT),"^",2)=+OSEQ ; Original ERA Detail Sequence Numbers
  1. . . . S XX=$$GET1^DIQ(344.491,I344491,.02,"E") ; Claim Number
  1. . . . S $P(RCARRY(RCT),"^",3)=XX
  1. . . . S $P(RCARRY(RCT),"^",4)=RCDA1 ; Internal IEN for subfile 344.491
  1. . . . S $P(RCARRY(RCT),"^",5)=REASON ; Reason on APAR
  1. . I $D(RCARRY) D
  1. . . S RCDT=$$GET1^DIQ(344.4,ERAIEN_",",.07,"I") ; ERA File Date/Time for sort
  1. . . S AUTOPDT=$$GET1^DIQ(344.4,ERAIEN_",",4.01,"I") ; Internal Auto-Post Date
  1. . . S XX=$$GET1^DIQ(344.4,ERAIEN_",",.03,"I") ; Payer ID
  1. . . S YY=$$GET1^DIQ(344.4,ERAIEN_",",.06,"I") ; Payer Name
  1. . . D ERALINES(ERAIEN,.RCARRY,BALANCE,TOTPOSTD,AUTOPDT,RCDT,XX,YY,P2)
  1. . . K RCARRY
  1. . S (BALANCE,TOTPOSTD)=0 ; Reset posted and unposted balances
  1. ;
  1. ; Final Pass - build the display lines and load the listman template
  1. D BOUT(P2,.VALMCNT)
  1. Q
  1. ;
  1. ERALINES(RCDA,RCARRY,BALANCE,TOTPOSTD,POSTDT,FILEDT,PAYID,PAYNM,P2) ; Build sorted list
  1. ; Input: RCDA - Top file ien for files 344.4 and 344.49
  1. ; RCARRY(CTR) - A1^A2^A3^A4 Where:
  1. ; A1 - ERA Number
  1. ; A2 - Original Sequence Numbers
  1. ; A3 - Claim Number
  1. ; A4 - Internal IEN for subfile 344.491
  1. ; A5 - Reason on APAR
  1. ; BALANCE - Amount that is left to be posted
  1. ; TOTPOSTD - Total amount posted thus far against the ERA
  1. ; POSTDT - Latest auto-posted date
  1. ; FILEDT - Date/Time the ERA was filed
  1. ; PAYID - Payer id
  1. ; PAYNM - Payer name
  1. ; P2 - "RCDPE_APAR_EEOB_PASS2"
  1. ; REASON - External Auto-Post Reject Reason
  1. ; Output: ^TMP($J,P2,A1,A2) = B1^B2^B3^B4^B5^B6^B7^B8^B9 Where:
  1. ; A1 - Uppercased value of the selected sort field
  1. ; A2 - Internal IEN of the ERA record
  1. ; B1 - Line Number
  1. ; B2 - ERA #.Sequence # (max 19 10+"."+8 characters)
  1. ; B3 - Claim # (max 15 characters)
  1. ; B4 - Posted Amount (max 15 characters)
  1. ; B5 - External Post Date (8 characters)
  1. ; B6 - Unposted Balance (max 15 characters)
  1. ; B7 - Payer Name/Payer ID (max 76 characters)
  1. ; B8 - Internal IEN for subfile 344.491
  1. ; B9 - Auto-Post Reject Reason
  1. ; B10 - Date ERA Filed
  1. N A1,DLINE,RCT,REASON,X,XX
  1. S RCT=""
  1. F D Q:RCT=""
  1. . S RCT=$O(RCARRY(RCT))
  1. . Q:RCT=""
  1. . S REASON=$P(RCARRY(RCT),"^",5)
  1. . S A1=$$SORTP(BALANCE,TOTPOSTD,PAYNM,REASON,FILEDT) ; Get Sort Value
  1. . I A1="" S A1=" " ; Set null sort value to space to avoid subscript error
  1. . S DLINE=RCT ; Line Number
  1. . S XX=$P(RCARRY(RCT),U,1)_"."_$P(RCARRY(RCT),U,2) ; ERA #.Sequence #
  1. . S $P(DLINE,"^",2)=XX
  1. . S $P(DLINE,"^",3)=$P(RCARRY(RCT),U,3) ; Claim #
  1. . S $P(DLINE,"^",4)=TOTPOSTD ; Posted Amount
  1. . S $P(DLINE,"^",5)=$$FMTE^XLFDT(POSTDT,"2ZD") ; External Post Date
  1. . S $P(DLINE,"^",6)=BALANCE ; Unposted Balance
  1. . S $P(DLINE,"^",7)=PAYNM_"/"_PAYID ; Payer Name/ID
  1. . S $P(DLINE,"^",8)=$P(RCARRY(RCT),"^",4) ; Internal IEN for subfile 344.491
  1. . S $P(DLINE,"^",9)=REASON ; Auto-Post Reject Reason
  1. . S $P(DLINE,"^",10)=$$FMTE^XLFDT($P(FILEDT,".",1),"2ZD") ; External Date ERA Filed
  1. . S ^TMP($J,P2,A1,RCDA,RCT)=DLINE
  1. Q
  1. ;
  1. BOUT(P2,VALMCNT) ; Build the display lines and load into the listman template
  1. ; Input: P2 - "RCDPE_APAR_EEOB_PASS2"
  1. ; ^TMP($J,P2,A1,A2) - B1^B2^B3^B4^B5^B6^B7^B8
  1. ; See ERALINES for detail
  1. ; Output: VALMCNT - Total # of body lines
  1. ; ^TMP("RCDPE-APAR_EEOB_WL",$J,VALMCNT,0) - Listman Body line
  1. ; ^TMP("RCDPE-APAR_EEOB_WL",$J,"IDX",VALMCNT,RCSEQ) - Line selection index
  1. ; ^TMP("RCDPE-APAR_EEOB_WLDX",$J,RCSEQ) - A1^A2^A3^...An Where
  1. ; A1 - Line selection #
  1. ; A2 - Internal IEN for 344.4
  1. ; A3 - Internal IEN for 344.491
  1. ; A4 - Unposted Balance
  1. ; A5 - Posted Amount
  1. N A1,BALANCE,COUNT,DLINE,ERAIEN,RCT,TOTPOSTDX,XX
  1. S A1="",COUNT=0
  1. F D Q:A1=""
  1. . S A1=$O(^TMP($J,P2,A1))
  1. . Q:A1=""
  1. . S ERAIEN=""
  1. . F D Q:ERAIEN=""
  1. . . S ERAIEN=$O(^TMP($J,P2,A1,ERAIEN))
  1. . . Q:ERAIEN=""
  1. . . S RCT=""
  1. . . F D Q:RCT=""
  1. . . . S RCT=$O(^TMP($J,P2,A1,ERAIEN,RCT))
  1. . . . Q:RCT=""
  1. . . . S XX=^TMP($J,P2,A1,ERAIEN,RCT)
  1. . . . S COUNT=COUNT+1 ; Selection #
  1. . . . S DLINE=$J(COUNT,3)
  1. . . . S DLINE=DLINE_$J("",7)_$$LJ^XLFSTR($P(XX,"^",2),17) ; ERA #.Sequence #
  1. . . . S DLINE=DLINE_$$LJ^XLFSTR($P(XX,"^",3),14) ; Claim #
  1. . . . S TOTPOSTD=$P(XX,"^",4)
  1. . . . S DLINE=DLINE_$J(TOTPOSTD,13,2)_" " ; Posted Amount
  1. . . . ; S DLINE=DLINE_$P(XX,"^",5)_" " ; Posted Date
  1. . . . S DLINE=DLINE_$P(XX,"^",10)_" " ; Date ERA filed
  1. . . . S BALANCE=$P(XX,"^",6)
  1. . . . S DLINE=DLINE_$J(BALANCE,13,2)_" " ; Unpaid Balance
  1. . . . ; S DLINE=DLINE_$P(XX,"^",10) ; Date ERA filed
  1. . . . S DLINE=DLINE_$P(XX,"^",5) ; Posted Date
  1. . . . ;
  1. . . . ; Line 1 of displayed EEOB item
  1. . . . D SET(DLINE,COUNT,ERAIEN,$P(XX,"^",8),BALANCE,TOTPOSTD,.VALMCNT)
  1. . . . ;
  1. . . . ; Line 2 of displayed EEOB item: payer name/payer id
  1. . . . S DLINE=$J("",5)_$$PAYTIN^RCDPRU2($P(XX,"^",7),75)
  1. . . . D SET(DLINE,COUNT,ERAIEN,$P(XX,"^",8),BALANCE,TOTPOSTD,.VALMCNT)
  1. . . . ;
  1. . . . ; Line 3 of displayed EEOB item: Auto-Post Reject Reason
  1. . . . S DLINE=$J("",5)_$P(XX,"^",9)
  1. . . . D SET(DLINE,COUNT,ERAIEN,$P(XX,"^",8),BALANCE,TOTPOSTD,.VALMCNT)
  1. Q
  1. ;
  1. SORTP(BALANCE,TOTPOSTD,PAYNM,REASON,FILEDT) ; Get the value for the selected sort
  1. ; Input: BALANCE - Unpaid Balance
  1. ; TOTPOSTD - Posted Amount
  1. ; POSTDT - Internal Posted Datge
  1. ; PAYNM - Payer Name
  1. ; REASON - External Auto-Post Reject Reason
  1. ; FILEDT - Internal Date/Time the ERA was filed
  1. ; ^TMP("RCDPE_APAR_EEOB_PARAMS",$J,"SORT")- Selected sort (P/D/A/T)
  1. ; Returns: External value for the selected sort type
  1. N VALUE,XX,YY
  1. S XX=^TMP("RCDPE_APAR_EEOB_PARAMS",$J,"SORT")
  1. S YY=$P(XX,"^",2),XX=$P(XX,"^",1)
  1. S YY=$S(YY="H":-1,1:1)
  1. I XX="N" Q $$UP^XLFSTR(PAYNM) ; Sort by Payer Name
  1. I XX="R" Q $$UP^XLFSTR(REASON) ; Sort by Auto-post Reject Reason
  1. I XX="D" Q FILEDT*YY ; Sort by Date/Time ERA filed
  1. I XX="U" Q BALANCE*YY ; Sort by Unposted Balance
  1. Q TOTPOSTD*YY ; Sort by Posted Amount
  1. ;
  1. SET(DLINE,RCSEQ,ERAIEN,RCDA1,BALANCE,TOTPOSTD,VALMCNT) ; Set ListManager arrays
  1. ; Input: DLINE - Line to be displayed in the listman body
  1. ; RCSEQ - Line Selection number
  1. ; ERAIEN - Internal IEN for 344.4 or 344.49
  1. ; RCDA1 - Inernal IEN for subfile 344.491
  1. ; BALANCE - Unposted Balance
  1. ; TOTPOSTD - Posted Amount
  1. ; VALMCNT - Current listman body line count
  1. ; Output: VALMCNT - Updated listman body line count
  1. ; ^TMP("RCDPE-APAR_EEOB_WL",$J,VALMCNT,0) - Listman Body line
  1. ; ^TMP("RCDPE-APAR_EEOB_WL",$J,"IDX",VALMCNT,RCSEQ) - Line selection index
  1. ; ^TMP("RCDPE-APAR_EEOB_WLDX",$J,RCSEQ) - A1^A2^A3^...An Where
  1. ; A1 - Line selection #
  1. ; A2 - Internal IEN for 344.4
  1. ; A3 - Internal IEN for 344.491
  1. ; A4 - Unposted Balance
  1. ; A5 - Posted Amount
  1. S VALMCNT=VALMCNT+1
  1. S ^TMP("RCDPE-APAR_EEOB_WL",$J,VALMCNT,0)=DLINE
  1. S ^TMP("RCDPE-APAR_EEOB_WL",$J,"IDX",VALMCNT,RCSEQ)=ERAIEN
  1. S ^TMP("RCDPE-APAR_EEOB_WLDX",$J,RCSEQ)=VALMCNT_U_ERAIEN_U_RCDA1_U_$G(BALANCE)_U_$G(TOTPOSTD)
  1. Q
  1. ;