1 | PSSQORD ;BIR/RTR-POE Quick Order Conversion ;08/21/00
|
---|
2 | ;;1.0;PHARMACY DATA MANAGEMENT;**38**;9/30/97
|
---|
3 | ;S X=$$EN^PSSQORD(V1,V2)
|
---|
4 | ;V1=Orderable Item of Quick Order
|
---|
5 | ;V2=Dispense Drug of the Quick Order
|
---|
6 | ;If we get V2, we get current OI, and return
|
---|
7 | ; piece 1 is returned as IEN from 50.7
|
---|
8 | ; piece 2 is 1 if active
|
---|
9 | ; piece 2 is 0 if inactive
|
---|
10 | ; piece 3 is the inactive date, only if piece 2 is 0
|
---|
11 | EN(PSS1,PSS2) ;
|
---|
12 | N PSSNW,PSSNEWIT,PSSDT,PSSLA,PSSLS,PSSOFLAG,PSSDR
|
---|
13 | I '$G(PSS1),'$G(PSS2) Q -1
|
---|
14 | I $G(PSS2) S PSSNEWIT=+$P($G(^PSDRUG(PSS2,2)),"^") G AC
|
---|
15 | I '$D(^PS(50.7,+$G(PSS1),0)) Q -1
|
---|
16 | I '$P($G(^PS(50.7,+$G(PSS1),0)),"^",3) S PSSNEWIT=$G(PSS1) G AC
|
---|
17 | S (PSSNW,PSSOFLAG)=0
|
---|
18 | F PSSLS=0:0 S PSSLS=$O(^XTMP("PSSCONS",PSS1,PSSLS)) Q:'PSSLS!($G(PSSOFLAG)) D
|
---|
19 | .I 'PSSNW S PSSNW=$P($G(^XTMP("PSSCONS",PSS1,PSSLS)),"^") Q
|
---|
20 | .I PSSNW,PSSNW'=$P($G(^XTMP("PSSCONS",PSS1,PSSLS)),"^") S PSSOFLAG=1
|
---|
21 | I $G(PSSOFLAG) Q -1
|
---|
22 | F PSSLA=0:0 S PSSLA=$O(^XTMP("PSSCONA",PSS1,PSSLA)) Q:'PSSLA!($G(PSSOFLAG)) D
|
---|
23 | .I 'PSSNW S PSSNW=$P($G(^XTMP("PSSCONA",PSS1,PSSLA)),"^") Q
|
---|
24 | .I PSSNW,PSSNW'=$P($G(^XTMP("PSSCONA",PSS1,PSSLA)),"^") S PSSOFLAG=1
|
---|
25 | I $G(PSSOFLAG) Q -1
|
---|
26 | I '$G(PSSNW) Q -1
|
---|
27 | S PSSNEWIT=$G(PSSNW)
|
---|
28 | AC ;
|
---|
29 | I '$G(PSSNEWIT) Q -1
|
---|
30 | I '$D(^PS(50.7,PSSNEWIT,0)) Q -1
|
---|
31 | S PSSDT=$P($G(^PS(50.7,PSSNEWIT,0)),"^",4)
|
---|
32 | I PSSDT Q PSSNEWIT_"^0^"_PSSDT
|
---|
33 | Q PSSNEWIT_"^"_1
|
---|