source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDPWK.m@ 1722

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

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1PSDPWK ;BIR/JPW,BJW-Print Pharm Disp. Worksheet ; 3 Aug 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**10**;13 Feb 97
3 ;refer to nois#:sdc-0597-60187
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
7 W !!,"=> This report lists all pending CS requests for a dispensing site.",!!
8 I '$O(^PSD(58.85,0)) W $C(7),!!,"There are no pending request orders.",!! K OK Q
9SUM ;ask worksheet, summary or both
10 K DA,DIR,DIRUT S DIR(0)="SO^W:WORKSHEET ONLY;S:SUMMARY TOTALS ONLY;B:BOTH WORKSHEET AND SUMMARY TOTALS"
11 S DIR("A")="Select Worksheet Report(s) to Print"
12 S DIR("?",1)="Answer 'W' to print only the worksheet for this report,",DIR("?",2)="answer 'S' to print only the summary totals, or",DIR("?")="answer 'B' to print the worksheet and the summary totals."
13 D ^DIR K DIR G:$D(DIRUT) END S SUM=Y
14ASKD ;ask disp location
15 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
16 I $P(PSDSITE,U,5) S PSDS=PSDS_"^"_+$P(^PSD(58.8,+PSDS,0),"^",5) G CHKD
17 W ! 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)",DIC("A")="Select Primary Dispensing Site: ",DIC("B")=$P(PSDSITE,U,4)
18 D ^DIC K DIC G:Y<0 END
19 S PSDS=+Y,PSDSN=$P(Y,"^",2),PSDS=PSDS_"^"_+$P(Y(0),"^",5)
20 S $P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
21CHKD I '$O(^PSD(58.85,"AE",+PSDS,0)) W !!,"There are no pending CS requests for "_PSDSN_".",!! G END
22ASKN ;ask naou or group
23 W !!,?5,"Select one of the following:",!!,?10,"N",?20,"NAOU (One, Some, or ^ALL)",!,?10,"G",?20,"Group of NAOUs",!
24 K DA,DIR,DIRUT S DIR(0)="SOA^N:NAOU;G:Group of NAOUs",DIR("A")="Select Method: "
25 S DIR("?",1)="Enter 'N' to select one, some or ^ALL NAOU(s).",DIR("?")="Enter 'G' to select a group of NAOUs, or '^' to quit"
26 D ^DIR K DIR
27 I $D(DIRUT),X="^ALL" S ALL=1,CNT=0,SEL="N" D NOW^%DTC S PSDT=X G SORT
28 I $D(DIRUT) G END
29 S SEL=Y D NOW^%DTC S PSDT=X K DA,DIC S CNT=0
30 I SEL="G" D GROUP G:'$D(PSDG) END G SORT
31 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 D
32 .S NAOU(+Y)="",CNT=CNT+1
33 I '$D(NAOU)&(X'="^ALL") G END
34 S:X="^ALL" ALL=1
35SORT ;asks sort
36 S ANS=$P($G(^PSD(58.8,+PSDS,2)),"^",7)
37 I (ANS="D")!(ANS="N") G DEV
38 K DA,DIR,DIRUT S DIR(0)="SO^D:DRUG/NAOU;N:NAOU/DRUG",DIR("A",1)="You may print by either of these sorting methods."
39 S DIR("?",1)="Enter 'D' to print the worksheet sorted by DRUG then NAOU",DIR("?")="Enter 'N' to print the worksheet sorted by NAOU then DRUG."
40 S DIR("A")="Select SORT ORDER for Worksheet" D ^DIR K DIR G:$D(DIRUT) END S ANS=Y
41DEV ;ask device and queue info
42 ;chgd L4 to s psdio=ion_";"_iost
43 W !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
44 S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
45 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
46 I $D(IO("Q")) K IO("Q") S PSDIO=ION_";"_IOST,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDPWK1",ZTDESC="Compile Worksheet for CS PHARM" D SAVE,^%ZTLOAD K ZTSK G END
47 U IO G START^PSDPWK1
48END K %,%H,%I,%ZIS,ALL,ANS,C,CNT,COMM,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IO("Q"),JJ,JJ1,JJDA,LOOP,LOOP2,NAOU,NODE,OK,ORD,ORDN
49 K POP,PRT,PSD,PSDCPY,PSDEV,PSDG,PSDIO,PSDN,PSDNA,PSDR,PSDRN,PSDS,PSDSN,PSDT
50 K QTY,SEL,SUM,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK,^TMP("PSDWK",$J),^TMP("PSDWKT",$J) D ^%ZISC
51 S:$D(ZTQUEUED) ZTREQ="@"
52 Q
53GROUP ;select group of naous
54 K DA,DIC F S DIC=58.2,DIC("A")="Select NAOU INVENTORY GROUP NAME: ",DIC(0)="QEA",DIC("S")="I $S($D(^PSI(58.2,""CS"",+Y)):1,1:0)" D ^DIC K DIC Q:Y<0 S PSDG(+Y)=""
55 Q
56SAVE S (ZTSAVE("PSDT"),ZTSAVE("PSDIO"),ZTSAVE("ANS"),ZTSAVE("CNT"),ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("SUM"),ZTSAVE("PSDSITE"))=""
57 S:$D(PSDG) ZTSAVE("PSDG(")="" S:$D(NAOU) ZTSAVE("NAOU(")="" S:$D(ALL) ZTSAVE("ALL")=""
58 Q
Note: See TracBrowser for help on using the repository browser.