source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCDMCUT2.m@ 1005

Last change on this file since 1005 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 7.2 KB
Line 
1RCDMCUT2 ;HEC/SBW - Utility Functions for Hold Debt to DMC Project ;30/AUG/2007
2 ;;4.5;Accounts Receivable;**253**;Mar 20, 1995;Build 9
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ;
7DEVICE(ROUTINE,DESC,STOPIT,RCSCR,BEGDT,EXCEL,RCTYPE,RCDMC) ;
8 ;INPUT:
9 ; ROUTINE - Routine Entry to Queue (e.g. MAIN^RDDMCR1)
10 ; DESC - Description to use for tasked jobs
11 ; BEGDT - Beginning date the report should begin with (required)
12 ; EXCEL - If 1 report format will be Excel Delimited (Optional)
13 ; RCTYPE - Report Type - D-DETAILED,S-SUMMARY,E-Excel (Optional)
14 ; RCDMC - DMC Debt Valid Field Value - A-ALL VALUES,B-BLANK/NULL,
15 ; Y-YES,N-NO (Optional)
16 ;OUTPUT:
17 ; STOPIT - Variable to indicate if process should't continue
18 ; RCSCR - Variable to indicate if process is being sent to
19 ; the screen or a device. 1 indicate screen
20 ;
21 N %ZIS,ZTSK,ZTRTN,ZTIO,ZTDESC,POP,ZTSAVE
22 I $G(ROUTINE)']"" S STOPIT=1 Q
23 I $G(BEGDT)']"" S STOPIT=1 Q
24 S %ZIS="QM"
25 W ! D ^%ZIS
26 I POP S STOPIT=1 Q
27 S RCSCR=$S($E($G(IOST),1,2)="C-":1,1:0)
28 ;
29 I $D(IO("Q")) D S STOPIT=1
30 . S ZTRTN=ROUTINE
31 . S ZTIO=ION
32 . S ZTSAVE("RC*")=""
33 . S ZTSAVE("STOPIT")=""
34 . S ZTSAVE("BEGDT")=""
35 . S ZTSAVE("EXCEL")=""
36 . S ZTDESC=$G(DESC)
37 . D ^%ZTLOAD
38 . W !!,$S($D(ZTSK):"Request Queued. TASK = "_ZTSK,1:"REQUEST CANCELLED")
39 . D HOME^%ZIS
40 Q
41 ;
42STOPIT() ; Checks if user requested task to stop
43 ;Input:
44 ; No input
45 ;Output
46 ; Function returns one if the user requested the task to stop
47 ;
48 N RCX,STOPIT
49 S STOPIT=0
50 S RCX=$$S^%ZTLOAD
51 I RCX D ;
52 . S STOPIT=1
53 . I $G(ZTSK) S ZTSTOP=1
54 Q STOPIT
55 ;
56EXCEL() ; - Returns whether to capture data for Excel report.
57 ;INPUT:
58 ; None
59 ; Output:
60 ; Returns 1 - YES (capture data) / 0 - NO (DO NOT capture data) /
61 ; "^" - Exit report
62 ;
63 N EXCEL,X,Y,DIR,DIRUT,DTOUT,DUOUT,DIROUT
64 ;
65 S EXCEL=0
66 S DIR(0)="Y",DIR("B")="NO",DIR("T")=DTIME W !
67 S DIR("A")="Do you want to capture report data for an Excel document"
68 S DIR("?")="^D HEXC^RCDMCUT2"
69 D ^DIR
70 S:$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) EXCEL="^"
71 S:$G(Y)>0 EXCEL=1
72 ;
73 Q EXCEL
74 ;
75HEXC ; - 'Do you want to capture data...' prompt
76 W !!," Enter: 'Y' - To capture detail report data to transfer"
77 W !," to an Excel document"
78 W !," '<CR>' - To skip this option"
79 W !," '^' - To quit this option"
80 Q
81 ;
82EXMSG ; - Displays the message about capturing to an Excel file format
83 ;
84 W !!?5,"This report may take a while to run. It is recommended that you Queue it."
85 W !!?5,"To capture as an Excel format, it is recommended that you queue this"
86 W !?5,"report to a spool device with margins of 256 and page length of 99999"
87 W !?5,"(e.g. spoolname;256;99999). This should help avoid wrapping problems."
88 W !!?5,"Another method would be to set up your terminal to capture the detail"
89 W !?5,"report data. On some terminals, this can be done by clicking on the"
90 W !?5,"'Tools' menu above, then click on 'Capture Incoming Data' to save to"
91 W !?5,"Desktop. To avoid undesired wrapping of the data saved to the file,"
92 W !?5,"please enter '0;256;99999' at the 'DEVICE:' prompt.",!
93 Q
94 ;
95GETTYPE(STOPIT) ; Choose a (S)ummary or (D)etail or (E)xcel Delimited Report
96 ;INPUT
97 ; STOPIT - Variable to be set if user '^' out or time out
98 ;OUTPUT
99 ; STOPIT - Variable to be set if user '^' out or time out
100 ; Function returns the Report Type (D,S,E)
101 ;
102 N Y,X,DIR,DIRUT,DUOUT,DTOUT,DIROUT
103 S DIR(0)="S^D:DETAILED;S:SUMMARY;E:EXCEL DELIMITED"
104 S DIR("A")="Select Type of Report"
105 W !
106 D ^DIR
107 S:$D(DIRUT)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT) STOPIT=1,Y=""
108 Q Y
109 ;
110GETDMC(STOPIT) ;Chose DMC Debt Valid field value to include Null, Pending,
111 ; Yes, No and All vallues
112 ;INPUT
113 ; STOPIT - Variable to be set if user '^' out or time out
114 ;OUTPUT
115 ; STOPIT - Variable to be set if user '^' out or time out
116 ; Function returns the DMC Debt Valid Field Value (A,B,P,Y,N)
117 ;
118 N Y,X,DIR,DIRUT,DUOUT,DTOUT,DIROUT
119 S DIR(0)="S^A:ALL FIELD VALUES;B:BLANK/NULL;P:PENDING;Y:YES;N:NO"
120 S DIR("A")="Select DMC Debt Valid field value"
121 S DIR("?")=" "
122 S DIR("?",1)="Enter 'A' to list bills of all DMC Debt Valid values"
123 S DIR("?",2)="Enter 'B' to list bills not yet reviewed by the user"
124 S DIR("?",3)="Enter 'P' to list bills excluded by AR nightly background process"
125 S DIR("?",4)="Enter 'Y' to list bills a User determined should be referred to DMC"
126 S DIR("?",5)="Enter 'N' to list bills a User determined should not be referred to DMC"
127 W !
128 D ^DIR
129 S:$D(DIRUT)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT) STOPIT=1,Y=""
130 Q Y
131 ;
132EXTTYPE(TYPE) ;Get Set of Code external format for Report type
133 ;INPUT
134 ; TYPE - Internal Report type: D, S, E
135 ;OUTPUT
136 ; Returns external Report type: D - DETAILED, S - SUMMARY,
137 ; E - EXCEL DELIMITED
138 ;
139 S TYPE=$G(TYPE)
140 Q $S(TYPE="D":"DETAILED",TYPE="S":"SUMMARY",TYPE="E":"EXCEL DELIMITED",1:"")
141 ;
142EXTDMC(VAL) ;Get Set of Code external format for DMC Debt Valid field value
143 ;INPUT
144 ; VAL - Internal DMC Debt Valid value: A, B, P, Y, N
145 ;OUTPUT
146 ; Returns external DMC Debt Valid value: A - ALL, B - BLANK/NULL
147 ; P - PENDING, Y - YES, N - NO
148 ;
149 S VAL=$G(VAL)
150 Q $S(VAL="A":"ALL",VAL="B":"BLANK/NULL",VAL="P":"PENDING",VAL="Y":"YES",VAL="N":"NO",1:"")
151 ;
152DATE(PROMPT) ;Get beginning and Ending dates
153 ;INPUT:
154 ; PROMPT - Message to display prior to prompting for dates
155 ;OUTPUT:
156 ; 1^BEGDT^ENDDT - Data found
157 ; 0 - User up arrowed or timed out
158 ;
159 N %DT,Y,X,BEGDT,ENDDT,DTOUT,OUT,DIRUT,DUOUT,DIROUT
160 S OUT=0
161 W !,$G(PROMPT)
162 S %DT="AEX"
163 S %DT("A")="Enter Beginning Date: "
164 S %DT("B")="TODAY"
165 W !
166 D ^%DT
167 K %DT
168 ;Quit if user time out or didn't enter valid date
169 Q:Y<0 OUT
170 S BEGDT=+Y
171 S %DT="AEX"
172 S %DT("A")="Enter Ending Date: ",%DT("B")="TODAY"
173 D ^%DT
174 K %DT
175 ;Quit if user time out or didn't enter valid date
176 Q:Y<0 OUT
177 S ENDDT=+Y
178 S OUT=1_U_BEGDT_U_ENDDT
179 ;Switch dates when user enters more recent date for Begin Date
180 ;than End Date
181 S:BEGDT>ENDDT OUT=1_U_ENDDT_U_BEGDT
182 Q OUT
183 ;
184GETBEGDT(PROMPT1,PROMPT2) ;Get beginning date
185 ;INPUT:
186 ; PROMPT1 - Message to display prior to prompting for date
187 ; PROMPT2 - Message to display prior to prompting for date
188 ;OUTPUT:
189 ; 1^BEGDT - Data found
190 ; 0 - User up arrowed or timed out
191 ;
192 N %DT,Y,X,BEGDT,DTOUT,OUT,DIRUT,DUOUT,DIROUT
193 S OUT=0
194 W !!,$G(PROMPT1)
195 W:$G(PROMPT2)]"" !,PROMPT2
196 S %DT="AEX"
197 S %DT("A")="Enter Beginning Date: "
198 S %DT("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-365,0,0,0),"1D")
199 S %DT(0)=-$$FMADD^XLFDT(DT,-365,0,0,0)
200 W !
201 D ^%DT
202 K %DT
203 ;Quit if user time out or didn't enter valid date
204 Q:Y<0 OUT
205 S BEGDT=+Y
206 S OUT=1_U_BEGDT
207 Q OUT
208 ;
209PAUSE ;If sending report to screen display pause message at screen bottom
210 N X
211 U IO(0)
212 W !!,"Press RETURN to continue, '^' to exit:"
213 R X:DTIME
214 S:'$T X="^"
215 S:X["^" STOPIT=2
216 U IO
217 Q
218 ;
219PAUSE2 ;If sending report to screen display pause message at screen bottom;
220 N X
221 U IO(0)
222 W !!,"Press RETURN to continue:"
223 R X:DTIME
224 S:'$T X="^"
225 S:X["^" STOPIT=2
226 U IO
227 Q
228 ;
229ULINE(X,WIDTH) ;Display line of a given character
230 ;INPUT:
231 ; X - Character to display
232 ; WIDTH - Number of Character to display
233 ;
234 N I
235 S:$G(WIDTH)'>0 WIDTH=80
236 W !
237 F I=1:1:WIDTH W $G(X,"-")
238 Q
239 ;
Note: See TracBrowser for help on using the repository browser.