PSAVINC ;BIR/LTL-Update Prices ;7/23/97
;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;; 10/24/97
;This routine updates prices for a drug.
;
N DA,DIC,DIR,DR,DTOUT,DUOUT,PSA,PSACNT,PSALOC,PSALOCN,PSAOUT,PSAR,PSARPDT,PSAT,PSAU,X,X2,X3,Y S PSAOUT=1,PSAU=0
LOOK D ^PSADA I '$G(PSALOC) S PSAOUT=1 G END
I '$O(^PSD(58.8,PSALOC,1,0)) W !!,"There are no drugs in ",PSALOCN G END
S PSACNT=0 W !!,"You may select one, several, or ^ALL drugs.",!
CHKD F S DIC="^PSD(58.8,+PSALOC,1,",DIC(0)="AEMQ",DIC("A")="Please Select "_PSALOCN_"'s Drug: ",DIC("S")="I $S($G(^(""I"")):$G(^(""I""))>DT,1:1)" W ! D ^DIC K DIC G:X'="^ALL"&(Y<1)&('PSACNT) END Q:Y<0 S PSA(+Y)="",PSACNT=PSACNT+1
I X="^ALL" F S PSAU=$O(^PSD(58.8,+PSALOC,1,PSAU)) Q:'PSAU S PSA(PSAU)=""
START ;begin
N %DT,PSALN,PSAR,PSAPG,PSARPDT S (PSAPG,PSAOUT)=0,Y=DT,PSAR="" X ^DD("DD") S PSARPDT=Y,PSAU(1)=$O(PSA(0)) D HEADER S PSAU=0
F S PSAU=$O(PSA(PSAU)) Q:'PSAU D Q:$G(PSAOUT)
LOOP .D:$Y+8>IOSL HEADER Q:$G(PSAOUT)
.W !,$P($G(^PSDRUG(+PSAU,0)),U)
.S PSAU(9)=$G(^PSDRUG(+PSAU,660))
.W !!,"DRUG file prices: "
.S X=$P(PSAU(9),U,3),X2="2$",X3=4 D COMMA^%DTC W X,"/"
.S PSAU(8)=$P($G(^DIC(51.5,+$P(PSAU(9),U,2),0)),U)
.W PSAU(8)," (",$P(PSAU(9),U,5)," ",$P(PSAU(9),U,8),"/",PSAU(8)
.S X=$P(PSAU(9),U,6),X2="3$",X3=4 D COMMA^%DTC
.W ") => ",X,"/",$P(PSAU(9),U,8),!!
.G:'$O(^PSDRUG(+PSAU,441,0)) PRI
.F PSAU(1)=0:0 S PSAU(1)=$O(^PSDRUG(+PSAU,441,PSAU(1))) Q:'PSAU(1) D
..S PSAU(2)=$P($G(^PSDRUG(+PSAU,441,+PSAU(1),0)),U) Q:'PSAU(2)
..Q:'$O(^PRCP(445,"AE",+PSAU(2),0))
..F PSAU(3)=0:0 S PSAU(3)=$O(^PRCP(445,"AE",+PSAU(2),PSAU(3))) Q:'PSAU(3) D:$O(^PSD(58.8,"P",PSAU(3),0))
...S PSAU(5)=$G(PSAU(5))+1
...W $$DESCR^PRCPUX1(PSAU(3),PSAU(2))
...W !!,$$INVNAME^PRCPUX1(PSAU(3)),"'s prices: "
...S PSAU(6)=$G(^PRCP(445,+PSAU(3),1,+PSAU(2),0))
...S X=$P(PSAU(6),U,15),X2="2$",X3=4 D COMMA^%DTC W X,"/"
...S PSAU(11)=$$UNITCODE^PRCPUX1($P(PSAU(6),U,5))
...W PSAU(11)," (",$P(PSAU(6),U,29)
...W " ",$P(PSAU(6),U,28),"/",PSAU(11),")"
...S X=($P(PSAU(6),U,15)/($S(($P(PSAU(6),U,29)>0):$P(PSAU(6),U,29),1:1)))
...S X2="3$",X3=4 D COMMA^%DTC W " => ",X,"/",$P(PSAU(6),U,28),!!
PRI .S DIE="^PSDRUG(",DA=PSAU,DR="13DRUG file Price per Order Unit: "
.D ^DIE K DIE W !! I $D(Y) S PSAOUT=1 Q
.I $P($G(^PSDRUG(+PSAU,660)),U,3)'=$P(PSAU(9),U,3) W "New price per ",$P(PSAU(9),U,8)," => ",$P($G(^(660)),U,6),!!
END I 'PSAOUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR K DIR
Q
I PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
W:$Y @IOF S $P(PSALN,"&",81)="",PSAPG=PSAPG+1 W !?2,"DRUG File Price Update",?55,PSARPDT,?70,"PAGE: ",PSAPG,!,PSALN,!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSAVINC 2738 printed Dec 13, 2024@01:51:15 Page 2
PSAVINC ;BIR/LTL-Update Prices ;7/23/97
+1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;; 10/24/97
+2 ;This routine updates prices for a drug.
+3 ;
+4 NEW DA,DIC,DIR,DR,DTOUT,DUOUT,PSA,PSACNT,PSALOC,PSALOCN,PSAOUT,PSAR,PSARPDT,PSAT,PSAU,X,X2,X3,Y
SET PSAOUT=1
SET PSAU=0
LOOK DO ^PSADA
IF '$GET(PSALOC)
SET PSAOUT=1
GOTO END
+1 IF '$ORDER(^PSD(58.8,PSALOC,1,0))
WRITE !!,"There are no drugs in ",PSALOCN
GOTO END
+2 SET PSACNT=0
WRITE !!,"You may select one, several, or ^ALL drugs.",!
CHKD FOR
SET DIC="^PSD(58.8,+PSALOC,1,"
SET DIC(0)="AEMQ"
SET DIC("A")="Please Select "_PSALOCN_"'s Drug: "
SET DIC("S")="I $S($G(^(""I"")):$G(^(""I""))>DT,1:1)"
WRITE !
DO ^DIC
KILL DIC
if X'="^ALL"&(Y<1)&('PSACNT)
GOTO END
if Y<0
QUIT
SET PSA(+Y)=""
SET PSACNT=PSACNT+1
+1 IF X="^ALL"
FOR
SET PSAU=$ORDER(^PSD(58.8,+PSALOC,1,PSAU))
if 'PSAU
QUIT
SET PSA(PSAU)=""
START ;begin
+1 NEW %DT,PSALN,PSAR,PSAPG,PSARPDT
SET (PSAPG,PSAOUT)=0
SET Y=DT
SET PSAR=""
XECUTE ^DD("DD")
SET PSARPDT=Y
SET PSAU(1)=$ORDER(PSA(0))
DO HEADER
SET PSAU=0
+2 FOR
SET PSAU=$ORDER(PSA(PSAU))
if 'PSAU
QUIT
Begin DoDot:1
LOOP if $Y+8>IOSL
DO HEADER
if $GET(PSAOUT)
QUIT
+1 WRITE !,$PIECE($GET(^PSDRUG(+PSAU,0)),U)
+2 SET PSAU(9)=$GET(^PSDRUG(+PSAU,660))
+3 WRITE !!,"DRUG file prices: "
+4 SET X=$PIECE(PSAU(9),U,3)
SET X2="2$"
SET X3=4
DO COMMA^%DTC
WRITE X,"/"
+5 SET PSAU(8)=$PIECE($GET(^DIC(51.5,+$PIECE(PSAU(9),U,2),0)),U)
+6 WRITE PSAU(8)," (",$PIECE(PSAU(9),U,5)," ",$PIECE(PSAU(9),U,8),"/",PSAU(8)
+7 SET X=$PIECE(PSAU(9),U,6)
SET X2="3$"
SET X3=4
DO COMMA^%DTC
+8 WRITE ") => ",X,"/",$PIECE(PSAU(9),U,8),!!
+9 if '$ORDER(^PSDRUG(+PSAU,441,0))
GOTO PRI
+10 FOR PSAU(1)=0:0
SET PSAU(1)=$ORDER(^PSDRUG(+PSAU,441,PSAU(1)))
if 'PSAU(1)
QUIT
Begin DoDot:2
+11 SET PSAU(2)=$PIECE($GET(^PSDRUG(+PSAU,441,+PSAU(1),0)),U)
if 'PSAU(2)
QUIT
+12 if '$ORDER(^PRCP(445,"AE",+PSAU(2),0))
QUIT
+13 FOR PSAU(3)=0:0
SET PSAU(3)=$ORDER(^PRCP(445,"AE",+PSAU(2),PSAU(3)))
if 'PSAU(3)
QUIT
if $ORDER(^PSD(58.8,"P",PSAU(3),0))
Begin DoDot:3
+14 SET PSAU(5)=$GET(PSAU(5))+1
+15 WRITE $$DESCR^PRCPUX1(PSAU(3),PSAU(2))
+16 WRITE !!,$$INVNAME^PRCPUX1(PSAU(3)),"'s prices: "
+17 SET PSAU(6)=$GET(^PRCP(445,+PSAU(3),1,+PSAU(2),0))
+18 SET X=$PIECE(PSAU(6),U,15)
SET X2="2$"
SET X3=4
DO COMMA^%DTC
WRITE X,"/"
+19 SET PSAU(11)=$$UNITCODE^PRCPUX1($PIECE(PSAU(6),U,5))
+20 WRITE PSAU(11)," (",$PIECE(PSAU(6),U,29)
+21 WRITE " ",$PIECE(PSAU(6),U,28),"/",PSAU(11),")"
+22 SET X=($PIECE(PSAU(6),U,15)/($SELECT(($PIECE(PSAU(6),U,29)>0):$PIECE(PSAU(6),U,29),1:1)))
+23 SET X2="3$"
SET X3=4
DO COMMA^%DTC
WRITE " => ",X,"/",$PIECE(PSAU(6),U,28),!!
End DoDot:3
End DoDot:2
PRI SET DIE="^PSDRUG("
SET DA=PSAU
SET DR="13DRUG file Price per Order Unit: "
+1 DO ^DIE
KILL DIE
WRITE !!
IF $DATA(Y)
SET PSAOUT=1
QUIT
+2 IF $PIECE($GET(^PSDRUG(+PSAU,660)),U,3)'=$PIECE(PSAU(9),U,3)
WRITE "New price per ",$PIECE(PSAU(9),U,8)," => ",$PIECE($GET(^(660)),U,6),!!
End DoDot:1
if $GET(PSAOUT)
QUIT
END IF 'PSAOUT
SET DIR(0)="EA"
SET DIR("A")="END OF REPORT! Press <RET> to return to the menu."
DO ^DIR
KILL DIR
+1 QUIT
+1 IF PSAPG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSAOUT=1
QUIT
+2 if $Y
WRITE @IOF
SET $PIECE(PSALN,"&",81)=""
SET PSAPG=PSAPG+1
WRITE !?2,"DRUG File Price Update",?55,PSARPDT,?70,"PAGE: ",PSAPG,!,PSALN,!
+3 QUIT