PSDOR2 ;BIR/LTL-Reg 2 Nurse CS Order Request Entry ;12/14/99 12:44
;;3.0; CONTROLLED SUBSTANCES ;**20**;13 Feb 97
;
; Reference to PSD(58.8 supported by DBIA # 2711
; Reference to DD("DD" supported by DBIA # 10017
;
QTY K ORD S (CNT,PSDOUT,PSDR(2))=0
S DIR(0)="DA^NOW::AEFT",DIR("A")="Date/time required: "
S DIR("?",1)="You are on the verge of creating a priority order."
S DIR("?",2)="If this is a mistake, enter ""^"" to create a scheduled order, otherwise,"
S DIR("?")="Pharmacy needs to know how soon you need this order."
W ! D ^DIR K DIR G:$D(DIRUT) END X ^DD("DD") S PSDT(9)=Y
;Dispensing Site's Maximum Quantity per Order
S PSDR(1)=$P($G(^PSD(58.8,+PSDS,1,+PSDR,0)),U,7)
;Ask Quantity
S DIR(0)="NA^1:"_$S(PSDR(1):PSDR(1),1:999999)_":0"
S DIR("A")="QUANTITY ("_NBKU_"/"_NPKG_"): ",DIR("B")=NPKG
W:$P($G(^PSD(58.8,+NAOU,1,+PSDR,0)),U,3) !,"Stock Level: ",$P($G(^(0)),U,3)," ",NBKU,!
S:PSDR(1) DIR("A",1)="Maximum quantity per order: "_PSDR(1)_" "_NBKU,DIR("A",2)=""
S DIR("?",1)="Because "_NAOUN_" is keeping a perpetual inventory,"
S DIR("?",2)="Pharmacy Service has set "_$S(PSDR(1):"a maximum quantity of "_PSDR(1)_" "_NBKU_" per order",1:"no maximum order quantity")
S DIR("?")="for "_PSDRN_"."
D ^DIR K DIR G:Y<1 END S PSDQTY=Y
;Quantity ordered is equal to or less than max ord qty
NOMAX I '(Y#NPKG)&('PSDR(1)!(Y'>PSDR(1))) D DIE,ASK^PSDORN1 G:PSDOUT END K PSDEM G DRUG^PSDORN
;Quantity ordered is not divisible by package size
D:(Y#NPKG) G:$D(DIRUT) END G:Y<1 QTY I 'PSDR(1)!(Y>PSDR(1)) S Y=PSDQTY G QTY
.S PSDQTY=Y-(Y#NPKG)
.S DIR(0)="S^"_PSDQTY_":"_NBKU_";"_(PSDQTY+NPKG)_":"_NBKU_";*:New Quantity"
.S DIR("A",1)="Please order "_PSDRN,DIR("A",3)=""
.S DIR("A",2)="in multiples of "_NPKG_" "_NBKU_".",DIR("B")=PSDQTY
.S DIR("A")="QUANTITY ("_NBKU_"/"_NPKG_")"
.S DIR("?")="Enter an adjusted quantity or * to enter a new quantity" D ^DIR K DIR Q:Y<1 S PSDQTY=Y
D DIE,ASK^PSDORN1 G:PSDOUT END K PSDEM G DRUG^PSDORN
END K %,%DT,%H,%I,CNT,CNT1,DA,DIC,DIE,DINUM,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DR,DTOUT,DUOUT,LN,MSG,MSG1
K NBKU,NPKG,OK,OKTYP,ORD,PSDA,PSDEM,PSDOUT,PSDQTY,PSDRD,PSDR,PSDRN,PSDT,REQD,TEXT,TYPE,WORD,X,Y
Q
DIE ;create the order request
S:$G(ORD)<2 PSDEM=1
S:'$D(^PSD(58.8,NAOU,1,PSDR,3,0)) ^(0)="^58.800118A^^"
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
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
D NOW^%DTC S PSDT=+$E(%,1,12) W ?10,!!,"processing now..."
S DA=PSDA,DA(1)=PSDR,DA(2)=NAOU,DR="1////"_PSDT_";2////"_+PSDS_";3////"_PSDUZ_";10////1;5////"_PSDQTY_";24////"_$G(PSDEM)_";13" D ^DIE K DIE,DR
Q
PSDOR2 ;BIR/LTL-Reg 2 Nurse CS Order Request Entry ;12/14/99 12:44
+1 ;;3.0; CONTROLLED SUBSTANCES ;**20**;13 Feb 97
+2 ;
+3 ; Reference to PSD(58.8 supported by DBIA # 2711
+4 ; Reference to DD("DD" supported by DBIA # 10017
+5 ;
QTY KILL ORD
SET (CNT,PSDOUT,PSDR(2))=0
+1 SET DIR(0)="DA^NOW::AEFT"
SET DIR("A")="Date/time required: "
+2 SET DIR("?",1)="You are on the verge of creating a priority order."
+3 SET DIR("?",2)="If this is a mistake, enter ""^"" to create a scheduled order, otherwise,"
+4 SET DIR("?")="Pharmacy needs to know how soon you need this order."
+5 WRITE !
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
GOTO END
XECUTE ^DD("DD")
SET PSDT(9)=Y
+6 ;Dispensing Site's Maximum Quantity per Order
+7 SET PSDR(1)=$PIECE($GET(^PSD(58.8,+PSDS,1,+PSDR,0)),U,7)
+8 ;Ask Quantity
+9 SET DIR(0)="NA^1:"_$SELECT(PSDR(1):PSDR(1),1:999999)_":0"
+10 SET DIR("A")="QUANTITY ("_NBKU_"/"_NPKG_"): "
SET DIR("B")=NPKG
+11 IF $PIECE($GET(^PSD(58.8,+NAOU,1,+PSDR,0)),U,3)
WRITE !,"Stock Level: ",$PIECE($GET(^(0)),U,3)," ",NBKU,!
+12 IF PSDR(1)
SET DIR("A",1)="Maximum quantity per order: "_PSDR(1)_" "_NBKU
SET DIR("A",2)=""
+13 SET DIR("?",1)="Because "_NAOUN_" is keeping a perpetual inventory,"
+14 SET DIR("?",2)="Pharmacy Service has set "_$SELECT(PSDR(1):"a maximum quantity of "_PSDR(1)_" "_NBKU_" per order",1:"no maximum order quantity")
+15 SET DIR("?")="for "_PSDRN_"."
+16 DO ^DIR
KILL DIR
IF Y<1
GOTO END
SET PSDQTY=Y
+17 ;Quantity ordered is equal to or less than max ord qty
NOMAX IF '(Y#NPKG)&('PSDR(1)!(Y'>PSDR(1)))
DO DIE
DO ASK^PSDORN1
IF PSDOUT
GOTO END
KILL PSDEM
GOTO DRUG^PSDORN
+1 ;Quantity ordered is not divisible by package size
+2 IF (Y#NPKG)
Begin DoDot:1
+3 SET PSDQTY=Y-(Y#NPKG)
+4 SET DIR(0)="S^"_PSDQTY_":"_NBKU_";"_(PSDQTY+NPKG)_":"_NBKU_";*:New Quantity"
+5 SET DIR("A",1)="Please order "_PSDRN
SET DIR("A",3)=""
+6 SET DIR("A",2)="in multiples of "_NPKG_" "_NBKU_"."
SET DIR("B")=PSDQTY
+7 SET DIR("A")="QUANTITY ("_NBKU_"/"_NPKG_")"
+8 SET DIR("?")="Enter an adjusted quantity or * to enter a new quantity"
DO ^DIR
KILL DIR
IF Y<1
QUIT
SET PSDQTY=Y
End DoDot:1
IF $DATA(DIRUT)
GOTO END
IF Y<1
GOTO QTY
IF 'PSDR(1)!(Y>PSDR(1))
SET Y=PSDQTY
GOTO QTY
+9 DO DIE
DO ASK^PSDORN1
IF PSDOUT
GOTO END
KILL PSDEM
GOTO DRUG^PSDORN
END KILL %,%DT,%H,%I,CNT,CNT1,DA,DIC,DIE,DINUM,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DR,DTOUT,DUOUT,LN,MSG,MSG1
+1 KILL NBKU,NPKG,OK,OKTYP,ORD,PSDA,PSDEM,PSDOUT,PSDQTY,PSDRD,PSDR,PSDRN,PSDT,REQD,TEXT,TYPE,WORD,X,Y
+2 QUIT
DIE ;create the order request
+1 IF $GET(ORD)<2
SET PSDEM=1
+2 IF '$DATA(^PSD(58.8,NAOU,1,PSDR,3,0))
SET ^(0)="^58.800118A^^"
+3 SET PSDA=$PIECE(^PSD(58.8,NAOU,1,PSDR,3,0),"^",3)+1
IF $DATA(^PSD(58.8,NAOU,1,PSDR,3,PSDA))
SET $PIECE(^PSD(58.8,NAOU,1,PSDR,3,0),"^",3)=$PIECE(^PSD(58.8,NAOU,1,PSDR,3,0),"^",3)+1
GOTO DIE
+4 KILL DA,DIC,DIE,DD,DR,DO
SET DIC(0)="L"
SET (DIC,DIE)="^PSD(58.8,"_NAOU_",1,"_PSDR_",3,"
SET DA(2)=NAOU
SET DA(1)=PSDR
SET (X,DINUM)=PSDA
DO FILE^DICN
KILL DIC
+5 DO NOW^%DTC
SET PSDT=+$EXTRACT(%,1,12)
WRITE ?10,!!,"processing now..."
+6 SET DA=PSDA
SET DA(1)=PSDR
SET DA(2)=NAOU
SET DR="1////"_PSDT_";2////"_+PSDS_";3////"_PSDUZ_";10////1;5////"_PSDQTY_";24////"_$GET(PSDEM)_";13"
DO ^DIE
KILL DIE,DR
+7 QUIT