source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSLOCK.m@ 1638

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1PSSLOCK ;BIR/RSB-Pharmacy patient lock ;09/15/97 13:30
2 ;;1.0;PHARMACY DATA MANAGEMENT;**26,58,125**;9/30/97;Build 2
3 ;
4 ; Reference to ^ORX2 supported by DBIA #867
5 ; Reference to ^PS(53.1 supported by DBIA #2140
6 ; Reference to ^PS(52.41 supported by DBIA #2844
7 ; Reference to ^PSRX supported by DBIA #2845
8 ; Reference to ^PS(55 supported by DBIA #2191
9 ;
10L(DFN,DIS) ;
11 I $G(PSONOLCK) Q 1
12 N FLAG S ^XTMP("PSSLOCK",0)=$$PDATE
13 I '$D(^XTMP("PSSLOCK",DFN)) D Q FLAG
14 . D NOW^%DTC S ^XTMP("PSSLOCK",DFN)=DUZ_"^"_%
15 . L +^XTMP("PSSLOCK",DFN):$S($G(DILOCKTM)>0:DILOCKTM,1:3) S FLAG=$S($T=1:$T,1:0)
16 I $D(^XTMP("PSSLOCK",DFN)) Q $$R
17UL(DFN) ; unlock
18 I $G(PSONOLCK) Q
19 L -^XTMP("PSSLOCK",DFN) K ^XTMP("PSSLOCK",DFN)
20 Q
21 ;
22R() ; check lock on node
23 ;if user has same patient already locked, Q 1, will only lock once
24 I $P($G(^XTMP("PSSLOCK",DFN)),"^")=DUZ Q 1
25 L +^XTMP("PSSLOCK",DFN):$S($G(DILOCKTM)>0:DILOCKTM,1:3)
26 I $T=1 D NOW^%DTC S ^XTMP("PSSLOCK",DFN)=DUZ_"^"_% Q 1
27 I $T=0 W:DIS=1 !,$$WHO(DFN) S Y=$P($G(^XTMP("PSSLOCK",DFN)),"^",2) X ^DD("DD") Q $S(DIS=0:0_"^"_$P($G(^VA(200,+$P($G(^XTMP("PSSLOCK",DFN)),"^"),0)),"^")_"^"_Y,1:0)
28 ;
29PDATE() ;
30 N X1,X2 S X1=DT,X2=+14 D C^%DTC
31 Q X_"^"_DT_"^Pharmacy patient locks"
32 ;
33WHO(DFN) ;
34 S Y=$P($G(^XTMP("PSSLOCK",DFN)),"^",2) X ^DD("DD")
35 Q $P($G(^VA(200,+$P($G(^XTMP("PSSLOCK",DFN)),"^"),0)),"^")_" is editing orders for this patient ("_Y_")"
36 ;
37 ;
38LS(DFN,X) ;
39 ;LOCK CPRS ORDER
40 ;DFN is patient #, X is PSJORD OR PSGORD
41 N OR100 S OR100=$$ORD(DFN,X) I OR100=0 Q 1
42 N L S L=$$LOCK1^ORX2(OR100)
43 I L Q 1
44 I 'L W !,$P(L,"^",2),$C(7) D PAUSE^VALM1 Q 0
45 Q 0
46 ;
47UNL(DFN,X) ;
48 ; unlocks order in file 100
49 ; DFN is patient #, X is PSJORD OR PSGORD
50 D UNLK1^ORX2($$ORD(DFN,X))
51 Q
52 ;
53ORD(DFN,X) ;
54 ; return order number in file 100 from entry in 53.1 or 55.
55 ; DFN is patient #, X is PSJORD OR PSGORD
56 N ORD100
57 S ORD100=$S(X["N"!(X["P"):"^PS(53.1,"_+X_",0)",X["V":"^PS(55,"_DFN_",""IV"","_+X_",0)",1:"^PS(55,"_DFN_",5,"_+X_",0)",1:"NA")
58 Q +$P(@ORD100,"^",21)
59 ;
60PSOL(X) ;
61 S PSOMSG=1
62 I X["S" D Q
63 .S X=+$P($G(^PS(52.41,+$G(X),0)),"^") I X S PSOMSG=$$LOCK1^ORX2(X)
64 S X=+$P($G(^PSRX(+$G(X),"OR1")),"^",2) I X S PSOMSG=$$LOCK1^ORX2(X)
65 Q
66PSOUL(X) ;
67 I X["S" D Q
68 .S X=+$P($G(^PS(52.41,+$G(X),0)),"^") I X D UNLK1^ORX2(X)
69 S X=+$P($G(^PSRX(+$G(X),"OR1")),"^",2) I X D UNLK1^ORX2(X)
70 Q
Note: See TracBrowser for help on using the repository browser.