RCDPEMA1 ;EDE/FA - LIST ALL AUTO-POSTED RECEIPTS REPORT ;Nov 17, 2016
;;4.5;Accounts Receivable;**332,432**;Mar 20, 1995;Build 16
;Per VA Directive 6402, this routine should not be modified.
;
Q ; no direct entry
;
RPTOUT(INPUT) ;EP from RCDPEMAP
; Output the report to paper/screen, listman or excel
; Input: INPUT - See REPORT^RCDPEMAP for a complete description
; ^TMP($J,A1,"SEL",A2)=External Auto-Post Date
; ^TMP($J,A1,"SEL",A3)=External lower cased sort value (Payer or User)
; ^TMP($J,A1,"SEL",A2,A3,A4,A5)=B1^B2^B3^B4^B5 - if record passed filters Where:
; A1 - "RCDPE_MAP"
; A2 - Internal Auto-Post Date (primary sort)
; A3 - Secondary Sort Value (Payer or User Name)
; A4 - IEN for file 344.4
; A5 - IEN for file 344.41
; B1 - Payer Name
; B2 - User Name
; B3 - ERA #
; B4 - Claim #
; B5 - Trace #
; Output: ^TMP("RCDPE_MAP",$J,CTR)=Line - Array of display lines (no headers)
; for output to Listman
; Only set when A7-1
;
N A1,ADATE,DATA,EXCEL,FIRST,LNCNT,LSTMAN,OUTYPE,PAGE,PAYER,SORT,STOP,SVAL
S (LNCNT,PAGE)=0 ; Initialize Line/Page counters
S $P(INPUT,"^",9)=0 ; Line Counter for Listman output
S SORT=$P(INPUT,"^",6) ; Secondary Sort by Payer or User?
S EXCEL=$P(INPUT,"^",8) ; Output to Excel?
S LSTMAN=$P(INPUT,"^",7) ; Output to Listman?
S OUTYPE=$S(EXCEL:2,LSTMAN:1,1:0)
S DATA=0,FIRST=1
I OUTYPE=2 D ; Excel Ouput - Print header line
. S XX="Auto-Post Date^"
. S XX=XX_$S(SORT=2:"Payer",1:"User")_"^"
. S XX=XX_$S(SORT=2:"User",1:"Payer")_"^"
. S XX=XX_"ERA #^Claim #^Trace #"
. W !,XX
. ;
S A1="RCDPE_MAP",STOP=0
S ADATE=""
F D Q:ADATE="" Q:STOP
. S ADATE=$O(^TMP($J,A1,"SEL",ADATE))
. Q:ADATE=""
. I OUTYPE=1 D ; Listman Output
. . S XX=$P(INPUT,"^",9),XX=XX+1
. . I FIRST D ;
. . . S FIRST=0
. . E D ;
. . . S ^TMP(A1,$J,XX)="",XX=XX+1
. . S ^TMP(A1,$J,XX)="Auto-Post Date: "_^TMP($J,A1,"SEL",ADATE)
. . S $P(INPUT,"^",9)=XX
. ;
. I 'OUTYPE D Q:STOP ; Output to Screen/Paper
. . I FIRST D Q ; Initial Page Header
. . . S FIRST=0
. . . D PHEADER(INPUT,.LNCNT,.PAGE)
. . . W !,"Auto-Post Date: "_^TMP($J,A1,"SEL",ADATE)
. . . S LNCNT=LNCNT+1
. . I (LNCNT+6)>IOSL D Q:STOP ; Page break
. . . S STOP=$$ASKSTOP^RCDPEMAP()
. . . Q:STOP
. . . D PHEADER(INPUT,.LNCNT,.PAGE) ; Page Header
. . I LNCNT>7 W ! S LNCNT=LNCNT+1
. . W !,"Auto-Post Date: "_^TMP($J,A1,"SEL",ADATE)
. . S LNCNT=LNCNT+1
. D RPT2(.INPUT,A1,ADATE,SORT,OUTYPE,.LNCNT,.STOP,.DATA)
I 'DATA,'EXCEL,'LSTMAN D
. D PHEADER(INPUT,.LNCNT,.PAGE)
I 'EXCEL D
. S XX=$$ENDORPRT^RCDPEARL
. I OUTYPE=1 D Q
. . S YY=$P(INPUT,"^",9)+1
. . S $P(INPUT,"^",9)=YY
. . S ^TMP(A1,$J,YY)=XX
. W !,XX
I (OUTYPE'=1),'STOP,$$ASKSTOP^RCDPEMAP()
Q
;
RPT2(INPUT,A1,ADATE,SORT,OUTYPE,LNCNT,STOP,DATA) ; Report Output Continued
; Input: INPUT - See REPORT^RCDPEMAP for detail
; ADATE - Internal Auto-Post Date
; SORT - 2 - Sort by User, 1 - Sort by Payer
; OUTYPE - 2 - Excel, 1 - Listman, 0 - Paper/Screen
; LNCNT - Current line count (only if OUTYPE=0)
; ^TMP($J,A1,"SEL",...) - See RPTOUT for details
; Output: LNCNT - Updated line count (only if OUTYPE=0)
; STOP - 1 if user quit out (only if OUTYPE=0)
; INPUT - 9th '^' piece update with current line # is OUTYPE=1
; DATA - 1 if at least one line of data is fount
; ^TMP("RCDPE_MAP",$J,CTR) - Output lines for Listman (only if OUTYPE=1)
N CURS,SVAL,LASTS,XX
S SVAL="",XX=$O(^TMP($J,A1,"SEL",ADATE,""))
S LASTS=^TMP($J,A1,"SEL",ADATE,XX)
F D Q:SVAL="" Q:STOP
. S SVAL=$O(^TMP($J,A1,"SEL",ADATE,SVAL))
. Q:SVAL=""
. S CURS=^TMP($J,A1,"SEL",ADATE,SVAL) ; Current lower case Payer or User Name
. I OUTYPE=1 D ; Listman output
. . S XX=$P(INPUT,"^",9)
. . I CURS'=LASTS D
. . . S XX=XX+1,^TMP(A1,$J,XX)=""
. . S XX=XX+1,^TMP(A1,$J,XX)=" "_$S(SORT=2:"Payer: ",1:"User: ")_CURS
. . S $P(INPUT,"^",9)=XX
. ;
. I 'OUTYPE D Q:STOP ; Output to Paper/Screen
. . I (LNCNT+4)>IOSL D Q:STOP ; Page break
. . . S STOP=$$ASKSTOP^RCDPEMAP()
. . . Q:STOP
. . . D PHEADER(INPUT,.LNCNT,.PAGE) ; Print Page Header
. . . W !,"Auto-Post Date: "_^TMP($J,A1,"SEL",ADATE)
. . . ; W !,CURS
. . . S LNCNT=LNCNT+3
. . I CURS'=LASTS D
. . . S LNCNT=LNCNT+1,LASTS=CURS
. . . W !
. . W !," ",$S(SORT=2:"Payer: ",1:"User: "),CURS
. . S LNCNT=LNCNT+1
. D RPT3(.INPUT,A1,ADATE,SORT,SVAL,OUTYPE,.LNCNT,.STOP,.DATA)
Q
;
RPT3(INPUT,A1,ADATE,SORT,SVAL,OUTYPE,LNCNT,STOP,DATA) ; Report Output Continued
; Input: INPUT - See REPORT^RCDPEMAP for detail
; ADATE - Internal Auto-Post Date
; SORT - 1 - Sort by User, 2 - Sort by Payer
; SVAL - Current sort value (Upper cased Payer or User Name)
; OUTYPE - 2 - Excel, 1 - Listman, 0 - Paper/Screen
; LNCNT - Current line count (only if OUTYPE=0)
; ^TMP($J,A1,"SEL",...2) - See RPTOUT for details
; Output: LNCNT - Updated line count (only if OUTYPE=0)
; STOP - 1 if user quit out (only if OUTYPE=0)
; INPUT - 9th '^' piece update with current line # is OUTYPE=1
; DATA - 1 if at least one line of data is found
; ^TMP("RCDPE_MAP",$J,CTR) - Output lines for Listman (only if OUTYPE=1)
N DATAR,FIRSTS,IEN3444,IEN34441,LN1,LN2,LN3,UORP,UORPF,UORPL,XX,YY
S IEN3444="",FIRSTS=1,UORPF=1
F D Q:IEN3444="" Q:STOP
. S IEN3444=$O(^TMP($J,A1,"SEL",ADATE,SVAL,IEN3444))
. Q:IEN3444=""
. S IEN34441=""
. S XX=$O(^TMP($J,A1,"SEL",ADATE,SVAL,IEN3444,""))
. S XX=^TMP($J,A1,"SEL",ADATE,SVAL,IEN3444,XX)
. S UORPL=$P(XX,"^",SORT)
. F D Q:IEN34441=""
. . S IEN34441=$O(^TMP($J,A1,"SEL",ADATE,SVAL,IEN3444,IEN34441))
. . Q:IEN34441=""
. . S DATA=1 ; found data
. . ;
. . S DATAR=^TMP($J,A1,"SEL",ADATE,SVAL,IEN3444,IEN34441)
. . S:SORT=2 LN1=" Payer: "_$P(DATAR,"^",1),LN2=" User: "_$P(DATAR,"^",2)
. . S:SORT=1 LN1=" User: "_$P(DATAR,"^",2),LN2=" Payer: "_$P(DATAR,"^",1)
. . S LN3=$P(DATAR,"^",3) ; ERA #
. . S YY=$P(DATAR,"^",4) ; Claim #
. . S LN3=$$SETSTR^VALM1(YY,LN3,13,10)
. . S YY=$P(DATAR,"^",5) ; Trace #
. . S LN3=$$SETSTR^VALM1(YY,LN3,25,50)
. . S UORP=$P(DATAR,"^",SORT)
. . I OUTYPE=2 D Q ; Excel Output
. . . S XX=^TMP($J,A1,"SEL",ADATE)_"^"
. . . I SORT=1 D
. . . . S XX=XX_$P(DATAR,"^",2)_"^"_$P(DATAR,"^",1)
. . . E D
. . . . S XX=XX_$P(DATAR,"^",1,2)
. . . S XX=XX_"^"_$P(DATAR,"^",3,5)
. . . W !,XX
. . ;
. . ; Listman output
. . I OUTYPE=1 D RPT3LM(A1,.INPUT,.FIRSTS,.UORP,.UORPL,.UORPF,LN2,LN3) Q
. . ;
. . ; Output to Paper/Screen - check if we need a page break
. . I (LNCNT+2)>IOSL D Q:STOP
. . . S STOP=$$ASKSTOP^RCDPEMAP()
. . . Q:STOP
. . . D PHEADER(INPUT,.LNCNT,.PAGE)
. . . W !,"Auto-Post Date: "_^TMP($J,A1,"SEL",ADATE)
. . . S LNCNT=LNCNT+1
. . . W !,LN1
. . . S LNCNT=LNCNT+1
. . . W !,LN2
. . . S LNCNT=LNCNT+1
. . I UORP'=UORPL D
. . . S UORPL=UORP,LNCNT=LNCT+2,UORPF=0
. . . I LNCNT>7 W ! S LNCNT=LNCNT+1
. . . W !,LN2 S LNCNT=LNCNT+1
. . I UORPF D
. . . S LNCNT=LNCNT+1,UORPF=0
. . . W !,LN2 S LNCNT=LNCNT+1
. . W !,LN3
. . S LNCNT=LNCNT+1
Q
;
RPT3LM(A1,INPUT,FIRSTS,UORP,UORPL,UORPF,LN2,LN3) ; Continue listman output
; Input: A1 - "RCDPE_MAP"
; INPUT - 9th piece contains the current listman line counter
; FIRSTS - 1 if this is the first Payer for the current date, 0 otherwise
; UORP - Current User or Payer Name (whichever we're not sorting by)
; UORPL - Current last User or Payer Name (whichever we're not sorting by)
; UORPF - 1 if this is the first user or payer for the current sor value
; 0 otherwise
; LN2 - Payer or User Name (whatever is not the sort) display line
; LN3 - ERA display line
; ^TMP(A1,$J,XX) - Current listman display lines
; Output: INPUT - Updated 9th piece contains the current listman line counter
; FIRSTS - Updated to 0 (potentially)
; UORP - Updated User or Payer Name (potentially)
; UORPL - Updated last User or Payer Name (potentially)
; UORPF - Updated
; ^TMP(A1,$J,XX) - Current listman display lines
N XX
S XX=$P(INPUT,"^",9)
I UORPF D ; first User or Payer for sort value and date
. S UORPF=0,XX=XX+1,UORPL=UORP
. S ^TMP(A1,$J,XX)=LN2
I UORP'=UORPL D ; Different User or Payer for date
. S UORPL=UORP,UORPF=0
. S XX=XX+1
. S ^TMP(A1,$J,XX)=""
. S XX=XX+1
. S ^TMP(A1,$J,XX)=LN2
S XX=XX+1
S ^TMP(A1,$J,XX)=LN3
S $P(INPUT,"^",9)=XX
Q
;
; Input: INPUT - See REPORT for a complete description
; LNCNT - Current Line Count
; PAGE - Current Page Count
; Output: LNCNT - Updated Line Count
; PAGE - Updated Page Count
N XX,YY,ZZ
S YY="EEOBs Marked for Auto-Post Audit Report",PAGE=PAGE+1
S XX=$$NOW^XLFDT(),XX=$$FMTE^XLFDT(XX)
S XX=$$SETSTR^VALM1(XX,YY,42,21)
S YY="Page: "_$J(PAGE,3)
S XX=$$SETSTR^VALM1(YY,XX,69,$L(YY))
W @IOF,XX
S LNCNT=1
;
S XX=$$HDRLN2(INPUT)
W !,XX
S LNCNT=LNCNT+1
;
S XX=$$HDRLN3(INPUT)
W !,XX
S LNCNT=LNCNT+1
;
S XX=$$HDRLN4(INPUT)
W !,XX
S LNCNT=LNCNT+1
;
S LNCNT=LNCNT+1
W !,"ERA # Claim # Trace #"
S LNCNT=LNCNT+1
W !,"--------------------------------------------------------------------------------"
S LNCNT=LNCNT+1
Q
;
HDRLN2(INPUT) ; Build the 2nd header line
; Input: INPUT - See REPORT^RCDPEMAP for a complete description
; Returns: Text for 2nd header line
N XX
S XX="Divs : "_$S($P(INPUT,"^",1)=1:"All",1:$$DIVS(.RCVAUTD))
Q XX
;
HDRLN3(INPUT) ; Build the 3rd header line
; Input: INPUT - See REPORT^RCDPEMAP for a complete description
; Returns: Text for 3rd header line
N XX,YY,ZZ
S YY=$P(INPUT,"^",3)
S XX="M/P/T/C: "_$S(YY="A":"All",YY="M":"Medical",YY="P":"Pharmacy ",YY="C":"CHAMPVA",1:"Tricare")_" - " ;PRCA*4.5*432 Add CHAMPVA
S XX=XX_$S($P(INPUT,"^",4)="A":" All",1:" Sel")_" Payers"
S YY=$P($P(INPUT,"^",2),"|",1),YY="Auto-Post Date: "_$$FMTE^XLFDT(YY,"2Z")
S ZZ=$P($P(INPUT,"^",2),"|",2),ZZ=$$FMTE^XLFDT(ZZ,"2Z")
S YY=YY_"-"_ZZ
S XX=$$SETSTR^VALM1(YY,XX,40,$L(YY))
Q XX
;
HDRLN4(INPUT) ; Build the 4th header line
; Input: INPUT - See REPORT^RCDPEMAP for a complete description
; Returns: Text for 4th header line
N XX,YY,ZZ
S YY=$P(INPUT,"^",4)
S XX="Users: "_$S($P(INPUT,"^",5)=1:"All ",1:"Selected")
S YY="Sort: "_$S($P(INPUT,"^",6)=1:"User ",1:"Payer ")_"Name"
S XX=$$SETSTR^VALM1(YY,XX,50,$L(YY))
Q XX
;
DIVS(VAUTD) ;
; Input - VAUTD array of divisions selected
; Returns - List of station numbers
N RETURN,XX,Z0,Z1
S Z1=""
S Z0=0
F D Q:'Z0
. S Z0=$O(VAUTD(Z0))
. Q:'Z0
. S XX=$$GET1^DIQ(40.8,Z0,1,"I") ;Facility Number ;PRCA*4.5*321
. S Z1=Z1_XX_", "
S RETURN=$E(Z1,1,$L(Z1)-2)
Q RETURN
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPEMA1 12062 printed Dec 13, 2024@01:44:55 Page 2
RCDPEMA1 ;EDE/FA - LIST ALL AUTO-POSTED RECEIPTS REPORT ;Nov 17, 2016
+1 ;;4.5;Accounts Receivable;**332,432**;Mar 20, 1995;Build 16
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; no direct entry
QUIT
+5 ;
RPTOUT(INPUT) ;EP from RCDPEMAP
+1 ; Output the report to paper/screen, listman or excel
+2 ; Input: INPUT - See REPORT^RCDPEMAP for a complete description
+3 ; ^TMP($J,A1,"SEL",A2)=External Auto-Post Date
+4 ; ^TMP($J,A1,"SEL",A3)=External lower cased sort value (Payer or User)
+5 ; ^TMP($J,A1,"SEL",A2,A3,A4,A5)=B1^B2^B3^B4^B5 - if record passed filters Where:
+6 ; A1 - "RCDPE_MAP"
+7 ; A2 - Internal Auto-Post Date (primary sort)
+8 ; A3 - Secondary Sort Value (Payer or User Name)
+9 ; A4 - IEN for file 344.4
+10 ; A5 - IEN for file 344.41
+11 ; B1 - Payer Name
+12 ; B2 - User Name
+13 ; B3 - ERA #
+14 ; B4 - Claim #
+15 ; B5 - Trace #
+16 ; Output: ^TMP("RCDPE_MAP",$J,CTR)=Line - Array of display lines (no headers)
+17 ; for output to Listman
+18 ; Only set when A7-1
+19 ;
+20 NEW A1,ADATE,DATA,EXCEL,FIRST,LNCNT,LSTMAN,OUTYPE,PAGE,PAYER,SORT,STOP,SVAL
+21 ; Initialize Line/Page counters
SET (LNCNT,PAGE)=0
+22 ; Line Counter for Listman output
SET $PIECE(INPUT,"^",9)=0
+23 ; Secondary Sort by Payer or User?
SET SORT=$PIECE(INPUT,"^",6)
+24 ; Output to Excel?
SET EXCEL=$PIECE(INPUT,"^",8)
+25 ; Output to Listman?
SET LSTMAN=$PIECE(INPUT,"^",7)
+26 SET OUTYPE=$SELECT(EXCEL:2,LSTMAN:1,1:0)
+27 SET DATA=0
SET FIRST=1
+28 ; Excel Ouput - Print header line
IF OUTYPE=2
Begin DoDot:1
+29 SET XX="Auto-Post Date^"
+30 SET XX=XX_$SELECT(SORT=2:"Payer",1:"User")_"^"
+31 SET XX=XX_$SELECT(SORT=2:"User",1:"Payer")_"^"
+32 SET XX=XX_"ERA #^Claim #^Trace #"
+33 WRITE !,XX
+34 ;
End DoDot:1
+35 SET A1="RCDPE_MAP"
SET STOP=0
+36 SET ADATE=""
+37 FOR
Begin DoDot:1
+38 SET ADATE=$ORDER(^TMP($JOB,A1,"SEL",ADATE))
+39 if ADATE=""
QUIT
+40 ; Listman Output
IF OUTYPE=1
Begin DoDot:2
+41 SET XX=$PIECE(INPUT,"^",9)
SET XX=XX+1
+42 ;
IF FIRST
Begin DoDot:3
+43 SET FIRST=0
End DoDot:3
+44 ;
IF '$TEST
Begin DoDot:3
+45 SET ^TMP(A1,$JOB,XX)=""
SET XX=XX+1
End DoDot:3
+46 SET ^TMP(A1,$JOB,XX)="Auto-Post Date: "_^TMP($JOB,A1,"SEL",ADATE)
+47 SET $PIECE(INPUT,"^",9)=XX
End DoDot:2
+48 ;
+49 ; Output to Screen/Paper
IF 'OUTYPE
Begin DoDot:2
+50 ; Initial Page Header
IF FIRST
Begin DoDot:3
+51 SET FIRST=0
+52 DO PHEADER(INPUT,.LNCNT,.PAGE)
+53 WRITE !,"Auto-Post Date: "_^TMP($JOB,A1,"SEL",ADATE)
+54 SET LNCNT=LNCNT+1
End DoDot:3
QUIT
+55 ; Page break
IF (LNCNT+6)>IOSL
Begin DoDot:3
+56 SET STOP=$$ASKSTOP^RCDPEMAP()
+57 if STOP
QUIT
+58 ; Page Header
DO PHEADER(INPUT,.LNCNT,.PAGE)
End DoDot:3
if STOP
QUIT
+59 IF LNCNT>7
WRITE !
SET LNCNT=LNCNT+1
+60 WRITE !,"Auto-Post Date: "_^TMP($JOB,A1,"SEL",ADATE)
+61 SET LNCNT=LNCNT+1
End DoDot:2
if STOP
QUIT
+62 DO RPT2(.INPUT,A1,ADATE,SORT,OUTYPE,.LNCNT,.STOP,.DATA)
End DoDot:1
if ADATE=""
QUIT
if STOP
QUIT
+63 IF 'DATA
IF 'EXCEL
IF 'LSTMAN
Begin DoDot:1
+64 DO PHEADER(INPUT,.LNCNT,.PAGE)
End DoDot:1
+65 IF 'EXCEL
Begin DoDot:1
+66 SET XX=$$ENDORPRT^RCDPEARL
+67 IF OUTYPE=1
Begin DoDot:2
+68 SET YY=$PIECE(INPUT,"^",9)+1
+69 SET $PIECE(INPUT,"^",9)=YY
+70 SET ^TMP(A1,$JOB,YY)=XX
End DoDot:2
QUIT
+71 WRITE !,XX
End DoDot:1
+72 IF (OUTYPE'=1)
IF 'STOP
IF $$ASKSTOP^RCDPEMAP()
+73 QUIT
+74 ;
RPT2(INPUT,A1,ADATE,SORT,OUTYPE,LNCNT,STOP,DATA) ; Report Output Continued
+1 ; Input: INPUT - See REPORT^RCDPEMAP for detail
+2 ; ADATE - Internal Auto-Post Date
+3 ; SORT - 2 - Sort by User, 1 - Sort by Payer
+4 ; OUTYPE - 2 - Excel, 1 - Listman, 0 - Paper/Screen
+5 ; LNCNT - Current line count (only if OUTYPE=0)
+6 ; ^TMP($J,A1,"SEL",...) - See RPTOUT for details
+7 ; Output: LNCNT - Updated line count (only if OUTYPE=0)
+8 ; STOP - 1 if user quit out (only if OUTYPE=0)
+9 ; INPUT - 9th '^' piece update with current line # is OUTYPE=1
+10 ; DATA - 1 if at least one line of data is fount
+11 ; ^TMP("RCDPE_MAP",$J,CTR) - Output lines for Listman (only if OUTYPE=1)
+12 NEW CURS,SVAL,LASTS,XX
+13 SET SVAL=""
SET XX=$ORDER(^TMP($JOB,A1,"SEL",ADATE,""))
+14 SET LASTS=^TMP($JOB,A1,"SEL",ADATE,XX)
+15 FOR
Begin DoDot:1
+16 SET SVAL=$ORDER(^TMP($JOB,A1,"SEL",ADATE,SVAL))
+17 if SVAL=""
QUIT
+18 ; Current lower case Payer or User Name
SET CURS=^TMP($JOB,A1,"SEL",ADATE,SVAL)
+19 ; Listman output
IF OUTYPE=1
Begin DoDot:2
+20 SET XX=$PIECE(INPUT,"^",9)
+21 IF CURS'=LASTS
Begin DoDot:3
+22 SET XX=XX+1
SET ^TMP(A1,$JOB,XX)=""
End DoDot:3
+23 SET XX=XX+1
SET ^TMP(A1,$JOB,XX)=" "_$SELECT(SORT=2:"Payer: ",1:"User: ")_CURS
+24 SET $PIECE(INPUT,"^",9)=XX
End DoDot:2
+25 ;
+26 ; Output to Paper/Screen
IF 'OUTYPE
Begin DoDot:2
+27 ; Page break
IF (LNCNT+4)>IOSL
Begin DoDot:3
+28 SET STOP=$$ASKSTOP^RCDPEMAP()
+29 if STOP
QUIT
+30 ; Print Page Header
DO PHEADER(INPUT,.LNCNT,.PAGE)
+31 WRITE !,"Auto-Post Date: "_^TMP($JOB,A1,"SEL",ADATE)
+32 ; W !,CURS
+33 SET LNCNT=LNCNT+3
End DoDot:3
if STOP
QUIT
+34 IF CURS'=LASTS
Begin DoDot:3
+35 SET LNCNT=LNCNT+1
SET LASTS=CURS
+36 WRITE !
End DoDot:3
+37 WRITE !," ",$SELECT(SORT=2:"Payer: ",1:"User: "),CURS
+38 SET LNCNT=LNCNT+1
End DoDot:2
if STOP
QUIT
+39 DO RPT3(.INPUT,A1,ADATE,SORT,SVAL,OUTYPE,.LNCNT,.STOP,.DATA)
End DoDot:1
if SVAL=""
QUIT
if STOP
QUIT
+40 QUIT
+41 ;
RPT3(INPUT,A1,ADATE,SORT,SVAL,OUTYPE,LNCNT,STOP,DATA) ; Report Output Continued
+1 ; Input: INPUT - See REPORT^RCDPEMAP for detail
+2 ; ADATE - Internal Auto-Post Date
+3 ; SORT - 1 - Sort by User, 2 - Sort by Payer
+4 ; SVAL - Current sort value (Upper cased Payer or User Name)
+5 ; OUTYPE - 2 - Excel, 1 - Listman, 0 - Paper/Screen
+6 ; LNCNT - Current line count (only if OUTYPE=0)
+7 ; ^TMP($J,A1,"SEL",...2) - See RPTOUT for details
+8 ; Output: LNCNT - Updated line count (only if OUTYPE=0)
+9 ; STOP - 1 if user quit out (only if OUTYPE=0)
+10 ; INPUT - 9th '^' piece update with current line # is OUTYPE=1
+11 ; DATA - 1 if at least one line of data is found
+12 ; ^TMP("RCDPE_MAP",$J,CTR) - Output lines for Listman (only if OUTYPE=1)
+13 NEW DATAR,FIRSTS,IEN3444,IEN34441,LN1,LN2,LN3,UORP,UORPF,UORPL,XX,YY
+14 SET IEN3444=""
SET FIRSTS=1
SET UORPF=1
+15 FOR
Begin DoDot:1
+16 SET IEN3444=$ORDER(^TMP($JOB,A1,"SEL",ADATE,SVAL,IEN3444))
+17 if IEN3444=""
QUIT
+18 SET IEN34441=""
+19 SET XX=$ORDER(^TMP($JOB,A1,"SEL",ADATE,SVAL,IEN3444,""))
+20 SET XX=^TMP($JOB,A1,"SEL",ADATE,SVAL,IEN3444,XX)
+21 SET UORPL=$PIECE(XX,"^",SORT)
+22 FOR
Begin DoDot:2
+23 SET IEN34441=$ORDER(^TMP($JOB,A1,"SEL",ADATE,SVAL,IEN3444,IEN34441))
+24 if IEN34441=""
QUIT
+25 ; found data
SET DATA=1
+26 ;
+27 SET DATAR=^TMP($JOB,A1,"SEL",ADATE,SVAL,IEN3444,IEN34441)
+28 if SORT=2
SET LN1=" Payer: "_$PIECE(DATAR,"^",1)
SET LN2=" User: "_$PIECE(DATAR,"^",2)
+29 if SORT=1
SET LN1=" User: "_$PIECE(DATAR,"^",2)
SET LN2=" Payer: "_$PIECE(DATAR,"^",1)
+30 ; ERA #
SET LN3=$PIECE(DATAR,"^",3)
+31 ; Claim #
SET YY=$PIECE(DATAR,"^",4)
+32 SET LN3=$$SETSTR^VALM1(YY,LN3,13,10)
+33 ; Trace #
SET YY=$PIECE(DATAR,"^",5)
+34 SET LN3=$$SETSTR^VALM1(YY,LN3,25,50)
+35 SET UORP=$PIECE(DATAR,"^",SORT)
+36 ; Excel Output
IF OUTYPE=2
Begin DoDot:3
+37 SET XX=^TMP($JOB,A1,"SEL",ADATE)_"^"
+38 IF SORT=1
Begin DoDot:4
+39 SET XX=XX_$PIECE(DATAR,"^",2)_"^"_$PIECE(DATAR,"^",1)
End DoDot:4
+40 IF '$TEST
Begin DoDot:4
+41 SET XX=XX_$PIECE(DATAR,"^",1,2)
End DoDot:4
+42 SET XX=XX_"^"_$PIECE(DATAR,"^",3,5)
+43 WRITE !,XX
End DoDot:3
QUIT
+44 ;
+45 ; Listman output
+46 IF OUTYPE=1
DO RPT3LM(A1,.INPUT,.FIRSTS,.UORP,.UORPL,.UORPF,LN2,LN3)
QUIT
+47 ;
+48 ; Output to Paper/Screen - check if we need a page break
+49 IF (LNCNT+2)>IOSL
Begin DoDot:3
+50 SET STOP=$$ASKSTOP^RCDPEMAP()
+51 if STOP
QUIT
+52 DO PHEADER(INPUT,.LNCNT,.PAGE)
+53 WRITE !,"Auto-Post Date: "_^TMP($JOB,A1,"SEL",ADATE)
+54 SET LNCNT=LNCNT+1
+55 WRITE !,LN1
+56 SET LNCNT=LNCNT+1
+57 WRITE !,LN2
+58 SET LNCNT=LNCNT+1
End DoDot:3
if STOP
QUIT
+59 IF UORP'=UORPL
Begin DoDot:3
+60 SET UORPL=UORP
SET LNCNT=LNCT+2
SET UORPF=0
+61 IF LNCNT>7
WRITE !
SET LNCNT=LNCNT+1
+62 WRITE !,LN2
SET LNCNT=LNCNT+1
End DoDot:3
+63 IF UORPF
Begin DoDot:3
+64 SET LNCNT=LNCNT+1
SET UORPF=0
+65 WRITE !,LN2
SET LNCNT=LNCNT+1
End DoDot:3
+66 WRITE !,LN3
+67 SET LNCNT=LNCNT+1
End DoDot:2
if IEN34441=""
QUIT
End DoDot:1
if IEN3444=""
QUIT
if STOP
QUIT
+68 QUIT
+69 ;
RPT3LM(A1,INPUT,FIRSTS,UORP,UORPL,UORPF,LN2,LN3) ; Continue listman output
+1 ; Input: A1 - "RCDPE_MAP"
+2 ; INPUT - 9th piece contains the current listman line counter
+3 ; FIRSTS - 1 if this is the first Payer for the current date, 0 otherwise
+4 ; UORP - Current User or Payer Name (whichever we're not sorting by)
+5 ; UORPL - Current last User or Payer Name (whichever we're not sorting by)
+6 ; UORPF - 1 if this is the first user or payer for the current sor value
+7 ; 0 otherwise
+8 ; LN2 - Payer or User Name (whatever is not the sort) display line
+9 ; LN3 - ERA display line
+10 ; ^TMP(A1,$J,XX) - Current listman display lines
+11 ; Output: INPUT - Updated 9th piece contains the current listman line counter
+12 ; FIRSTS - Updated to 0 (potentially)
+13 ; UORP - Updated User or Payer Name (potentially)
+14 ; UORPL - Updated last User or Payer Name (potentially)
+15 ; UORPF - Updated
+16 ; ^TMP(A1,$J,XX) - Current listman display lines
+17 NEW XX
+18 SET XX=$PIECE(INPUT,"^",9)
+19 ; first User or Payer for sort value and date
IF UORPF
Begin DoDot:1
+20 SET UORPF=0
SET XX=XX+1
SET UORPL=UORP
+21 SET ^TMP(A1,$JOB,XX)=LN2
End DoDot:1
+22 ; Different User or Payer for date
IF UORP'=UORPL
Begin DoDot:1
+23 SET UORPL=UORP
SET UORPF=0
+24 SET XX=XX+1
+25 SET ^TMP(A1,$JOB,XX)=""
+26 SET XX=XX+1
+27 SET ^TMP(A1,$JOB,XX)=LN2
End DoDot:1
+28 SET XX=XX+1
+29 SET ^TMP(A1,$JOB,XX)=LN3
+30 SET $PIECE(INPUT,"^",9)=XX
+31 QUIT
+32 ;
+1 ; Input: INPUT - See REPORT for a complete description
+2 ; LNCNT - Current Line Count
+3 ; PAGE - Current Page Count
+4 ; Output: LNCNT - Updated Line Count
+5 ; PAGE - Updated Page Count
+6 NEW XX,YY,ZZ
+7 SET YY="EEOBs Marked for Auto-Post Audit Report"
SET PAGE=PAGE+1
+8 SET XX=$$NOW^XLFDT()
SET XX=$$FMTE^XLFDT(XX)
+9 SET XX=$$SETSTR^VALM1(XX,YY,42,21)
+10 SET YY="Page: "_$JUSTIFY(PAGE,3)
+11 SET XX=$$SETSTR^VALM1(YY,XX,69,$LENGTH(YY))
+12 WRITE @IOF,XX
+13 SET LNCNT=1
+14 ;
+15 SET XX=$$HDRLN2(INPUT)
+16 WRITE !,XX
+17 SET LNCNT=LNCNT+1
+18 ;
+19 SET XX=$$HDRLN3(INPUT)
+20 WRITE !,XX
+21 SET LNCNT=LNCNT+1
+22 ;
+23 SET XX=$$HDRLN4(INPUT)
+24 WRITE !,XX
+25 SET LNCNT=LNCNT+1
+26 ;
+27 SET LNCNT=LNCNT+1
+28 WRITE !,"ERA # Claim # Trace #"
+29 SET LNCNT=LNCNT+1
+30 WRITE !,"--------------------------------------------------------------------------------"
+31 SET LNCNT=LNCNT+1
+32 QUIT
+33 ;
HDRLN2(INPUT) ; Build the 2nd header line
+1 ; Input: INPUT - See REPORT^RCDPEMAP for a complete description
+2 ; Returns: Text for 2nd header line
+3 NEW XX
+4 SET XX="Divs : "_$SELECT($PIECE(INPUT,"^",1)=1:"All",1:$$DIVS(.RCVAUTD))
+5 QUIT XX
+6 ;
HDRLN3(INPUT) ; Build the 3rd header line
+1 ; Input: INPUT - See REPORT^RCDPEMAP for a complete description
+2 ; Returns: Text for 3rd header line
+3 NEW XX,YY,ZZ
+4 SET YY=$PIECE(INPUT,"^",3)
+5 ;PRCA*4.5*432 Add CHAMPVA
SET XX="M/P/T/C: "_$SELECT(YY="A":"All",YY="M":"Medical",YY="P":"Pharmacy ",YY="C":"CHAMPVA",1:"Tricare")_" - "
+6 SET XX=XX_$SELECT($PIECE(INPUT,"^",4)="A":" All",1:" Sel")_" Payers"
+7 SET YY=$PIECE($PIECE(INPUT,"^",2),"|",1)
SET YY="Auto-Post Date: "_$$FMTE^XLFDT(YY,"2Z")
+8 SET ZZ=$PIECE($PIECE(INPUT,"^",2),"|",2)
SET ZZ=$$FMTE^XLFDT(ZZ,"2Z")
+9 SET YY=YY_"-"_ZZ
+10 SET XX=$$SETSTR^VALM1(YY,XX,40,$LENGTH(YY))
+11 QUIT XX
+12 ;
HDRLN4(INPUT) ; Build the 4th header line
+1 ; Input: INPUT - See REPORT^RCDPEMAP for a complete description
+2 ; Returns: Text for 4th header line
+3 NEW XX,YY,ZZ
+4 SET YY=$PIECE(INPUT,"^",4)
+5 SET XX="Users: "_$SELECT($PIECE(INPUT,"^",5)=1:"All ",1:"Selected")
+6 SET YY="Sort: "_$SELECT($PIECE(INPUT,"^",6)=1:"User ",1:"Payer ")_"Name"
+7 SET XX=$$SETSTR^VALM1(YY,XX,50,$LENGTH(YY))
+8 QUIT XX
+9 ;
DIVS(VAUTD) ;
+1 ; Input - VAUTD array of divisions selected
+2 ; Returns - List of station numbers
+3 NEW RETURN,XX,Z0,Z1
+4 SET Z1=""
+5 SET Z0=0
+6 FOR
Begin DoDot:1
+7 SET Z0=$ORDER(VAUTD(Z0))
+8 if 'Z0
QUIT
+9 ;Facility Number ;PRCA*4.5*321
SET XX=$$GET1^DIQ(40.8,Z0,1,"I")
+10 SET Z1=Z1_XX_", "
End DoDot:1
if 'Z0
QUIT
+11 SET RETURN=$EXTRACT(Z1,1,$LENGTH(Z1)-2)
+12 QUIT RETURN