RCDPESPA ;OICO/HRUBOVCAK - ePayment Lockbox Parameter Audit Report ;29 Jan 2019 18:00:14
;;4.5;Accounts Receivable;**332,345,349,424**;Oct 11, 2018;Build 11
;Per VA Directive 6402, this routine should not be modified.
;
Q
;
AUDPARM ;EP from RCDPESP2
; EDI Lockbox Parameters Audit Report [RCDPE PARAMETER AUDIT REPORT]
; Report logic moved from RCDPESP2, 11 October 2018
; Report displays the RCDPE PARAMETER AUDIT file (#344.7)
; and changes to the RCDPE PARAMETER file (#344.61)
;
; ^TMP($T(+0)_"-AUD",$J) - storage for LIST^DIC
; ^TMP($J,"RCLABEL") - field labels from $$GET1^DID
; RCDIERR - Errors from LIST^DIC
; RCDIGET - ^TMP storage for LIST^DIC A1^A2^...^An Where:
; A1 - Field of the parameter that was changed
; A2 - Timestamp when the changed occurred (internal)
; A3 - Old value of the parameter
; A4 - New value of the parameter
; A5 - User who made the change
; A6 - File of the changed parameter
; A7 - IEN of the changed value
; RCFLDS - Fields for LIST^DIC
; RCPARAM - Changed parameter
; RCPARAM("dt&tm") - Date and time parameter changed
; RCPARAM("file") - File number
; RCPARAM("fld") - Field number
; RCPARAM("newVal") - New parameter value
; RCPARAM("oldVal") - Old parameter value
; RCPARAM("usr") - User who changed parameter
; RCRPRT("begDate") - Report start date
; RCRPRT("endDate") - Report end date
; RCRPRT("eXcel") - Flag, output to Excel?
; RCRPRT("hdrDate") - Date/time report was run
; RCRPRT("hdrPg#") - Page counter
; RCRPRT("hdrTyp") - Type to display in header
; RCRPRT("pgLns") - Line count for page (or screen)
; RCRPRT("typRprt") - Type of report (Medical, Pharmacy, or Both)
; RCRPRT("cntr") - Count of records output
; RCSCR - Screening logic for LIST^DIC
; RCSTOP - Flag, stop displaying report
; RCTMP - One line from LIST^DIC
;
N %ZIS,POP,RCDIERR,RCDIGET,RCFLDS,RCIEN,RCPARAM,RCRPRT,RCSCR,RCSTOP,RCTMP,X,XX,Y
W !!,"EDI Lockbox Parameters Audit Report",!
;
; Set up FileMan storage location
S RCDIGET=$NA(^TMP($T(+0)_"-AUD",$J))
K @RCDIGET,^TMP($J,"RCLABEL")
;
; Initialize to zero
S (RCSTOP,RCRPRT("hdrPg#"),RCRPRT("eXcel"),RCRPRT("cntr"),RCRPRT("pgLns"))=0
; Retrieve report type (Medical, Pharmacy, or All)
S RCRPRT("typRprt")=$$RTYPE("A") ; PRCA*4.5*349
Q:RCRPRT("typRprt")=-1 ; User '^' or timed out
;
; Type for header, PRCA*4.5*345
S XX=RCRPRT("typRprt") ; PRCA*4.5*349 - Added line
S RCRPRT("hdrTyp")=$S(XX="M":"Medical",XX="P":"Pharmacy",XX="T":"TRICARE",1:"All")
S Y("dtRange")=$$DTRNG ; date range for report
Q:Y("dtRange")=0 ; No date range selected
;
S RCRPRT("begDate")=$P(Y("dtRange"),U,2)
S RCRPRT("endDate")=$P(Y("dtRange"),U,3)
K Y
S RCRPRT("eXcel")=$$DISPTY^RCDPEM3 ; Export to excel?
Q:+RCRPRT("eXcel")=-1 ; User '^' or timed out
I RCRPRT("eXcel") D INFO^RCDPEM6 ; Display capture information for Excel
S %ZIS="M"
D ^%ZIS ; Select output device
Q:POP
U IO
;
S RCRPRT("hdrDate")=$$FMTE^XLFDT($$NOW^XLFDT,"5S")
S RCRPRT("dtRange")=$$FMTE^XLFDT(RCRPRT("begDate"),"5D")_" - "_$$FMTE^XLFDT(RCRPRT("endDate"),"5D")
S RCRPRT("endDate")=RCRPRT("endDate")+.5
S RCSCR="I ($P(^(0),U)'<"_RCRPRT("begDate")_")&($P(^(0),U)'>"_RCRPRT("endDate")_")"
S RCFLDS="@;.04;.01I;.07;.06;.03;.05I;.02"
D LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR,,RCDIGET,"RCDIERR")
I $D(RCDIERR) D Q
. W !!,"FileMan error when collecting report data."
. D ASK^RCDPEARL
;
; No changes found for date range
I '$D(@RCDIGET@("DILIST",1)) D RPTEND Q
;
; PRCA*4.5*349 - Next 3 lines, get Auto-Decrease paid parameters
S RCRPRT("medAuto")=$$GET1^DIQ(344.61,"1,",.03,"I") ; (#.03) AUTO-DECREASE MED ENABLED
S RCRPRT("rxAuto")=$$GET1^DIQ(344.61,"1,",1.02,"I") ; (#1.02) AUTO-DECREASE RX ENABLED
S RCRPRT("triAuto")=$$GET1^DIQ(344.61,"1,",1.06,"I") ; (#.03) AUTO-DECREASE TRI ENABLED
; Loop though changes from #344.7
S RCIEN=0 F S RCIEN=$O(@RCDIGET@("DILIST",RCIEN)) Q:RCSTOP!'RCIEN D
. I 'RCRPRT("hdrPg#") D ;
. . D HDRLPR(.RCRPRT,.RCSTOP)
. . S RCRPRT("pgLns")=9 ; page header
. Q:RCSTOP
. K RCPARAM
. S RCTMP=$P(@RCDIGET@("DILIST",RCIEN,0),U,2,8)
. S RCPARAM("file")=$P(RCTMP,U,6)
. Q:RCPARAM("file")=344.6 ; Excluded payers reported elsewhere
. S RCPARAM("fld")=$P(RCTMP,U,1) ; PRCA*4.5*326
. ; Store Parameter labels in ^TMP to avoid redundant FileMan calls
. I '$D(^TMP($J,"RCLABEL",RCPARAM("file"),RCPARAM("fld"))) D
. . S X=$$GET1^DID(RCPARAM("file"),RCPARAM("fld"),,"LABEL")
. . S ^TMP($J,"RCLABEL",RCPARAM("file"),RCPARAM("fld"))=X
. ; if not both types, verify field should be printed
. S RCPARAM=^TMP($J,"RCLABEL",RCPARAM("file"),RCPARAM("fld"))
. I '(RCRPRT("typRprt")="A") Q:'$$TYPMTCH(.RCRPRT,.RCPARAM) ; PRCA*4.5*349 change "B" tp "A"
. S RCRPRT("cntr")=RCRPRT("cntr")+1 ; Count records listed
. ; next 2 lines PRCA*4.5*326
. I RCPARAM("file")=344.61,RCPARAM("fld")=.11 S RCPARAM="AUTO-DECREASE MED NOPAY ENABLED"
. I RCPARAM("file")=344.61,RCPARAM("fld")=.12 S RCPARAM="AUTO-DECREASE MED DAYS (NO-PAY)"
. S X=$P(RCTMP,U,2) ; Timestamp
. S RCPARAM("dt&tm")=$S(RCRPRT("eXcel"):$TR($$FMTE^XLFDT(X),"@"," "),1:$$FMTE^XLFDT(X,"2SZ"))
. S RCPARAM("usr")=$P(RCTMP,U,5)
. S RCPARAM("oldVal")=$P(RCTMP,U,3)
. S RCPARAM("newVal")=$P(RCTMP,U,4)
. I RCPARAM("file")=344.62 D ; file 344.62, format CARC code
. . S Y="" I (RCPARAM("fld")>.01)&(RCPARAM("fld")<2) S Y="MED "
. . I RCPARAM["PHARM",(RCPARAM("fld")>2)&(RCPARAM("fld")<3) D
. . . Q:$E(RCPARAM,1,5)="PHARM"
. . . N F,J S F=$F(RCPARAM,"PHARM "),J=$E(RCPARAM,1,F-7)_$E(RCPARAM,F,$L(RCPARAM))
. . . S RCPARAM("oldParam")=RCPARAM,RCPARAM=J,Y="PHARM "
. . S X=" ("_$S($P(RCTMP,U,7)'="":$P($G(^RCY(344.62,$P(RCTMP,U,7),0)),U),1:"ERR")_")" ; CARC code in parentheses
. . S RCPARAM=Y_RCPARAM_X
. ; format Boolean values, only if non-null
. I RCPARAM("file")=342 D:"^7.05^7.06^7.07^7.08^7.09^"[(U_RCPARAM("fld")_U) YESNO(.RCPARAM,RCTMP)
. I RCPARAM("file")=344.61 D:"^.02^.03^.11^1.01^1.02^1.11^"[(U_RCPARAM("fld")_U) YESNO(.RCPARAM,RCTMP) ; PRCA*4.5*424 add 1.11
. ; PRCA*4.5*349 - Next line add 3.01 and 3.07 for TRICARE
. I RCPARAM("file")=344.62 D:"^.02^.08^2.01^3.01^3.07^"[(U_RCPARAM("fld")_U) YESNO(.RCPARAM,RCTMP)
. ;
. F Y="oldVal","newVal" S:'$L(RCPARAM(Y)) RCPARAM(Y)="-" ; if null set to hyphen
. I RCRPRT("eXcel") D Q ; no formatting needed
. . W !,RCPARAM_U_RCPARAM("dt&tm")_U_RCPARAM("oldVal")_U_RCPARAM("newVal")_U_RCPARAM("usr")
. ;
. S Y=$$PAD(RCPARAM,38)_$$PAD(RCPARAM("dt&tm"),19)_$$PAD(RCPARAM("oldVal"),5)_$$PAD(RCPARAM("newVal"),5)_RCPARAM("usr")
. W !,$E(Y,1,IOM) S RCRPRT("pgLns")=RCRPRT("pgLns")+1
. I '(RCRPRT("pgLns")<(IOSL-2)) D HDRLPR(.RCRPRT,.RCSTOP) Q:RCSTOP S RCRPRT("pgLns")=9
;
RPTEND ; end of report
I 'RCSTOP,'RCRPRT("cntr") D
. D HDRLPR(.RCRPRT,.RCSTOP)
. W !," * No PARAMETER AUDIT entries to report. *",!
;
I 'RCSTOP W !!,$$ENDORPRT^RCDPEARL,!
U IO(0) D ^%ZISC
I 'RCSTOP,'$G(ZTSK),($E(IOST,1,2)="C-") D ; Must have user
. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
. S DIR("A")="Press enter to continue: "
. S DIR(0)="EA" D ^DIR
;
K @RCDIGET,^TMP($J,"RCLABEL") ; Clean up
Q
;
HDRLPR(RCRPRT,RCSTOP) ; Report header Lockbox Parameter Report
; Input: RCRPRT("eXcel") - If true output for Excel
; RCRPRT("hdrPg#") - Current Page count
; RCSTOP - Report exit flag
; RCRPRT("dtRange") - Selected Date Range
; RCRPRT("typRprt") - Type of report to run
; Output: RCRPRT("hdrPg#") - Updated Page count
I RCRPRT("eXcel") D Q ; Excel header for PARAMETER AUDITS
. Q:RCRPRT("hdrPg#")
. W !,"PARAMETER^DATE/TIME EDITED^OLD VALUE^NEW VALUE^USER"
. S RCRPRT("hdrPg#")=1 ; only print once
;
I 'RCRPRT("eXcel") D
. I RCRPRT("hdrPg#") D ASK^RCDPEARL(.RCSTOP) Q:RCSTOP
. W @IOF
. S RCRPRT("hdrPg#")=RCRPRT("hdrPg#")+1
. W $$CNTR("EDI Lockbox Parameter Audit Report"),?IOM-8,"Page: "_RCRPRT("hdrPg#")
. W !,$$CNTR("RUN DATE: "_RCRPRT("hdrDate"))
. W !,$$CNTR("DATE RANGE: "_RCRPRT("dtRange"))
. W !,$$CNTR("REPORT TYPE: "_RCRPRT("hdrTyp"))
. W !!,"LOCKBOX PARAMETER UPDATES"
. W !,"-------------------------- Values"
. W !,"Parameter Date/Time Edited Old New User"
. W !,$TR($J("",IOM-1)," ","=") ; row of equal signs
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
;
;
CNTR(TXT) ; center TXT
Q $J("",IOM-$L(TXT)\2)_TXT
;
DTRNG() ; function, returns date range for the report
N RCEND,RCSTART
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,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
;
RTYPE(DEF) ; EP from RCDPESP2, RCDPESP1
; Type of information to display
; Input: DEF - default value
; Returns:
; ; *future build*, add Tricare, change 'Both' to 'All'
; M - Medical, P - Pharmacy, T - Tricare, A - All, -1 - ^ or timed out
N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
S DIR("?")="Enter the type of information to display on the report."
S DIR(0)="SA^M:Medical;P:Pharmacy;T:TRICARE;A:All" ; PRCA*4.5*349
S DIR("A")="(M)edical, (P)harmacy, (T)RICARE or (A)ll: " ; PRCA*4.5*349
S DIR("B")=$S($G(DEF)'="":DEF,1:"All") ; PRCA*4.5*349
D ^DIR
K DIR
I $D(DTOUT)!$D(DUOUT) Q -1
S:Y="" Y="A"
Q $E(Y)
;
TYPMTCH(RCRPRT,RCPARAM) ; function, print changed parameter?
; Input passed by ref:
; RCRPRT("typRprt") - Report filter
; RCPARAM - values for the changed parameter
; Returns: 1 if valid to print, 0 otherwise
N OK2PRNT S OK2PRNT=0
I RCRPRT("typRprt")="M" D ; Medical Parameters
. I RCPARAM["MED" S OK2PRNT=1 Q
. I RCPARAM("file")=344.62,(RCPARAM("fld")>.01)&(RCPARAM("fld")<2) S OK2PRNT=1
;
I RCRPRT("typRprt")="P" D ; Pharmacy parameters
. I (RCPARAM["RX")!(RCPARAM["PHARM") S OK2PRNT=1 Q
. I RCPARAM("file")=344.62,(RCPARAM("fld")>2)&(RCPARAM("fld")<3) S OK2PRNT=1
;
I RCRPRT("typRprt")="T",(RCPARAM["TRICARE") S OK2PRNT=1 ; PRCA*4.5*349 - TRICARE Parameters
Q OK2PRNT
;
PAD(A,N) ; pad A with N spaces
S A=A_" " ; always add 1 space
Q:'($L(A)<N) A ; no padding needed
Q A_$J("",N-$L(A))
;
YESNO(RCPARAM,Y) ; Yes/No text, RCPARAM passed by ref., Y=RCTMP
S:$L(RCPARAM("oldVal")) RCPARAM("oldVal")=$S($P(Y,U,3):"Yes",1:"No")
S:$L(RCPARAM("newVal")) RCPARAM("newVal")=$S($P(Y,U,4):"Yes",1:"No")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPESPA 11284 printed Nov 22, 2024@16:55:31 Page 2
RCDPESPA ;OICO/HRUBOVCAK - ePayment Lockbox Parameter Audit Report ;29 Jan 2019 18:00:14
+1 ;;4.5;Accounts Receivable;**332,345,349,424**;Oct 11, 2018;Build 11
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
AUDPARM ;EP from RCDPESP2
+1 ; EDI Lockbox Parameters Audit Report [RCDPE PARAMETER AUDIT REPORT]
+2 ; Report logic moved from RCDPESP2, 11 October 2018
+3 ; Report displays the RCDPE PARAMETER AUDIT file (#344.7)
+4 ; and changes to the RCDPE PARAMETER file (#344.61)
+5 ;
+6 ; ^TMP($T(+0)_"-AUD",$J) - storage for LIST^DIC
+7 ; ^TMP($J,"RCLABEL") - field labels from $$GET1^DID
+8 ; RCDIERR - Errors from LIST^DIC
+9 ; RCDIGET - ^TMP storage for LIST^DIC A1^A2^...^An Where:
+10 ; A1 - Field of the parameter that was changed
+11 ; A2 - Timestamp when the changed occurred (internal)
+12 ; A3 - Old value of the parameter
+13 ; A4 - New value of the parameter
+14 ; A5 - User who made the change
+15 ; A6 - File of the changed parameter
+16 ; A7 - IEN of the changed value
+17 ; RCFLDS - Fields for LIST^DIC
+18 ; RCPARAM - Changed parameter
+19 ; RCPARAM("dt&tm") - Date and time parameter changed
+20 ; RCPARAM("file") - File number
+21 ; RCPARAM("fld") - Field number
+22 ; RCPARAM("newVal") - New parameter value
+23 ; RCPARAM("oldVal") - Old parameter value
+24 ; RCPARAM("usr") - User who changed parameter
+25 ; RCRPRT("begDate") - Report start date
+26 ; RCRPRT("endDate") - Report end date
+27 ; RCRPRT("eXcel") - Flag, output to Excel?
+28 ; RCRPRT("hdrDate") - Date/time report was run
+29 ; RCRPRT("hdrPg#") - Page counter
+30 ; RCRPRT("hdrTyp") - Type to display in header
+31 ; RCRPRT("pgLns") - Line count for page (or screen)
+32 ; RCRPRT("typRprt") - Type of report (Medical, Pharmacy, or Both)
+33 ; RCRPRT("cntr") - Count of records output
+34 ; RCSCR - Screening logic for LIST^DIC
+35 ; RCSTOP - Flag, stop displaying report
+36 ; RCTMP - One line from LIST^DIC
+37 ;
+38 NEW %ZIS,POP,RCDIERR,RCDIGET,RCFLDS,RCIEN,RCPARAM,RCRPRT,RCSCR,RCSTOP,RCTMP,X,XX,Y
+39 WRITE !!,"EDI Lockbox Parameters Audit Report",!
+40 ;
+41 ; Set up FileMan storage location
+42 SET RCDIGET=$NAME(^TMP($TEXT(+0)_"-AUD",$JOB))
+43 KILL @RCDIGET,^TMP($JOB,"RCLABEL")
+44 ;
+45 ; Initialize to zero
+46 SET (RCSTOP,RCRPRT("hdrPg#"),RCRPRT("eXcel"),RCRPRT("cntr"),RCRPRT("pgLns"))=0
+47 ; Retrieve report type (Medical, Pharmacy, or All)
+48 ; PRCA*4.5*349
SET RCRPRT("typRprt")=$$RTYPE("A")
+49 ; User '^' or timed out
if RCRPRT("typRprt")=-1
QUIT
+50 ;
+51 ; Type for header, PRCA*4.5*345
+52 ; PRCA*4.5*349 - Added line
SET XX=RCRPRT("typRprt")
+53 SET RCRPRT("hdrTyp")=$SELECT(XX="M":"Medical",XX="P":"Pharmacy",XX="T":"TRICARE",1:"All")
+54 ; date range for report
SET Y("dtRange")=$$DTRNG
+55 ; No date range selected
if Y("dtRange")=0
QUIT
+56 ;
+57 SET RCRPRT("begDate")=$PIECE(Y("dtRange"),U,2)
+58 SET RCRPRT("endDate")=$PIECE(Y("dtRange"),U,3)
+59 KILL Y
+60 ; Export to excel?
SET RCRPRT("eXcel")=$$DISPTY^RCDPEM3
+61 ; User '^' or timed out
if +RCRPRT("eXcel")=-1
QUIT
+62 ; Display capture information for Excel
IF RCRPRT("eXcel")
DO INFO^RCDPEM6
+63 SET %ZIS="M"
+64 ; Select output device
DO ^%ZIS
+65 if POP
QUIT
+66 USE IO
+67 ;
+68 SET RCRPRT("hdrDate")=$$FMTE^XLFDT($$NOW^XLFDT,"5S")
+69 SET RCRPRT("dtRange")=$$FMTE^XLFDT(RCRPRT("begDate"),"5D")_" - "_$$FMTE^XLFDT(RCRPRT("endDate"),"5D")
+70 SET RCRPRT("endDate")=RCRPRT("endDate")+.5
+71 SET RCSCR="I ($P(^(0),U)'<"_RCRPRT("begDate")_")&($P(^(0),U)'>"_RCRPRT("endDate")_")"
+72 SET RCFLDS="@;.04;.01I;.07;.06;.03;.05I;.02"
+73 DO LIST^DIC(344.7,,RCFLDS,"P",,,,,RCSCR,,RCDIGET,"RCDIERR")
+74 IF $DATA(RCDIERR)
Begin DoDot:1
+75 WRITE !!,"FileMan error when collecting report data."
+76 DO ASK^RCDPEARL
End DoDot:1
QUIT
+77 ;
+78 ; No changes found for date range
+79 IF '$DATA(@RCDIGET@("DILIST",1))
DO RPTEND
QUIT
+80 ;
+81 ; PRCA*4.5*349 - Next 3 lines, get Auto-Decrease paid parameters
+82 ; (#.03) AUTO-DECREASE MED ENABLED
SET RCRPRT("medAuto")=$$GET1^DIQ(344.61,"1,",.03,"I")
+83 ; (#1.02) AUTO-DECREASE RX ENABLED
SET RCRPRT("rxAuto")=$$GET1^DIQ(344.61,"1,",1.02,"I")
+84 ; (#.03) AUTO-DECREASE TRI ENABLED
SET RCRPRT("triAuto")=$$GET1^DIQ(344.61,"1,",1.06,"I")
+85 ; Loop though changes from #344.7
+86 SET RCIEN=0
FOR
SET RCIEN=$ORDER(@RCDIGET@("DILIST",RCIEN))
if RCSTOP!'RCIEN
QUIT
Begin DoDot:1
+87 ;
IF 'RCRPRT("hdrPg#")
Begin DoDot:2
+88 DO HDRLPR(.RCRPRT,.RCSTOP)
+89 ; page header
SET RCRPRT("pgLns")=9
End DoDot:2
+90 if RCSTOP
QUIT
+91 KILL RCPARAM
+92 SET RCTMP=$PIECE(@RCDIGET@("DILIST",RCIEN,0),U,2,8)
+93 SET RCPARAM("file")=$PIECE(RCTMP,U,6)
+94 ; Excluded payers reported elsewhere
if RCPARAM("file")=344.6
QUIT
+95 ; PRCA*4.5*326
SET RCPARAM("fld")=$PIECE(RCTMP,U,1)
+96 ; Store Parameter labels in ^TMP to avoid redundant FileMan calls
+97 IF '$DATA(^TMP($JOB,"RCLABEL",RCPARAM("file"),RCPARAM("fld")))
Begin DoDot:2
+98 SET X=$$GET1^DID(RCPARAM("file"),RCPARAM("fld"),,"LABEL")
+99 SET ^TMP($JOB,"RCLABEL",RCPARAM("file"),RCPARAM("fld"))=X
End DoDot:2
+100 ; if not both types, verify field should be printed
+101 SET RCPARAM=^TMP($JOB,"RCLABEL",RCPARAM("file"),RCPARAM("fld"))
+102 ; PRCA*4.5*349 change "B" tp "A"
IF '(RCRPRT("typRprt")="A")
if '$$TYPMTCH(.RCRPRT,.RCPARAM)
QUIT
+103 ; Count records listed
SET RCRPRT("cntr")=RCRPRT("cntr")+1
+104 ; next 2 lines PRCA*4.5*326
+105 IF RCPARAM("file")=344.61
IF RCPARAM("fld")=.11
SET RCPARAM="AUTO-DECREASE MED NOPAY ENABLED"
+106 IF RCPARAM("file")=344.61
IF RCPARAM("fld")=.12
SET RCPARAM="AUTO-DECREASE MED DAYS (NO-PAY)"
+107 ; Timestamp
SET X=$PIECE(RCTMP,U,2)
+108 SET RCPARAM("dt&tm")=$SELECT(RCRPRT("eXcel"):$TRANSLATE($$FMTE^XLFDT(X),"@"," "),1:$$FMTE^XLFDT(X,"2SZ"))
+109 SET RCPARAM("usr")=$PIECE(RCTMP,U,5)
+110 SET RCPARAM("oldVal")=$PIECE(RCTMP,U,3)
+111 SET RCPARAM("newVal")=$PIECE(RCTMP,U,4)
+112 ; file 344.62, format CARC code
IF RCPARAM("file")=344.62
Begin DoDot:2
+113 SET Y=""
IF (RCPARAM("fld")>.01)&(RCPARAM("fld")<2)
SET Y="MED "
+114 IF RCPARAM["PHARM"
IF (RCPARAM("fld")>2)&(RCPARAM("fld")<3)
Begin DoDot:3
+115 if $EXTRACT(RCPARAM,1,5)="PHARM"
QUIT
+116 NEW F,J
SET F=$FIND(RCPARAM,"PHARM ")
SET J=$EXTRACT(RCPARAM,1,F-7)_$EXTRACT(RCPARAM,F,$LENGTH(RCPARAM))
+117 SET RCPARAM("oldParam")=RCPARAM
SET RCPARAM=J
SET Y="PHARM "
End DoDot:3
+118 ; CARC code in parentheses
SET X=" ("_$SELECT($PIECE(RCTMP,U,7)'="":$PIECE($GET(^RCY(344.62,$PIECE(RCTMP,U,7),0)),U),1:"ERR")_")"
+119 SET RCPARAM=Y_RCPARAM_X
End DoDot:2
+120 ; format Boolean values, only if non-null
+121 IF RCPARAM("file")=342
if "^7.05^7.06^7.07^7.08^7.09^"[(U_RCPARAM("fld")_U)
DO YESNO(.RCPARAM,RCTMP)
+122 ; PRCA*4.5*424 add 1.11
IF RCPARAM("file")=344.61
if "^.02^.03^.11^1.01^1.02^1.11^"[(U_RCPARAM("fld")_U)
DO YESNO(.RCPARAM,RCTMP)
+123 ; PRCA*4.5*349 - Next line add 3.01 and 3.07 for TRICARE
+124 IF RCPARAM("file")=344.62
if "^.02^.08^2.01^3.01^3.07^"[(U_RCPARAM("fld")_U)
DO YESNO(.RCPARAM,RCTMP)
+125 ;
+126 ; if null set to hyphen
FOR Y="oldVal","newVal"
if '$LENGTH(RCPARAM(Y))
SET RCPARAM(Y)="-"
+127 ; no formatting needed
IF RCRPRT("eXcel")
Begin DoDot:2
+128 WRITE !,RCPARAM_U_RCPARAM("dt&tm")_U_RCPARAM("oldVal")_U_RCPARAM("newVal")_U_RCPARAM("usr")
End DoDot:2
QUIT
+129 ;
+130 SET Y=$$PAD(RCPARAM,38)_$$PAD(RCPARAM("dt&tm"),19)_$$PAD(RCPARAM("oldVal"),5)_$$PAD(RCPARAM("newVal"),5)_RCPARAM("usr")
+131 WRITE !,$EXTRACT(Y,1,IOM)
SET RCRPRT("pgLns")=RCRPRT("pgLns")+1
+132 IF '(RCRPRT("pgLns")<(IOSL-2))
DO HDRLPR(.RCRPRT,.RCSTOP)
if RCSTOP
QUIT
SET RCRPRT("pgLns")=9
End DoDot:1
+133 ;
RPTEND ; end of report
+1 IF 'RCSTOP
IF 'RCRPRT("cntr")
Begin DoDot:1
+2 DO HDRLPR(.RCRPRT,.RCSTOP)
+3 WRITE !," * No PARAMETER AUDIT entries to report. *",!
End DoDot:1
+4 ;
+5 IF 'RCSTOP
WRITE !!,$$ENDORPRT^RCDPEARL,!
+6 USE IO(0)
DO ^%ZISC
+7 ; Must have user
IF 'RCSTOP
IF '$GET(ZTSK)
IF ($EXTRACT(IOST,1,2)="C-")
Begin DoDot:1
+8 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+9 SET DIR("A")="Press enter to continue: "
+10 SET DIR(0)="EA"
DO ^DIR
End DoDot:1
+11 ;
+12 ; Clean up
KILL @RCDIGET,^TMP($JOB,"RCLABEL")
+13 QUIT
+14 ;
HDRLPR(RCRPRT,RCSTOP) ; Report header Lockbox Parameter Report
+1 ; Input: RCRPRT("eXcel") - If true output for Excel
+2 ; RCRPRT("hdrPg#") - Current Page count
+3 ; RCSTOP - Report exit flag
+4 ; RCRPRT("dtRange") - Selected Date Range
+5 ; RCRPRT("typRprt") - Type of report to run
+6 ; Output: RCRPRT("hdrPg#") - Updated Page count
+7 ; Excel header for PARAMETER AUDITS
IF RCRPRT("eXcel")
Begin DoDot:1
+8 if RCRPRT("hdrPg#")
QUIT
+9 WRITE !,"PARAMETER^DATE/TIME EDITED^OLD VALUE^NEW VALUE^USER"
+10 ; only print once
SET RCRPRT("hdrPg#")=1
End DoDot:1
QUIT
+11 ;
+12 IF 'RCRPRT("eXcel")
Begin DoDot:1
+13 IF RCRPRT("hdrPg#")
DO ASK^RCDPEARL(.RCSTOP)
if RCSTOP
QUIT
+14 WRITE @IOF
+15 SET RCRPRT("hdrPg#")=RCRPRT("hdrPg#")+1
+16 WRITE $$CNTR("EDI Lockbox Parameter Audit Report"),?IOM-8,"Page: "_RCRPRT("hdrPg#")
+17 WRITE !,$$CNTR("RUN DATE: "_RCRPRT("hdrDate"))
+18 WRITE !,$$CNTR("DATE RANGE: "_RCRPRT("dtRange"))
+19 WRITE !,$$CNTR("REPORT TYPE: "_RCRPRT("hdrTyp"))
+20 WRITE !!,"LOCKBOX PARAMETER UPDATES"
+21 WRITE !,"-------------------------- Values"
+22 WRITE !,"Parameter Date/Time Edited Old New User"
+23 ; row of equal signs
WRITE !,$TRANSLATE($JUSTIFY("",IOM-1)," ","=")
End DoDot:1
+24 QUIT
+25 ;
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 ;
+7 ;
CNTR(TXT) ; center TXT
+1 QUIT $JUSTIFY("",IOM-$LENGTH(TXT)\2)_TXT
+2 ;
DTRNG() ; function, returns date range for the report
+1 NEW RCEND,RCSTART
+2 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,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: "
DO ^DIR
KILL DIR
+5 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET BDATE=-1
QUIT
+6 SET BDATE=Y
KILL DIR,X,Y
+7 SET DIR("?")="Enter the latest AUDIT DATE to include on the report"
+8 SET DIR(0)="DAO^"_BDATE_":"_DT_":APE"
SET DIR("A")="Report end date: "
SET DIR("B")=$$FMTE^XLFDT(DT)
+9 DO ^DIR
KILL DIR
+10 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET BDATE=-1
QUIT
+11 SET EDATE=Y
+12 QUIT
+13 ;
RTYPE(DEF) ; EP from RCDPESP2, RCDPESP1
+1 ; Type of information to display
+2 ; Input: DEF - default value
+3 ; Returns:
+4 ; ; *future build*, add Tricare, change 'Both' to 'All'
+5 ; M - Medical, P - Pharmacy, T - Tricare, A - All, -1 - ^ or timed out
+6 NEW DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+7 SET DIR("?")="Enter the type of information to display on the report."
+8 ; PRCA*4.5*349
SET DIR(0)="SA^M:Medical;P:Pharmacy;T:TRICARE;A:All"
+9 ; PRCA*4.5*349
SET DIR("A")="(M)edical, (P)harmacy, (T)RICARE or (A)ll: "
+10 ; PRCA*4.5*349
SET DIR("B")=$SELECT($GET(DEF)'="":DEF,1:"All")
+11 DO ^DIR
+12 KILL DIR
+13 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT -1
+14 if Y=""
SET Y="A"
+15 QUIT $EXTRACT(Y)
+16 ;
TYPMTCH(RCRPRT,RCPARAM) ; function, print changed parameter?
+1 ; Input passed by ref:
+2 ; RCRPRT("typRprt") - Report filter
+3 ; RCPARAM - values for the changed parameter
+4 ; Returns: 1 if valid to print, 0 otherwise
+5 NEW OK2PRNT
SET OK2PRNT=0
+6 ; Medical Parameters
IF RCRPRT("typRprt")="M"
Begin DoDot:1
+7 IF RCPARAM["MED"
SET OK2PRNT=1
QUIT
+8 IF RCPARAM("file")=344.62
IF (RCPARAM("fld")>.01)&(RCPARAM("fld")<2)
SET OK2PRNT=1
End DoDot:1
+9 ;
+10 ; Pharmacy parameters
IF RCRPRT("typRprt")="P"
Begin DoDot:1
+11 IF (RCPARAM["RX")!(RCPARAM["PHARM")
SET OK2PRNT=1
QUIT
+12 IF RCPARAM("file")=344.62
IF (RCPARAM("fld")>2)&(RCPARAM("fld")<3)
SET OK2PRNT=1
End DoDot:1
+13 ;
+14 ; PRCA*4.5*349 - TRICARE Parameters
IF RCRPRT("typRprt")="T"
IF (RCPARAM["TRICARE")
SET OK2PRNT=1
+15 QUIT OK2PRNT
+16 ;
PAD(A,N) ; pad A with N spaces
+1 ; always add 1 space
SET A=A_" "
+2 ; no padding needed
if '($LENGTH(A)<N)
QUIT A
+3 QUIT A_$JUSTIFY("",N-$LENGTH(A))
+4 ;
YESNO(RCPARAM,Y) ; Yes/No text, RCPARAM passed by ref., Y=RCTMP
+1 if $LENGTH(RCPARAM("oldVal"))
SET RCPARAM("oldVal")=$SELECT($PIECE(Y,U,3):"Yes",1:"No")
+2 if $LENGTH(RCPARAM("newVal"))
SET RCPARAM("newVal")=$SELECT($PIECE(Y,U,4):"Yes",1:"No")
+3 QUIT