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

RCDPEFA2.m

Go to the documentation of this file.
  1. RCDPEFA2 ;AITC/FA - FIRST PARTY AUTO-DECREASE REPORT, cont. ; 5/29/19 12:31pm
  1. ;;4.5;Accounts Receivable;**345,349**;Mar 20, 1995;Build 44
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. ; Read ^DG(40.8) - IA 417
  1. ; DIVISION^VAUTOMA - IA 664
  1. ;
  1. Q
  1. ;
  1. STADIV(RCVAUTD) ; EP from RCDPEFA1 - Division/Station selection
  1. ; Input: None
  1. ; Output: RCVAUTD - Array of selected Divisions/Stations, passed by ref.
  1. ; Returns: 1 - All selected, 2 - specific Divisions/Stations, 0 - U or timeout
  1. N DTOUT,DUOUT,VAUTD,Y
  1. D DIVISION^VAUTOMA ; RETURNS Y=-1 (quit), VAUTD=1 (for all),VAUTD=0 (selected divisions in VAUTD) - IA 664
  1. Q:Y<0 0
  1. Q:VAUTD=1 1 ; All Divisions
  1. S Y="" F S Y=$O(VAUTD(Y)) Q:'Y D ;
  1. . I $G(^DG(40.8,"ADV",Y)) S RCVAUTD(^DG(40.8,"ADV",Y))=VAUTD(Y)
  1. Q 2
  1. ;
  1. ASKPAT() ; EP from RCDPEFA1 - Filter by Patient or 'ALL'
  1. ; Input: None
  1. ; Returns: P - Sort by Claim
  1. ; A - Sort by Patient Name
  1. ; 0 - User entered '^' or timed out
  1. N C1,C2,C3,DIR,DIROUT,DIRUT,DTOUT,DUOUT,XX
  1. S DIR(0)="SA^P:PATIENT;A:ALL;"
  1. S DIR("A")="Select (P)ATIENT or (A)LL?: "
  1. S DIR("?",1)="Enter 'P' to filter by Patient or 'A' to show all 1st Party"
  1. S DIR("?")="Auto-Decreases."
  1. S DIR("B")="ALL"
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT) 0
  1. S C1=Y,C2="",C3="" ; PRCA*4.5*349 add C3
  1. S:C1="P" C2=$$ASKPAT2 ; Ask for Patient IEN
  1. Q:C2=0 0 ; No patient selected
  1. Q:C2=0 C1_"|"
  1. ; PRCA*4.5*349 Begin Modified Block
  1. S:+C2 C3=$$ASKPAT3
  1. Q:C3=-1 0
  1. Q C1_"|"_C2_"|"_C3
  1. ; PRCA*4.5*349 End Modified Block
  1. ;
  1. ASKPAT2() ; Select the Patient to filter by
  1. ; Input: None
  1. ; Returns: IEN - Select Patient IEN file #2
  1. ; 0 - User entered '^' or timed out or no patient selected
  1. N DIC,DIROUT,DIRUT,DTOUT,DUOUT
  1. S DIC="^DPT(",DIC(0)="AEINMQ"
  1. S DIC("A")="Select Patient: "
  1. D ^DIC
  1. Q:$D(DTOUT)!$D(DUOUT) 0
  1. Q:Y<1 0
  1. Q:Y="" 0
  1. Q $P(Y,U,1)
  1. ;
  1. ; prca*4.5*349 - Subroutine added
  1. ASKPAT3() ; Ask whether to display comment details for single patient search
  1. ; Input: None
  1. ; Returns: Y = Yes, display comment details
  1. ; N = No, do not display comment details
  1. ; -1 = User entered '^' or timed out
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,Y
  1. S DIR(0)="YA"
  1. S DIR("A")="Display Comment Detail? (Y/N)// "
  1. D ^DIR
  1. I $D(DTOUT)!$D(DUOUT) Q -1
  1. Q Y
  1. ;
  1. ASKSORT() ; EP from RCDPEFA1 - Select the sort criteria
  1. ; Input: None
  1. ; Returns: C - Sort by Claim
  1. ; N - Sort by Patient Name
  1. ; 0 - User entered '^' or timed out
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,XX
  1. S DIR(0)="SA^C:CLAIM;N:PATIENT NAME;"
  1. S DIR("A")="Sort by (C)LAIM # or PATIENT (N)AME?: "
  1. S DIR("?",1)="Enter 'C' to sort by Claim Number or 'N' to sort"
  1. S DIR("?")="by Patient Name."
  1. S DIR("B")="CLAIM"
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT) 0
  1. Q Y
  1. ;
  1. SORTORD(SORT) ; EP from RCDPEFA1 - Select the sort order
  1. ; Input: SORT - 'C' - Sort by Claim Number
  1. ; 'N' - Sort by Patient Name
  1. ; Returns: F - First to Last
  1. ; L - Last to First
  1. ; 0 - User entered '^' or timed out
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,XX,YY
  1. S XX=" (F)IRST TO LAST or (L)AST TO FIRST?: "
  1. S YY=$S(SORT="C":"CLAIM",1:"PATIENT NAME")
  1. S DIR("A")="Sort "_YY_XX
  1. S DIR(0)="SA^F:FIRST TO LAST;L:LAST TO FIRST"
  1. S DIR("B")="FIRST TO LAST"
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT) 0
  1. Q Y
  1. ;
  1. DTRNG() ; EP from RCDPEFA1 - Get the date range for the report
  1. ; Input: None
  1. ; Returns: A1|A2|A3 - Where:
  1. ; A1 - 0 - User up-arrowed or timed out, 1 otherwise
  1. ; A2 - Auto-Post Start Date
  1. ; A3 - Auto-Post End Date
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,RCEND,RCSTART,RNGFLG,X,Y
  1. D DATES(.RCSTART,.RCEND)
  1. Q:RCSTART=-1 0
  1. Q:RCSTART "1|"_RCSTART_"|"_RCEND
  1. Q:'RCSTART "0||"
  1. Q 0
  1. ;
  1. DATES(BDATE,EDATE) ; Get a date range.
  1. ; Input: None
  1. ; Output: BDATE - Internal Auto-Post Start Date
  1. ; EDATE - Internal Auto-Post End Date
  1. D1 ; looping tag
  1. S (BDATE,EDATE)=0
  1. S DIR("?")="Enter the earliest Auto-Posting date to include on the report."
  1. S DIR(0)="DAO^:"_DT_":APE"
  1. S DIR("A")="Start Date: "
  1. D ^DIR
  1. K DIR
  1. I $D(DTOUT)!$D(DUOUT)!(Y="") S BDATE=-1 Q
  1. S BDATE=Y
  1. S DIR("?")="Enter the latest Auto-Posting date to include on the report."
  1. S DIR("B")=Y(0)
  1. S DIR(0)="DAO^"_BDATE_":"_DT_":APE"
  1. S DIR("A")="End Date: "
  1. D ^DIR
  1. K DIR
  1. I $D(DTOUT)!$D(DUOUT)!(Y="") S BDATE=-1 Q
  1. S EDATE=Y
  1. Q
  1. ;
  1. DISPTY() ; EP from RCDPEFA1 - Get display/output type
  1. ; Input: None
  1. ; Returns: 1 - Output to Excel
  1. ; 0 - Output to paper
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,Y
  1. S DIR(0)="Y"
  1. S DIR("A")="Export the report to Microsoft Excel"
  1. S DIR("B")="NO"
  1. D ^DIR
  1. I $G(DUOUT) Q -1
  1. Q Y
  1. ;
  1. ; PRCA*4.5*349 - Subroutine added
  1. DETSUM() ; EP from RCDPEFA1 - Get detail/summary type
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,Y
  1. S DIR("A")="Display (S)UMMARY or (D)ETAIL Format?: "
  1. S DIR(0)="SA^S:SUMMARY;D:DETAIL"
  1. S DIR("B")="DETAIL"
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT) 0
  1. Q Y
  1. ;
  1. DEVICE(IO) ; Select output device
  1. ; Input: None
  1. ; Output: IO - Array of selected output info
  1. ; Returns: 0 - No device selected, 1 Otherwise
  1. N POP,%ZIS
  1. S %ZIS="QM"
  1. D ^%ZIS
  1. Q:POP 0
  1. Q 1
  1. ;
  1. LMAN(DATA,INPUT,RCCMT,XX) ;EP from RCDPEFA1
  1. ; Format and save List Manager line
  1. ; Input: DATA - ERA line adjustment total
  1. ; INPUT - Input parameters in delimited list
  1. ; RCCMT - Array of free text comments for this decrease
  1. ; XX - List Counter for ^TMP("RCDPE_ADP",$J)
  1. ;
  1. N CNT,Y
  1. S Y=$P(DATA,U,3) ; Patient Name/SSN last 4
  1. S $E(Y,33)=$J($P(DATA,U,4),6,2) ; COPAY Amount
  1. S $E(Y,41)=$J($P(DATA,U,5),6,2) ; Auto-Decrease Amount
  1. S $E(Y,49)=$E($P(DATA,U,6),1,10) ; Copay Claim #
  1. S $E(Y,61)=$E($P(DATA,U,7),1,10) ; 3rd Party Claim #
  1. S $E(Y,73)=$P(DATA,U,8) ; Auto-Decrease Date
  1. S ^TMP("RCDPE_ADP",$J,XX)=Y,XX=XX+1
  1. I $P($P(INPUTS,U,7),"|",3)=1 D ; Show comment detail?
  1. . S CNT="" F S CNT=$O(RCCMT(CNT)) Q:CNT="" D ;
  1. . . S Y=$S(CNT=1:" Comment: ",1:" ")
  1. . . S Y=Y_RCCMT(CNT)
  1. . . S ^TMP("RCDPE_ADP",$J,XX)=Y,XX=XX+1
  1. Q
  1. ;
  1. TOTALD(LMAN,HDRINFO,PAGE,STOP,DAY,DTOTAL,LCNT) ; Totals for a single day
  1. ; Input: LMAN - 1 if output to List Template, 0 otherwise
  1. ; HDRINFO - Array of header information
  1. ; PAGE - Page Number
  1. ; DAY - FileMan date to display totals for
  1. ; DTOTAL - Array of totals by day
  1. ; LCNT - Current line count (only passedif LMAN=1)
  1. ; Output: PAGE - Updated Page Number (if a new header is displayed)
  1. ; STOP - 1 if user indiacted to stop
  1. ; LCNT - Updated line count (only passedif LMAN=1)
  1. N DAMT,DCNT,LN1,LN2,LN3,DCOP
  1. S DCNT=$P(DTOTAL(DAY),U,1)
  1. S DAMT=$P(DTOTAL(DAY),U,2)
  1. S DCOP=$P(DTOTAL(DAY),U,3) ; PRCA*4.5*349
  1. S LN1="**Totals for Date: "_$$FMTE^XLFDT(DAY,"2Z")
  1. S $E(LN1,35)=" # of Decrease Adjustments: "_DCNT
  1. S LN2="",$E(LN2,28)="Total Amount of Decrease Adjustments: $"_$J(DAMT,3,2)
  1. S LN3="",$E(LN3,22)="% of Dollars Auto-Decreased of Total Copay: "_$$PCENT^RCDPEFA1(DAMT,DCOP)_"%" ; PRCA*4.5*349
  1. ;
  1. I LMAN D Q
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)="",LCNT=LCNT+1
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)=LN1,LCNT=LCNT+1
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)=LN2,LCNT=LCNT+1
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)=LN3,LCNT=LCNT+1 ; PRCA*4.5*349
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)="",LCNT=LCNT+1
  1. ;
  1. I $Y>(IOSL-7) D
  1. . D ASK^RCDPEADP(.STOP,0)
  1. . Q:STOP
  1. . D HDR^RCDPEFA1(EXCEL,.HDRINFO,.PAGE)
  1. Q:STOP
  1. W !!,LN1
  1. W !,LN2
  1. W !,LN3 ; PRCA*4.5*349
  1. Q
  1. ;
  1. TOTALG(LMAN,HDRINFO,PAGE,GTOTAL,STOP,LCNT) ; Overall report total
  1. ; Input: LMAN - 1 if output to Listman, 0 otherwise
  1. ; HDRINFO - Array of header info
  1. ; PAGE - Current Page Number
  1. ; GTOTAL - Grand Totals for report
  1. ; LCNT - Current line count (only passedif LMAN=1)
  1. ; Output: PAGE - Updated Page Number (if new header is displayed)
  1. ; LCNT - Updated line count (only passedif LMAN=1)
  1. N LN1,LN2,LN3,GAMT,GCOP
  1. S GAMT=+$P(GTOTAL,U,2),GCOP=+$P(GTOTAL,U,3) ; PRCA*4.5*349
  1. S LN1="**** Totals for Date Range: # of Decrease Adjustments: "_+$P(GTOTAL,U,1)
  1. S LN2="",$E(LN2,28)="Total Amount of Decrease Adjustments: $"_$J((+$P(GTOTAL,U,2)),3,2)
  1. S LN3="",$E(LN3,22)="% of Dollars Auto-Decreased of Total Copay: "_$$PCENT^RCDPEFA1(GAMT,GCOP)_"%" ; PRCA*4.5*349
  1. ;
  1. I LMAN D Q
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)="",LCNT=LCNT+1
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)=LN1,LCNT=LCNT+1
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)=LN2,LCNT=LCNT+1
  1. . S ^TMP("RCDPE_ADP",$J,LCNT)=LN3,LCNT=LCNT+1 ; PRCA*4.5*349
  1. ;
  1. I $Y>(IOSL-6) D
  1. . D ASK^RCDPEADP(.STOP,0)
  1. . Q:STOP
  1. . D HDR^RCDPEFA1(EXCEL,.HDRINFO,.PAGE)
  1. Q:STOP
  1. W !!,"**** Totals for Date Range: # of Decrease Adjustments: "_+$P(GTOTAL,U,1)
  1. S Y="",$E(Y,28)="Total Amount of Decrease Adjustments: $"_$J((+$P(GTOTAL,U,2)),3,2)
  1. W !,Y ; PRCA*4.5*349
  1. S Y="",$E(Y,22)="% of Dollars Auto-Decreased of Total Copay: "_$$PCENT^RCDPEFA1(GAMT,GCOP)_"%" ; PRCA*4.5*349
  1. W !,Y,!
  1. Q