source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDEM.m@ 1427

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1PSDEM ;BIR/BJW-Priority Order Report for NAOUs ;12/14/99 12:10
2 ;;3.0; CONTROLLED SUBSTANCES ;**8,20**;13 Feb 97
3 ;**Y2K compliance**,"P" added to date input string
4 ;
5 ; Reference to PSD(58.8 supported by DBIA # 2711
6 ;
7 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
8 W !!,"Select Date Range for NAOU Priority Order Report",!
9DATE ;ask date range
10 W ! K %DT S %DT="AEP",%DT("A")="Start with Date: " D ^%DT I Y<0 S PSDOUT=1 G END
11 S PSDSD=Y D D^DIQ S PSDATE=Y,%DT("A")="End with Date: " D ^%DT I Y<0 S PSDOUT=1 G END
12 I Y<PSDSD W !!,"The ending date of the range must be later than the starting date." G DATE
13 S PSDED=Y D D^DIQ S PSDATE=PSDATE_"^"_Y,PSDSD=PSDSD-.0001,PSDED=PSDED+.9999
14 D NOW^%DTC S PSDT=X
15SUM ;if summary only
16 W ! K DA,DIR,DIRUT S DIR(0)="Y",DIR("A")="Do you want to print a summary only",DIR("B")="NO"
17 S DIR("?",1)="Answer 'YES' to print only the summary totals for this report,",DIR("?")="answer 'NO' to print the detail report including summary totals."
18 D ^DIR K DIR G:$D(DIRUT) END S SUM=Y
19SUM2 ;D:Y G:$D(DIRUT) END
20 ;.S DIR(0)="SO^T:Totals Only;S:Sub-totals for DRUG or NAOU;W:Within DRUG or NAOU, list each DRUG or NAOU",DIR("B")="S" D ^DIR K DIR S SUM(1)=Y
21SORT ;sel sort order
22 K DA,DIR,DIRUT S DIR(0)="SO^D:DRUG/ALL NAOUS;N:NAOU/ALL DRUGS",DIR("A",1)="You may print by either of these sorting methods."
23 S DIR("?",1)="Enter 'D' if you wish to print the NAOU Priority Order Report sorted by DRUG",DIR("?",2)=" and within DRUG by each NAOU."
24 S DIR("?",3)="Enter 'N' to print the NAOU Priority Order Report by NAOU",DIR("?")=" and within NAOU by each DRUG."
25 S DIR("A")="Select SORT ORDER for Report" D ^DIR K DIR G:$D(DIRUT) END S ANS=Y
26 G:ANS="D" DRUG
27ASKN ;ask NAOU(s)
28 W !!,?5,"You may select a single NAOU, several NAOUs,",!,?5,"or enter ^ALL to select all NAOUs.",!!
29 K DA,DIC
30 F S DIC=58.8,DIC("A")="Select NAOU: ",DIC(0)="QEA",DIC("S")="I $S('$D(^(""I"")):1,'^(""I""):1,+^(""I"")>PSDT:1,1:0),$P(^(0),""^"",2)=""N"",$P(^(0),""^"",3)=+PSDSITE" D ^DIC K DIC Q:Y<0 S LOC(+Y)=""
31 I '$D(LOC)&(X'="^ALL") G END
32 I X="^ALL" F PSD=0:0 S PSD=$O(^PSD(58.8,PSD)) Q:'PSD I $S('$D(^PSD(58.8,PSD,"I")):1,'^("I"):1,+^("I")>PSDT:1,1:0),$P($G(^(0)),"^",2)="N",$P($G(^(0)),"^",3)=+PSDSITE S LOC(PSD)=""
33 G DEV
34DRUG ;ask drug(s)
35 W !!,?5,"You may select a single drug, several drugs,",!,?5,"or enter ^ALL to select all drugs.",!!
36 K DA,DIC F S DIC("A")="Select DRUG: ",DIC=50,DIC(0)="QEA",DIC("S")="I $S('$D(^(""I"")):1,+^(""I"")>DT:1,1:0),$P($G(^(2)),""^"",3)[""N""" D ^DIC K DIC Q:Y<0 S LOC(+Y)=""
37 I '$D(LOC)&(X'="^ALL") G END
38 I X="^ALL" S ALL=1
39DEV ;asks device and queueing information
40 W !!,"This report is designed for a 80 column format.",!,"You may queue this report to print at a later time.",!!
41 K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
42 I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN=$S(ANS="D":"START^PSDEM1",1:"START^PSDEM2"),ZTDESC="CS PHARM NAOU Priority Order Report" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
43 U IO G:ANS="D" START^PSDEM1 G:ANS="N" START^PSDEM2
44END ;
45 K %,%DT,%H,%I,%ZIS,ALL,ANS,DA,DATE,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IO("Q"),LOC
46 K POP,PSD,PSDATE,PSDED,PSDOUT,PSDSD,PSDT,SUM,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE D ^%ZISC
47 S:$D(ZTQUEUED) ZTREQ="@"
48 Q
49SAVE ;save variables for queueing
50 S ZTSAVE("ANS")="",ZTSAVE("SUM")="",ZTSAVE("PSDSITE")="",ZTSAVE("PSD")="",ZTSAVE("PSDT")="" S:$D(LOC) ZTSAVE("LOC(")=""
51 S:$D(ALL) ZTSAVE("ALL")=""
52 S (ZTSAVE("PSDATE"),ZTSAVE("PSDED"),ZTSAVE("PSDSD"))=""
53 Q
Note: See TracBrowser for help on using the repository browser.