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

RCDMCR8A.m

Go to the documentation of this file.
  1. RCDMCR8A ;ALB/YG - Pension Report Exempt Charge Reconciliation Report - Input/output; Jun 16, 2021@14:23
  1. ;;4.5;Accounts Receivable;**384**;Jun 16, 2021;Build 29
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;This routine is being implemented for the AR Cross-Servicing Project
  1. ; This report assists users in reviewing all bills containing charges
  1. ; with a distinct date of service on or after the co-payment exemption
  1. ; effective date for Veterans with Primary or Secondary Eligibility equal
  1. ; Pension
  1. ;
  1. ; The report captures any charges without an IB status of cancelled, and
  1. ; with an AR Status of Active, Open, Suspended, Write-Off, or Collected/
  1. ; Closed or an IB Status of On-Hold, with a date of service on or after
  1. ; the exemption effective date.
  1. ;
  1. MAIN ; Initial Interactive Processing
  1. N ZTQUEUED,ZTREQ
  1. S:$G(U)="" U="^"
  1. N STOPIT,EXCEL,RCSCR,ARTYPE,NDTFLAG
  1. W !!,"*** Print the Pension Exempt Charge Recon Report ***",!
  1. S STOPIT=0 ; quit flag
  1. ; Get Status
  1. ;S ARTYPE=$$ARSTAT^RCDMCUT2(.STOPIT)
  1. S ARTYPE=$$ARSTAT(.STOPIT)
  1. Q:STOPIT>0!(ARTYPE']"")
  1. ;
  1. S NDTFLAG=0
  1. D Q:NDTFLAG="^"
  1. . N Y
  1. . K DIR,DIRUT,DTOUT,DIROUT,DUOUT
  1. . S DIR(0)="Y",DIR("B")="NO",DIR("T")=DTIME W !
  1. . S DIR("A")="Show veterans with missing Exempt Date"
  1. . D ^DIR S NDTFLAG=$G(Y)
  1. . S:$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) NDTFLAG="^"
  1. . K DIR,DIRUT,DTOUT,DIROUT,DUOUT,Y
  1. ; Prompt user if report will be Excel Delimited format:
  1. S EXCEL=$$EXCEL^RCDMCUT2
  1. ;Quit is user up arrowed or timed out
  1. Q:EXCEL="^"
  1. D:EXCEL>0 EXMSG^RCDMCUT2
  1. D:EXCEL'>0
  1. . W !!,"This report may take a while to process. It is recommended that"
  1. . W !,"you Queue this report to a device that is 132 characters wide."
  1. ;
  1. N %ZIS,ZTSK,ZTRTN,ZTIO,ZTDESC,POP,ZTSAVE
  1. S %ZIS="QM"
  1. W ! D ^%ZIS
  1. I POP S STOPIT=1 Q
  1. S RCSCR=$S($E($G(IOST),1,2)="C-":1,1:0)
  1. ;
  1. I $D(IO("Q")) D S STOPIT=1
  1. . S ZTRTN="RUN^RCDMCR8A"
  1. . S ZTIO=ION
  1. . S ZTSAVE("RCSCR")=""
  1. . S ZTSAVE("ARTYPE")=""
  1. . S ZTSAVE("EXCEL")=""
  1. . S ZTSAVE("NDTFLAG")=""
  1. . S ZTDESC="Pension Exempt Charge Recon Report Process"
  1. . D ^%ZTLOAD
  1. . W !!,$S($D(ZTSK):"Request Queued. TASK = "_ZTSK,1:"REQUEST CANCELLED")
  1. . D HOME^%ZIS
  1. ;
  1. Q:STOPIT>0!($D(ZTQUEUED))
  1. D RUN^RCDMCR8A
  1. I STOPIT'=2 D PAUSE2^RCDMCUT2
  1. Q
  1. ;
  1. RUN ;Get data and Print it out
  1. ;If queued ensure you delete it from the TASKS file
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. N RCPAGE
  1. K ^TMP($J,"RCDMCR8")
  1. S RCPAGE=0,STOPIT=$G(STOPIT)
  1. ; Collect the data in ^TMP
  1. D COLLECT^RCDMCR8B(.STOPIT,ARTYPE)
  1. Q:$G(STOPIT)>0
  1. U IO
  1. ; Print Report using data in ^TMP
  1. D REPORT
  1. I 'RCSCR W !,@IOF
  1. D ^%ZISC
  1. K ^TMP($J,"RCDMCR8")
  1. K EXCEL,RCSCR,TESTDATE
  1. Q
  1. ;
  1. REPORT ;Print report
  1. N RUNDATE,STATUS,NAME,SSN,BILLNO,IBIEN,SKIP,DISCHDT
  1. ;
  1. S RUNDATE=$$FMTE^XLFDT($$NOW^XLFDT,"9MP")
  1. D HDR
  1. I +$D(^TMP($J,"RCDMCR8"))'>0 W !,"No data meets the criteria." Q
  1. K SKIP
  1. S NAME=""
  1. F S NAME=$O(^TMP($J,"RCDMCR8","DETAIL",NAME)) Q:NAME']"" D Q:STOPIT
  1. . S SSN=""
  1. . F S SSN=$O(^TMP($J,"RCDMCR8","DETAIL",NAME,SSN)) Q:SSN']"" D Q:STOPIT
  1. . . S BILLNO=""
  1. . . F S BILLNO=$O(^TMP($J,"RCDMCR8","DETAIL",NAME,SSN,BILLNO)) Q:BILLNO']"" D Q:STOPIT
  1. . . . S IBIEN=""
  1. . . . F S IBIEN=$O(^TMP($J,"RCDMCR8","DETAIL",NAME,SSN,BILLNO,IBIEN)) Q:IBIEN']"" D Q:STOPIT
  1. . . . . N NODE,SERVDT,RXDT,ELIG,EXEMPTDT,RXNUM,RXNAM,STATUS,ELIGTYP,PNTERMDT
  1. . . . . ; S ^TMP($J,"RCDMCR8","DETAIL",NAME,SSN,BILLNO,IBIEN)=SERVDT_U_RXDT_U_ELIG_U_EXEMPTDT_U_RXNUM_U_RXNAM_U_STATUS_U_ELIGTYP
  1. . . . . S NODE=$G(^TMP($J,"RCDMCR8","DETAIL",NAME,SSN,BILLNO,IBIEN))
  1. . . . . S SERVDT=$S($P(NODE,U,10)'="":$P(NODE,U,10),1:$P(NODE,U,1))
  1. . . . . S RXDT=$P(NODE,U,2)
  1. . . . . S ELIG=$P(NODE,U,3)
  1. . . . . S EXEMPTDT=$P(NODE,U,4)
  1. . . . . S RXNUM=$P(NODE,U,5)
  1. . . . . S RXNAM=$P(NODE,U,6)
  1. . . . . S STATUS=$P(NODE,U,7)
  1. . . . . S ELIGTYP=$P(NODE,U,8)
  1. . . . . S PNTERMDT=$P(NODE,U,9) ;Pension Termination Date
  1. . . . . S DISCHDT=$P(NODE,U,11) ;Discharge Date
  1. . . . . I EXCEL'>0 D WRLINE Q
  1. . . . . I EXCEL>0 D WRLINE2 Q
  1. Q
  1. ;
  1. WRLINE ; Write the data formated report line
  1. ; Columns are - position, width, spacing (offset header by)
  1. ;Veteran Name - 1,23,1
  1. ;Pat/ID (1st char Last Name + Last 4 of SSN) - 25,5,2
  1. ;Bill # - 32,11,1
  1. ;EXMPTDT - 44,7,2
  1. ;PNTERMDT - 53,7,3
  1. ;Med Care Date - 63,7,1
  1. ;D/C Date - 72,8,2
  1. ;RXFillDT - 82,7,2
  1. ;RX # - 91,9,1
  1. ;RX Name - 101,22,1
  1. ;Status - 124,9,1
  1. D CHKP() Q:STOPIT
  1. I NDTFLAG=0,EXEMPTDT="NODATE" Q
  1. W !
  1. W $E(NAME,1,23) ; Veteran Name
  1. W ?24,$E(NAME,1)_$E(SSN,$L(SSN)-3,$L(SSN)) ; 1st char last name + Last 4 of SSN
  1. W ?31,$P(BILLNO,"/",1) ; Bill Number
  1. I EXEMPTDT="NODATE" W ?43,EXEMPTDT Q
  1. W ?43,$$STRIP^XLFSTR($$FMTE^XLFDT(EXEMPTDT,"8D")," ")
  1. W:PNTERMDT>0 ?52,$$STRIP^XLFSTR($$FMTE^XLFDT(PNTERMDT,"8D")," ")
  1. W:SERVDT>0 ?62,$$STRIP^XLFSTR($$FMTE^XLFDT(SERVDT,"8D")," ")
  1. W:DISCHDT>0 ?70,$$STRIP^XLFSTR($$FMTE^XLFDT(DISCHDT,"8D")," ") ;Discharge Date
  1. W:RXDT>0 ?80,$$STRIP^XLFSTR($$FMTE^XLFDT(RXDT,"8D")," ") ; Med Fill Date
  1. W ?89,RXNUM ; RX #
  1. W ?99,$E(RXNAM,1,22) ; RX Name
  1. W ?122,$E(STATUS,1,9)
  1. ;W:RXDT>0 ?71,$$STRIP^XLFSTR($$FMTE^XLFDT(RXDT,"8D")," ") ; Med Fill Date
  1. ;W ?79,RXNUM ; RX #
  1. ;W ?89,$E(RXNAM,1,22) ; RX Name
  1. ;W ?112,$E(STATUS,1,9)
  1. ;W ?122,$E(ELIGTYP,1,4)
  1. Q
  1. ;
  1. WRLINE2 ; Write the Excel report line
  1. I NDTFLAG=0,EXEMPTDT="NODATE" Q
  1. W !
  1. W NAME,U
  1. W $E(NAME,1)_$E(SSN,$L(SSN)-3,$L(SSN)),U
  1. W $P(BILLNO,"/",1),U
  1. I EXEMPTDT="NODATE" W EXEMPTDT,U,U,U,U,U,U,U Q
  1. W:EXEMPTDT $$FMTE^XLFDT(EXEMPTDT,"9D") W U
  1. W:PNTERMDT $$FMTE^XLFDT(PNTERMDT,"9D") W U
  1. W:SERVDT $$FMTE^XLFDT(SERVDT,"9D") W U
  1. W:DISCHDT $$FMTE^XLFDT(DISCHDT,"9D") W U
  1. W:RXDT $$FMTE^XLFDT(RXDT,"9D") W U
  1. W RXNUM,U
  1. W RXNAM,U
  1. W STATUS,U
  1. ;W ELIGTYP,U
  1. Q
  1. ;
  1. CHKP(FOOTER) ;Check for End of Page
  1. ;INPUT:
  1. ; FOOTER - Footer value. Optional. Default to 4 if nothing passed
  1. I $G(FOOTER)'>0 S FOOTER=4
  1. I $Y>(IOSL-FOOTER) D:RCSCR PAUSE^RCDMCUT2 Q:STOPIT D HDR K SKIP
  1. Q
  1. ;
  1. HDR ;Print Report Header
  1. I EXCEL>0 D Q
  1. . W !,"Veteran Name",U,"Pat/ID",U
  1. . W "Bill #",U,"EXMPTDT",U,"PenTermDt",U,"Med Care Date",U,"D/C Date",U,"RXFillDT",U,"RX #",U,"RX Name",U,"Status"
  1. S RCPAGE=RCPAGE+1
  1. W @IOF,"Pension Exempt Charge Reconciliation Report -- Run Date: ",RUNDATE," --"
  1. W ?122,"Page "_RCPAGE
  1. ;Print to screen or printer
  1. W !,"Veteran Name",?24,"Pat/ID",?31,"Bill #",?43,"EXMPTDT",?52,"PenTermDt",?62,"MedC DT",?70,"D/C Date",?80,"RXFillDT",?89,"RX #",?99,"RX Name",?122,"Status"
  1. D ULINE^RCDMCUT2("=",$G(IOM))
  1. Q
  1. ;
  1. ARSTAT(STOPIT) ;Chose AR status
  1. N C,SL,J,TEMP
  1. S SL=0
  1. F J=1:1:10 D Q:SL=0
  1. . S SL=0
  1. . D MENU
  1. . I Y=7 Q
  1. . I Y="^"!(Y="") S STOPIT=1 Q
  1. . I $E(Y,$L(Y))="," S Y=$E(Y,1,$L(Y)-1)
  1. . F C=1:1:$L(Y,",") Q:SL!(Y=7) D
  1. . . S TEMP=$P(Y,",",C)
  1. . . I TEMP>7!(TEMP<1) S SL=1 Q
  1. . . I TEMP=7 S Y=7 Q
  1. Q Y
  1. ;
  1. W !,?5,"1 - Active"
  1. W !,?5,"2 - Open"
  1. W !,?5,"3 - Suspended"
  1. W !,?5,"4 - Collected/Closed"
  1. W !,?5,"5 - IB On-Hold"
  1. W !,?5,"6 - Write-Off"
  1. W !,?5,"7 - ALL (Includes 1-6 and AR CANCELLATIONS)",!
  1. N DIR
  1. K X,Y
  1. S DIR(0)="LO^1:7"
  1. S DIR("B")=7
  1. D ^DIR
  1. Q