RCDPESP2 ;BIRM/SAB - ePayment Lockbox Parameter Audit and Exclusion Reports ;29 Jan 2019 18:00:14
;;4.5;Accounts Receivable;**298,304,317,321,326,332,345,349**;Mar 20, 1995;Build 44
;Per VA Directive 6402, this routine should not be modified.
;
Q
;
RPT1 ; EDI Lockbox Parameters Report [RCDPE SITE PARAMETER REPORT]
D AUDPARM^RCDPESPA ; PRCA*4.5*332, report moved, 11 October 2018
Q
;
RPT2 ; EDI Lockbox Exclusion Audit Report [RCDPE EXCLUSION AUDIT REPORT]
;
; Input: NONE
; Local Variables:
; RCRANGE - Date range for report
; RCSTDT - Report start date
; RCENDT - Report end date
; RCEXCEL - 1 if report in Excel format, 0 otherwise
; RCSCR - Screening logic for LIST^DIC
; RCFLDS - Fields for LIST^DIC
; RCDIGET - Storage for results from LIST^DIC
; RCDIERR - Errors from LIST^DIC
; RCHDR("PAGE") - Page counter
; RCHDR("RUNDATE") - Date/time report was run
; RCSTOP - 1 to exit report, 0 otherwise
; RCPARAM - Parameter that was changed
; RCPARAM("TIME") - Time parameter changed
; RCPARAM("OLDVAL") - Old parameter value
; RCPARAM("NEWVAL") - New parameter value
; RCPARAM("USER") - User who changed the parameter
; RCTMP - One record from LIST^DIC
; RCFND - Flag indicating records returned
; RCTYPE - Report filter (MEDICAL, PHARMACY, TRICARE OR ALL)
;
W !!," EDI Lockbox Exclusion Audit Report",!
; PRCA*4.5*349 - Added RCDIMEDD, RCDIRXD,RCDITR,RCDITRD
N RCT,RCDIERR,RCDIMED,RCDIMEDD,RCDIRX,RCDIRXD,RCDITR,RCDITRD,RCFLDS,RCFND,RCHDR,RCRPT
N RCSCR,RCSCRTYP,RCSTDT,RCSTOP,RCTMP,RCTYPE
N X1,X2,X,Y,%ZIS,POP ; Kernel variable
;
W !!," EDI Lockbox Exclusion Audit Report",!
; PRCA*4.5*345 Begin
S (RCHDR("PAGE"),RCSTOP,RCIEN,RCRPT("excel"),RCFND)=0 ; Initialize values
S RCT("MedPost")=$NA(^TMP("RC-MedPost",$J))
K @RCT("MedPost")
S RCT("MedDecr")=$NA(^TMP("RC-MedDecr",$J))
K @RCT("MedDecr")
S RCT("RxPost")=$NA(^TMP("RC-RxPost",$J))
K @RCT("RxPost")
S RCT("RxDecr")=$NA(^TMP("RC-RxDecr",$J))
K @RCT("RxDecr")
S RCT("TriPost")=$NA(^TMP("RC-TriPost",$J)) ; PRCA*4.5*349 - Add TRICARE
K @RCT("TriPost") ; PRCA*4.5*349
S RCT("TriDecr")=$NA(^TMP("RC-TriDecr",$J)) ; PRCA*4.5*349
K @RCT("TriDecr") ; PRCA*4.5*349
; PRCA*4.5*345 end
S RCTYPE=$$RTYPE^RCDPESPA ; PRCA*4.5*345 - changed to M,P,T,ALL
Q:RCTYPE=-1
S RCHDR("rprtTyp")=RCTYPE ; Save filter selection
S RCRPT("dtRange")=$$DTRNG ; Get date range
Q:RCRPT("dtRange")=0
S RCRPT("begDt")=$P(RCRPT("dtRange"),U,2)-.1
S RCRPT("endDt")=$P(RCRPT("dtRange"),U,3)+.9
S RCFLDS="@;.04;.01I;.06;.03;.08;.02" ; Output fields for LIST^DIC
; .04 - CHANGED FIELD .01 - TIMESTAMP .06 - NEW VALUE
; .03 - CHANGED BY .08 - COMMENT .02 - MODIFIED IEN
;
; first part of LIST^DIC screening logic
S RCSCR="I ($P(^(0),U,5)=344.6)&($P(^(0),U,1)>"_RCRPT("begDt")_")&($P(^(0),U,1)<"_RCRPT("endDt")_")"
;
S RCRPT("excel")=$$DISPTY^RCDPEM3 ; output to Excel?
Q:+RCRPT("excel")=-1
I RCRPT("excel") D INFO^RCDPEM6
S %ZIS="M" D ^%ZIS Q:POP U IO ; Select output device
;
S RCHDR("RUNDATE")=$$FMTE^XLFDT($$NOW^XLFDT,"5S")
;
; Process Auto-Post Payer Exclusions
; Get screening logic based on the type of audit report
S RCSCR(.06)=RCSCR_"&($P(^(0),U,4)=.06)" ; screening logic for medical auto-post
S RCSCR(.07)=RCSCR_"&($P(^(0),U,4)=.07)" ; screening logic for medical auto-decrease
S RCSCR(.08)=RCSCR_"&($P(^(0),U,4)=.08)" ; screening logic for pharmacy auto-post
S RCSCR(.12)=RCSCR_"&($P(^(0),U,4)=.12)" ; screening logic for pharmacy auto-decrease, PRCA*4.5*345
S RCSCR(.13)=RCSCR_"&($P(^(0),U,4)=.13)" ; PRCA*4.5*349 - screening logic for TRICARE auto-post
S RCSCR(.14)=RCSCR_"&($P(^(0),U,4)=.14)" ; PRCA*4.5*349 - screening logic for TRICARE auto-decrease
; Get medical Auto-Post Payer exclusions
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.06),,RCT("MedDecr"),"RCDIERR")
I $D(RCDIERR) D Q ; exit if errors
. W !!,"Error collecting auto-post report data."
. D ASK^RCDPEARL(.RCSTOP)
;
; Get medical Auto-Decrease Payer exclusions
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.07),,RCT("MedPost"),"RCDIERR")
I $D(RCDIERR) D Q ; exit if errors
. W !!,"Error collecting Payer auto-decrease report data."
. D ASK^RCDPEARL(.RCSTOP)
;
; Get the pharmacy Auto-Post Payer exclusions
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.08),,RCT("RxPost"),"RCDIERR")
I $D(RCDIERR) D Q ; exit if errors
. D ERR4USR("Pharmacy Auto-Post"),ASK^RCDPEARL(.RCSTOP)
; Get pharmacy Auto-Decrease Payer exclusions
;
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.12),,RCT("RxDecr"),"RCDIERR")
I $D(RCDIERR) D Q ; exit if errors
. D ERR4USR("Pharmacy Auto-Decrease"),ASK^RCDPEARL(.RCSTOP)
;
; PRCA*4.5*349 - Start modified block
; Get Tricare Auto-Post Payer exclusions
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.13),,RCT("TriPost"),"RCDIERR")
I $D(RCDIERR) D Q ; exit if errors
. D ERR4USR("Tricare Auto-Post"),ASK^RCDPEARL(.RCSTOP)
;
; Tricare Auto-Decrease Payer exclusions
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.14),,RCT("TriDecr"),"RCDIERR")
I $D(RCDIERR) D Q ; exit if errors
. D ERR4USR("Tricare Auto-Decrease"),ASK^RCDPEARL(.RCSTOP)
; PRCA*4.5*349 - End modified block
;
I (RCTYPE="A")!(RCTYPE="M") D G:RCSTOP RPT2Q ; Display Medical Payer exclusions
. D OPTYPE("MedPost",.06,RCTYPE)
. D OPTYPE("MedDecr",.07,RCTYPE)
;
I (RCTYPE="A")!(RCTYPE="P") D G:RCSTOP RPT2Q ; Display pharmacy Payer exclusions
. D OPTYPE("RxPost",.08,RCTYPE)
. D OPTYPE("RxDecr",.12,RCTYPE)
;
; PRCA*4.5*349 - Add TRICARE, next 3 lines
I (RCTYPE="A")!(RCTYPE="T") D G:RCSTOP RPT2Q ; Display TRICARE Payer exclusions
. D OPTYPE("TriPost",.13,RCTYPE)
. D OPTYPE("TriDecr",.14,RCTYPE)
;
; PRCA*4.5*345 end
; end of report
W !!,$$ENDORPRT^RCDPEARL
D ASK^RCDPEARL(.RCSTOP)
;
RPT2Q ; exit point
S X="" F S X=$O(RCT(X)) Q:X="" K @RCT(X) ; clean up ^TMP storage
Q
;
GETPAYER() ; GET THE PAYER NAME + PAYER ID
N RCIEN,RCPAYR
S RCIEN=$P(RCTMP,U,6)
I '$D(^RCY(344.6,RCIEN)) Q ""
S RCPAYR=$$GET1^DIQ(344.6,RCIEN_",",.01)_" "_$$GET1^DIQ(344.6,RCIEN_",",.02)
Q RCPAYR
;
HDRXAR(RCTYP,RCEXCTYP) ; Report header for auto-posting exclusion report
; Input:
; RCTYP - .06 = Auto-Posting exclusion (medical)
; .07 = Auto-Decrease exclusion (medical)
; .08 = Auto-Posting exclusion (pharmacy)
; .12 = Auto-Decrease exclusion (pharmacy)
; .13 = Auto-Posting exclusion (TRICARE)
; .14 = Auto-Decrease exclusion (TRICARE)
; RCEXCTYP - M - Medical, P - Pharmacy, T - TRICARE A - All
;
N RCTYPED,XX
S RCTYPED=$S(RCEXCTYP="M":"MEDICAL",RCEXCTYP="P":"PHARMACY",RCEXCTYP="T":"TRICARE",1:"ALL")
I RCRPT("excel") D Q
. Q:RCHDR("PAGE")
. ; Excel header for parameter audits
. W !!,"TYPE^CHANGE^PAYER^TIMESTAMP^USER^COMMENT"
. S RCHDR("PAGE")=1 ; only print it once
;
I RCHDR("PAGE") D ASK^RCDPEARL(.RCSTOP) Q:RCSTOP
W @IOF
S RCHDR("PAGE")=RCHDR("PAGE")+1
; report header for parameter audits
W $$CNTR("EDI Lockbox Exclusion Audit Report"),?IOM-8,"Page: "_RCHDR("PAGE")
W !,$$CNTR("DIVISIONS: ALL")
W !,$$CNTR("RUN DATE: "_$G(RCHDR("RUNDATE")))
S XX=$$FMTE^XLFDT($P(RCRPT("dtRange"),U,2),"5D")_" - "_$$FMTE^XLFDT($P(RCRPT("dtRange"),U,3),"5D") ; PRCA*4.5*349
W !,$$CNTR("DATE RANGE: "_XX) ; PRCA*4.5*349 - Changed to XX to make it easier to read
W !,$$CNTR("REPORT TYPE: "_RCTYPED) ; PRCA*4.5*349
D SECTHDR(RCTYP,RCEXCTYP)
Q
; PRCA*4.5*345 begin
SECTHDR(RCTYPE,RCREPT) ; SECTION HEADER
; PRCA*4.5*345 - Added Rx Auto-Decrease
; Input: RCTYP - .06 = Auto-Posting exclusion (medical)
; .07 = Auto-Decrease exclusion (medical)
; .08 = Auto-Posting exclusion (Rx)
; .12 = Auto-Decrease exclusion (Rx)
; .13 = Auto-Posting exclusion (TRICARE)
; .14 = Auto-Decrease exclusion (TRICARE)
; RCREPT - M - Medical, P - Pharmacy, T - TRICARE A - All
Q:$G(RCRPT("excel"))
I RCTYPE=.06 D TXPEQLS("MEDICAL AUTO-POSTING PAYER EXCLUSION LIST")
I RCTYPE=.07 D TXPEQLS("MEDICAL AUTO-DECREASE PAYER EXCLUSION LIST")
I RCTYPE=.08 D TXPEQLS("PHARMACY AUTO-POSTING PAYER EXCLUSION LIST")
I RCTYPE=.12 D TXPEQLS("PHARMACY AUTO-DECREASE PAYER EXCLUSION LIST")
I RCTYPE=.13 D TXPEQLS("TRICARE AUTO-POSTING PAYER EXCLUSION LIST") ; PRCA*4.5*349
I RCTYPE=.14 D TXPEQLS("TRICARE AUTO-DECREASE PAYER EXCLUSION LIST") ; PRCA*4.5*349
;
W !,"Change Payer Date/Time Edited User"
W !,$$EQLSGNS(IOM-1) ; row of equal signs
Q
;
TXPEQLS(Y) ; write text in Y then row of equal signs
Q:$G(Y)="" ; must have text
W !!,Y,!,$$EQLSGNS($L(Y)) Q
;
EQLSGNS(N) Q $S($G(N)>0:$TR($J("",N)," ","="),1:"") ; row of N equal signs
;
ERR4USR(TXT) ; error message display
W !!,"Error collecting "_$G(TXT)_" report data." Q
; PRCA*4.5*345 end
CNTR(TXT) ; center TXT
Q $J("",IOM-$L(TXT)\2)_TXT
;
DTRNG() ; function, returns date range for the report
N DIR,DUOUT,RNGFLG,X,Y,RCSTART,RCEND
S (RCSTART,RCEND)=0 D DATES(.RCSTART,.RCEND)
Q:RCSTART=-1 0
Q:RCSTART "1^"_RCSTART_"^"_RCEND
Q:'RCSTART "0^^"
Q 0
;
DATES(BDATE,EDATE) ; Get a date range, both values passed by ref.
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
S (BDATE,EDATE)=0
S DIR("?")="Enter the earliest AUDIT DATE to include on the report"
S DIR(0)="DAO^:"_DT_":APE",DIR("A")="Report start date: "
D ^DIR
K DIR
I $D(DTOUT)!$D(DUOUT)!(Y="") S BDATE=-1 Q
S BDATE=Y K DIR,X,Y
S DIR("?")="Enter the latest AUDIT DATE to include on the report"
S DIR(0)="DAO^"_BDATE_":"_DT_":APE",DIR("A")="Report end date: ",DIR("B")=$$FMTE^XLFDT(DT)
D ^DIR
K DIR
I $D(DTOUT)!$D(DUOUT)!(Y="") S BDATE=-1 Q
S EDATE=Y
Q
;
DSPXCLSN(RCX) ; display exclusion
; RCX - exclusion value from ^DIC call
N RCXCLSN
S RCXCLSN("CHANGE")=$S($P(RCX,U,3):"Added",1:"Removed")
S RCXCLSN("TIME")=$$FMTE^XLFDT($P(RCX,U,2),"2")
S RCXCLSN("USER")=$P(RCX,U,4)
S RCXCLSN("PAYER")=$$GETPAYER
S RCXCLSN("COMMENT")=$P(RCX,U,5)
;
I 'RCRPT("excel") D Q
.N Y S Y=RCXCLSN("CHANGE"),$E(Y,9)=$E(RCXCLSN("PAYER"),1,30),$E(Y,41)=" "_RCXCLSN("TIME"),Y=Y_" "_RCXCLSN("USER")
.W !,Y,!," Comment: "_RCXCLSN("COMMENT")
; Excel format
S RCXCLSN("LABEL")=$$GET1^DID(344.6,$P(RCX,U,1),,"LABEL")
W !,RCXCLSN("LABEL")_U_RCXCLSN("CHANGE")_U_RCXCLSN("PAYER")_U_RCXCLSN("TIME")_U_RCXCLSN("USER")_U_RCXCLSN("COMMENT")
;
Q
;
;Retrieve the parameter for the type of information to display
RTYPE(DEF) ;EP from RCDPEAA1
; Input: DEF - Value to use a default
; Returns: -1 - User ^ or timed out
; M - User selected MEDICAL
; P - User selected PHARMACY
; T - User selected TRICARE
; A - User selected ALL
;
N DA,DIR,DTOUT,DUOUT,X,Y,DIRUT,DIROUT,RCTYPE
S RCTYPE=""
S DIR("?")="Enter the type of information to display on the report"
S DIR(0)="SA^M:MEDICAL;P:PHARMACY;T:TRICARE;A:ALL"
S DIR("A")="(M)EDICAL, (P)HARMACY, (T)RICARE or (A)LL: "
S DIR("B")=$S($G(DEF)'="":DEF,1:"ALL")
D ^DIR
K DIR
I $D(DTOUT)!$D(DUOUT) Q -1
Q:Y="" "A"
Q $E(Y)
;
;Check to see if the Data element matches the report type
RPTYPE(RCTYPE,RCPARAM) ;
; Return 1 if valid to print, 0 otherwise
N RCDATA,RCMEN,RCREN
;
S (RCMEN,RCREN)=""
; Get Auto Decrease parameters
I RCTYPE="M" S RCMEN=$P($G(^RCY(344.61,1,0)),U,3)
I RCTYPE="P" S RCREN=$P($G(^RCY(344.61,1,1)),U,2)
;
Q:RCTYPE="B" 1
Q:(RCTYPE="M")&(RCPARAM["MED") 1 ; Medical Parameters
Q:(RCTYPE="P")&(RCPARAM["RX") 1 ; Pharmacy parameters
Q:(RCTYPE="P")&(RCPARAM["PHARM") 1 ; Pharmacy parameters
Q:(RCTYPE="M")&(RCMEN)&(RCPARAM["DECREASE") 1 ; Auto-decrease for med is on
Q:(RCTYPE="P")&(RCREN)&(RCPARAM["DECREASE") 1 ; Auto-decrease for pharmacy
Q 0
;
OPTYPE(SUB,FIELD,RCTYPE) ; Output data for each type
; Input: SUB - Subscript to array that contain the data for this type
; FIELD - Changed field from field 4 file 344.7
; RCTYPE - M - Medical, P - Pharmacy, T - Tricare, A - All
D HDRXAR(FIELD,RCTYPE) ; complete header
S RCFND=$D(@RCT(SUB)@("DILIST",1)) ; check for payer exclusions
I 'RCFND D ;
. W !,"No "
. I FIELD=.06 W "Medical Auto-Post"
. I FIELD=.07 W "Medical Auto-Decrease"
. I FIELD=.08 W "Pharmacy Auto-Post"
. I FIELD=.12 W "Pharmacy Auto-Decrease"
. I FIELD=.13 W "Pharmacy Auto-Post"
. I FIELD=.14 W "Pharmacy Auto-Decrease"
. W " Exclusions to Display",!
I RCFND D ; Display medical Auto-post Payer exclusions
. S RCIEN=0,RCSTOP=0
. F S RCIEN=$O(@RCT(SUB)@("DILIST",RCIEN)) Q:RCSTOP!('RCIEN) D
. . S RCTMP=$P(@RCT(SUB)@("DILIST",RCIEN,0),U,2,7)
. . I $Y+4>IOSL D HDRXAR(FIELD,RCTYPE) Q:RCSTOP
. . D DSPXCLSN(RCTMP)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPESP2 13125 printed Nov 22, 2024@16:55:24 Page 2
RCDPESP2 ;BIRM/SAB - ePayment Lockbox Parameter Audit and Exclusion Reports ;29 Jan 2019 18:00:14
+1 ;;4.5;Accounts Receivable;**298,304,317,321,326,332,345,349**;Mar 20, 1995;Build 44
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
RPT1 ; EDI Lockbox Parameters Report [RCDPE SITE PARAMETER REPORT]
+1 ; PRCA*4.5*332, report moved, 11 October 2018
DO AUDPARM^RCDPESPA
+2 QUIT
+3 ;
RPT2 ; EDI Lockbox Exclusion Audit Report [RCDPE EXCLUSION AUDIT REPORT]
+1 ;
+2 ; Input: NONE
+3 ; Local Variables:
+4 ; RCRANGE - Date range for report
+5 ; RCSTDT - Report start date
+6 ; RCENDT - Report end date
+7 ; RCEXCEL - 1 if report in Excel format, 0 otherwise
+8 ; RCSCR - Screening logic for LIST^DIC
+9 ; RCFLDS - Fields for LIST^DIC
+10 ; RCDIGET - Storage for results from LIST^DIC
+11 ; RCDIERR - Errors from LIST^DIC
+12 ; RCHDR("PAGE") - Page counter
+13 ; RCHDR("RUNDATE") - Date/time report was run
+14 ; RCSTOP - 1 to exit report, 0 otherwise
+15 ; RCPARAM - Parameter that was changed
+16 ; RCPARAM("TIME") - Time parameter changed
+17 ; RCPARAM("OLDVAL") - Old parameter value
+18 ; RCPARAM("NEWVAL") - New parameter value
+19 ; RCPARAM("USER") - User who changed the parameter
+20 ; RCTMP - One record from LIST^DIC
+21 ; RCFND - Flag indicating records returned
+22 ; RCTYPE - Report filter (MEDICAL, PHARMACY, TRICARE OR ALL)
+23 ;
+24 WRITE !!," EDI Lockbox Exclusion Audit Report",!
+25 ; PRCA*4.5*349 - Added RCDIMEDD, RCDIRXD,RCDITR,RCDITRD
+26 NEW RCT,RCDIERR,RCDIMED,RCDIMEDD,RCDIRX,RCDIRXD,RCDITR,RCDITRD,RCFLDS,RCFND,RCHDR,RCRPT
+27 NEW RCSCR,RCSCRTYP,RCSTDT,RCSTOP,RCTMP,RCTYPE
+28 ; Kernel variable
NEW X1,X2,X,Y,%ZIS,POP
+29 ;
+30 WRITE !!," EDI Lockbox Exclusion Audit Report",!
+31 ; PRCA*4.5*345 Begin
+32 ; Initialize values
SET (RCHDR("PAGE"),RCSTOP,RCIEN,RCRPT("excel"),RCFND)=0
+33 SET RCT("MedPost")=$NAME(^TMP("RC-MedPost",$JOB))
+34 KILL @RCT("MedPost")
+35 SET RCT("MedDecr")=$NAME(^TMP("RC-MedDecr",$JOB))
+36 KILL @RCT("MedDecr")
+37 SET RCT("RxPost")=$NAME(^TMP("RC-RxPost",$JOB))
+38 KILL @RCT("RxPost")
+39 SET RCT("RxDecr")=$NAME(^TMP("RC-RxDecr",$JOB))
+40 KILL @RCT("RxDecr")
+41 ; PRCA*4.5*349 - Add TRICARE
SET RCT("TriPost")=$NAME(^TMP("RC-TriPost",$JOB))
+42 ; PRCA*4.5*349
KILL @RCT("TriPost")
+43 ; PRCA*4.5*349
SET RCT("TriDecr")=$NAME(^TMP("RC-TriDecr",$JOB))
+44 ; PRCA*4.5*349
KILL @RCT("TriDecr")
+45 ; PRCA*4.5*345 end
+46 ; PRCA*4.5*345 - changed to M,P,T,ALL
SET RCTYPE=$$RTYPE^RCDPESPA
+47 if RCTYPE=-1
QUIT
+48 ; Save filter selection
SET RCHDR("rprtTyp")=RCTYPE
+49 ; Get date range
SET RCRPT("dtRange")=$$DTRNG
+50 if RCRPT("dtRange")=0
QUIT
+51 SET RCRPT("begDt")=$PIECE(RCRPT("dtRange"),U,2)-.1
+52 SET RCRPT("endDt")=$PIECE(RCRPT("dtRange"),U,3)+.9
+53 ; Output fields for LIST^DIC
SET RCFLDS="@;.04;.01I;.06;.03;.08;.02"
+54 ; .04 - CHANGED FIELD .01 - TIMESTAMP .06 - NEW VALUE
+55 ; .03 - CHANGED BY .08 - COMMENT .02 - MODIFIED IEN
+56 ;
+57 ; first part of LIST^DIC screening logic
+58 SET RCSCR="I ($P(^(0),U,5)=344.6)&($P(^(0),U,1)>"_RCRPT("begDt")_")&($P(^(0),U,1)<"_RCRPT("endDt")_")"
+59 ;
+60 ; output to Excel?
SET RCRPT("excel")=$$DISPTY^RCDPEM3
+61 if +RCRPT("excel")=-1
QUIT
+62 IF RCRPT("excel")
DO INFO^RCDPEM6
+63 ; Select output device
SET %ZIS="M"
DO ^%ZIS
if POP
QUIT
USE IO
+64 ;
+65 SET RCHDR("RUNDATE")=$$FMTE^XLFDT($$NOW^XLFDT,"5S")
+66 ;
+67 ; Process Auto-Post Payer Exclusions
+68 ; Get screening logic based on the type of audit report
+69 ; screening logic for medical auto-post
SET RCSCR(.06)=RCSCR_"&($P(^(0),U,4)=.06)"
+70 ; screening logic for medical auto-decrease
SET RCSCR(.07)=RCSCR_"&($P(^(0),U,4)=.07)"
+71 ; screening logic for pharmacy auto-post
SET RCSCR(.08)=RCSCR_"&($P(^(0),U,4)=.08)"
+72 ; screening logic for pharmacy auto-decrease, PRCA*4.5*345
SET RCSCR(.12)=RCSCR_"&($P(^(0),U,4)=.12)"
+73 ; PRCA*4.5*349 - screening logic for TRICARE auto-post
SET RCSCR(.13)=RCSCR_"&($P(^(0),U,4)=.13)"
+74 ; PRCA*4.5*349 - screening logic for TRICARE auto-decrease
SET RCSCR(.14)=RCSCR_"&($P(^(0),U,4)=.14)"
+75 ; Get medical Auto-Post Payer exclusions
+76 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.06),,RCT("MedDecr"),"RCDIERR")
+77 ; exit if errors
IF $DATA(RCDIERR)
Begin DoDot:1
+78 WRITE !!,"Error collecting auto-post report data."
+79 DO ASK^RCDPEARL(.RCSTOP)
End DoDot:1
QUIT
+80 ;
+81 ; Get medical Auto-Decrease Payer exclusions
+82 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.07),,RCT("MedPost"),"RCDIERR")
+83 ; exit if errors
IF $DATA(RCDIERR)
Begin DoDot:1
+84 WRITE !!,"Error collecting Payer auto-decrease report data."
+85 DO ASK^RCDPEARL(.RCSTOP)
End DoDot:1
QUIT
+86 ;
+87 ; Get the pharmacy Auto-Post Payer exclusions
+88 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.08),,RCT("RxPost"),"RCDIERR")
+89 ; exit if errors
IF $DATA(RCDIERR)
Begin DoDot:1
+90 DO ERR4USR("Pharmacy Auto-Post")
DO ASK^RCDPEARL(.RCSTOP)
End DoDot:1
QUIT
+91 ; Get pharmacy Auto-Decrease Payer exclusions
+92 ;
+93 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.12),,RCT("RxDecr"),"RCDIERR")
+94 ; exit if errors
IF $DATA(RCDIERR)
Begin DoDot:1
+95 DO ERR4USR("Pharmacy Auto-Decrease")
DO ASK^RCDPEARL(.RCSTOP)
End DoDot:1
QUIT
+96 ;
+97 ; PRCA*4.5*349 - Start modified block
+98 ; Get Tricare Auto-Post Payer exclusions
+99 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.13),,RCT("TriPost"),"RCDIERR")
+100 ; exit if errors
IF $DATA(RCDIERR)
Begin DoDot:1
+101 DO ERR4USR("Tricare Auto-Post")
DO ASK^RCDPEARL(.RCSTOP)
End DoDot:1
QUIT
+102 ;
+103 ; Tricare Auto-Decrease Payer exclusions
+104 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR(.14),,RCT("TriDecr"),"RCDIERR")
+105 ; exit if errors
IF $DATA(RCDIERR)
Begin DoDot:1
+106 DO ERR4USR("Tricare Auto-Decrease")
DO ASK^RCDPEARL(.RCSTOP)
End DoDot:1
QUIT
+107 ; PRCA*4.5*349 - End modified block
+108 ;
+109 ; Display Medical Payer exclusions
IF (RCTYPE="A")!(RCTYPE="M")
Begin DoDot:1
+110 DO OPTYPE("MedPost",.06,RCTYPE)
+111 DO OPTYPE("MedDecr",.07,RCTYPE)
End DoDot:1
if RCSTOP
GOTO RPT2Q
+112 ;
+113 ; Display pharmacy Payer exclusions
IF (RCTYPE="A")!(RCTYPE="P")
Begin DoDot:1
+114 DO OPTYPE("RxPost",.08,RCTYPE)
+115 DO OPTYPE("RxDecr",.12,RCTYPE)
End DoDot:1
if RCSTOP
GOTO RPT2Q
+116 ;
+117 ; PRCA*4.5*349 - Add TRICARE, next 3 lines
+118 ; Display TRICARE Payer exclusions
IF (RCTYPE="A")!(RCTYPE="T")
Begin DoDot:1
+119 DO OPTYPE("TriPost",.13,RCTYPE)
+120 DO OPTYPE("TriDecr",.14,RCTYPE)
End DoDot:1
if RCSTOP
GOTO RPT2Q
+121 ;
+122 ; PRCA*4.5*345 end
+123 ; end of report
+124 WRITE !!,$$ENDORPRT^RCDPEARL
+125 DO ASK^RCDPEARL(.RCSTOP)
+126 ;
RPT2Q ; exit point
+1 ; clean up ^TMP storage
SET X=""
FOR
SET X=$ORDER(RCT(X))
if X=""
QUIT
KILL @RCT(X)
+2 QUIT
+3 ;
GETPAYER() ; GET THE PAYER NAME + PAYER ID
+1 NEW RCIEN,RCPAYR
+2 SET RCIEN=$PIECE(RCTMP,U,6)
+3 IF '$DATA(^RCY(344.6,RCIEN))
QUIT ""
+4 SET RCPAYR=$$GET1^DIQ(344.6,RCIEN_",",.01)_" "_$$GET1^DIQ(344.6,RCIEN_",",.02)
+5 QUIT RCPAYR
+6 ;
HDRXAR(RCTYP,RCEXCTYP) ; Report header for auto-posting exclusion report
+1 ; Input:
+2 ; RCTYP - .06 = Auto-Posting exclusion (medical)
+3 ; .07 = Auto-Decrease exclusion (medical)
+4 ; .08 = Auto-Posting exclusion (pharmacy)
+5 ; .12 = Auto-Decrease exclusion (pharmacy)
+6 ; .13 = Auto-Posting exclusion (TRICARE)
+7 ; .14 = Auto-Decrease exclusion (TRICARE)
+8 ; RCEXCTYP - M - Medical, P - Pharmacy, T - TRICARE A - All
+9 ;
+10 NEW RCTYPED,XX
+11 SET RCTYPED=$SELECT(RCEXCTYP="M":"MEDICAL",RCEXCTYP="P":"PHARMACY",RCEXCTYP="T":"TRICARE",1:"ALL")
+12 IF RCRPT("excel")
Begin DoDot:1
+13 if RCHDR("PAGE")
QUIT
+14 ; Excel header for parameter audits
+15 WRITE !!,"TYPE^CHANGE^PAYER^TIMESTAMP^USER^COMMENT"
+16 ; only print it once
SET RCHDR("PAGE")=1
End DoDot:1
QUIT
+17 ;
+18 IF RCHDR("PAGE")
DO ASK^RCDPEARL(.RCSTOP)
if RCSTOP
QUIT
+19 WRITE @IOF
+20 SET RCHDR("PAGE")=RCHDR("PAGE")+1
+21 ; report header for parameter audits
+22 WRITE $$CNTR("EDI Lockbox Exclusion Audit Report"),?IOM-8,"Page: "_RCHDR("PAGE")
+23 WRITE !,$$CNTR("DIVISIONS: ALL")
+24 WRITE !,$$CNTR("RUN DATE: "_$GET(RCHDR("RUNDATE")))
+25 ; PRCA*4.5*349
SET XX=$$FMTE^XLFDT($PIECE(RCRPT("dtRange"),U,2),"5D")_" - "_$$FMTE^XLFDT($PIECE(RCRPT("dtRange"),U,3),"5D")
+26 ; PRCA*4.5*349 - Changed to XX to make it easier to read
WRITE !,$$CNTR("DATE RANGE: "_XX)
+27 ; PRCA*4.5*349
WRITE !,$$CNTR("REPORT TYPE: "_RCTYPED)
+28 DO SECTHDR(RCTYP,RCEXCTYP)
+29 QUIT
+30 ; PRCA*4.5*345 begin
SECTHDR(RCTYPE,RCREPT) ; SECTION HEADER
+1 ; PRCA*4.5*345 - Added Rx Auto-Decrease
+2 ; Input: RCTYP - .06 = Auto-Posting exclusion (medical)
+3 ; .07 = Auto-Decrease exclusion (medical)
+4 ; .08 = Auto-Posting exclusion (Rx)
+5 ; .12 = Auto-Decrease exclusion (Rx)
+6 ; .13 = Auto-Posting exclusion (TRICARE)
+7 ; .14 = Auto-Decrease exclusion (TRICARE)
+8 ; RCREPT - M - Medical, P - Pharmacy, T - TRICARE A - All
+9 if $GET(RCRPT("excel"))
QUIT
+10 IF RCTYPE=.06
DO TXPEQLS("MEDICAL AUTO-POSTING PAYER EXCLUSION LIST")
+11 IF RCTYPE=.07
DO TXPEQLS("MEDICAL AUTO-DECREASE PAYER EXCLUSION LIST")
+12 IF RCTYPE=.08
DO TXPEQLS("PHARMACY AUTO-POSTING PAYER EXCLUSION LIST")
+13 IF RCTYPE=.12
DO TXPEQLS("PHARMACY AUTO-DECREASE PAYER EXCLUSION LIST")
+14 ; PRCA*4.5*349
IF RCTYPE=.13
DO TXPEQLS("TRICARE AUTO-POSTING PAYER EXCLUSION LIST")
+15 ; PRCA*4.5*349
IF RCTYPE=.14
DO TXPEQLS("TRICARE AUTO-DECREASE PAYER EXCLUSION LIST")
+16 ;
+17 WRITE !,"Change Payer Date/Time Edited User"
+18 ; row of equal signs
WRITE !,$$EQLSGNS(IOM-1)
+19 QUIT
+20 ;
TXPEQLS(Y) ; write text in Y then row of equal signs
+1 ; must have text
if $GET(Y)=""
QUIT
+2 WRITE !!,Y,!,$$EQLSGNS($LENGTH(Y))
QUIT
+3 ;
EQLSGNS(N) ; row of N equal signs
QUIT $SELECT($GET(N)>0:$TRANSLATE($JUSTIFY("",N)," ","="),1:"")
+1 ;
ERR4USR(TXT) ; error message display
+1 WRITE !!,"Error collecting "_$GET(TXT)_" report data."
QUIT
+2 ; PRCA*4.5*345 end
CNTR(TXT) ; center TXT
+1 QUIT $JUSTIFY("",IOM-$LENGTH(TXT)\2)_TXT
+2 ;
DTRNG() ; function, returns date range for the report
+1 NEW DIR,DUOUT,RNGFLG,X,Y,RCSTART,RCEND
+2 SET (RCSTART,RCEND)=0
DO DATES(.RCSTART,.RCEND)
+3 if RCSTART=-1
QUIT 0
+4 if RCSTART
QUIT "1^"_RCSTART_"^"_RCEND
+5 if 'RCSTART
QUIT "0^^"
+6 QUIT 0
+7 ;
DATES(BDATE,EDATE) ; Get a date range, both values passed by ref.
+1 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+2 SET (BDATE,EDATE)=0
+3 SET DIR("?")="Enter the earliest AUDIT DATE to include on the report"
+4 SET DIR(0)="DAO^:"_DT_":APE"
SET DIR("A")="Report start date: "
+5 DO ^DIR
+6 KILL DIR
+7 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET BDATE=-1
QUIT
+8 SET BDATE=Y
KILL DIR,X,Y
+9 SET DIR("?")="Enter the latest AUDIT DATE to include on the report"
+10 SET DIR(0)="DAO^"_BDATE_":"_DT_":APE"
SET DIR("A")="Report end date: "
SET DIR("B")=$$FMTE^XLFDT(DT)
+11 DO ^DIR
+12 KILL DIR
+13 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET BDATE=-1
QUIT
+14 SET EDATE=Y
+15 QUIT
+16 ;
DSPXCLSN(RCX) ; display exclusion
+1 ; RCX - exclusion value from ^DIC call
+2 NEW RCXCLSN
+3 SET RCXCLSN("CHANGE")=$SELECT($PIECE(RCX,U,3):"Added",1:"Removed")
+4 SET RCXCLSN("TIME")=$$FMTE^XLFDT($PIECE(RCX,U,2),"2")
+5 SET RCXCLSN("USER")=$PIECE(RCX,U,4)
+6 SET RCXCLSN("PAYER")=$$GETPAYER
+7 SET RCXCLSN("COMMENT")=$PIECE(RCX,U,5)
+8 ;
+9 IF 'RCRPT("excel")
Begin DoDot:1
+10 NEW Y
SET Y=RCXCLSN("CHANGE")
SET $EXTRACT(Y,9)=$EXTRACT(RCXCLSN("PAYER"),1,30)
SET $EXTRACT(Y,41)=" "_RCXCLSN("TIME")
SET Y=Y_" "_RCXCLSN("USER")
+11 WRITE !,Y,!," Comment: "_RCXCLSN("COMMENT")
End DoDot:1
QUIT
+12 ; Excel format
+13 SET RCXCLSN("LABEL")=$$GET1^DID(344.6,$PIECE(RCX,U,1),,"LABEL")
+14 WRITE !,RCXCLSN("LABEL")_U_RCXCLSN("CHANGE")_U_RCXCLSN("PAYER")_U_RCXCLSN("TIME")_U_RCXCLSN("USER")_U_RCXCLSN("COMMENT")
+15 ;
+16 QUIT
+17 ;
+18 ;Retrieve the parameter for the type of information to display
RTYPE(DEF) ;EP from RCDPEAA1
+1 ; Input: DEF - Value to use a default
+2 ; Returns: -1 - User ^ or timed out
+3 ; M - User selected MEDICAL
+4 ; P - User selected PHARMACY
+5 ; T - User selected TRICARE
+6 ; A - User selected ALL
+7 ;
+8 NEW DA,DIR,DTOUT,DUOUT,X,Y,DIRUT,DIROUT,RCTYPE
+9 SET RCTYPE=""
+10 SET DIR("?")="Enter the type of information to display on the report"
+11 SET DIR(0)="SA^M:MEDICAL;P:PHARMACY;T:TRICARE;A:ALL"
+12 SET DIR("A")="(M)EDICAL, (P)HARMACY, (T)RICARE or (A)LL: "
+13 SET DIR("B")=$SELECT($GET(DEF)'="":DEF,1:"ALL")
+14 DO ^DIR
+15 KILL DIR
+16 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT -1
+17 if Y=""
QUIT "A"
+18 QUIT $EXTRACT(Y)
+19 ;
+20 ;Check to see if the Data element matches the report type
RPTYPE(RCTYPE,RCPARAM) ;
+1 ; Return 1 if valid to print, 0 otherwise
+2 NEW RCDATA,RCMEN,RCREN
+3 ;
+4 SET (RCMEN,RCREN)=""
+5 ; Get Auto Decrease parameters
+6 IF RCTYPE="M"
SET RCMEN=$PIECE($GET(^RCY(344.61,1,0)),U,3)
+7 IF RCTYPE="P"
SET RCREN=$PIECE($GET(^RCY(344.61,1,1)),U,2)
+8 ;
+9 if RCTYPE="B"
QUIT 1
+10 ; Medical Parameters
if (RCTYPE="M")&(RCPARAM["MED")
QUIT 1
+11 ; Pharmacy parameters
if (RCTYPE="P")&(RCPARAM["RX")
QUIT 1
+12 ; Pharmacy parameters
if (RCTYPE="P")&(RCPARAM["PHARM")
QUIT 1
+13 ; Auto-decrease for med is on
if (RCTYPE="M")&(RCMEN)&(RCPARAM["DECREASE")
QUIT 1
+14 ; Auto-decrease for pharmacy
if (RCTYPE="P")&(RCREN)&(RCPARAM["DECREASE")
QUIT 1
+15 QUIT 0
+16 ;
OPTYPE(SUB,FIELD,RCTYPE) ; Output data for each type
+1 ; Input: SUB - Subscript to array that contain the data for this type
+2 ; FIELD - Changed field from field 4 file 344.7
+3 ; RCTYPE - M - Medical, P - Pharmacy, T - Tricare, A - All
+4 ; complete header
DO HDRXAR(FIELD,RCTYPE)
+5 ; check for payer exclusions
SET RCFND=$DATA(@RCT(SUB)@("DILIST",1))
+6 ;
IF 'RCFND
Begin DoDot:1
+7 WRITE !,"No "
+8 IF FIELD=.06
WRITE "Medical Auto-Post"
+9 IF FIELD=.07
WRITE "Medical Auto-Decrease"
+10 IF FIELD=.08
WRITE "Pharmacy Auto-Post"
+11 IF FIELD=.12
WRITE "Pharmacy Auto-Decrease"
+12 IF FIELD=.13
WRITE "Pharmacy Auto-Post"
+13 IF FIELD=.14
WRITE "Pharmacy Auto-Decrease"
+14 WRITE " Exclusions to Display",!
End DoDot:1
+15 ; Display medical Auto-post Payer exclusions
IF RCFND
Begin DoDot:1
+16 SET RCIEN=0
SET RCSTOP=0
+17 FOR
SET RCIEN=$ORDER(@RCT(SUB)@("DILIST",RCIEN))
if RCSTOP!('RCIEN)
QUIT
Begin DoDot:2
+18 SET RCTMP=$PIECE(@RCT(SUB)@("DILIST",RCIEN,0),U,2,7)
+19 IF $Y+4>IOSL
DO HDRXAR(FIELD,RCTYPE)
if RCSTOP
QUIT
+20 DO DSPXCLSN(RCTMP)
End DoDot:2
End DoDot:1
+21 QUIT