source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDHRPT.m@ 1464

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

initial load of WorldVistAEHR

File size: 4.8 KB
RevLine 
[613]1PSDHRPT ;BIR/BJW-Destructions Holding file Report ; 3 Mar 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
3 ;**Y2K compliance** display 4 digit year on va forms
4 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
5 I '$D(^XUSEC("PSJ RPHARM",DUZ)) W !!,"Please contact your Pharmacy Coordinator for access to",!,"the pending Controlled Substances destruction data.",!!,"PSJ RPHARM security key required.",! G END
6ASKD ;ask disp location
7 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
8ASKV ;ask vault(s)
9 W !!,?5,"You may select a single VAULT, several VAULT(s),",!,?5,"or enter ^ALL to select all VAULT(s).",!
10 K DA,DIC D NOW^%DTC S (PSDT,Y)=X X ^DD("DD") S RPDT=Y
11 F S DIC=58.8,DIC("A")="Select VAULT: ",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 S PSDVAU(+Y)="" Q:Y<0
12 I '$D(PSDVAU)&(X'="^ALL") G END
13 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 PSDVAU(PSD)=""
14 S JJ=$O(PSDVAU(0)),JJ=$S($O(PSDVAU(JJ)):1,1:2)
15 S DIC="^DIC(4,",DR=.01,DA=+$P($G(^XMB(1,1,"XUS")),U,17),DIQ="PSD"
16 D EN^DIQ1 K DIC,DR,DIQ
17 S PSDSN=$S(JJ=1:PSD(4,DA,.01),1:$P($G(^PSD(58.8,+$O(PSDVAU(0)),0)),U))
18 K DA,PSD
19DEV ;select device
20 S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
21 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
22 I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDHRPT",ZTDESC="CS PHARM HOLD for DESTROY" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
23 U IO
24START ;start looping
25 ;1/26/96 CHG L3,added chk for 3-node;dte cancelld
26 D NOW^%DTC S Y=X X ^DD("DD") S RPDT=Y
27 K LN S (CNT,PG,PSDOUT)=0,$P(LN,"-",132)="" D HDR
28 F PSD=0:0 S PSD=$O(^PSD(58.86,PSD)) Q:'PSD I $D(^PSD(58.86,PSD,0)),$D(PSDVAU(+$P(^(0),"^",7))),'$P(^(0),"^",11)!$D(^PSD(58.86,PSD,3)) S CNT=CNT+1 D PRINT Q:PSDOUT
29 I CNT=0 W !!,?10,"*** NO HOLDING FOR DESTRUCTIONS ***",!!
30DONE I $E(IOST)'="C" W @IOF
31 I $E(IOST,1,2)="C-",'PSDOUT W ! K DIR,DIRUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu" D ^DIR K DIR
32END ;
33 K %I,%ZIS,ALL,C,CNT,DA,DIC,DIR,DIROUT,DIRUT,DRUG,DRUGN,DTOUT,DUOUT,JJ,LN,NODE
34 K PG,PHARM,PHARMN,POP,PSD,PSDCD,PSDCYR,PSDCNL,PSDCONT,PSDCOMS,PSDGS,PSDEV,PSDOUT,PSDS,PSDSN,PSDT,PSDTR,PSDYR,PSDVAU,PVAULT,QTY,BAREAS,REAS,RPDT,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
35 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
36 Q
37PRINT ;print data
38 ;58.86(2;1)"PSDCOMS" holds reason drug placed on hold,3/22/95
39 ;58.86(3;3)"PSDCNL" " " HLD# was cancelled,12-11-95
40 ;58.81(0;16)"BAREAS" " " reason for bal-adj,10-5-95
41 ;58.81(3;6)" " " GS# placed on hold
42 D:$Y+8>IOSL HDR Q:PSDOUT
43 S (PSDCOMS,PSDCNL)=""
44 S NODE=^PSD(58.86,PSD,0),DRUG=+$P(NODE,"^",2),PSDTR=$P(NODE,"^",9)
45 S PVAULT=$P(NODE,"^",7) I JJ=1 W !,"=> ",$P($G(^PSD(58.8,+PVAULT,0)),U)
46 S DRUGN=$S($G(^PSD(58.86,PSD,1))]"":$G(^PSD(58.86,PSD,1))_"*",$P($G(^PSDRUG(+DRUG,0)),"^")]"":$P($G(^PSDRUG(+DRUG,0)),"^"),1:"DRUG NAME MISSING")
47 S QTY=$P(NODE,"^",3),PHARM=$P(NODE,"^",4),PHARMN=$P($G(^VA(200,+PHARM,0)),"^") I PHARMN]"" S PHARMN=$E($P(PHARMN,",",2))_$E(PHARMN)
48 S PSDT=$P(NODE,"^",6) I PSDT S Y=PSDT X ^DD("DD") S PSDYR=$P(Y,",",2),PSDYR=$E(PSDYR,1,4) S PSDT=$E(PSDT,4,5)_"/"_$E(PSDT,6,7)_"/"_PSDYR
49 S PSDCD=$P($G(^PSD(58.86,PSD,3)),"^") I PSDCD S Y=PSDCD X ^DD("DD") S PSDCYR=$P(Y,",",2),PSDCYR=$E(PSDCYR,1,4) S PSDCD=$E(PSDCD,4,5)_"/"_$E(PSDCD,6,7)_"/"_PSDCYR
50 S PSDCONT=$P(NODE,"^",8)
51 ;The next 2 lines added for E3R# 3771 to print comments
52 S:$D(^PSD(58.86,PSD,2)) PSDCOMS=$P(^(2),"^",1)
53 S:'$D(^PSD(58.86,PSD,2)) PSDCOMS=""
54 S:$D(^PSD(58.86,PSD,3)) PSDCNL=$P(^(3),"^",3)
55 S:'$D(^PSD(58.86,PSD,3)) PSDCNL=""
56 S PSDGS="",REAS="",BAREAS=""
57 I +PSDTR S PSDGS=$P($G(^PSD(58.81,PSDTR,0)),U,17),REAS=$P($G(^(3)),U,6),BAREAS=$P($G(^(0)),U,16)
58 W:$D(^PSD(58.86,PSD,3)) !,PSD,"(C)",?13,DRUGN,?83,PSDCONT,?92,QTY,?102,PSDT,?115,PSDCD,?128,PHARMN,!,?15,"Comments: "
59 W:'$D(^PSD(58.86,PSD,3)) !,PSD,?13,DRUGN,?83,PSDCONT,?92,QTY,?102,PSDT,?115,PSDCD,?128,PHARMN,!,?15,"Comments: "
60 I $D(PSDCOMS) W ?24,PSDCOMS
61 I $D(REAS) W ?24,REAS
62 I $D(BAREAS) W ?24,BAREAS
63 I $D(PSDCNL) W ?24,PSDCNL
64 W ?85,PSDGS,!
65 Q
66HDR ;prints header information
67 ;Modified for E3R# 3771 3/22/95,mod:1/12/96
68 I $E(IOST,1,2)="C-",PG W ! K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
69 S PG=PG+1 W:$Y @IOF W !,?125,"PAGE: ",PG,!,?42,"DESTRUCTION HOLDING FILE REPORT for ",PSDSN,!,?42,"Run Date: ",RPDT,!,"=> VAULT",!
70 W !,"HOLD #",?13,"DRUG",?80,"# OF CONT",?92,"QTY",?102,"TURN IN",?115,"DATE HLD#",?127,"PHARM",!,?15,"COMMENTS",?85,"GS#",?104,"DATE",?115,"CANCELLED",!,LN,!
71 Q
72SAVE ;4/5/95 added by bjw
73 S (ZTSAVE("PSDS"),ZTSAVE("PSDGS"),ZTSAVE("PSDSN"),ZTSAVE("PSDTR"),ZTSAVE("REAS"),ZTSAVE("JJ"),ZTSAVE("BAREAS"),ZTSAVE("PSDCOMS"),ZTSAVE("PSDCNL"))=""
74 S:$D(ALL) ZTSAVE("ALL")="" S:$D(PSDVAU) ZTSAVE("PSDVAU(")=""
75 Q
Note: See TracBrowser for help on using the repository browser.