RCDMCR2A ;HEC/SBW - DMC Debt Validity Management Report ;9/Oct/2007
;;4.5;Accounts Receivable;**253**;Mar 20, 1995;Build 9
;;Per VHA Directive 2004-038, this routine should not be modified.
;
;This routine is being implemented for the Hold Debt to DMC Project.
;It will do the following:
; A new management report option will be added in AR to assist
; managers in reviewing the processing of the bills related to
; the Debt Validity Report. This report will include bills
; for veterans who are SC 50% to 100% or in receipt of VA Pension
; benefits and have bills for episodes of care within the previous
; 365 days (or older selected date). The user will have the option to
; select if the report will be for bills where the DMC Debt Valid
; field is "null", "PENDING", "YES", "NO" or All Values. The report
; will list only bills with Current Status of "ACTIVE", "OPEN",
; "SUSPENDED", "CANCELLATION", "REFUND REVIEW" and "REFUNDED".
;
MAIN ; Initial Interactive Processing
N STOPIT,RCSCR,GETBEGDT,BEGDT,RCTYPE,RCDMCVAL
W !!,"*** Print the DMC Debt Validity Management Report ***"
W !!,"This report may take a while to process. It is recommended that"
W !,"you Queue this report to a device that is 132 characters wide."
;
S STOPIT=0 ; quit flag
; Prompts to the user:
;
;Prompt user for Date from which to include bills for episodes of care
;on report
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!")
Q:+GETBEGDT'>0
S BEGDT=$P(GETBEGDT,U,2)
;
S RCTYPE=$$GETTYPE^RCDMCUT2(.STOPIT)
Q:STOPIT>0!(RCTYPE']"")
S RCDMCVAL=$$GETDMC^RCDMCUT2(.STOPIT)
Q:STOPIT>0!(RCDMCVAL']"")
D:RCTYPE="D"
. W !?5,"It is recommended that you Queue this report to a"
. W !?5,"device that is 132 characters wide.",!
D:RCTYPE="S"
. W !?5,"It is recommended that you Queue this report to run.",!
D:RCTYPE="E" EXMSG^RCDMCUT2
;
D DEVICE^RCDMCUT2("RUN^RCDMCR2A","DMC Debt Validity Management Report Process",.STOPIT,.RCSCR,BEGDT,"",RCTYPE,RCDMCVAL)
Q:STOPIT>0!($D(ZTQUEUED))
D RUN^RCDMCR2A
I STOPIT'=2 D PAUSE2^RCDMCUT2
Q
;
QUERPT ; Initial Taskman Scheduled Queued processing
N STOPIT,RCSCR,RCTYPE,RCDMCVAL,BEGDT
;Queued Report option allows print the Detailed report
;for all DMC Debt Values
S STOPIT=0,RCSCR="",RCTYPE="D",RCDMCVAL="A"
;
;Get the "NUMBER OF DAYS FOR DMC REPORTS" site parameter in the AR Site
;Parameter (#342) file.
S BEGDT=$$GETRDAY^RCMSITE
;If parameter value not greater than 364 day set default to 365 days
S:BEGDT'>364 BEGDT=365
;Set report begin date to past date using Number of Days for DMC reports
S BEGDT=$$FMADD^XLFDT(DT,0-BEGDT,0,0,0)
;
D RUN^RCDMCR2A
Q
;
RUN ;Get data and Print it out
;If queued ensure you delete it from the TASKS file
I $D(ZTQUEUED) S ZTREQ="@"
N RCPAGE
;If not passed date, default to get data 365 old
I $G(BEGDT)'>0 S BEGDT=$$FMADD^XLFDT(DT,-365,0,0,0)
K ^TMP($J,"RCDMCR2")
S RCPAGE=0
I RCDMCVAL="A" S RCDMCVAL("BLANK/NULL")="",RCDMCVAL("PENDING")="",RCDMCVAL("YES")="",RCDMCVAL("NO")=""
I RCDMCVAL'="A" S RCDMCVAL($$EXTDMC^RCDMCUT2(RCDMCVAL))=""
; Collect the data in ^TMP
D COLLECT^RCDMCR2B(.STOPIT,BEGDT,.RCDMCVAL)
Q:$G(STOPIT)>0
U IO
; Print Report using data in ^TMP
D REPORT
I 'RCSCR W !,@IOF
D ^%ZISC
K ^TMP($J,"RCDMCR2")
K RCTYPE,RCDMCVAL,RCSCR,TESTDATE
Q
;
REPORT ;Print report
N RUNDATE,FULLHDR,STATUS,VALID,NAME,SSN,NAMEPRT,BILLNO
N NODE,CNUM,CLOC,PRINAMT,STATUS,EDITBY,EDITDT
S FULLHDR=1
S RUNDATE=$$FMTE^XLFDT($$NOW^XLFDT,"9D")
;No report data. Print header and Message. Then quit
I +$D(^TMP($J,"RCDMCR2"))'>0 S FULLHDR=0 D HDR W !,"No data meets the criteria." Q
;Summary Type report for single DMC Debt Valid value.
;Print summary data and then quit.
I RCTYPE="S" D SUMRPT Q
I RCTYPE="E" S FULLHDR=1 D HDR
S VALID=""
F S VALID=$O(^TMP($J,"RCDMCR2","DETAIL",VALID)) Q:VALID']"" D Q:STOPIT
. ;Detailed Report - Print header with field headers when DMC Debt
. ;Valid value changes
. I RCTYPE="D" S FULLHDR=1 D HDR
. S NAME=""
. F S NAME=$O(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME)) Q:NAME']"" D Q:STOPIT
. . S SSN=""
. . F S SSN=$O(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME,SSN)) Q:SSN']"" D Q:STOPIT
. . . ;NAMEPRT - Use to only print Name & SSN once for multiple bills
. . . S NAMEPRT=1
. . . S BILLNO=""
. . . F S BILLNO=$O(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME,SSN,BILLNO)) Q:BILLNO']"" D Q:STOPIT
. . . . S NODE=$G(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME,SSN,BILLNO))
. . . . S CNUM=$P(NODE,U,1),CLOC=$P(NODE,U,2),PRINAMT=$P(NODE,U,3)
. . . . S STATUS=$P(NODE,U,4),EDITBY=$P(NODE,U,5),EDITDT=$P(NODE,U,6)
. . . . I RCTYPE="D" S FULLHDR=1 D WRLINE Q
. . . . I RCTYPE="E" S FULLHDR=0 D WRLINE2 Q
. ;Print Summary for DMC Debt Valid if printing all DMC Debt Valid
. ;values on Detailed report
. I RCTYPE="D",RCDMCVAL="A" D
. . D VALSUM
. . ;Pause Prompt when print to Screen and more Patient Data
. . I RCSCR,$O(^TMP($J,"RCDMCR2","DETAIL",VALID))]"" D PAUSE^RCDMCUT2
S FULLHDR=0
D TOTSUM
Q
;
;
WRLINE ; Write the data formated report line
D CHKP() Q:STOPIT
;If Multiple Bills for Vet only print Name & SSN for 1st record on page
W !
I NAMEPRT>0 D
. W $E(NAME,1,20)
. W ?22,SSN
. W ?30,CNUM
. W ?42,CLOC
. S NAMEPRT=0
W ?50,BILLNO
W ?63,$J("$"_$FN($P(PRINAMT,".",1),",P"),12)
W ?77,$E(STATUS,1,13)
W ?93,$E(EDITBY,1,20)
W ?115,$$FMTE^XLFDT(EDITDT,"9D")
Q
;
WRLINE2 ; Write the Excel report line
W !
W NAME_U
W SSN_U
W CNUM_U
W CLOC_U
W BILLNO_U
W PRINAMT_U
W VALID_U
W STATUS_U
W EDITBY_U
W $$FMTE^XLFDT(EDITDT,"9D")
Q
;
CHKP(FOOTER) ;Check for End of Page
;Input
; FOOTER - Footer value. Optional. Default to 4 if nothing passed
I $G(FOOTER)'>0 S FOOTER=4
I $Y>(IOSL-FOOTER) D:RCSCR PAUSE^RCDMCUT2 Q:STOPIT D HDR
Q
;
HDR ;Print Report Header
;NAMEPRT - Use to only print Name & SSN once for multiple bills
S NAMEPRT=1
S RCPAGE=RCPAGE+1
;Header for Detailed and Excel Delimited format (132 Chars wide)
D:RCTYPE="D"!(RCTYPE="E")
. W @IOF,"DMC Debt Validity Management ",$$EXTTYPE^RCDMCUT2(RCTYPE)," Report"
. W ?53,"Run Date: ",RUNDATE
. W ?78,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
. W ?120,"Page: "_RCPAGE
;Header for Summary Format (80 chars wide
D:RCTYPE="S"
. W @IOF,"DMC Debt Validity Management ",$$EXTTYPE^RCDMCUT2(RCTYPE)," Report"
. W ?70,"Page: "_RCPAGE
. W !,"Run Date: ",RUNDATE
. W ?30,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
;
W !?5,"DMC Debt Valid Field Values = ",$$EXTDMC^RCDMCUT2(RCDMCVAL)
;Print Underline for Summary Report header and Summary Data Header
I RCTYPE="S"!((RCTYPE="D")&(FULLHDR'>0)) D
. D ULINE^RCDMCUT2("=",$G(IOM))
;Quit if printing summary data. Don't need field headers
Q:FULLHDR'>0
;Print Detail Report header
I RCTYPE="D" D
. W !?30,"Claim",?42,"Claim",?50,"Bill",?65,"Receivable",?93,"DMC Debt Valid",?115,"DMC Debt Valid"
. W !,"Veteran Name",?22,"SSN",?30,"Number",?42,"Loc.",?50,"Number",?65,"Amount",?77,"Status",?93,"Edit By",?115,"Edit Date"
. D ULINE^RCDMCUT2("=",$G(IOM))
. I RCDMCVAL="A" W !,"*** Following data is for DMC Debt Valid Field Values of ",VALID," ***"
;Print Excel Delimited format header
I RCTYPE="E" D
. W !,"Veteran Name",U,"SSN",U,"Claim #",U,"Claim Loc",U,"Bill #",U,"DMC Debt Valid",U,"Amount",U,"STATUS",U,"DMC Debt Valid Edit By",U,"DMC Debt Valid Edit Date"
Q
;
SUMRPT ;Print Summary report (No detailed data)
S FULLHDR=0
D HDR
;If not all DMC Debt Values then just print Total Summary and quit
I RCDMCVAL'="A" D TOTSUM Q
;If DMC Debt Valid Report is for all values then print summary by DMC
;Debt Valid value and then the Total Summary for all DMC Debt Valid
;values.
S VALID=""
F S VALID=$O(^TMP($J,"RCDMCR2","DETAIL",VALID)) Q:VALID']"" D Q:STOPIT
. D VALSUM
D TOTSUM
Q
;
TOTSUM ;Print Total Summary
N STAT
;Don't print summary if user ^ out
Q:STOPIT
;Don't print field headers
S FULLHDR=0
D CHKP() Q:STOPIT
W !
;At bottom of page need to get 3 lines of Summary Total display
D CHKP(7) Q:STOPIT
W !,"SUMMARY TOTAL - ",$$EXTDMC^RCDMCUT2(RCDMCVAL)
D ULINE^RCDMCUT2("-",65)
W !,"Total Number of Bills:",?53,$J($FN($G(^TMP($J,"RCDMCR2","TOT","BILL")),",P"),13)
D CHKP() Q:STOPIT
W !,"Total Number of unique veterans:",?53,$J($FN($G(^TMP($J,"RCDMCR2","TOT","VET")),",P"),13)
D CHKP() Q:STOPIT
W !,"Total Account Receivable Dollars:",?53,$J("$"_$FN($P($G(^TMP($J,"RCDMCR2","TOT","$")),".",1),",P"),13)
;Get summary data for each Status
S STAT=""
F S STAT=$O(^TMP($J,"RCDMCR2","TOT-STAT",STAT)) Q:STAT']"" D Q:STOPIT
. D CHKP() Q:STOPIT
. W !,"Total Number of unique ",STAT," Bill Status:",?53,$J($FN($G(^TMP($J,"RCDMCR2","TOT-STAT",STAT)),",P"),13)
Q
;
VALSUM ;Print Summary Total by DMC Debt Valid value
;Don't print summary if user ^ out
Q:STOPIT
D CHKP() Q:STOPIT
W !
;At bottom of page need to get 3 lines of Summary Total display
D CHKP(7) Q:STOPIT
W !,"SUMMARY TOTAL FOR DMC Debt Valid = ",VALID
D ULINE^RCDMCUT2("-",75)
W !,"Total Number of Bills (",VALID,"):",?63,$J($FN($G(^TMP($J,"RCDMCR2","SUM",VALID,"BILL")),",P"),13)
D CHKP() Q:STOPIT
W !,"Total Number of unique veterans (",VALID,"):",?63,$J($FN($G(^TMP($J,"RCDMCR2","SUM",VALID,"VET")),",P"),13)
D CHKP() Q:STOPIT
W !,"Total Account Receivable Dollars (",VALID,"):",?63,$J("$"_$FN($P($G(^TMP($J,"RCDMCR2","SUM",VALID,"$")),".",1),",P"),13)
;Get summary data for each Current Status
S STAT=""
F S STAT=$O(^TMP($J,"RCDMCR2","SUM-STAT",VALID,STAT)) Q:STAT']"" D Q:STOPIT
. D CHKP() Q:STOPIT
. W !,"Total Number of unique ",STAT," Bill Status (",VALID,"):",?63,$J($FN($G(^TMP($J,"RCDMCR2","SUM-STAT",VALID,STAT)),",P"),13)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDMCR2A 10027 printed Dec 13, 2024@01:43:31 Page 2
RCDMCR2A ;HEC/SBW - DMC Debt Validity Management Report ;9/Oct/2007
+1 ;;4.5;Accounts Receivable;**253**;Mar 20, 1995;Build 9
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ;This routine is being implemented for the Hold Debt to DMC Project.
+5 ;It will do the following:
+6 ; A new management report option will be added in AR to assist
+7 ; managers in reviewing the processing of the bills related to
+8 ; the Debt Validity Report. This report will include bills
+9 ; for veterans who are SC 50% to 100% or in receipt of VA Pension
+10 ; benefits and have bills for episodes of care within the previous
+11 ; 365 days (or older selected date). The user will have the option to
+12 ; select if the report will be for bills where the DMC Debt Valid
+13 ; field is "null", "PENDING", "YES", "NO" or All Values. The report
+14 ; will list only bills with Current Status of "ACTIVE", "OPEN",
+15 ; "SUSPENDED", "CANCELLATION", "REFUND REVIEW" and "REFUNDED".
+16 ;
MAIN ; Initial Interactive Processing
+1 NEW STOPIT,RCSCR,GETBEGDT,BEGDT,RCTYPE,RCDMCVAL
+2 WRITE !!,"*** Print the DMC Debt Validity Management Report ***"
+3 WRITE !!,"This report may take a while to process. It is recommended that"
+4 WRITE !,"you Queue this report to a device that is 132 characters wide."
+5 ;
+6 ; quit flag
SET STOPIT=0
+7 ; Prompts to the user:
+8 ;
+9 ;Prompt user for Date from which to include bills for episodes of care
+10 ;on report
+11 SET 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!")
+12 if +GETBEGDT'>0
QUIT
+13 SET BEGDT=$PIECE(GETBEGDT,U,2)
+14 ;
+15 SET RCTYPE=$$GETTYPE^RCDMCUT2(.STOPIT)
+16 if STOPIT>0!(RCTYPE']"")
QUIT
+17 SET RCDMCVAL=$$GETDMC^RCDMCUT2(.STOPIT)
+18 if STOPIT>0!(RCDMCVAL']"")
QUIT
+19 if RCTYPE="D"
Begin DoDot:1
+20 WRITE !?5,"It is recommended that you Queue this report to a"
+21 WRITE !?5,"device that is 132 characters wide.",!
End DoDot:1
+22 if RCTYPE="S"
Begin DoDot:1
+23 WRITE !?5,"It is recommended that you Queue this report to run.",!
End DoDot:1
+24 if RCTYPE="E"
DO EXMSG^RCDMCUT2
+25 ;
+26 DO DEVICE^RCDMCUT2("RUN^RCDMCR2A","DMC Debt Validity Management Report Process",.STOPIT,.RCSCR,BEGDT,"",RCTYPE,RCDMCVAL)
+27 if STOPIT>0!($DATA(ZTQUEUED))
QUIT
+28 DO RUN^RCDMCR2A
+29 IF STOPIT'=2
DO PAUSE2^RCDMCUT2
+30 QUIT
+31 ;
QUERPT ; Initial Taskman Scheduled Queued processing
+1 NEW STOPIT,RCSCR,RCTYPE,RCDMCVAL,BEGDT
+2 ;Queued Report option allows print the Detailed report
+3 ;for all DMC Debt Values
+4 SET STOPIT=0
SET RCSCR=""
SET RCTYPE="D"
SET RCDMCVAL="A"
+5 ;
+6 ;Get the "NUMBER OF DAYS FOR DMC REPORTS" site parameter in the AR Site
+7 ;Parameter (#342) file.
+8 SET BEGDT=$$GETRDAY^RCMSITE
+9 ;If parameter value not greater than 364 day set default to 365 days
+10 if BEGDT'>364
SET BEGDT=365
+11 ;Set report begin date to past date using Number of Days for DMC reports
+12 SET BEGDT=$$FMADD^XLFDT(DT,0-BEGDT,0,0,0)
+13 ;
+14 DO RUN^RCDMCR2A
+15 QUIT
+16 ;
RUN ;Get data and Print it out
+1 ;If queued ensure you delete it from the TASKS file
+2 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 NEW RCPAGE
+4 ;If not passed date, default to get data 365 old
+5 IF $GET(BEGDT)'>0
SET BEGDT=$$FMADD^XLFDT(DT,-365,0,0,0)
+6 KILL ^TMP($JOB,"RCDMCR2")
+7 SET RCPAGE=0
+8 IF RCDMCVAL="A"
SET RCDMCVAL("BLANK/NULL")=""
SET RCDMCVAL("PENDING")=""
SET RCDMCVAL("YES")=""
SET RCDMCVAL("NO")=""
+9 IF RCDMCVAL'="A"
SET RCDMCVAL($$EXTDMC^RCDMCUT2(RCDMCVAL))=""
+10 ; Collect the data in ^TMP
+11 DO COLLECT^RCDMCR2B(.STOPIT,BEGDT,.RCDMCVAL)
+12 if $GET(STOPIT)>0
QUIT
+13 USE IO
+14 ; Print Report using data in ^TMP
+15 DO REPORT
+16 IF 'RCSCR
WRITE !,@IOF
+17 DO ^%ZISC
+18 KILL ^TMP($JOB,"RCDMCR2")
+19 KILL RCTYPE,RCDMCVAL,RCSCR,TESTDATE
+20 QUIT
+21 ;
REPORT ;Print report
+1 NEW RUNDATE,FULLHDR,STATUS,VALID,NAME,SSN,NAMEPRT,BILLNO
+2 NEW NODE,CNUM,CLOC,PRINAMT,STATUS,EDITBY,EDITDT
+3 SET FULLHDR=1
+4 SET RUNDATE=$$FMTE^XLFDT($$NOW^XLFDT,"9D")
+5 ;No report data. Print header and Message. Then quit
+6 IF +$DATA(^TMP($JOB,"RCDMCR2"))'>0
SET FULLHDR=0
DO HDR
WRITE !,"No data meets the criteria."
QUIT
+7 ;Summary Type report for single DMC Debt Valid value.
+8 ;Print summary data and then quit.
+9 IF RCTYPE="S"
DO SUMRPT
QUIT
+10 IF RCTYPE="E"
SET FULLHDR=1
DO HDR
+11 SET VALID=""
+12 FOR
SET VALID=$ORDER(^TMP($JOB,"RCDMCR2","DETAIL",VALID))
if VALID']""
QUIT
Begin DoDot:1
+13 ;Detailed Report - Print header with field headers when DMC Debt
+14 ;Valid value changes
+15 IF RCTYPE="D"
SET FULLHDR=1
DO HDR
+16 SET NAME=""
+17 FOR
SET NAME=$ORDER(^TMP($JOB,"RCDMCR2","DETAIL",VALID,NAME))
if NAME']""
QUIT
Begin DoDot:2
+18 SET SSN=""
+19 FOR
SET SSN=$ORDER(^TMP($JOB,"RCDMCR2","DETAIL",VALID,NAME,SSN))
if SSN']""
QUIT
Begin DoDot:3
+20 ;NAMEPRT - Use to only print Name & SSN once for multiple bills
+21 SET NAMEPRT=1
+22 SET BILLNO=""
+23 FOR
SET BILLNO=$ORDER(^TMP($JOB,"RCDMCR2","DETAIL",VALID,NAME,SSN,BILLNO))
if BILLNO']""
QUIT
Begin DoDot:4
+24 SET NODE=$GET(^TMP($JOB,"RCDMCR2","DETAIL",VALID,NAME,SSN,BILLNO))
+25 SET CNUM=$PIECE(NODE,U,1)
SET CLOC=$PIECE(NODE,U,2)
SET PRINAMT=$PIECE(NODE,U,3)
+26 SET STATUS=$PIECE(NODE,U,4)
SET EDITBY=$PIECE(NODE,U,5)
SET EDITDT=$PIECE(NODE,U,6)
+27 IF RCTYPE="D"
SET FULLHDR=1
DO WRLINE
QUIT
+28 IF RCTYPE="E"
SET FULLHDR=0
DO WRLINE2
QUIT
End DoDot:4
if STOPIT
QUIT
End DoDot:3
if STOPIT
QUIT
End DoDot:2
if STOPIT
QUIT
+29 ;Print Summary for DMC Debt Valid if printing all DMC Debt Valid
+30 ;values on Detailed report
+31 IF RCTYPE="D"
IF RCDMCVAL="A"
Begin DoDot:2
+32 DO VALSUM
+33 ;Pause Prompt when print to Screen and more Patient Data
+34 IF RCSCR
IF $ORDER(^TMP($JOB,"RCDMCR2","DETAIL",VALID))]""
DO PAUSE^RCDMCUT2
End DoDot:2
End DoDot:1
if STOPIT
QUIT
+35 SET FULLHDR=0
+36 DO TOTSUM
+37 QUIT
+38 ;
+39 ;
WRLINE ; Write the data formated report line
+1 DO CHKP()
if STOPIT
QUIT
+2 ;If Multiple Bills for Vet only print Name & SSN for 1st record on page
+3 WRITE !
+4 IF NAMEPRT>0
Begin DoDot:1
+5 WRITE $EXTRACT(NAME,1,20)
+6 WRITE ?22,SSN
+7 WRITE ?30,CNUM
+8 WRITE ?42,CLOC
+9 SET NAMEPRT=0
End DoDot:1
+10 WRITE ?50,BILLNO
+11 WRITE ?63,$JUSTIFY("$"_$FNUMBER($PIECE(PRINAMT,".",1),",P"),12)
+12 WRITE ?77,$EXTRACT(STATUS,1,13)
+13 WRITE ?93,$EXTRACT(EDITBY,1,20)
+14 WRITE ?115,$$FMTE^XLFDT(EDITDT,"9D")
+15 QUIT
+16 ;
WRLINE2 ; Write the Excel report line
+1 WRITE !
+2 WRITE NAME_U
+3 WRITE SSN_U
+4 WRITE CNUM_U
+5 WRITE CLOC_U
+6 WRITE BILLNO_U
+7 WRITE PRINAMT_U
+8 WRITE VALID_U
+9 WRITE STATUS_U
+10 WRITE EDITBY_U
+11 WRITE $$FMTE^XLFDT(EDITDT,"9D")
+12 QUIT
+13 ;
CHKP(FOOTER) ;Check for End of Page
+1 ;Input
+2 ; FOOTER - Footer value. Optional. Default to 4 if nothing passed
+3 IF $GET(FOOTER)'>0
SET FOOTER=4
+4 IF $Y>(IOSL-FOOTER)
if RCSCR
DO PAUSE^RCDMCUT2
if STOPIT
QUIT
DO HDR
+5 QUIT
+6 ;
HDR ;Print Report Header
+1 ;NAMEPRT - Use to only print Name & SSN once for multiple bills
+2 SET NAMEPRT=1
+3 SET RCPAGE=RCPAGE+1
+4 ;Header for Detailed and Excel Delimited format (132 Chars wide)
+5 if RCTYPE="D"!(RCTYPE="E")
Begin DoDot:1
+6 WRITE @IOF,"DMC Debt Validity Management ",$$EXTTYPE^RCDMCUT2(RCTYPE)," Report"
+7 WRITE ?53,"Run Date: ",RUNDATE
+8 WRITE ?78,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
+9 WRITE ?120,"Page: "_RCPAGE
End DoDot:1
+10 ;Header for Summary Format (80 chars wide
+11 if RCTYPE="S"
Begin DoDot:1
+12 WRITE @IOF,"DMC Debt Validity Management ",$$EXTTYPE^RCDMCUT2(RCTYPE)," Report"
+13 WRITE ?70,"Page: "_RCPAGE
+14 WRITE !,"Run Date: ",RUNDATE
+15 WRITE ?30,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
End DoDot:1
+16 ;
+17 WRITE !?5,"DMC Debt Valid Field Values = ",$$EXTDMC^RCDMCUT2(RCDMCVAL)
+18 ;Print Underline for Summary Report header and Summary Data Header
+19 IF RCTYPE="S"!((RCTYPE="D")&(FULLHDR'>0))
Begin DoDot:1
+20 DO ULINE^RCDMCUT2("=",$GET(IOM))
End DoDot:1
+21 ;Quit if printing summary data. Don't need field headers
+22 if FULLHDR'>0
QUIT
+23 ;Print Detail Report header
+24 IF RCTYPE="D"
Begin DoDot:1
+25 WRITE !?30,"Claim",?42,"Claim",?50,"Bill",?65,"Receivable",?93,"DMC Debt Valid",?115,"DMC Debt Valid"
+26 WRITE !,"Veteran Name",?22,"SSN",?30,"Number",?42,"Loc.",?50,"Number",?65,"Amount",?77,"Status",?93,"Edit By",?115,"Edit Date"
+27 DO ULINE^RCDMCUT2("=",$GET(IOM))
+28 IF RCDMCVAL="A"
WRITE !,"*** Following data is for DMC Debt Valid Field Values of ",VALID," ***"
End DoDot:1
+29 ;Print Excel Delimited format header
+30 IF RCTYPE="E"
Begin DoDot:1
+31 WRITE !,"Veteran Name",U,"SSN",U,"Claim #",U,"Claim Loc",U,"Bill #",U,"DMC Debt Valid",U,"Amount",U,"STATUS",U,"DMC Debt Valid Edit By",U,"DMC Debt Valid Edit Date"
End DoDot:1
+32 QUIT
+33 ;
SUMRPT ;Print Summary report (No detailed data)
+1 SET FULLHDR=0
+2 DO HDR
+3 ;If not all DMC Debt Values then just print Total Summary and quit
+4 IF RCDMCVAL'="A"
DO TOTSUM
QUIT
+5 ;If DMC Debt Valid Report is for all values then print summary by DMC
+6 ;Debt Valid value and then the Total Summary for all DMC Debt Valid
+7 ;values.
+8 SET VALID=""
+9 FOR
SET VALID=$ORDER(^TMP($JOB,"RCDMCR2","DETAIL",VALID))
if VALID']""
QUIT
Begin DoDot:1
+10 DO VALSUM
End DoDot:1
if STOPIT
QUIT
+11 DO TOTSUM
+12 QUIT
+13 ;
TOTSUM ;Print Total Summary
+1 NEW STAT
+2 ;Don't print summary if user ^ out
+3 if STOPIT
QUIT
+4 ;Don't print field headers
+5 SET FULLHDR=0
+6 DO CHKP()
if STOPIT
QUIT
+7 WRITE !
+8 ;At bottom of page need to get 3 lines of Summary Total display
+9 DO CHKP(7)
if STOPIT
QUIT
+10 WRITE !,"SUMMARY TOTAL - ",$$EXTDMC^RCDMCUT2(RCDMCVAL)
+11 DO ULINE^RCDMCUT2("-",65)
+12 WRITE !,"Total Number of Bills:",?53,$JUSTIFY($FNUMBER($GET(^TMP($JOB,"RCDMCR2","TOT","BILL")),",P"),13)
+13 DO CHKP()
if STOPIT
QUIT
+14 WRITE !,"Total Number of unique veterans:",?53,$JUSTIFY($FNUMBER($GET(^TMP($JOB,"RCDMCR2","TOT","VET")),",P"),13)
+15 DO CHKP()
if STOPIT
QUIT
+16 WRITE !,"Total Account Receivable Dollars:",?53,$JUSTIFY("$"_$FNUMBER($PIECE($GET(^TMP($JOB,"RCDMCR2","TOT","$")),".",1),",P"),13)
+17 ;Get summary data for each Status
+18 SET STAT=""
+19 FOR
SET STAT=$ORDER(^TMP($JOB,"RCDMCR2","TOT-STAT",STAT))
if STAT']""
QUIT
Begin DoDot:1
+20 DO CHKP()
if STOPIT
QUIT
+21 WRITE !,"Total Number of unique ",STAT," Bill Status:",?53,$JUSTIFY($FNUMBER($GET(^TMP($JOB,"RCDMCR2","TOT-STAT",STAT)),",P"),13)
End DoDot:1
if STOPIT
QUIT
+22 QUIT
+23 ;
VALSUM ;Print Summary Total by DMC Debt Valid value
+1 ;Don't print summary if user ^ out
+2 if STOPIT
QUIT
+3 DO CHKP()
if STOPIT
QUIT
+4 WRITE !
+5 ;At bottom of page need to get 3 lines of Summary Total display
+6 DO CHKP(7)
if STOPIT
QUIT
+7 WRITE !,"SUMMARY TOTAL FOR DMC Debt Valid = ",VALID
+8 DO ULINE^RCDMCUT2("-",75)
+9 WRITE !,"Total Number of Bills (",VALID,"):",?63,$JUSTIFY($FNUMBER($GET(^TMP($JOB,"RCDMCR2","SUM",VALID,"BILL")),",P"),13)
+10 DO CHKP()
if STOPIT
QUIT
+11 WRITE !,"Total Number of unique veterans (",VALID,"):",?63,$JUSTIFY($FNUMBER($GET(^TMP($JOB,"RCDMCR2","SUM",VALID,"VET")),",P"),13)
+12 DO CHKP()
if STOPIT
QUIT
+13 WRITE !,"Total Account Receivable Dollars (",VALID,"):",?63,$JUSTIFY("$"_$FNUMBER($PIECE($GET(^TMP($JOB,"RCDMCR2","SUM",VALID,"$")),".",1),",P"),13)
+14 ;Get summary data for each Current Status
+15 SET STAT=""
+16 FOR
SET STAT=$ORDER(^TMP($JOB,"RCDMCR2","SUM-STAT",VALID,STAT))
if STAT']""
QUIT
Begin DoDot:1
+17 DO CHKP()
if STOPIT
QUIT
+18 WRITE !,"Total Number of unique ",STAT," Bill Status (",VALID,"):",?63,$JUSTIFY($FNUMBER($GET(^TMP($JOB,"RCDMCR2","SUM-STAT",VALID,STAT)),",P"),13)
End DoDot:1
if STOPIT
QUIT
+19 QUIT