source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGMTUTL.m@ 767

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1DGMTUTL ;ALB/CAW/BRM/LBD - Means Test generic utilities ; 8/12/02 4:33pm
2 ;;5.3;Registration;**3,31,166,182,454**;Aug 13, 1993
3 ;
4FDATE(Y) ; -- return formatted date
5 ; input: Y := field name
6 ; output: [returned] := formatted date only
7 N DGY
8 S DGY=$$FMTE^XLFDT(Y,"5F"),DGY=$TR(DGY," ","0")
9 Q DGY
10 ;
11FTIME(Y) ; -- return formatted date/time
12 ; input: Y := internal date/time
13 ; output: [returned] := formatted date and time
14 D DD^%DT
15 Q Y
16 ;
17RANGE(WHEN) ; select date range
18 ; input: WHEN := past or future dates (optional)
19 ; output: DGBEG := begin date
20 ; DGEND := end date
21 ; return: was selection made [ 1|yes 0|no]
22 W !!,$$LINE("Date Range Selection")
23DATE S DIR(0)="D^::EX",DIR("A")="Enter Beginning Date",DIR("?")="^D HELP^%DTC" D ^DIR K DIR G:$D(DIRUT) RANGEQ S DGBEG=Y
24 I $G(WHEN)="P",DGBEG>(DT_.9999) W !," Future dates are not allowed.",*7 K DGBEG G DATE
25 I $G(WHEN)="F",(DGBEG_.9999)<DT W !," Past dates are not allowed.",*7 K DGBEG G DATE
26 ;select ending date
27 S DIR(0)="D^::EX",DIR("A")="Enter Ending Date",DIR("?")="^D HELP^%DTC" D ^DIR K DIR G:$D(DIRUT) RANGEQ
28 S DGEND=Y
29 I $G(WHEN)="P",DGEND>(DT_.9999) W !," Future dates are not allowed.",*7 K DGEND G DATE
30 I $G(WHEN)="F",(DGEND_.9999)<DT W !," Past dates are not allowed.",*7 K DGEND G DATE
31 I DGEND<DGBEG W !!,"Beginning Date must be prior to Ending Date" K DGEND G DATE
32RANGEQ Q $D(DGEND)
33 ;
34DIV() ; -- get division data
35 ; input: none
36 ; output: VAUTD := divs selected (VAUTD=1 for all)
37 ; return: was selection made [ 1|yes 0|no]
38 ;
39 W:$P($G(^DG(43,1,"GL")),U,2) !!,$$LINE("Division Selection")
40 D ASK2 I Y<0 K VAUTD
41 Q $D(VAUTD)>0
42 ;
43CLINIC() ; -- get clinic data
44 ; input: VAUTD := divisions selected
45 ; output: VAUTC := clinic selected (VAUTC=1 for all)
46 ; return: was selection made [ 1|yes 0|no]
47 ;
48 W !!,$$LINE("Clinic Selection")
49 S DIC("S")="I $S(VAUTD:1,$D(VAUTD(+$P(^SC(Y,0),U,15))):1,'+$P(^(0),U,15)&$D(VAUTD(+$O(^DG(40.8,0)))):1,1:0)"
50 S DIC="^SC(",VAUTSTR="clinic",VAUTVB="VAUTC",VAUTNI=2
51 D FIRST^VAUTOMA
52 I Y<0 K VAUTC
53CLINICQ Q $D(VAUTC)>0
54 ;
55 ;
56LINE(STR) ; -- print line
57 ; input: STR := text to insert
58 ; output: none
59 ; return: text to use
60 ;
61 N X
62 S:STR]"" STR=" "_STR_" "
63 S $P(X,"_",(IOM/2)-($L(STR)/2))=""
64 Q X_STR_X
65 ;
66ASK2 S (VAUTD,Y)=0 I '$D(^DG(40.8,+$O(^DG(40.8,0)),0)) W !,*7,"***WARNING...MEDICAL CENTER DIVISION FILE IS NOT SET UP" G ASK2Q
67 I '$P($G(^DG(43,1,"GL")),U,2) S VAUTD=1 G ASK2Q
68 I $D(^DG(43,1,"GL")),$P(^("GL"),U,2) G DIVISION^VAUTOMA
69 S I=$O(^DG(40.8,0)) G:'$D(^DG(40.8,+I,0)) ASK2Q S VAUTD(I)=$P(^(0),U) K DIC Q
70ASK2Q ;
71 Q
72 ;
73CLOSE ; Utility to clean up tasked outputs
74 Q:'$D(ZTQUEUED)
75 D KILL^%ZTLOAD K ZTSK,ZTDESC,ZTRTN,ZTREQ,ZTSAVE,ZTIO,ZTDTH,ZTUCI,IO("Q"),IO("C")
76 Q
77 ;
78XMY(GROUP,DGDUZ,DGPOST) ; -- set up XMY for mail group members
79 ; input: GROUP := mail group efn [required]
80 ; DGDUZ := send to current user [ 0|no ; 1|yes] [optional]
81 ; DGPOST := send to postmaster if XMY is undefined
82 ; [ 0|no ; 1|yes] [optional]
83 ; output: XMY := array of users
84 ; XMDUZ := message sender set postmaster
85 ;
86 N I K XMY
87 I '$D(DGDUZ) N DGDUZ S DGDUZ=1
88 I '$D(DGPOST) N DGPOST S SDPOST=1
89 S XMY("G."_$P($G(^XMB(3.8,GROUP,0)),U))=""
90 I DGDUZ,DUZ S XMY(DUZ)=""
91 ; makes sure it gets sent to someone
92 I '$D(XMY),DGPOST S XMY(.5)=""
93 ; make postmaster the sender so it will show up as new to DUZ
94 S XMDUZ=.5
95 Q
96 ;
97 ;
98LOCK(DFN) ;
99 ; Description: Sets a lock used to synchronize local income test
100 ; options with the income test upload.
101 ;
102 ; Input:
103 ; DFN - ien of record in PATIENT file
104 ;
105 ; Output:
106 ; Function value - returns 1 if the lock was obtained, 0 otherwise.
107 ;
108 Q:'$G(DFN) 1
109 L +^DGMT("LOCAL INCOME TEST",DFN):5
110 Q $T
111 ;
112 ;
113UNLOCK(DFN) ;
114 ; Description: Release the lock obtained by calling $$LOCK(DFN).
115 ;
116 ; Input:
117 ; DFN - ien of record in PATIENT file
118 ;
119 ; Output: none
120 ;
121 Q:'$G(DFN)
122 L -^DGMT("LOCAL INCOME TEST",DFN)
123 Q
124 ;
125PA(DGMTI) ;Determine if the Pending Adjudication is for MT or GMT
126 ; Input:
127 ; DGMTI - IEN of Annual Means Test file #408.31
128 ; Output:
129 ; Returns "MT","GMT", or "" if it can't be determined
130 ;
131 N PA,DGMT0,MTTHR,GMTTHR
132 S PA=""
133 I '$G(DGMTI) Q PA
134 S DGMT0=$G(^DGMT(408.31,DGMTI,0))
135 ; If means test status is not Pending Adjudication, quit
136 I $P(DGMT0,U,3)'=2 Q PA
137 ; Get MT Threshold and GMT Threshold
138 S MTTHR=+$P(DGMT0,U,12) I 'MTTHR Q PA
139 S GMTTHR=+$P(DGMT0,U,27)
140 ; If GMT Threshold is greater than MT Threshold then return GMT,
141 ; otherwise return MT
142 S PA=$S(GMTTHR>MTTHR:"GMT",1:"MT")
143 Q PA
Note: See TracBrowser for help on using the repository browser.