source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDORP2.m@ 861

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1PSDORP2 ;BIR/JPW,LTL-Pharm CS Order Request Entry ; 22 Jun 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3QTY K ORD S (CNT,PSDR(2),PSDOUT)=0
4 ;DISPLAY STOCK LEVEL
5 W:$P($G(^PSD(58.8,+NAOU,1,+PSDR,0)),U,3) !,"Stock Level: ",$P($G(^(0)),U,3)," ",NBKU,!
6 ;Dispensing Sites's Max Qty per order
7 S PSDR(1)=$P($G(^PSD(58.8,+PSDS,1,+PSDR,0)),U,7)
8 ;ASK QUANTITY
9 S DIR(0)="NA^1:999999:0"
10 S DIR("A")="QUANTITY ("_NBKU_"/"_NPKG_"): ",DIR("B")=NPKG
11 S:PSDR(1) DIR("A",1)="Maximum quantity per order: "_PSDR(1)_" "_NBKU,DIR("A",2)=""
12 S DIR("?",1)="Because "_NAOUN_" is keeping a perpetual inventory,"
13 S DIR("?",2)=$S(PSDR(1):"a maximum quantity of "_PSDR(1)_" "_NBKU_" per order",1:"no maximum order quantity")_" has been set for "_PSDRN_"."
14 S:PSDR(1) DIR("?")="If you request more than "_PSDR(1)_" "_NBKU_", multiple orders will be generated.",DIR("?",3)="for "_PSDRN_".",DIR("?",4)=""
15 D ^DIR K DIR G:Y<1 END S PSDQTY=Y
16 ;quantity ordered is equal to or less than max ord qty
17NOMAX I 'PSDR(1)!(Y'>PSDR(1)) D DIE,ASK^PSDORP1 G:PSDOUT END G DRUG^PSDORP
18 ;QUANTITY EXCEEDS MAX ORD QTY, MULTIPLE ORDERS
19 S:(PSDQTY#PSDR(1)) CNT=1,PSDR(2)=(PSDQTY#PSDR(1))
20 S CNT=$G(CNT)+(Y\PSDR(1))
21 W !!,"This will be "_CNT_" separate order requests,"
22 W:PSDR(2) !!,"One order for ",PSDR(2)," ",NBKU,", and"
23 W !!,(PSDQTY\PSDR(1))," order"
24 W:CNT>2!('PSDR(2)&(CNT=2)) "s"
25 W " for ",PSDR(1)," ",NBKU,"."
26 W ! K DA,DIR,DIRUT S DIR(0)="Y",DIR("A")="Do you want me to generate the "_CNT_" separate order requests",DIR("B")="YES",DIR("?",1)="Answer 'YES' to create the multiple order requests,"
27 S DIR("?")="Answer 'NO' to edit your quantity or '^' to quit." D ^DIR K DIR G:$D(DIRUT) END
28 I 'Y W !,"No order request created. You must edit quantity.",! G QTY
29 I Y W !!,"The "_CNT_" requests are being created. You must review every request.",! S PSDQTY=$S(PSDR(2):PSDR(2),1:PSDR(1)) D D ^PSDORP1 S PSDQTY=PSDR(1)
30 .F ORD=1:1:CNT W !!,"Creating your order request # "_ORD_" of "_CNT_" for "_PSDRN D DIE S ORD(ORD)=PSDA
31 G:'PSDOUT DRUG^PSDORP
32END K %,%DT,%H,%I,CNT,CNT1,DA,DIC,DIE,DINUM,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DR,DTOUT,DUOUT,LN,MSG,MSG1
33 K NAOU,NAOUN,NBKU,NPKG,OK,OKTYP,ORD,PSDA,PSDOUT,PSDQTY,PSDRD,PSDR,PSDRN,PSDS,PSDT,PSDUZ,PSDUZA,PSDUZN,REQD,TEXT,TYPE,WORD,X,Y
34 Q
35DIE ;create the order request
36 S:'$D(^PSD(58.8,NAOU,1,PSDR,3,0)) ^(0)="^58.800118A^^"
37 S PSDA=$P(^PSD(58.8,NAOU,1,PSDR,3,0),"^",3)+1 I $D(^PSD(58.8,NAOU,1,PSDR,3,PSDA)) S $P(^PSD(58.8,NAOU,1,PSDR,3,0),"^",3)=$P(^PSD(58.8,NAOU,1,PSDR,3,0),"^",3)+1 G DIE
38 K DA,DIC,DIE,DD,DR,DO S DIC(0)="L",(DIC,DIE)="^PSD(58.8,"_NAOU_",1,"_PSDR_",3,",DA(2)=NAOU,DA(1)=PSDR,(X,DINUM)=PSDA D FILE^DICN K DIC
39 D NOW^%DTC S PSDT=+$E(%,1,12) W ?10,!!,"processing now..."
40 S DA=PSDA,DA(1)=PSDR,DA(2)=NAOU,DR="1////"_PSDT_";2////"_PSDS_";10////1;5////"_PSDQTY_";13;3//^S X=PSDUZN" D ^DIE K DIE,DR
41 S PSDUZA=+$P($G(^PSD(58.8,NAOU,1,PSDR,3,PSDA,0)),"^",4)
42 Q
43MSG ;display error message
44 W $C(7),!!,?10,"Contact your Pharmacy Coordinator.",!,?10,"This "_$S(MSG=2:"Dispensing Site",MSG=1:"NAOU",1:"PSDR")_" is missing "
45 W $S(MSG1=1:"Primary Disp. Site",MSG1=2:"stocked drugs",MSG1=3:"narcotic breakdown unit",MSG1=4:"narcotic package size",1:"data")_".",!
46 Q
Note: See TracBrowser for help on using the repository browser.