source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOHLEXP.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1PSOHLEXP ;BIR/RTR-Auto expire prescriptions ; 10/10/07 11:16am
2 ;;7.0;OUTPATIENT PHARMACY;**10,22,36,73,148,257**;DEC 1997;Build 19
3 ;
4 ;External reference to ^PS(59.7 supported by DBIA 694
5 ;External reference to STATUS^ORQOR2 is supported by DBIA 3458
6 ;External references to LOCK1^ORX2 and UNLK1^ORX2 are supported by DBIA 867
7EN N PSOEXRX,PSOEXCOM,PSOEXSTS,SUSD,PSOEXSTA,ZZDT,ZZEDT,IFN,NODE,RF,PIFN,PSUSD,PRFDT,PDA,PSDTEST,ORN,CPRSDC
8 I '$G(DT) S DT=$$DT^XLFDT
9 S X1=DT,X2=-1 D C^%DTC S ZZEDT=X
10 S ZZDT=$P($G(^PS(59.7,1,49.99)),"^",8) I +ZZDT=0 S X1=DT,X2=-2 D C^%DTC S ZZDT=X
11 F S ZZDT=$O(^PSRX("AG",ZZDT)) Q:ZZDT>ZZEDT Q:ZZDT="" D EN1
12 Q
13EN1 F PSOEXRX=0:0 S PSOEXRX=$O(^PSRX("AG",ZZDT,PSOEXRX)) Q:'PSOEXRX D:$D(^PSRX(PSOEXRX,0))
14 .N CPRSDC,CPRSSTA
15 .S CPRSDC=",1,7,12,13,"
16 .S ORN=$P($G(^PSRX(PSOEXRX,"OR1")),"^",2),CPRSSTA=""
17 .I ORN S CPRSSTA=+$$STATUS^ORQOR2(ORN) I CPRSSTA=0 S ORN=""
18 .Q:$P($G(^PSRX(PSOEXRX,2)),"^",6)'=ZZDT
19 .K CMOP S DA=PSOEXRX I DA D ^PSOCMOPA ;*257 ;SET UP CMOP() ARRAY
20 .S DA=$O(^PS(52.5,"B",PSOEXRX,0))
21 .I DA S SUSD=$P($G(^PS(52.5,DA,0)),"^",2) I SUSD,$P($G(^(0)),"^",3) S DIK="^PS(52.5," D ^DIK K DIK
22 .I $D(^PS(52.4,PSOEXRX,0)) S DIK="^PS(52.4,",DA=PSOEXRX D ^DIK K DIK
23 .I $G(^PSRX(PSOEXRX,"H"))]"" K:$P(^PSRX(PSOEXRX,"H"),"^") ^PSRX("AH",$P(^PSRX(PSOEXRX,"H"),"^"),PSOEXRX) S ^PSRX(PSOEXRX,"H")=""
24 .S PSOEXSTA=$P($G(^PSRX(PSOEXRX,"STA")),"^")
25 .I PSOEXSTA=13 D Q
26 ..I 'ORN D EN^PSOHDR("PRES",PSOEXRX)
27 .I PSOEXSTA=12!(PSOEXSTA=14)!(PSOEXSTA=15) I ORN,CPRSDC'[(","_CPRSSTA_",") D
28 ..D EN^PSOHLSN1(PSOEXRX,"OD","","","A")
29 ..I ORN S CPRSSTA=+$$STATUS^ORQOR2(ORN)
30 .I PSOEXSTA=11 I ORN,CPRSDC'[(","_CPRSSTA_",") D
31 ..S $P(^PSRX(PSOEXRX,0),"^",19)=1
32 ..D EN^PSOHLSN1(PSOEXRX,"SC","ZE","Prescription is expired")
33 .I PSOEXSTA>9&(PSOEXSTA'=16) Q
34 .S $P(^PSRX(PSOEXRX,"STA"),"^")=11
35 .D REVERSE^PSOBPSU1(PSOEXRX,0,"DE",5,"RX EXPIRED")
36 .S (PIFN,PSUSD,PRFDT)=0 F S PIFN=$O(^PSRX(PSOEXRX,1,PIFN)) Q:'PIFN S PSUSD=PIFN,PRFDT=+$P($G(^PSRX(PSOEXRX,1,PIFN,0)),"^")
37 .S ORN=$P($G(^PSRX(PSOEXRX,"OR1")),"^",2)
38 .I $G(PSUSD) I '$P($G(^PSRX(PSOEXRX,1,PSUSD,0)),"^",18) S PSDTEST=0 D I 'PSDTEST K ^PSRX(PSOEXRX,1,PSUSD),^PSRX("AD",PRFDT,PSOEXRX,PSUSD),^PSRX(PSOEXRX,1,"B",PRFDT,PSUSD) D NSET
39 ..D REVERSE^PSOBPSU1(PSOEXRX,PSUSD,"DE",5,"RX EXPIRED")
40 ..F PDA=0:0 S PDA=$O(^PSRX(PSOEXRX,"L",PDA)) Q:'PDA I $P($G(^PSRX(PSOEXRX,"L",PDA,0)),"^",2)=PSUSD S PSDTEST=1
41 ..I $G(CMOP(CMOP("L")))="",".L.X."[("."_$G(CMOP("S"))_".") S PSDTEST=1
42 ..N PSOORL
43 ..S PSOORL=$$LOCK1^ORX2(ORN) S:'PSOORL PSDTEST=1 I PSOORL D UNLK1^ORX2(ORN)
44 ..N PDA0
45 ..;S PDAQ=0
46 ..F PDA=0:0 S PDA=$O(^PSRX(PSOEXRX,4,PDA)) Q:'PDA D
47 ...S PDA0=$G(^PSRX(PSOEXRX,4,PDA,0))
48 ...I $P(PDA0,"^",3)=PSUSD S PSDTEST=1 ;*257
49 ..;Q:'PDAQ
50 ..;S PSDTEST=1
51 .I 'ORN D EN^PSOHDR("PRES",PSOEXRX) Q
52 .I CPRSDC[(","_CPRSSTA_",") D EN^PSOHDR("PRES",PSOEXRX) Q
53 .S $P(^PSRX(PSOEXRX,0),"^",19)=1
54 .S PSOEXCOM="Prescription past expiration date" D EN^PSOHLSN1(PSOEXRX,"SC","ZE",PSOEXCOM)
55 S DIE=59.7,DA=1,DR="49.95///"_ZZDT D ^DIE K DIE,DA,DR
56 Q
57NSET ;
58 N PSONM,PSONMX
59 S PSONM="" F PSONMX=0:0 S PSONMX=$O(^PSRX(PSOEXRX,1,PSONMX)) Q:'PSONMX S PSONM=PSONMX
60 S ^PSRX(PSOEXRX,1,0)="^52.1DA^"_$G(PSONM)_"^"_$G(PSONM)
61 Q
62SETUP ;
63 K %DT,DIC,DTOUT S DIC(0)="XZM",DIC="^DIC(19.2,",X="PSO EXPIRE PRESCRIPTIONS" D ^DIC
64 I +Y>0 D EDIT^XUTMOPT("PSO EXPIRE PRESCRIPTIONS") K DIC,Y,X Q
65 D RESCH^XUTMOPT("PSO EXPIRE PRESCRIPTIONS","","","24H","L"),EDIT^XUTMOPT("PSO EXPIRE PRESCRIPTIONS") K DIC,Y,X
66OUT Q
Note: See TracBrowser for help on using the repository browser.