source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDEXGS.m@ 1154

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1PSDEXGS ;BIR/BJW-Enter Existing Green Sheets at Startup ; 10 Feb 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**8,33**;13 Feb 97
3 ;**Y2K compliance**,added a "P" to date input string in ^DD(58.81,19)
4 ;Reference to ^PSD(58.8 are covered by DBIA #2711
5 ;Reference to ^PSD(58.81 are covered by DBIA #2808
6 ;Reference to ^PSDRUG( are covered by DBIA #221
7 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
8 I '$D(^XUSEC("PSJ RPHARM",DUZ)) W !!,"Contact your Pharmacy Coordinator for access to enter existing Green Sheets",!,"into the Controlled Substances package.",!!,"PSJ RPHARM security key required.",! Q
9 S PSDUZ=DUZ
10 W !!,?5,"The Order Status of all Green Sheets entered as existing before",!,?5,"the Controlled Substances package initialization will be",!,?10," *** DELIVERED - ACTIVELY ON NAOU ***",!!
11ASKD ;ask disp site
12 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
13 G:$P(PSDSITE,U,5) CHKD
14 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)"
15 S DIC("A")="Select Primary Dispensing Site: ",DIC("B")=PSDSN
16 D ^DIC K DIC G:Y<0 END
17 S PSDS=+Y,PSDSN=$P(Y,"^",2),$P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
18CHKD I '$D(^PSD(58.8,+PSDS,0)) W !!,"The ",PSDSN," vault is missing data.",!! G END
19NAOU ;select NAOU
20 K DA,DIC S DIC=58.8,DIC(0)="QEA",DIC("A")="Select NAOU: "
21 S DIC("S")="I $P(^(0),""^"",4)=+PSDS,$P(^(0),""^"",2)=""N"""
22 D ^DIC K DIC G:Y<0 END S NAOU=+Y,NAOUN=$P(Y,"^",2)
23 I '$D(^PSD(58.8,NAOU,0)) W !!,"This NAOU is missing data.",!! G END
24DRUG ;ask drug
25 I '$O(^PSD(58.8,NAOU,1,0)) W !!,"There are no stocked drugs for this NAOU.",!! G END
26 W !!,?15,"=> NAOU: ",NAOUN,!
27 K DA,DIC S DIC("W")="W:$P(^PSDRUG(Y,0),""^"",9) "" N/F"" I $P(^PSD(58.8,NAOU,1,Y,0),""^"",14)]"""",$P(^(0),""^"",14)'>DT W $C(7),"" *** INACTIVE ***"""
28 S DIC("S")="I $S('$P(^(0),""^"",14):1,+$P(^(0),""^"",14)>DT:1,1:0)"
29 S DA(1)=+NAOU,DIC(0)="QEAM",DIC="^PSD(58.8,"_+NAOU_",1," D ^DIC K DIC G:Y<0 END S PSDRG=+Y,PSDRGN=$S($P($G(^PSDRUG(PSDRG,0)),"^")]"":$P(^(0),"^"),1:"DRUG NAME MISSING")
30 I '$D(^PSD(58.8,NAOU,1,PSDRG,0)) W !!,PSDRGN," is missing",!,"data in ",NAOUN G END
31 I '$D(^PSD(58.8,+PSDS,1,PSDRG,0)) W !!,PSDRGN," is not stocked",!,"in ",PSDSN,!! G END
32 S NBKU=$P(^PSD(58.8,+PSDS,1,PSDRG,0),"^",8),NPKG=+$P(^(0),"^",9)
33 I 'NPKG!(NBKU']"") W $C(7),!!,PSDRGN," is missing breakdown unit or",!,"package size in ",PSDSN,".",! G END
34GS W !!,"Enter Green Sheet #: " R X:DTIME I '$T!(X="")!(X["^") W !!,"** No action taken. **" G END
35 I X'?1.9N D MSG1 G GS
36 I 'X D MSG1 G GS
37 I +$O(^PSD(58.81,"D",X,0)) W !!,"This number has already been used.",!! G GS
38 S PSDPN=X K X
39QTY W !!,"Enter Quantity ("_NBKU_"/"_NPKG_"): " R X:DTIME I '$T!(X="")!(X["^") D MSG G END
40 I X'?1.6N D MSG2 G QTY
41 I 'X D MSG2 G QTY
42 S QTY=X K X
43PHARM K DA,DIR,DTOUT,DUOUT S DIR(0)="58.81,18O" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
44 S PHARM=$P(Y,"^")
45RDATE K DA,DIR,DTOUT,DUOUT S DIR("A")="DISPENSED DATE: ",DIR(0)="58.81,19OA" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
46 S RDATE=$P(Y,"^")
47NURSE K DA,DIR,DTOUT,DUOUT S DIR(0)="58.81,20O" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
48 S NURS=$P(Y,"^")
49MFG K DA,DIR,DTOUT,DUOUT S DIR(0)="58.81,12O" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
50 S MFG=Y
51LOT K DA,DIR,DTOUT,DUOUT S DIR(0)="58.81,13O" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
52 S LOT=Y
53EXP K DA,DIR,DTOUT,DUOUT S DIR(0)="58.81,14O" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
54 S EXP=Y
55 ;DAVE B (PSD*3*33) add PRINTED 2638 field
56PNT10 K DA,DIR,DTOUT,DUOUT S DIR(0)="58.81,103" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) D MSG G END
57 S PNT10=Y
58OK W ! K DA,DIR,DIRUT S DIR(0)="Y",DIR("B")="YES",DIR("A")="Is this OK"
59 S DIR("?",1)="Answer 'YES' to post this Green Sheet information,",DIR("?")="answer 'NO' to erase this information and try again."
60 D ^DIR K DIR G:$D(DIRUT) END
61 I 'Y G QTY
62 D ^PSDEXGS1 G DRUG
63END K %,%DT,%H,%I,DA,DIC,DIE,DINUM,DIR,DIROUT,DIRUT,DLAYGO,DR,DTOUT,DUOUT,EXP,LOT,MFG
64 K NAOU,NAOUN,NBKU,NPKG,NURS,PHARM,PSDA,PSDPN,PSDRG,PSDRGN,PSDRN,PSDS,PSDSN,PSDT,PSDUZ,RDATE,QTY,X,Y
65 Q
66MSG W !!,"No action taken. The Green Sheet # ",PSDPN," has not been added to your CS files.",!
67 Q
68MSG1 W !!,"You must enter a whole number between 1 and 999999999",!
69 Q
70MSG2 W !!,"You must enter a whole number between 1 and 999999",!
71 Q
Note: See TracBrowser for help on using the repository browser.