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

RCDMCR5A.m

Go to the documentation of this file.
  1. RCDMCR5A ;HAF/ASF - First Party Charge IB Cancellation Reconciliation Report - Input/output; Apr 9, 2019@21:06
  1. ;;4.5;Accounts Receivable;**347,361**;Mar 20, 1995;Build 6
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;This routine is being implemented for the AR Cross-Referencing Project
  1. ;
  1. ;This report will assist users in reviewing first party charges receiving
  1. ;Integrated Billing (IB) cancellation for potential refund activities or charge
  1. ;cancellation accuracy, and to identify and monitor cancellation activity
  1. ;productivity so veteran customers can receive refunds due to them for
  1. ;retroactive eligibility exemptions. The report provides data for first party
  1. ;charges receiving IB cancellation for a user defined bill cancellation
  1. ;date range.
  1. MAIN ; Initial Interactive Processing
  1. N STOPIT,EXCEL,CANDATE,CANBEGDT,CANENDDT,BILLPAYS,RCSCR
  1. W !!,"*** Print the First Party Charge IB Cancellation Reconciliation Report ***",!
  1. S STOPIT=0 ; quit flag
  1. ;Prompt user for Date Range for Bill Cancellation date range
  1. S CANDATE=$$DATE2^RCDMCUT2(" Enter the Bill Cancellation Date Range: ")
  1. ;Quit is user up arrowed or timed out
  1. Q:CANDATE'>0
  1. S CANBEGDT=$P(CANDATE,U,2),CANENDDT=$P(CANDATE,U,3)
  1. ; Prompt user for Bills with Payments
  1. S BILLPAYS=$$BILLPAYS^RCDMCUT2
  1. Q:BILLPAYS="^"
  1. ; Prompt user if report will be Excel Delimited format:
  1. S EXCEL=$$EXCEL
  1. ;Quit if user up arrowed or timed out
  1. Q:EXCEL="^"
  1. D:EXCEL>0 EXMSG
  1. D:EXCEL'>0
  1. . W !!,"This report is designed to be uploaded to an Excel spreadsheet format"
  1. . W !,"but you have chosen non-Excel format. Therefore, it is recommended that you"
  1. . W !,"adjust your screen display size and terminal settings to at least 150 characters"
  1. .W !,"wide to accommodate the screen output."
  1. ; Logic from DEVICE^RCDMCUT2 copied here
  1. N %ZIS,ZTRTN,ZTIO,ZTSAVE,ZTDESK,ZTSK,POP,ZTDESC
  1. S %ZIS="QM"
  1. W ! D ^%ZIS
  1. I POP 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^RCDMCR5A"
  1. . S ZTIO=ION
  1. . S ZTSAVE("RCSCR")=""
  1. . S ZTSAVE("CANBEGDT")=""
  1. . S ZTSAVE("CANENDDT")=""
  1. . S ZTSAVE("BILLPAYS")=""
  1. . S ZTSAVE("EXCEL")=""
  1. . S ZTDESC="DMC 0-40 Percent SC Change Reconciliation 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^RCDMCR5A
  1. I 'STOPIT D PAUSE2^RCDMCUT2
  1. Q
  1. ; Currently, Taskman schedulable option is not being planned for this report
  1. ; If this is going to change later on, QUERPT^RCDMCR3A would be a good example
  1. ; of how to do such an option
  1. QUERPT ; Initial Taskman Scheduled Queued processing
  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. S STOPIT=0
  1. K ^TMP($J,"RCDMCR5B")
  1. S RCPAGE=0
  1. ; Collect the data in ^TMP
  1. D COLLECT^RCDMCR5B(.STOPIT,CANBEGDT,CANENDDT,BILLPAYS)
  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,"RCDMCR5B")
  1. K EXCEL,RCSCR
  1. Q
  1. ;
  1. REPORT ;Print report
  1. N RUNDATE,NAME,SSN,BILLNO,IBIEN,SKIP
  1. ;
  1. S RUNDATE=$$FMTE^XLFDT($$NOW^XLFDT,"9MP")
  1. D HDR
  1. I +$D(^TMP($J,"RCDMCR5B"))'>0 W !,"No data meets the criteria." Q
  1. K SKIP
  1. S NAME=""
  1. F S NAME=$O(^TMP($J,"RCDMCR5B","DETAIL",NAME)) Q:NAME']"" D Q:STOPIT
  1. . S SSN=""
  1. . F S SSN=$O(^TMP($J,"RCDMCR5B","DETAIL",NAME,SSN)) Q:SSN']"" D Q:STOPIT
  1. . . S BILLNO=""
  1. . . F S BILLNO=$O(^TMP($J,"RCDMCR5B","DETAIL",NAME,SSN,BILLNO)) Q:BILLNO']"" D Q:STOPIT
  1. . . . S IBIEN=""
  1. . . . F S IBIEN=$O(^TMP($J,"RCDMCR5B","DETAIL",NAME,SSN,BILLNO,IBIEN)) Q:IBIEN']"" D Q:STOPIT
  1. . . . . N NODE,CHGAMT,SERVDT,RXDT,RXNUM,RXNAM,CANCDT,CANCREAS,CANCUSER,APPR,RSC
  1. . . . . ; S ^TMP($J,"RCDMCR5B","DETAIL",NAME,SSN,BILLNO,IBIEN)=SERVDT_U_RXDT_U_CHGAMT_U_RXNUM_U_RXNAM_U_CANCDT_U_CANCREAS_U_CANCUSER
  1. . . . . S NODE=$G(^TMP($J,"RCDMCR5B","DETAIL",NAME,SSN,BILLNO,IBIEN))
  1. . . . . S SERVDT=$P(NODE,U,1)
  1. . . . . S RXDT=$P(NODE,U,2)
  1. . . . . S CHGAMT=$P(NODE,U,3)
  1. . . . . S RXNUM=$P(NODE,U,4)
  1. . . . . S RXNAM=$P(NODE,U,5)
  1. . . . . S CANCDT=$P(NODE,U,6)
  1. . . . . S CANCREAS=$P(NODE,U,7)
  1. . . . . S CANCUSER=$P(NODE,U,8)
  1. . . . . S APPR=$P(NODE,U,9)
  1. . . . . S RSC=$P(NODE,U,10) ;S ZZ=$G(ZZ)_", "_RSC
  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. ;If Multiple Bills for Vet only print Name & SSN for 1st record on page
  1. ;
  1. ; Columns are - position, width, spacing (offset header by)
  1. ; Veteran Name - 0, 13, 1 (offset 1)
  1. ; SSN - 14, 10, 1 (offset 3)
  1. ; Bill Number - 25, 11, 1 (offset 1)
  1. ; Charge/Amount - 37, 11, 1 (offset 3,3)
  1. ; Appropriation Fund Number - 49, 6, 1 (offset 1)
  1. ; Revenue Source Code - 56, 5, 1 (offset 1)
  1. ; Medical/Care Date - 62, 8, 1 (offset 1, 0)
  1. ; RXFillDT - 72, 9, 1 (offset 0)
  1. ; RX # - 82, 9, 1 (offset 3)
  1. ; RX Name - 92, 14, 1 (offset 3)
  1. ; IBCXLDT - 107, 7, 1 (offset 0)
  1. ; IB Cancellation/Reason - 115, 16, 1 (Offset 0, 6)
  1. ; Cancelled By - 132, 14 (offset 1)
  1. D CHKP() Q:STOPIT
  1. ; Disable Skips for now per direction of customer with :0
  1. W !
  1. I (NAME_SSN)'=$G(SKIP(1)) D
  1. . W $E(NAME,1,13) ; Veteran Name
  1. . W ?14,SSN ; SSN
  1. . S:0 SKIP(1)=NAME_SSN
  1. W ?25,BILLNO ; Bill Number
  1. W ?37,$J("$"_$FN(CHGAMT,",",2),11)
  1. W ?49,APPR
  1. W ?56,RSC
  1. W:SERVDT>0 ?62,$$STRIP^XLFSTR($$FMTE^XLFDT(SERVDT,"8D")," ")
  1. W:RXDT>0 ?72,$$STRIP^XLFSTR($$FMTE^XLFDT(RXDT,"8D")," ") ; Med Fill Date
  1. W ?82,RXNUM ; RX #
  1. W ?92,$E(RXNAM,1,14) ; RX Name
  1. W ?107,$$STRIP^XLFSTR($$FMTE^XLFDT(CANCDT,"8D")," ")
  1. W ?115,$E(CANCREAS,1,16)
  1. W ?132,$E(CANCUSER,1,14)
  1. Q
  1. ;
  1. WRLINE2 ; Write the Excel report line
  1. W !
  1. W $$EXOUT^RCDMCR4A(NAME),U
  1. W $$EXOUT^RCDMCR4A(SSN),U
  1. W BILLNO,U
  1. W "$",$FN(CHGAMT,",",2),U
  1. W APPR,U
  1. W RSC,U
  1. W $$FMTE^XLFDT(SERVDT,"9D")
  1. W U
  1. I RXDT W $$FMTE^XLFDT(RXDT,"9D")
  1. W U
  1. W RXNUM,U
  1. W RXNAM,U
  1. W $$FMTE^XLFDT(CANCDT,"9D"),U
  1. W CANCREAS,U
  1. W $$EXOUT^RCDMCR4A(CANCUSER)
  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. ;RUNDATE - Current Date in human readable format
  1. I EXCEL>0 D Q
  1. . ;ASF 8/10/19
  1. . W !,"Veteran Name",U,"SSN",U,"Bill Number",U,"Charge Amount",U,"APPR",U,"RSC",U,"Medical Care Date",U,"RXFillDT",U
  1. . W "RX #",U,"RX Name",U,"IBCXLDT",U,"IB Cancellation Reason",U,"Cancelled By"
  1. S RCPAGE=RCPAGE+1 K SKIP
  1. W @IOF,"First Party Charge IB Cancellation Reconciliation Report -- Run Date: ",RUNDATE," --"
  1. W ?140,"Page "_RCPAGE
  1. W !?6,"Cancellation Dates from ",$$FMTE^XLFDT(CANBEGDT,"9D")," to ",$$FMTE^XLFDT(CANENDDT,"9D")
  1. W !
  1. ;Print to screen or printer
  1. W !,?42,"Charge",?63,"Medical",?115,"IB Cancellation"
  1. W !," Veteran Name",?17,"SSN",?25,"Bill Number",?42,"Amount",?50,"APPR",?56,"RSC",?62,"Care Date",?72,"RXFillDT",?84,"RX #",?95,"RX Name",?107,"IBCXLDT",?120,"Reason",?132,"Cancelled By"
  1. D ULINE^RCDMCUT2("=",$G(IOM))
  1. Q
  1. EXCEL() ; - Returns whether to capture data for Excel report.
  1. ;INPUT:
  1. ; None
  1. ; Output:
  1. ; Returns 1 - YES (capture data) / 0 - NO (DO NOT capture data) /
  1. ; "^" - Exit report
  1. ;
  1. N EXCEL,X,Y,DIR,DIRUT,DTOUT,DUOUT,DIROUT
  1. ;
  1. S EXCEL=0
  1. S DIR(0)="Y",DIR("B")="YES",DIR("T")=DTIME W !
  1. S DIR("A")="Do you want to capture report data for an Excel document"
  1. S DIR("?")="^D HEXC^RCDMCUT2"
  1. D ^DIR
  1. S:$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) EXCEL="^"
  1. S:$G(Y)>0 EXCEL=1
  1. ;
  1. Q EXCEL
  1. EXMSG ;message if sending to excel
  1. W !!,"This report may take a while to run. It is recommended that you Queue it."
  1. W !,"To capture as an Excel format, it is recommended that you queue this"
  1. W !,"report to a spool device with margins of 256 and page length of 99999"
  1. W !,"(e.g. spoolname;256;99999). This should help avoid wrapping problems."
  1. W !
  1. W !,"Another method would be to set up your terminal to capture the detail"
  1. W !,"report data. On some terminals, this can be done by clicking on the"
  1. W !,"'Tools' menu above, then click on 'Capture Incoming Data' to save to"
  1. W !,"Desktop. To avoid undesired wrapping of the data saved to the file,"
  1. W !,"please enter '0;256;99999' at the 'DEVICE:' prompt."