source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDGSL.m@ 1722

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

initial load of WorldVistAEHR

File size: 2.9 KB
Line 
1PSDGSL ;BIR/BJW-Review Green Sheet Log ; 10 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 view",!,?12,"Green Sheets. PSJ RPHARM or PSJ PHARM TECH security key required.",! K OK Q
7ASKD ;ask disp location
8 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
9 G:$P(PSDSITE,U,5) SORT
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")=PSDSN
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
14SORT ;sort gs number or date
15 K DA,DIR,DIRUT S DIR(0)="SO^D:DATE RANGE;N:GREEN SHEET NUMBER"
16 S DIR("A")="Select Sort for Green Sheet Listing"
17 S DIR("?",1)="Answer 'D' to print for a specific date range or",DIR("?")="answer 'N' to print a range of Green Sheet numbers."
18 D ^DIR K DIR G:$D(DIRUT) END S ASK=Y
19 I ASK="N" G GS
20DATE ;ask date range
21 W ! K %DT S %DT="AEP",%DT("A")="Start with Date: " D ^%DT I Y<0 S PSDOUT=1 G END
22 S PSDSD=Y D D^DIQ S PSDATE=Y,%DT("A")="End with Date: " D ^%DT I Y<0 S PSDOUT=1 G END
23 I Y<PSDSD W !!,"The ending date of the range must be later than the starting date." G DATE
24 S PSDED=Y D D^DIQ S PSDATE=PSDATE_"^"_Y,PSDSD=PSDSD-.0001,PSDED=PSDED+.9999
25 G DEV
26GS ;ask gs num range
27 W !!,"Start with Green Sheet: " R X:DTIME I '$T!(X="")!(X["^") G END
28 I X'?1.9N W !!,"Please enter your starting Green Sheet number from 1 to 999999999.",! G GS
29 S PSD1=X
30GS2 W !!,"End with Green Sheet: " R X:DTIME I '$T!(X="")!(X["^") G END
31 I X'?1.9N W !!,"Please enter your ending Green Sheet number from 1 to 999999999.",! G GS2
32 I X'>PSD1 W !!,"Ending GS number must be larger that the starting GS number.",! G GS2
33 S PSD2=X
34DEV ;asks device and queueing information
35 W !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
36 S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
37 W ! 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
38 I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDGSL1",ZTDESC="CS PHARM GREEN SHEET HISTORY" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
39 U IO G START^PSDGSL1
40END K %,%DT,%H,%I,%ZIS,ASK,C,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,OK,POP,PSD1,PSD2,PSDATE,PSDED,PSDEV,PSDOUT,PSDS,PSDSD,PSDSN,X,Y
41 K ^TMP("PSDGSL",$J)
42 K ZTDESC,ZTRTN,ZTSAVE,ZTSK D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
43 Q
44SAVE ;sets variables for queueing
45 S (ZTSAVE("ASK"),ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDA"),ZTSAVE("NODE"))=""
46 S:$D(PSDATE) ZTSAVE("PSDATE")="" S:$D(PSDSD) ZTSAVE("PSDSD")=""
47 S:$D(PSDED) ZTSAVE("PSDED")=""
48 S:$D(PSD2) ZTSAVE("PSD2")="" S:$D(PSD1) ZTSAVE("PSD1")=""
49 Q
Note: See TracBrowser for help on using the repository browser.