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

RCDMCR1A.m

Go to the documentation of this file.
  1. RCDMCR1A ;HEC/SBW - DMC Debt Validity Report ;28/SEP/2007
  1. ;;4.5;Accounts Receivable;**253**;Mar 20, 1995;Build 9
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ;This routine is being implemented for the Hold Debt to DMC Project.
  1. ;It will do the following:
  1. ; Report option in AR to assist users in focusing on reviewing the
  1. ; legitimacy of bills for veterans who are SC 50% to 100% or in
  1. ; receipt of VA Pension benefits. The report contains information
  1. ; on veterans who meet the above criteria and have bills for episodes
  1. ; of care within the previous 365 days (or older selected date) with
  1. ; a DMC Debt Valid field not flagged as 'YES' or 'NO'. Authorized
  1. ; billing staff can run the report to ensure that all bills meeting
  1. ; the above criteria are reviewed and if necessary the appropriate
  1. ; action is taken as follows:
  1. ; Bill is appropriate - Update the Debt Validity Status field to
  1. ; 'YES' in order that the bill is referred to DMC via the
  1. ; automated process if all other DMC criteria is met
  1. ; Bill is inappropriate - Update the Debt Validity Status Field
  1. ; to 'NO' and staff will cancel the bill using existing
  1. ; functionality
  1. ; Inappropriate bill sent to DMC - Staff to initiate action to
  1. ; cancel DMC collection or refund payments using existing
  1. ; functionality
  1. ;
  1. MAIN ; Initial Interactive Processing
  1. N STOPIT,GETBEGDT,BEGDT,EXCEL,RCSCR
  1. W !!,"*** Print the Debt Validity Report ***"
  1. ;
  1. S STOPIT=0 ; quit flag
  1. ; Prompts to the user:
  1. ;
  1. ;Prompt user for Date from which to include bills for episodes of care
  1. ;on report
  1. S GETBEGDT=$$GETBEGDT^RCDMCUT2("Report To Include Bills For Episodes of Care Beginning With User Selected Date."," Entered Date Must be "_$$FMTE^XLFDT($$FMADD^XLFDT(DT,-365,0,0,0),"1D")_" or older!")
  1. Q:+GETBEGDT'>0
  1. S BEGDT=$P(GETBEGDT,U,2)
  1. ;
  1. S EXCEL=$$EXCEL^RCDMCUT2()
  1. ;Quit if 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. D DEVICE^RCDMCUT2("RUN^RCDMCR1A","DMC Debt Validity Report Process",.STOPIT,.RCSCR,BEGDT,EXCEL)
  1. Q:STOPIT>0!($D(ZTQUEUED))
  1. D RUN^RCDMCR1A
  1. I STOPIT'=2 D PAUSE2^RCDMCUT2
  1. Q
  1. ;
  1. QUERPT ; Initial Taskman Scheduled Queued processing
  1. N STOPIT,EXCEL,RCSCR,BEGDT
  1. S STOPIT=0,EXCEL="",RCSCR=""
  1. ;
  1. ;Get the "NUMBER OF DAYS FOR DMC REPORTS" site parameter in the AR Site
  1. ;Parameter (#342) file.
  1. S BEGDT=$$GETRDAY^RCMSITE
  1. ;If parameter value not greater than 364 day set default to 365 days
  1. S:BEGDT'>364 BEGDT=365
  1. ;Set report begin date to past date using Number of Days for DMC reports
  1. S BEGDT=$$FMADD^XLFDT(DT,0-BEGDT,0,0,0)
  1. ;
  1. D RUN^RCDMCR1A
  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. ;If not passed date, default to get data 365 old
  1. I $G(BEGDT)'>0 S BEGDT=$$FMADD^XLFDT(DT,-365,0,0,0)
  1. K ^TMP($J,"RCDMCR1")
  1. S RCPAGE=0
  1. ; Collect the data in ^TMP
  1. D COLLECT^RCDMCR1B(.STOPIT,BEGDT)
  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,"RCDMCR1")
  1. K EXCEL,RCSCR,TESTDATE
  1. Q
  1. ;
  1. REPORT ;Print report
  1. N RUNDATE,FULLHDR,STATUS,IEN,NAME,SSN,NAMEPRT,BILLNO,NODE
  1. N CNUM,CLOC,ELIG,ELIGDT,RXDT,OPTDT,DISCHDT,DMCREFDT,DMCVALID
  1. S RUNDATE=$$FMTE^XLFDT($$NOW^XLFDT,"9MP")
  1. ;Print header with field headers
  1. S FULLHDR=1
  1. D HDR
  1. I +$D(^TMP($J,"RCDMCR1"))'>0 W !,"No data meets the criteria." Q
  1. S NAME=""
  1. F S NAME=$O(^TMP($J,"RCDMCR1","DETAIL",NAME)) Q:NAME']"" D Q:STOPIT
  1. . S SSN=""
  1. . F S SSN=$O(^TMP($J,"RCDMCR1","DETAIL",NAME,SSN)) Q:SSN']"" D Q:STOPIT
  1. . . ;NAMEPRT - Use to only print Name & SSN once for multiple bills
  1. . . S NAMEPRT=1
  1. . . S BILLNO=""
  1. . . F S BILLNO=$O(^TMP($J,"RCDMCR1","DETAIL",NAME,SSN,BILLNO)) Q:BILLNO']"" D Q:STOPIT
  1. . . . S NODE=$G(^TMP($J,"RCDMCR1","DETAIL",NAME,SSN,BILLNO))
  1. . . . S CNUM=$P(NODE,U,1),CLOC=$P(NODE,U,2),ELIG=$P(NODE,U,3)
  1. . . . S ELIGDT=$P(NODE,U,4),RXDT=$P(NODE,U,5),OPTDT=$P(NODE,U,6)
  1. . . . S DISCHDT=$P(NODE,U,7),DMCREFDT=$P(NODE,U,8),DMCVALID=$P(NODE,U,9)
  1. . . . S STATUS=$P(NODE,U,10)
  1. . . . I EXCEL'>0 D WRLINE Q
  1. . . . I EXCEL>0 D WRLINE2 Q
  1. ;Don't print summary if user ^ out
  1. Q:STOPIT
  1. ;Don't print field headers
  1. S FULLHDR=0
  1. ;Ensure all Summary data fits on page
  1. D CHKP(9) Q:STOPIT
  1. W !!,"SUMMARY - BILLS REFERRED TO DMC"
  1. D ULINE^RCDMCUT2("-",55)
  1. W !,"Total Number of Bills Referred: ",$J($FN($G(^TMP($J,"RCDMCR1","SUM-BILL")),",P"),13)
  1. W !,"Total Number of unique veterans referred: ",$J($FN($G(^TMP($J,"RCDMCR1","SUM-VET")),",P"),13)
  1. W !,"Total Account Receivable Dollars referred: ",$J("$"_$FN($G(^TMP($J,"RCDMCR1","SUM-$")),",P"),13)
  1. ;Ensure all Summary data fits on page
  1. D CHKP(9) Q:STOPIT
  1. W !!,"SUMMARY - TOTAL BILLS"
  1. D ULINE^RCDMCUT2("-",46)
  1. W !,"Total Number of Bills: ",$J($FN($G(^TMP($J,"RCDMCR1","TOT-BILL")),",P"),13)
  1. W !,"Total Number of unique veterans: ",$J($FN($G(^TMP($J,"RCDMCR1","TOT-VET")),",P"),13)
  1. W !,"Total Account Receivable Dollars: ",$J("$"_$FN($G(^TMP($J,"RCDMCR1","TOT-$")),",P"),13)
  1. ;
  1. Q
  1. ;
  1. WRLINE ; Write the data formated report line
  1. D CHKP() Q:STOPIT
  1. ;If Multiple Bills for Vet only print Name & SSN for 1st record on page
  1. W !
  1. I NAMEPRT>0 D
  1. . W $E(NAME,1,16)
  1. . W ?18,SSN
  1. . W ?25,CNUM
  1. . W ?37,CLOC
  1. . W ?44,ELIG
  1. . Q:ELIGDT>0
  1. . S NAMEPRT=0
  1. W ?60,BILLNO
  1. W ?73,$$STRIP^XLFSTR($$FMTE^XLFDT(RXDT,"8D")," ")
  1. W ?83,$$STRIP^XLFSTR($$FMTE^XLFDT(OPTDT,"8D")," ")
  1. W ?92,$$STRIP^XLFSTR($$FMTE^XLFDT(DISCHDT,"8D")," ")
  1. W ?101,DMCVALID
  1. W ?110,$E(STATUS,1,9)
  1. W ?121,$$STRIP^XLFSTR($$FMTE^XLFDT(DMCREFDT,"8D")," ")
  1. I NAMEPRT>0,ELIGDT>0 W !?44,$$STRIP^XLFSTR($$FMTE^XLFDT(ELIGDT,"8D")," ") S NAMEPRT=0
  1. Q
  1. ;
  1. WRLINE2 ; Write the Excel report line
  1. W !
  1. W NAME_U
  1. W SSN_U
  1. W CNUM_U
  1. W CLOC_U
  1. W ELIG_U
  1. W $$FMTE^XLFDT(ELIGDT,"9D")_U
  1. W BILLNO_U
  1. W $$FMTE^XLFDT(RXDT,"9D")_U
  1. W $$FMTE^XLFDT(OPTDT,"9D")_U
  1. W $$FMTE^XLFDT(DISCHDT,"9D")_U
  1. W DMCVALID_U
  1. W STATUS_U
  1. W $$FMTE^XLFDT(DMCREFDT,"9D")
  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
  1. Q
  1. ;
  1. HDR ;Print Report Header
  1. ;NAMEPRT - Use to only print Name & SSN once for multiple bills
  1. S NAMEPRT=1
  1. S RCPAGE=RCPAGE+1
  1. W @IOF,"DMC Debt Validity Report"
  1. W ?40,"Run Date: ",RUNDATE
  1. W ?72,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
  1. W ?115,"Page: "_RCPAGE
  1. ;If summary data print underline and quit. Don't need field headers.
  1. I FULLHDR'>0 D ULINE^RCDMCUT2("=",$G(IOM)) Q
  1. ;Print to screen or printer
  1. I EXCEL'>0 D
  1. . W !!?25,"Claim",?37,"Claim",?44,"Eligibility/",?60,"Bill",?73,"RX Fill/",?83,"Outpat",?92,"Dischar",?101,"DMC Debt",?121,"DMC Ref"
  1. . W !,"Veteran Name",?18,"SSN",?25,"Number",?37,"Loc.",?44,"SC Eff. Date",?60,"Number",?73,"ReFill Dt",?83,"Visit Dt",?92,"Date",?101,"Valid",?110,"Status",?121,"Date"
  1. . D ULINE^RCDMCUT2("=",$G(IOM))
  1. ;Export to Delimited Excel format
  1. I EXCEL>0 D
  1. . W !!,"Veteran Name",U,"SSN",U,"Claim #",U,"Claim Loc",U,"Eligibility",U,"SC Eff Date",U,"Bill #",U,"RX Fill",U,"Outpat Visit Date",U,"Discharge Date",U,"DMC Debt Valid",U,"Status",U,"DMC Refer Date"
  1. Q
  1. ;