source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOLLL7.m@ 1484

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

initial load of WorldVistAEHR

File size: 5.4 KB
Line 
1PSOLLL7 ;BHAM/JLC - LASER LABEL MULTI RX REFILL REQUEST FORM ;12/12/92
2 ;;7.0;OUTPATIENT PHARMACY;**120,161,200**;DEC 1997;Build 7
3 ;
4 ;Reference to ^PS(59.7 supported by DBIA 694
5 ;Reference to ^PS(55 supported by DBIA 2228
6 ;Read-only reference to %ZIS(2 supported by DBIA 3435
7 ;
8EN D MAIL
9 I $G(PSOIO("PII"))]"" X PSOIO("PII")
10 S T="Use the adhesive label above to mail prescription" D PRINT(T)
11 S T="documents to your pharmacy." D PRINT(T)
12REFILL Q:'DFN S PS1=$G(^PS(59,PSOSITE,1)),PSOSITE7=$G(^("IB")),PSOSYS=$G(^PS(59.7,1,40.1))
13 I '$D(PSSPND) F PSRX=0:0 S PSRX=$O(RX(PSRX)) Q:'PSRX K RX(PSRX)
14 S BLNKLIN="",$P(BLNKLIN,"_",45)="_"
15 F PSRX=0:0 S PSRX=$O(^PS(55,DFN,"P",PSRX)) Q:'PSRX D RZX
16 ;NEW LABEL
17 S PSOX=0
18DOCNEW I $G(PSOIO("RPI"))]"" X PSOIO("RPI")
19 S PSOYI=PSOTYI,PSOX=PSOLX,ORIGY=PSOY
20 D HDR S PSA=0
21 F J=1:1 S PSA=$O(RX(PSA)) Q:'PSA D SCRPTNEW
22 I $O(RX(0))="" G EXIT
23 I PSOY=ORIGY G EXIT
24 S PSOYI=PSOSYI,T=BLNKLIN D PRINT(T) S PSOYI=PSOTYI
25 S PS=$S($D(^PS(59,PSOSITE,0)):^(0),1:"")
26 S T="Patient's Signature & Date "_$P(PS,"^",6)_" "_PSONOW D PRINT(T)
27EXIT K PSINF,AMC,PSA,PSDFN,PSDO,PSDT2,PSRFL,PSRX,PSLN,PSRXX,PSSS,PSST,PSOCR,DIWL,DIWR,DIWF,PSO9
28 I $D(ZTQUEUED) S ZTREQ="@"
29 Q
30SCRPTNEW S T="____"_$$ZZ^PSOSUTL(PSA) K ZDRUG D PRINT(T) S PSOYI=PSOTYI
31 D DTCONNW
32 S PSOYI=PSOTYI,OPSOX=PSOX,PSOX=PSOX+PSOXI,T="Refills "_$P(RX(PSA),"^",2)_" Exp "_PSDT2_" Rx# "_$P(^PSRX(PSA,0),"^") K TN D PRINT(T)
33 S PSOYI=PSOBYI
34 I $G(PSOIO("SBT"))]"" X PSOIO("SBT")
35 S X2=PSOINST_"-"_PSA,PSOX=PSOX+PSOXI
36 W X2
37 I $G(PSOIO("EBT"))]"" X PSOIO("EBT")
38 S PSOX=OPSOX
39 I PSOY>PSOYM D D:$O(RX(PSA)) HDR Q
40 .S T=BLNKLIN,PSOYI=PSOSYI D PRINT(T) S PSOYI=PSOTYI
41 .S T="Patient's Signature & Date "_$P(PS,"^",6)_" "_PSONOW D PRINT(T)
42 .S PSOY=ORIGY,PSOYI=PSOTYI
43 .I PSOX=PSORX S PSOX=PSOLX W @IOF Q
44 .S PSOX=PSORX
45 Q
46DTCONNW S PSDT2=$P(RX(PSA),"^"),PSDT2=$E(PSDT2,4,5)_"/"_$E(PSDT2,6,7)_"/"_($E(PSDT2,1,3)+1700) Q
47RFILL2 F AMC=0:0 S AMC=$O(^PSRX(PSRXX,1,AMC)) Q:'AMC S PSRFL=PSRFL-1
48 I PSRFL>0 S X1=DT,X2=$P(^PSRX(PSRXX,0),"^",8)-10 D C^%DTC I X'<$P(^(2),"^",6) S PSRFL=0
49 Q
50RZX S PSRXX=+^PS(55,DFN,"P",PSRX,0)
51 I $D(^PSRX(PSRXX,0)) S PSRFL=$P(^(0),"^",9) D:$D(^(1))&PSRFL RFILL2 I PSRFL>0,$P($G(^PSRX(PSRXX,"STA")),"^")<10,134'[$E(+$P($G(^("STA")),"^")),$P(^(2),"^",6)>DT S RX(PSRXX)=$P(^(2),"^",6)_"^"_PSRFL
52 Q
53HDR S T=PNM_" "_SSNP D PRINT(T)
54 D ADD^VADPT
55 I $G(VAPA(1))="" G HDR5
56 F I=1:1:3 I $G(VAPA(I))]"" S T=VAPA(I) D PRINT(T)
57 S A=+$G(VAPA(5)) I A S A=$S($D(^DIC(5,A,0)):$P(^(0),"^",2),1:"UNKNOWN")
58 S B=$G(VAPA(4))_", "_A_" "_$S($G(VAPA(11)):$P(VAPA(11),"^",2),1:$G(VAPA(6)))
59 S T=B D PRINT(T)
60HDR5 I $O(RX(0))="" D S PSOY=PSOY+PSOYI Q
61 .S PSOY=PSOY+PSOYI,T="You have no refillable prescriptions as of "_PSONOW_"." D PRINT(T)
62 .S T="Please contact your provider if you need new prescriptions." D PRINT(T)
63 .I '$D(PSOINST) D SITE
64 .S PS=$S($D(^PS(59,PSOSITE,0)):^(0),1:"")
65 .S OPSOX=PSOX,OPSOY=PSOY,T=$P(PS,"^",6) S PSOX=2300,PSOY=3900 D PRINT(T) S PSOX=OPSOX,PSOY=OPSOY
66ADD S PSOY=PSOY+PSOYI,T="Please check prescriptions to be refilled, sign the form, then" D PRINT(T)
67 S T="mail or return to your pharmacy." D PRINT(T) S PSOY=PSOY+PSOYI
68 Q
69MAIL ;PRINT MAILING ADHESIVE LABEL
70 S PS=$S($D(^PS(59,PSOSITE,0)):^(0),1:"")
71 I $P(PSOSYS,"^",4),$D(^PS(59,+$P($G(PSOSYS),"^",4),0)) S PS=^PS(59,$P($G(PSOSYS),"^",4),0)
72 S VAADDR1=$P(PS,"^"),VASTREET=$P(PS,"^",2),STATE=$S($D(^DIC(5,+$P(PS,"^",8),0)):$P(^(0),"^",2),1:"UNKNOWN")
73 S PSZIP=$P(PS,"^",5),PSOHZIP=$S(PSZIP["-":PSZIP,1:$E(PSZIP,1,5)_$S($E(PSZIP,6,9)]"":"-"_$E(PSZIP,6,9),1:""))
74 I $G(PSOIO("MLI"))]"" X PSOIO("MLI")
75 I $G(PSOIO("PSOFONT"))]"" X PSOIO("PSOFONT")
76 S TEXT="Attn: (119)" D PRINT(TEXT)
77 S TEXT=VAADDR1 D PRINT(TEXT)
78 S TEXT=$G(VASTREET) D PRINT(TEXT)
79 S TEXT=$P(PS,"^",7)_", "_$G(STATE)_" "_$G(PSOHZIP) D PRINT(TEXT)
80 Q
81PRINT(T) ;
82 I $G(PSOIO(PSOFONT))]"" X PSOIO(PSOFONT)
83 I $G(PSOIO("ST"))]"" X PSOIO("ST")
84 W T,!
85 I $G(PSOIO("ET"))]"" X PSOIO("ET")
86 Q
87QUEUE ; ENTRY POINT TO PRINT STAND-ALONE MULTI-RX FORM
88 S SAVDFN=$D(DFN) ; DFN SET IF COMING FROM HIDDEN ACTION
89 I '$D(PSOPAR) D ^PSOLSET I '$D(PSOPAR) Q
90 I '$G(PSOSYS) S PSOSYS=$G(^PS(59.7,1,40.1))
91 I '$D(PSOINST) D SITE
92 W !
93 I $D(DFN) G GETPT2
94GETPT S DIC="^DPT(",DIC("A")="Enter patient to reprint Multi-Rx refill form for: ",DIC(0)="QEAM" D ^DIC K P,DIC("A") I Y<0!("^"[X) K DIC,DUOUT,DTOUT,DIROUT,DIRUT Q
95 S DFN=$P(Y,"^")
96GETPT2 D DEM^VADPT S PNM=VADM(1)
97 I $P(VADM(6),"^",2)]"" D G GETPT
98 .W $C(7),!!,PNM_" Died "_$P(VADM(6),"^",2)_".",!
99Q1 W ! K POP,ZTSK S %ZIS("B")="",%ZIS="MNQ",%ZIS("A")="Select LABEL DEVICE: " D ^%ZIS S PSLION=ION K %ZIS("A")
100 I $G(POP) Q
101 I $G(IOST(0)),'$D(^%ZIS(2,IOST(0),55,"B","LL")) W !,"Must specify a laser labels printer for Multi-Rx form." G Q1
102 I '$G(IOST(0)) W !,"Nothing queued to print." H 1 Q
103 D 6^VADPT,PID^VADPT6 S SSNP=$G(VA("BID"))
104 D NOW^%DTC S Y=$P(%,"."),PSOFNOW=% X ^DD("DD") S PSONOW=Y
105 F G="DFN","PNM","PSOPAR","PSOSITE","SSNP","PSONOW","PSOSYS","PSOINST" S:$D(@G) ZTSAVE(G)=""
106 S ZTRTN="DQ^PSOLLL7",ZTIO=PSLION,ZTDESC="Outpatient Pharmacy Multi-Rx print",ZTDTH=$H,PDUZ=DUZ
107 D ^%ZISC,^%ZTLOAD W:$D(ZTSK) !!,"Multi-Rx form queued to print",!! H 1 K G
108 I $G(SAVDFN)=0 K DFN,SAVDFN
109 Q
110DQ N PSOBIO S (I,PSOIO)=0 F S I=$O(^%ZIS(2,IOST(0),55,I)) Q:'I S X0=$G(^(I,0)) I X0]"" S PSOIO($P(X0,"^"))=^(1),PSOIO=1
111 I $G(PSOIO("LLI"))]"" X PSOIO("LLI")
112 G EN
113SITE ;
114 K ^UTILITY("DIQ1",$J) S DA=$P($$SITE^VASITE(),"^")
115 I $G(DA)>0 S DIC=4,DIQ(0)="I",DR="99" D EN^DIQ1 S PSOINST=$G(^UTILITY("DIQ1",$J,4,DA,99,"I")) K ^UTILITY("DIQ1",$J),DA,DR,DIC
116 I '$D(PSOINST) S PSOINST=""
117 Q
Note: See TracBrowser for help on using the repository browser.