source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSODIR2.m@ 1639

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

initial load of WorldVistAEHR

File size: 5.1 KB
RevLine 
[613]1PSODIR2 ;IHS/DSD/JCM - rx order entry contd ;01/27/93 7:12
2 ;;7.0;OUTPATIENT PHARMACY;**3,9,26,46,124,146,139,152,166**;DEC 1997
3 ;External reference to ^DD(52 supported by DBIA 999
4 ;External reference to ^VA(200 supported by DBIA 10060
5 ;External reference to ^%DTC supported by DBIA 10000
6 ;External reference to ^DIC supported by DBIA 10006
7 ;External reference to ^DIR supported by DBIA 10026
8 ;
9 ;---------------------------------------------------------------------
10 ;
11EXP(PSODIR) ;
12 K DIR,DIC
13 I $G(PSODRUG("EXPIRATION DATE"))]"" S Y=PSODRUG("EXPIRATION DATE") X ^DD("DD") S PSORX("EXPIRATION DATE")=Y
14 S DIR("A")="EXPIRES",DIR("B")=$S($G(PSORX("EXPIRATION DATE"))]"":PSORX("EXPIRATION DATE"),1:"T+6M")
15 S DIR(0)="D^NOW::EX"
16 S DIR("?")="Both the month and date are required."
17 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") EXPX
18 S PSODIR("EXPIRATION DATE")=Y
19EXPX K X,Y
20 Q
21 ;
22CLINIC(PSODIR) ;
23 K DIR,DIC S PSODIR("FIELD")=0
24 S DIR(0)="52,5" S:$G(PSORX("CLINIC"))]"" DIR("B")=PSORX("CLINIC"),DIR("A")="CLINIC"
25 D ^DIR G:PSODIR("DFLG")!PSODIR("FIELD") CLINICX
26 I +Y>0 S PSODIR("CLINIC")=+Y,PSORX("CLINIC")=$P(Y,"^",2)
27 E S (PSORX("CLINIC"),PSODIR("CLINIC"))=""
28CLINICX K X,Y,PSOX,DIC
29 Q
30 ;
31MW(PSODIR) ;
32 K DIR,DIC
33 S DIR(0)="52,11" S:$G(POERR)&'$D(PSORX("MAIL/WINDOW")) PSORX("MAIL/WINDOW")=$S($P($G(OR0),"^",17)="M":"MAIL",1:"WINDOW")
34 S DIR("B")=$S($G(PSORX("MAIL/WINDOW"))]"":PSORX("MAIL/WINDOW"),$G(PSOTPBFG)&($G(PSOFROM)="NEW"):"MAIL",1:"WINDOW")
35 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") MWX
36 I $G(Y(0))']"" S PSODIR("DFLG")=1 G MWX
37 S PSODIR("MAIL/WINDOW")=Y,PSORX("MAIL/WINDOW")=Y(0)
38 I $G(PSORX("EDIT"))]"",PSODIR("MAIL/WINDOW")'="W" K PSODIR("METHOD OF PICK-UP")
39MW1 G:PSODIR("MAIL/WINDOW")'="W"!('$P($G(PSOPAR),"^",12)) MWX
40 S DIR(0)="52,35O"
41 S:$G(PSORX("METHOD OF PICK-UP"))]"" DIR("B")=PSORX("METHOD OF PICK-UP")
42 D DIR G:PSODIR("DFLG") MWX
43 I X[U W !,"Cannot jump to another field ..",! G MW1
44 S (PSODIR("METHOD OF PICK-UP"),PSORX("METHOD OF PICK-UP"))=Y
45MWX K X,Y
46 Q
47 ;
48RMK(PSODIR) ;
49RMKEN K DIR,DIC
50 S DIR(0)="52,12"
51 S:$G(PSODIR("REMARKS"))]"" DIR("B")=PSODIR("REMARKS")
52 D DIR G:PSODIR("DFLG") RMKX
53 I X[U W !,"Cannot jump to another field ..",! G RMKEN
54 S:$L(X)>0 PSODIR("REMARKS")=X
55 S:X="@" PSODIR("REMARKS")=""
56RMKX K X,Y
57 Q
58 ;
59ISSDT(PSODIR) ;
60 K DIR,DIC
61 S DIR("A")="ISSUE DATE",DIR("B")=$S($G(POERR)&($G(PSORX("ISSUE DATE"))']"")&($G(PSODIR("ISSUE DATE"))]""):PSODIR("ISSUE DATE"),$G(PSORX("ISSUE DATE"))]"":PSORX("ISSUE DATE"),1:"TODAY")
62 I DIR("B") S Y=DIR("B") X ^DD("DD") S DIR("B")=Y
63 S DIR(0)="52,1"
64 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") ISSDTX
65 S (PSODIR("ISSUE DATE"),PSOID)=Y
66 X ^DD("DD") S (PSORX("ISSUE DATE"),PSODIR("ISSUE DATE"))=Y
67ISSDTX K X,Y
68 Q
69 ;
70FILLDT(PSODIR) ;
71 K DIR,DIC
72 S:'$G(PSONEW("DAYS SUPPLY")) PSONEW("DAYS SUPPLY")=30,PSONEW("# OF REFILLS")=1
73 S DIR("A")="FILL DATE",DIR("B")=$S($G(PSORX("FILL DATE"))]"":PSORX("FILL DATE"),1:"TODAY")
74 S X2=PSONEW("DAYS SUPPLY")*(PSONEW("# OF REFILLS")+1)\1
75 S X1=$S($G(PSOID):PSOID,1:DT)
76 S X2=$S(PSONEW("DAYS SUPPLY")=X2:X2,+$G(PSODIR("CS")):184,1:366)
77 I X2<30 D
78 . N % S %=$P($G(PSORX("PATIENT STATUS")),"^"),X2=30
79 . S:%?.N %=$P($G(^PS(53,+%,0)),"^") I %["AUTH ABS" S X2=5
80 D C^%DTC S PSOFDMX=$P(X,".") I DT>X S Y=$S($G(PSOID):PSOID,1:PSORX("ISSUE DATE")) X ^DD("DD") S DIR("B")=Y
81 S DIR(0)="D^"_$S($G(PSOID):PSOID,+$G(PSODIR("ISSUE DATE")):PSODIR("ISSUE DATE"),1:DT)_$S($G(DUZ("AG"))="I":":"_DT_":EX",1:":"_PSOFDMX_":EX")
82 S Y=PSOFDMX X ^DD("DD")
83 S DIR("?",1)="The earliest fill date allowed is determined by the ISSUE DATE,"
84 S DIR("?",2)="the FILL DATE cannot be before the ISSUE DATE or AFTER the Expiration Date "
85 S DIR("?")=Y_". Both the month and date are required."
86 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") FILLDTX
87 S PSODIR("FILL DATE")=Y
88 X ^DD("DD") S PSORX("FILL DATE")=Y
89FILLDTX K X,Y,PSOFDMX
90 Q
91 ;
92CLERK(PSODIR) ;
93 I $G(DUZ("AG"))'="I" D G CLERKX
94 .S PSODIR("CLERK CODE")=$S($G(PSOFDR):$P(OR0,"^",4),1:DUZ),PSORX("CLERK CODE")=$P($G(^VA(200,PSODIR("CLERK CODE"),0)),"^")
95 K DIR,DIC
96 S DIR("A")="CLERK",DIR("B")=$S($G(PSORX("CLERK CODE"))]"":PSORX("CLERK CODE"),1:$P($G(^VA(200,DUZ,0)),"^",2)),DIR(0)="52,16"
97 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") CLERKX
98 S PSODIR("CLERK CODE")=+Y,PSORX("CLERK CODE")=$P(Y,"^")
99CLERKX Q
100 ;
101DIR ;
102 S PSODIR("FIELD")=0
103 G:$G(DIR(0))']"" DIRX
104 D ^DIR K DIR,DIE,DIC,DA I X="^^" S (PSODIR("QFLG"),PSODIR("DFLG"))=1 G DIRX
105 I $D(DUOUT)!($D(DTOUT))!($D(DIROUT)),$L($G(X))'>1!(Y="") S PSODIR("DFLG")=1 S:$G(SPEED) PSODIR("QFLG")=1 G DIRX
106 I $D(DUOUT)!($D(DTOUT)),$G(SPEED) S PSODIR("DFLG")=1 G DIRX
107 I X[U,$L(X)>1 D JUMP
108DIRX K DIRUT,DTOUT,DUOUT,DIROUT,PSOX
109 Q
110 ;
111JUMP ;
112 I $G(PSOEDIT)!($G(OR0)) S PSODIR("DFLG")=1 Q
113 S X=$P(X,"^",2),DIC="^DD(52,",DIC(0)="QM" D ^DIC K DIC
114 I Y=-1 S PSODIR("FIELD")=$G(PSODIR("FLD")) G JUMPX
115 I $G(PSONEW1)=0 D JUMP^PSONEW1 G JUMPX
116 I $G(PSONEW3)=0 D JUMP^PSONEW3 G JUMPX
117 I $G(PSORENW3)=0 D JUMP^PSORENW3 G JUMPX
118JUMPX S X="^"_X
119 Q
120 ;Reset refills when drug changed to a controlled sub
121RFRSET ;
122 N RFN,RFNC
123 S (RFN,RFNC)=0
124 F S RFN=$O(^PSRX(+$G(PSODIR("IRXN")),1,RFN)) Q:'RFN S RFNC=RFNC+1
125 I $D(PSODIR("FIELD")) S PSODIR("FIELD")=0
126 S PSODIR("# OF REFILLS")=RFNC
127 S VALMSG="The drug has been changed and no longer allows refills."
128 W !,VALMSG,!
129 Q
Note: See TracBrowser for help on using the repository browser.