source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOPMPPF.m@ 1608

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

initial load of WorldVistAEHR

File size: 7.8 KB
Line 
1PSOPMPPF ;BIRM/MFR - Patient Medication Profile - Preferences ;04/28/05
2 ;;7.0;OUTPATIENT PHARMACY;**260**;DEC 1997;Build 84
3 ;
4EN ; - Menu option entry point
5 N PSOCHNG,PSOQUIT,DIR,DIRUT,DIROUT
6 I '$G(PSOSITE) D ^PSOLSET I '$D(PSOPAR) W $C(7),!!,"Pharmacy Division Must be Selected!",! Q
7 ;
8 D LOAD(PSOSITE),LST(PSOSITE)
9 I '$G(PSOQUIT),$G(PSOCHNG) D SAVE(PSOSITE)
10 ;
11 G END
12 ;
13LST(PSOSITE,PSOUSER) ; - Listmanager entry point
14 N DIR,DIRUT,DIROUT
15 S (PSOCHNG,PSOQUIT)=0,PSOUSER=+$G(PSOUSER) D FULL^VALM1 W !
16 ;
17 ; - Reset user/division preferences
18 I (PSOUSER&$D(^PS(52.85,PSOSITE,"USER",PSOUSER)))!('PSOUSER&($$GET1^DIQ(52.85,PSOSITE,1)'="")) D
19 . D DISPLAY(PSOSITE,PSOUSER)
20 . S DIR("A")=" Delete this default view? "
21 . S DIR(0)="YA",DIR("B")="NO" D ^DIR I $D(DIRUT)!$D(DIROUT) S PSOQUIT=1 Q
22 . I Y=1 D DELETE(PSOSITE,PSOUSER),LOAD(PSOSITE,PSOUSER)
23 . W !
24 E W !,"Division: ",$$GET1^DIQ(59,PSOSITE,.01),!
25 I PSOQUIT Q
26 ;
27EXPDC ; - Expiration/Discontinued Cutoff Date
28 K DIR,DIRUT,DIROUT,SAVEX
29 S DIR(0)="NA^0:9999",DIR("A")="EXP/CANCEL CUTOFF: ",DIR("B")=PSOEXDCE
30 S DIR("?",1)="Enter the maximum number of days for an expired and/or"
31 S DIR("?")="discontinued prescription to be cut from the profile."
32 D ^DIR I $D(DIRUT)!$D(DIROUT) G @$$GOTO(X,"EXPDC")
33 W " DAYS" S PSOEXDCE=X,X="T"_$S(X:"-"_X,1:"") D ^%DT S PSOEXPDC=Y
34 D CHANGED(PSOSITE,PSOUSER,"EXPDC",PSOEXDCE)
35 ;
36SRTBY ; - Sort By
37 K DIR,DIRUT,DIROUT
38 S DIR(0)="SA^RX:Rx#;DR:DRUG NAME;ID:ISSUE DATE;LF:LAST FILL DATE",DIR("B")=PSOSRTBY
39 S DIR("A")="SORT BY: " D ^DIR I $D(DIRUT)!$D(DIROUT) G @$$GOTO(X,"SRTBY")
40 S PSOSRTBY=Y D CHANGED(PSOSITE,PSOUSER,"SRTBY",PSOSRTBY)
41 ;
42ORDER ; - Sort Order
43 K DIR,DIRUT,DIROUT
44 S DIR(0)="SA^A:ASCENDING;D:DESCENDING",DIR("B")=$S(PSORDER="A":"ASCENDING",1:"DESCENDING")
45 S DIR("A")="SORT ORDER: " D ^DIR I $D(DIRUT)!$D(DIROUT) G @$$GOTO(X,"ORDER")
46 S PSORDER=Y D CHANGED(PSOSITE,PSOUSER,"ORDER",PSORDER)
47 ;
48SIGDP ; - Display SIG
49 K DIR,DIRUT,DIROUT
50 S DIR(0)="SA^ON:ON;OFF:OFF",DIR("B")=$S(PSOSIGDP=1:"ON",1:"OFF")
51 S DIR("A")="DISPLAY SIG: " D ^DIR I $D(DIRUT)!$D(DIROUT) G @$$GOTO(X,"SIGDP")
52 S Y=$S(X="ON":1,1:0),PSOSIGDP=Y D CHANGED(PSOSITE,PSOUSER,"SIGDP",PSOSIGDP)
53 ;
54STSGP ; - Group By Status
55 K DIR,DIRUT,DIROUT
56 S DIR(0)="SA^ON:ON;OFF:OFF",DIR("B")=$S(PSOSTSGP=1:"ON",1:"OFF")
57 S DIR("A")="GROUP BY STATUS: " D ^DIR I $D(DIRUT)!$D(DIROUT) G @$$GOTO(X,"STSGP")
58 S Y=$S(X="ON":1,1:0),PSOSTSGP=Y D CHANGED(PSOSITE,PSOUSER,"STSGP",PSOSTSGP)
59 ;
60ORDCNT ; - Display Order Count
61 K DIR,DIRUT,DIROUT
62 S DIR(0)="SA^ON:ON;OFF:OFF",DIR("B")=$S(PSORDCNT=1:"ON",1:"OFF")
63 S DIR("A")="DISPLAY ORDER COUNT: " D ^DIR I $D(DIRUT)!$D(DIROUT) G @$$GOTO(X,"ORDCNT")
64 S Y=$S(X="ON":1,1:0),PSORDCNT=Y D CHANGED(PSOSITE,PSOUSER,"ORDCNT",PSORDCNT)
65 ;
66EXIT ; Exit
67 ;
68 ; - Save view?
69 I $G(PSOCHNG),PSOUSER D
70 . W ! S DIR(0)="YA",DIR("B")="NO",DIR("A")="Save as your default View? "
71 . D ^DIR I $D(DIRUT)!$D(DIROUT)!(Y=0) Q
72 . D SAVE(PSOSITE,PSOUSER)
73 ;
74 S VALMBCK="R"
75 ;
76END Q
77 ;
78DISPLAY(SITE,USER) ; - Displays the current view
79 N X,Z,FLG,LN
80 S (X,Z,FLG)=""
81 I $G(USER),$D(^PS(52.85,SITE,"USER",+$G(USER))) D
82 . S X=$$GET1^DIQ(200,USER,.01),Z=^PS(52.85,SITE,"USER",+$G(USER),0),FLG=1
83 E D
84 . S X=$$GET1^DIQ(59,SITE,.01),Z=$G(^PS(52.85,SITE,0))
85 I Z="" Q
86 S X=X_"'s current default view"_$S(FLG:" ("_$$GET1^DIQ(59,SITE,.01)_")",1:"")_":"
87 S $P(LN,"-",$L(X))="" W !?5,X,!?5,LN
88 W !?5,"EXP/CANCEL CUTOFF : ",$P(Z,"^",2)," DAYS"
89 S X=$P(Z,"^",3) W !?5,"SORT BY : "
90 W $S(X="RX":"Rx#",X="DR":"DRUG NAME",X="ID":"ISSUE DATE",X="LF":"LAST FILL DATE",1:"??")
91 W !?5,"SORT ORDER : ",$S($P(Z,"^",4)="A":"ASCENDING",1:"DESCENDING")
92 W !?5,"DISPLAY SIG : ",$S($P(Z,"^",5):"ON",1:"OFF")
93 W !?5,"GROUP BY STATUS : ",$S($P(Z,"^",6):"ON",1:"OFF")
94 W !?5,"DISPLAY ORDER COUNT: ",$S($P(Z,"^",7):"ON",1:"OFF")
95 W !
96 Q
97 ;
98GOTO(INPUT,HOME) ; - Directed up-arrow
99 N GOTO,TAG,TRGT
100 I $P(INPUT,"^",2)="" S PSOQUIT=1 Q "EXIT"
101 ;
102 S TRGT=$P(INPUT,"^",2)
103 S TAG("EXP/CANCEL CUTOFF")="EXPDC"
104 S TAG("SORT BY")="SRTBY"
105 S TAG("SORT ORDER")="ORDER"
106 S TAG("DISPLAY SIG")="SIGDP"
107 S TAG("GROUP BY STATUS")="STSGP"
108 S TAG("DISPLAY ORDER COUNT")="ORDCNT"
109 ;
110 S GOTO=HOME
111 S TAG="" F S TAG=$O(TAG(TAG)) Q:TAG="" I $E(TAG,1,$L(TRGT))=TRGT S GOTO=TAG(TAG) Q
112 I GOTO=HOME W " ??",$C(7)
113 ;
114 Q GOTO
115 ;
116LOAD(SITE,USER) ; Loading Factory/Division/User preferences
117 ;Input : SITE - Pointer to OUTPATIENT SITE file (#59)
118 ; USER - Pointer to NEW PSERON file (#200)
119 ;Output: PSOEXPDC - Expiration Cutoff Date
120 ; PSOEXDCE - Expiration Cutoff Date (External)
121 ; PSOSRTBY - Sort By
122 ; PSORDER - Sort Order ("A":Asc,"D":Desc)
123 ; PSOSIGDP - Display SIG (1:ON/0:OFF)
124 ; PSORDCNT - Display Order Count (1:ON/0:OFF)
125 ; PSOSTSGP - Group by Status (1:ON/0:OFF)
126 ; PSOSTSEQ - Status Display Order Array
127 ; PSORDSEQ - Group Display Order Array
128 ;
129 K PSOEXPDC,PSOEXDCE,PSOSRTBY,PSORDER,PSOSTSGP,PSOSIGDP,PSOSTSEQ,PSORDSEQ
130 ;
131 N X,Y,Z,TMP,STSGRP,STS,ORDGRP,GRPNAM
132 ;
133 ; - Factory Defaults
134 S PSOEXDCE=120,X="T-120" D ^%DT S PSOEXPDC=Y
135 S PSOSRTBY="DR",PSORDER="A",PSORDCNT=1,(PSOSTSGP,PSOSIGDP)=0
136 ;
137 S PSOSTSEQ("A")="1^ACTIVE^A" ; Active
138 S PSOSTSEQ("S")="1^ACTIVE^S" ; Suspended
139 S PSOSTSEQ("E")="1^ACTIVE^E" ; Expired
140 S PSOSTSEQ("DC")="2^DISCONTINUED^DC" ; Discontinued
141 S PSOSTSEQ("DP")="2^DISCONTINUED^DP" ; Discontinued by Provider
142 S PSOSTSEQ("DE")="2^DISCONTINUED^DE" ; Discontinued on Edit
143 S PSOSTSEQ("H")="3^HOLD^H" ; Hold
144 S PSOSTSEQ("PH")="3^HOLD^PH" ; Provider Hold
145 S PSOSTSEQ("N")="4^NON-VERIFIED^N" ; Non-Verified
146 ;
147 S PSORDSEQ("T")="1^REFILL TOO SOON/DUR REJECTS(Third Party)"
148 S PSORDSEQ("R")="2^CURRENT ORDERS"
149 S PSORDSEQ("P")="3^PENDING"
150 S PSORDSEQ("N")="4^NON-VA MEDS (Not dispensed by VA)"
151 ;
152 ; - User's preferences
153 I $G(USER),$D(^PS(52.85,SITE,"USER",USER,0)) D SET(^PS(52.85,SITE,"USER",USER,0)) Q
154 ;
155 ; - Division's preferences
156 I $D(^PS(52.85,SITE,0)) D SET(^PS(52.85,SITE,0)) Q
157 ;
158 Q
159 ;
160CHANGED(SITE,USER,FIELD,VALUE) ; - Sets PSOCHNG so the list can be refreshed
161 I $G(PSOCHNG) Q
162 ;
163 ; - Saved User's preferences
164 S Z=""
165 I '$G(USER),$P($G(^PS(52.85,SITE,0)),"^",2) S Z=^PS(52.85,SITE,0)
166 I $G(USER),$D(^PS(52.85,SITE,"USER",USER,0)) S Z=^PS(52.85,SITE,"USER",USER,0)
167 ;
168 I FIELD="EXPDC",VALUE'=$P(Z,"^",2) S PSOCHNG=1 Q
169 I FIELD="SRTBY",VALUE'=$P(Z,"^",3) S PSOCHNG=1 Q
170 I FIELD="ORDER",VALUE'=$P(Z,"^",4) S PSOCHNG=1 Q
171 I FIELD="SIGDP",VALUE'=+$P(Z,"^",5) S PSOCHNG=1 Q
172 I FIELD="STSGP",VALUE'=+$P(Z,"^",6) S PSOCHNG=1 Q
173 I FIELD="ORDCNT",VALUE'=+$P(Z,"^",7) S PSOCHNG=1 Q
174 ;
175 Q
176 ;
177 ;
178SET(ZNODE) ;
179 N X,Y
180 S X=+$P(ZNODE,"^",2) I X S PSOEXDCE=X,X="T-"_X D ^%DT S PSOEXPDC=Y
181 S X=$P(ZNODE,"^",3) I X'="" S PSOSRTBY=X
182 S X=$P(ZNODE,"^",4) I X'="" S PSORDER=X
183 S X=$P(ZNODE,"^",5) I X'="" S PSOSIGDP=X
184 S X=$P(ZNODE,"^",6) I X'="" S PSOSTSGP=X
185 S X=$P(ZNODE,"^",7) I X'="" S PSORDCNT=X
186 Q
187 ;
188SAVE(SITE,USER) ; - Saves preferences by Site and/or User
189 N DIE,DR,DA
190 ;
191 W !!,"Saving..."
192 ;
193 I '$D(^PS(52.85,SITE)) D
194 . N %,DIC,DR,DA,X,DINUM,DLAYGO,DD,DO
195 . S DIC="^PS(52.85,",(DINUM,X)=SITE,DIC(0)=""
196 . K DD,DO D FILE^DICN K DD,DO
197 ;
198 I $G(USER),'$D(^PS(52.85,SITE,"USER",USER,0)) D
199 . N %,DIC,DR,DA,X,DINUM,DLAYGO,DD,DO
200 . S DIC="^PS(52.85,"_SITE_",""USER"",",DA(1)=SITE,(DINUM,X)=USER,DIC(0)=""
201 . K DD,DO D FILE^DICN K DD,DO
202 ;
203 S DR="1///"_PSOEXDCE_";2///"_PSOSRTBY_";3///"_PSORDER
204 S DR=DR_";4///"_PSOSIGDP_";5///"_PSOSTSGP_";6///"_PSORDCNT
205 ;
206 I '$G(USER) S DIE="^PS(52.85,",DA=SITE
207 I $G(USER) S DIE="^PS(52.85,"_SITE_",""USER"",",DA(1)=SITE,DA=USER
208 ;
209 D ^DIE H 2 W "OK!"
210 ;
211 Q
212 ;
213DELETE(SITE,USER) ; - Deletes user/division preferences
214 N DIK,DA,DIE,DR,FLD
215 ;
216 W !!,"Deleting..."
217 ;
218 I '$G(SITE) Q
219 I $G(USER) S DIK="^PS(52.85,"_SITE_",""USER"",",DA(1)=SITE,DA=USER D ^DIK H 1 W "OK!" Q
220 I '$D(^PS(52.85,SITE,"USER")) S DIK="^PS(52.85,",DA=SITE D ^DIK H 1 W "OK!" Q
221 S DR="" F FLD=1:1:8 S $P(DR,";",FLD)=FLD_"///@"
222 S DIE="^PS(52.85,",DA=SITE D ^DIE H 1 W "OK!"
223 Q
Note: See TracBrowser for help on using the repository browser.