source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDRDR.m@ 949

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1PSDRDR ;BIR/BJW-Narc Disp/Rec Report (reprint VA FORM 10-2321) ; 12 Feb 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
3 ;**Y2K compliance**,"P" added to date input string
4 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
5 S OK=$S($D(^XUSEC("PSJ RPHARM",DUZ)):1,$D(^XUSEC("PSJ PHARM TECH",DUZ)):1,1:0)
6 I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"process/dispense narcotic supplies.",!!,"PSJ RPHARM or PSJ PHARM TECH security key required.",! K OK Q
7ASKD ;ask dispensing location
8 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
9 G:$P(PSDSITE,U,5) SUM
10 K DIC,DA S DIC=58.8,DIC(0)="QEAZ",DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S($P(^(0),""^"",2)[""M"":1,$P(^(0),""^"",2)[""S"":1,1:0)"
11 S DIC("A")="Select Primary Dispensing Site: ",DIC("B")=$P(PSDSITE,U,4)
12 D ^DIC K DIC G:Y<0 END
13 S PSDS=+Y,PSDSN=$P(Y,"^",2),$P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
14SUM ;if ret-to-stock or turn in for dest
15 K DA,DIR,DIRUT W ! S DIR(0)="Y",DIR("A")="Is this a Return to Stock or Turn in for Destruction Reprint",DIR("B")="NO"
16 S DIR("?",1)="Answer 'YES' to select a Return to Stock or Turn in for Destruction form,",DIR("?")="answer 'NO' to print a dispensing VA FORM 10-2321."
17 D ^DIR K DIR G:$D(DIRUT) END S SUM=Y G:SUM TYPE^PSDRPT
18COPY ;ask vault, nursing or both
19 K DA,DIR,DIRUT S DIR(0)="SO^V:VAULT COPY ONLY;N:NURSING COPY ONLY;B:BOTH VAULT AND NURSING COPY"
20 S DIR("A")="Select Disp/Receiving Report(s) to Print"
21 S DIR("?",1)="Answer 'V' to print only the vault copy of this report,",DIR("?",2)="answer 'N' to print only the nursing copy, or",DIR("?")="answer 'B' to print both the vault and nursing copies."
22 D ^DIR K DIR
23 I $D(DIRUT) W !,"No report will be printed.",! G END
24 S PSDCPY=Y
25ASKN ;ask naou or green sheet number
26 K DA,DIR,DIRUT S DIR(0)="SO^N:NAOU;G:Green Sheet #",DIR("A")="Select Method"
27 S DIR("?",1)="Enter 'N' to select one, several, or ^ALL NAOUs,",DIR("?")="enter 'G' to select a Green Sheet #, or '^' to quit"
28 D ^DIR K DIR G:$D(DIRUT) END S SEL=Y
29 I SEL="G" W ! K DA,DIC S DIC("A")="Select Green Sheet #: ",DIC=58.81,D="D",DIC(0)="QEAS",DIC("S")="I $P(^(0),""^"",3)=+PSDS" D IX^DIC G:Y<0 END S PSDA=+Y G DEV
30NAOU ;sel naou
31 W !!,?5,"You may select a single NAOU, several NAOUs,",!,?5,"or enter ^ALL to select all NAOUs.",!!
32 F S DIC=58.8,DIC("A")="Select NAOU: ",DIC(0)="QEA",DIC("S")="I $P(^(0),""^"",2)=""N"",$P(^(0),""^"",4)=+PSDS" D ^DIC K DIC Q:Y<0 S NAOU(+Y)=""
33 I '$D(NAOU)&(X'="^ALL") G END
34 I X="^ALL" F PSD=0:0 S PSD=$O(^PSD(58.8,PSD)) Q:'PSD I $P($G(^PSD(58.8,PSD,0)),"^",2)="N",$P($G(^(0)),"^",4)=+PSDS S NAOU(PSD)=""
35DATE ;asks date range if naou is selected
36 W !!,"Please enter the DATE and TIME period you wish to reprint data for this report",!
37 W ! K %DT S %DT="AEPRXT",%DT("A")="Start with Date/Time: " D ^%DT I Y<0 S PSDOUT=1 G END
38 S PSDSD=Y D D^DIQ S PSDATE=Y,%DT("A")="End with Date/Time: " D ^%DT I Y<0 S PSDOUT=1 G END
39 I Y<PSDSD W !!,"The ending date of the range must be later than the starting date." G DATE
40 S PSDED=Y D D^DIQ S PSDATE=PSDATE_"^"_Y,PSDSD=PSDSD-.0001,PSDED=PSDED+.0001
41DEV ;ask device and queue info
42 W !,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
43 S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
44 K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")=PSDEV D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
45 I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDRDR1",ZTDESC="Reprint Narcotic Disp Report" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
46 U IO G START^PSDRDR1
47END K %,%I,%H,%ZIS,C,COMM,COPY,D,DA,DIC,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DRUG,DRUGN,DTOUT,DUOUT,EXP,EXPD,FLAG,LN,LOOP,LOT,MFG,NAOU,NAOUN,NODE,NUM,OK,ORD,ORDN
48 K PG,PHARM,PHARMN,PSD,PSDA,PSDATE,PSDCPY,PSDDT,PSDED,PSDEV,PSDN,PSDNA,PSDOUT,PSDS,PSDSD,PSDSN,PSDST,QTY,REC,RECN,REQD,REQDT,RPDT,SEL,SUM,TEXT,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
49 K ^TMP("PSDRDR",$J) D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
50 Q
51SAVE S (ZTSAVE("PSDATE"),ZTSAVE("PSDSD"),ZTSAVE("PSDED"),ZTSAVE("PSDSN"),ZTSAVE("PSDS"),ZTSAVE("PSDCPY"))=""
52 S:$D(NAOU) ZTSAVE("NAOU(")="" S:$D(PSDA) ZTSAVE("PSDA")=""
53 Q
Note: See TracBrowser for help on using the repository browser.