source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDRLOG.m@ 1008

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1PSDRLOG ;BIR/BJW-CS Inspector's Log By Date ; 12 Feb 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
3 ;**Y2K compliance**,"P" added to date input string in (DATE,RDATE)
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) I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"print the CS Inspector's Log.",! K OK Q
6 W !,?5,"Inspector's Log by Date Received",!
7DATE ;ask date range
8 W ! K %DT S %DT="AEP",%DT("A")="Start with Date Received: " D ^%DT I Y<0 S PSDOUT=1 D MSG G END
9 S PSDSD=Y D D^DIQ S PSDATE=Y
10 S PSDSD=PSDSD-.0001
11RET ;ask ret to stk
12 K DA,DIR S DIR(0)="Y",DIR("A")="Include Returns to Stock",DIR("B")="YES"
13 S DIR("?")="Answer 'YES' or return to include returns to stock, 'NO' to continue without returns, or '^' to quit."
14 D ^DIR K DIR I $D(DIRUT) D MSG G END
15 S PSDRET=Y G:'PSDRET ASKN
16RDATE ;ask return date
17 W ! K %DT S %DT="AEP",%DT("A")="Start with Date Returned to Stock: " D ^%DT I Y<0 S PSDOUT=1 D MSG G END
18 S PSDRD=Y,PSDRD=PSDRD-.0001
19ASKN ;ask naou or group
20 W !!,?5,"Select one of the following:",!!,?10,"N",?20,"NAOU (One, Some, or ^ALL)",!,?10,"G",?20,"Group of NAOUs",!
21 K DA,DIR,DIRUT S DIR(0)="SOA^N:NAOU;G:Group of NAOUs",DIR("A")="Select Method: "
22 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"
23 D ^DIR K DIR G:$D(DIRUT) END S SEL=Y K DA,DIC S CNT=0
24 I SEL="G" D GROUP G:'$D(PSDG) END G SORT
25 F S DIC=58.8,DIC("A")="Select NAOU: ",DIC(0)="QEA",DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$P(^(0),""^"",2)=""N"",'$P(^(0),""^"",7)" D ^DIC K DIC Q:Y<0 D
26 .S NAOU(+Y)="",CNT=CNT+1
27 I '$D(NAOU)&(X'="^ALL") G END
28 S:X="^ALL" ALL=1
29SORT ;asks sort
30 W ! K DA,DIR,DIRUT S DIR(0)="YO",DIR("A")="Do you wish to sort by Inventory Type",DIR("B")="NO"
31 S DIR("?")="Answer YES to sort drugs by Inventory Type, NO or <RET> to sort by drug."
32 D ^DIR K DIR G:$D(DIRUT) END S ASKN=Y
33SORT2 ;asks second sort
34 K DA,DIR,DIRUT S DIR(0)="SO^D:DRUG/DISPENSING #S;N:NUMERIC DISPENSING #S"
35 S DIR("A")="Select Print Order for Inspector's Log",DIR("?",1)="Select D to print Dispensing Number numerically by drug, within an NAOU,",DIR("?")="select N to print numerically within an NAOU, or '^' to quit."
36 D ^DIR K DIR G:$D(DIRUT) END S ASK=Y
37DEV ;ask device and queue info
38 W !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
39 K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
40 I $D(IO("Q")) K IO("Q") S PSDIO=ION,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDRLOG1",ZTDESC="Compile Narcotic Inspector Log By Date" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
41 U IO G START^PSDRLOG1
42END K %,%DT,%H,%I,%ZIS,ALL,ASK,ASKN,CNT,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DTOUT,DUOUT,EXP,EXPD,FLAG,JJ,KK,NAOU,NODE,NODE1,NODE3,NODE7,NUM
43 K OK,PSD,PSDA,PSDATE,PSDCNT,PSDDT,PSDED,PSDG,PSDIO,PSDOK,PSDOUT,PSDN,PSDNA,PSDPN,PSDR,PSDRD,PSDRET,PSDRN,PSDSD,PSDST,PSDTR,PSDTYP
44 K QTY,SEL,STAT,TYP,TYPN,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
45 K ^TMP("PSDRLOG",$J) D ^%ZISC
46 S:$D(ZTQUEUED) ZTREQ="@"
47 Q
48GROUP ;select group of naous
49 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)=""
50 Q
51SAVE S (ZTSAVE("PSDIO"),ZTSAVE("CNT"),ZTSAVE("PSDSITE"),ZTSAVE("ASK"),ZTSAVE("ASKN"))=""
52 S:$D(PSDG) ZTSAVE("PSDG(")="" S:$D(NAOU) ZTSAVE("NAOU(")="" S:$D(ALL) ZTSAVE("ALL")=""
53 S:$D(PSDSD) ZTSAVE("PSDSD")=""
54 S:$D(PSDATE) ZTSAVE("PSDATE")=""
55 S:$D(PSDRET) ZTSAVE("PSDRET")=""
56 S:$D(PSDRD) ZTSAVE("PSDRD")=""
57 Q
58MSG W !!,"No action taken.",!!
59 Q
Note: See TracBrowser for help on using the repository browser.