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

RCDMCUT2.m

Go to the documentation of this file.
  1. RCDMCUT2 ;HEC/SBW - Utility Functions for Hold Debt to DMC Project ;30/AUG/2007
  1. ;;4.5;Accounts Receivable;**253,347**;Mar 20, 1995;Build 47
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. DEVICE(ROUTINE,DESC,STOPIT,RCSCR,BEGDT,EXCEL,RCTYPE,RCDMC) ;
  1. ;INPUT:
  1. ; ROUTINE - Routine Entry to Queue (e.g. MAIN^RDDMCR1)
  1. ; DESC - Description to use for tasked jobs
  1. ; BEGDT - Beginning date the report should begin with (required)
  1. ; EXCEL - If 1 report format will be Excel Delimited (Optional)
  1. ; RCTYPE - Report Type - D-DETAILED,S-SUMMARY,E-Excel (Optional)
  1. ; RCDMC - DMC Debt Valid Field Value - A-ALL VALUES,B-BLANK/NULL,
  1. ; Y-YES,N-NO (Optional)
  1. ;OUTPUT:
  1. ; STOPIT - Variable to indicate if process should't continue
  1. ; RCSCR - Variable to indicate if process is being sent to
  1. ; the screen or a device. 1 indicate screen
  1. ;
  1. N %ZIS,ZTSK,ZTRTN,ZTIO,ZTDESC,POP,ZTSAVE
  1. I $G(ROUTINE)']"" S STOPIT=1 Q
  1. I $G(BEGDT)']"" S STOPIT=1 Q
  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=ROUTINE
  1. . S ZTIO=ION
  1. . S ZTSAVE("RC*")=""
  1. . S ZTSAVE("STOPIT")=""
  1. . S ZTSAVE("BEGDT")=""
  1. . S ZTSAVE("EXCEL")=""
  1. . S ZTDESC=$G(DESC)
  1. . D ^%ZTLOAD
  1. . W !!,$S($D(ZTSK):"Request Queued. TASK = "_ZTSK,1:"REQUEST CANCELLED")
  1. . D HOME^%ZIS
  1. Q
  1. ;
  1. STOPIT() ; Checks if user requested task to stop
  1. ;Input:
  1. ; No input
  1. ;Output
  1. ; Function returns one if the user requested the task to stop
  1. ;
  1. N RCX,STOPIT
  1. S STOPIT=0
  1. S RCX=$$S^%ZTLOAD
  1. I RCX D ;
  1. . S STOPIT=1
  1. . I $G(ZTSK) S ZTSTOP=1
  1. Q STOPIT
  1. ;
  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")="NO",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. ;
  1. HEXC ; - 'Do you want to capture data...' prompt
  1. W !!," Enter: 'Y' - To capture detail report data to transfer"
  1. W !," to an Excel document"
  1. W !," '<CR>' - To skip this option"
  1. W !," '^' - To quit this option"
  1. Q
  1. ;
  1. EXMSG ; - Displays the message about capturing to an Excel file format
  1. ;
  1. W !!?5,"This report may take a while to run. It is recommended that you Queue it."
  1. W !!?5,"To capture as an Excel format, it is recommended that you queue this"
  1. W !?5,"report to a spool device with margins of 256 and page length of 99999"
  1. W !?5,"(e.g. spoolname;256;99999). This should help avoid wrapping problems."
  1. W !!?5,"Another method would be to set up your terminal to capture the detail"
  1. W !?5,"report data. On some terminals, this can be done by clicking on the"
  1. W !?5,"'Tools' menu above, then click on 'Capture Incoming Data' to save to"
  1. W !?5,"Desktop. To avoid undesired wrapping of the data saved to the file,"
  1. W !?5,"please enter '0;256;99999' at the 'DEVICE:' prompt.",!
  1. Q
  1. ;
  1. GETTYPE(STOPIT) ; Choose a (S)ummary or (D)etail or (E)xcel Delimited Report
  1. ;INPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ;OUTPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ; Function returns the Report Type (D,S,E)
  1. ;
  1. N Y,X,DIR,DIRUT,DUOUT,DTOUT,DIROUT
  1. S DIR(0)="S^D:DETAILED;S:SUMMARY;E:EXCEL DELIMITED"
  1. S DIR("A")="Select Type of Report"
  1. W !
  1. D ^DIR
  1. S:$D(DIRUT)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT) STOPIT=1,Y=""
  1. Q Y
  1. GETTYPE2(STOPIT) ; Choose a (S)ummary or (D)etail
  1. ;INPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ;OUTPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ; Function returns the Report Type (D,S,E)
  1. ;
  1. N Y,X,DIR,DIRUT,DUOUT,DTOUT,DIROUT
  1. S DIR(0)="S^D:DETAILED;S:SUMMARY"
  1. S DIR("A")="Select Type of Report"
  1. S DIR("B")="DETAILED"
  1. W !
  1. D ^DIR
  1. S:$D(DIRUT)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT) STOPIT=1,Y=""
  1. Q $E(Y)
  1. ;
  1. BILLPAYS() ; Do you want to see only bills with payments?
  1. ;INPUT:
  1. ; None
  1. ; Output:
  1. ; Returns 1 - YES (Bills with payments) / 0 - NO (All bills) /
  1. ; "^" - Exit report
  1. ;
  1. N BP,X,Y,DIR,DIRUT,DTOUT,DUOUT,DIROUT
  1. ;
  1. S BP=0
  1. S DIR(0)="Y",DIR("B")="YES",DIR("T")=DTIME W !
  1. S DIR("A")="Do you want to see only bills with payments"
  1. ;S DIR("?")="^D HEXC^RCDMCUT2"
  1. D ^DIR
  1. S:$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) BP="^"
  1. S:$G(Y)>0 BP=1
  1. Q BP
  1. ;
  1. GETDMC(STOPIT) ;Chose DMC Debt Valid field value to include Null, Pending,
  1. ; Yes, No and All vallues
  1. ;INPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ;OUTPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ; Function returns the DMC Debt Valid Field Value (A,B,P,Y,N)
  1. ;
  1. N Y,X,DIR,DIRUT,DUOUT,DTOUT,DIROUT
  1. S DIR(0)="S^A:ALL FIELD VALUES;B:BLANK/NULL;P:PENDING;Y:YES;N:NO"
  1. S DIR("A")="Select DMC Debt Valid field value"
  1. S DIR("?")=" "
  1. S DIR("?",1)="Enter 'A' to list bills of all DMC Debt Valid values"
  1. S DIR("?",2)="Enter 'B' to list bills not yet reviewed by the user"
  1. S DIR("?",3)="Enter 'P' to list bills excluded by AR nightly background process"
  1. S DIR("?",4)="Enter 'Y' to list bills a User determined should be referred to DMC"
  1. S DIR("?",5)="Enter 'N' to list bills a User determined should not be referred to DMC"
  1. W !
  1. D ^DIR
  1. S:$D(DIRUT)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT) STOPIT=1,Y=""
  1. Q Y
  1. ;
  1. EXTTYPE(TYPE) ;Get Set of Code external format for Report type
  1. ;INPUT
  1. ; TYPE - Internal Report type: D, S, E
  1. ;OUTPUT
  1. ; Returns external Report type: D - DETAILED, S - SUMMARY,
  1. ; E - EXCEL DELIMITED
  1. ;
  1. S TYPE=$G(TYPE)
  1. Q $S(TYPE="D":"DETAILED",TYPE="S":"SUMMARY",TYPE="E":"EXCEL DELIMITED",1:"")
  1. ;
  1. EXTDMC(VAL) ;Get Set of Code external format for DMC Debt Valid field value
  1. ;INPUT
  1. ; VAL - Internal DMC Debt Valid value: A, B, P, Y, N
  1. ;OUTPUT
  1. ; Returns external DMC Debt Valid value: A - ALL, B - BLANK/NULL
  1. ; P - PENDING, Y - YES, N - NO
  1. ;
  1. S VAL=$G(VAL)
  1. Q $S(VAL="A":"ALL",VAL="B":"BLANK/NULL",VAL="P":"PENDING",VAL="Y":"YES",VAL="N":"NO",1:"")
  1. ;
  1. DATE(PROMPT,PROMPT2,BEG,END,DTYPE) ;Get beginning and Ending dates
  1. ;INPUT:
  1. ; PROMPT - Message to display prior to prompting for dates
  1. ; PROMPT2 - (Optional) Message to display on second line
  1. ; BEG - (Optional) default begin date
  1. ; END - (Optional) default end date
  1. ; DTYPE - (Optional) date type
  1. ;OUTPUT:
  1. ; 1^BEGDT^ENDDT - Data found
  1. ; 0 - User up arrowed or timed out
  1. ;NOTE:
  1. ; Optional Parameters added by Glaz to support date range from other reports
  1. ;
  1. N %DT,Y,X,BEGDT,ENDDT,DTOUT,OUT,DIRUT,DUOUT,DIROUT
  1. S OUT=0
  1. W !,$G(PROMPT)
  1. I $G(PROMPT2)'="" W !,$G(PROMPT2)
  1. S %DT="AEX"
  1. S %DT("A")="Enter "_$S($G(DTYPE)="":"",1:DTYPE_" ")_"Beginning Date: "
  1. I $G(BEG)="" S %DT("B")="TODAY"
  1. E S Y=BEG X ^DD("DD") S %DT("B")=Y
  1. W !
  1. D ^%DT
  1. K %DT
  1. ;Quit if user time out or didn't enter valid date
  1. Q:Y<0 OUT
  1. S BEGDT=+Y
  1. S %DT="AEX"
  1. S %DT("A")="Enter "_$S($G(DTYPE)="":"",1:DTYPE_" ")_"Ending Date: "
  1. I $G(END)="" S %DT("B")="TODAY"
  1. E S Y=END X ^DD("DD") S %DT("B")=Y
  1. D ^%DT
  1. K %DT
  1. ;Quit if user time out or didn't enter valid date
  1. Q:Y<0 OUT
  1. S ENDDT=+Y
  1. S OUT=1_U_BEGDT_U_ENDDT
  1. ;Switch dates when user enters more recent date for Begin Date
  1. ;than End Date
  1. S:BEGDT>ENDDT OUT=1_U_ENDDT_U_BEGDT
  1. Q OUT
  1. ;
  1. DATE2(PROMPT,PROMPT2,BEG,END,DTYPE) ;Get beginning and Ending dates
  1. ;INPUT:
  1. ; PROMPT - Message to display prior to prompting for dates
  1. ; PROMPT2 - (Optional) Message to display on second line
  1. ; BEG - (Optional) default begin date
  1. ; END - (Optional) default end date
  1. ; DTYPE - (Optional) date type
  1. ;OUTPUT:
  1. ; 1^BEGDT^ENDDT - Data found
  1. ; 0 - User up arrowed or timed out
  1. ;NOTE:
  1. ; Optional Parameters added to support date range from other reports
  1. ;
  1. N %DT,Y,X,BEGDT,ENDDT,DTOUT,OUT,DIRUT,DUOUT,DIROUT
  1. S OUT=0
  1. W !,$G(PROMPT)
  1. I $G(PROMPT2)'="" W !,$G(PROMPT2)
  1. S %DT="AEX"
  1. S %DT("A")="Enter "_$S($G(DTYPE)="":"",1:DTYPE_" ")_"Begin Date: "
  1. I $G(BEG)="" S %DT("B")="TODAY"
  1. I $G(BEG)'="" S Y=BEG X ^DD("DD") S %DT("B")=Y
  1. W !
  1. D ^%DT
  1. K %DT
  1. ;Quit if user time out or didn't enter valid date
  1. Q:Y<0 OUT
  1. S BEGDT=+Y
  1. S %DT="AEX"
  1. S %DT("A")="Enter "_$S($G(DTYPE)="":"",1:DTYPE_" ")_"End Date: "
  1. I $G(END)="" S %DT("B")="TODAY"
  1. I $G(END)'="" S Y=END X ^DD("DD") S %DT("B")=Y
  1. D ^%DT
  1. K %DT
  1. ;Quit if user time out or didn't enter valid date
  1. Q:Y<0 OUT
  1. S ENDDT=+Y
  1. S OUT=1_U_BEGDT_U_ENDDT
  1. ;Switch dates when user enters more recent date for Begin Date
  1. ;than End Date
  1. S:BEGDT>ENDDT OUT=1_U_ENDDT_U_BEGDT
  1. Q OUT
  1. ;
  1. GETBEGDT(PROMPT1,PROMPT2,DTPROMPT) ;Get beginning date
  1. ;INPUT:
  1. ; PROMPT1 - Message to display prior to prompting for date
  1. ; PROMPT2 - Message to display prior to prompting for date
  1. ; DTPROMPT - Date query verbiage, if defined
  1. ;OUTPUT:
  1. ; 1^BEGDT - Data found
  1. ; 0 - User up arrowed or timed out
  1. ;
  1. N %DT,Y,X,BEGDT,DTOUT,OUT,DIRUT,DUOUT,DIROUT
  1. S OUT=0
  1. W !!,$G(PROMPT1)
  1. W:$G(PROMPT2)]"" !,PROMPT2
  1. S %DT="AEX"
  1. S %DT("A")="Enter Beginning Date: " I $G(DTPROMPT)]"" S %DT("A")=DTPROMPT
  1. S %DT("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-365,0,0,0),"1D")
  1. S %DT(0)=-$$FMADD^XLFDT(DT,-365,0,0,0)
  1. W !
  1. D ^%DT
  1. K %DT
  1. ;Quit if user time out or didn't enter valid date
  1. Q:Y<0 OUT
  1. S BEGDT=+Y
  1. S OUT=1_U_BEGDT
  1. Q OUT
  1. ARSTAT(STOPIT) ;Chose AR status
  1. ; Yes, No and All vallues
  1. ;INPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ;OUTPUT
  1. ; STOPIT - Variable to be set if user '^' out or time out
  1. ; Function returns 1-7 (1:Active;2:Open;3:Suspended;4:Collected/Closed;5:On-Hold;6:Write Off;7:All)
  1. ;
  1. N Y,X,DIR,DIRUT,DUOUT,DTOUT,DIROUT
  1. ;W !,"Report to Include Bills for charges without an IB status of Cancelled, with an"
  1. ;W !,"AR Status of Active, Open, Suspended, Write-Off, Collected/Closed, or with IB"
  1. ;W !,"Status of On-Hold, and date of service on or after the exemption effective date."
  1. S DIR(0)="S^1:Active;2:Open;3:Suspended;4:Collected/Closed;5:On-Hold;6:Write-Off;7:ALL (Includes 1-6 and AR CANCELLATIONS)"
  1. S DIR("A")="Select a Status"
  1. S DIR("B")=7
  1. W !
  1. D ^DIR
  1. S:$D(DIRUT)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT) STOPIT=1,Y=""
  1. Q Y
  1. ;
  1. PAUSE ;If sending report to screen display pause message at screen bottom
  1. N X
  1. U IO(0)
  1. W !!,"Press RETURN to continue, '^' to exit:"
  1. R X:DTIME
  1. S:'$T X="^"
  1. S:X["^" STOPIT=2
  1. U IO
  1. Q
  1. ;
  1. PAUSE2 ;If sending report to screen display pause message at screen bottom;
  1. N X
  1. U IO(0)
  1. W !!,"Press RETURN to continue:"
  1. R X:DTIME
  1. S:'$T X="^"
  1. S:X["^" STOPIT=2
  1. U IO
  1. Q
  1. ;
  1. ULINE(X,WIDTH) ;Display line of a given character
  1. ;INPUT:
  1. ; X - Character to display
  1. ; WIDTH - Number of Character to display
  1. ;
  1. N I
  1. S:$G(WIDTH)'>0 WIDTH=80
  1. W !
  1. F I=1:1:WIDTH W $G(X,"-")
  1. Q
  1. ;