source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDEM4.m@ 1535

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

initial load of FOIAVistA 6/30/08 version

File size: 2.1 KB
Line 
1PSDEM4 ;BIR/JPW,LTL-Nurse CS Priority Order Status; 25 Apr 95
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
4 S PSDUZ=DUZ,(MSG,MSG1)=0,Y=DT X ^DD("DD") S REQD=Y
5NAOU ;select NAOU to check priority orders for
6 K DA,DIC S DIC=58.8,DIC(0)="QEA",DIC("A")="Select Ordering NAOU: "
7 S DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S('$D(^(""I"")):1,'^(""I""):1,+^(""I"")>DT:1,1:0),$P(^(0),""^"",2)=""N"",'$P(^(0),""^"",7)"
8 W ! D ^DIC K DIC G:Y<0 END S NAOU=+Y,NAOUN=$P(Y,"^",2)
9 I '$D(^PSD(58.8,NAOU,0)) S MSG=1 D MSG G END
10 I '$O(^PSD(58.8,NAOU,1,0)) S MSG=1,MSG1=2 D MSG G END
11 S PSDS=+$P(^PSD(58.8,NAOU,0),"^",4),PSDS=PSDS_"^"_+$P(^PSD(58.8,+PSDS,0),"^",5) I '+PSDS S (MSG,MSG1)=1 D MSG G END
12 I '$D(^PSD(58.8,+PSDS,0)) S MSG=2 D MSG G END
13 I '$O(^PSD(58.8,+PSDS,1,0)) S MSG=2,MSG1=2 D MSG G END
14 S TYPE=$P(^PSD(58.8,+PSDS,0),"^",2),OKTYP=$S(TYPE="M":1,TYPE="S":1,1:0) I 'OKTYP W !!,"Contact your Pharmacy Coordinator.",!,"The Pharmacy Dispensing Site is invalid for this NAOU." G END
15LOOP S PSDT=DT
16 W:$O(^PSD(58.81,"AEM",DT)) !!,"Today's Priority Orders:"
17 F S PSDT=$O(^PSD(58.81,"AEM",PSDT)) Q:'PSDT S PSDT(1)=0 F S PSDT(1)=$O(^PSD(58.81,"AEM",PSDT,+PSDS,PSDT(1))) Q:'PSDT(1) S PSDT(2)=0 F S PSDT(2)=$O(^PSD(58.81,"AEM",PSDT,+PSDS,PSDT(1),PSDT(2))) Q:'PSDT(2) D
18 .S PSDT(3)=$G(^PSD(58.81,PSDT(2),0)) Q:$P(PSDT(3),U,18)'=NAOU
19 .S PSDT(4)=PSDT(2)
20 .W !!,$P($G(^PSDRUG(PSDT(1),0)),U)," ",$P(PSDT(3),U,6)," "
21 .W $P($G(^PSD(58.8,+PSDS,1,PSDT(1),0)),U,8)
22 .W !,$P($G(^PSD(58.82,$P(PSDT(3),U,11),0)),U)
23 W:'$G(PSDT(4)) !!,"No Priority Orders ready for ",NAOUN,"."
24END K %,%DT,%H,%I,CNT,CNT1,DA,DIC,DIE,DINUM,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DR,DTOUT,DUOUT,LN,MSG,MSG1
25 K NAOU,NAOUN,NBKU,NPKG,OK,OKTYP,ORD,PSDA,PSDEM,PSDOUT,PSDQTY,PSDRD,PSDR,PSDRN,PSDS,PSDT,PSDUZ,PSDUZN,REQD,TEXT,TYPE,WORD,X,Y
26 Q
27MSG ;display error message
28 W $C(7),!!,?10,"Contact your Pharmacy Coordinator.",!,?10,"This "_$S(MSG=2:"Dispensing Site",MSG=1:"NAOU",1:"Drug")_" is missing "
29 W $S(MSG1=1:"Primary Disp. Site",MSG1=2:"stocked drugs",MSG1=3:"narcotic breakdown unit",MSG1=4:"narcotic package size",1:"data")_".",!
30 Q
Note: See TracBrowser for help on using the repository browser.