source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAVINC.m@ 1042

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

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1PSAVINC ;BIR/LTL-Update Prices ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;; 10/24/97
3 ;This routine updates prices for a drug.
4 ;
5 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
6LOOK D ^PSADA I '$G(PSALOC) S PSAOUT=1 G END
7 I '$O(^PSD(58.8,PSALOC,1,0)) W !!,"There are no drugs in ",PSALOCN G END
8 S PSACNT=0 W !!,"You may select one, several, or ^ALL drugs.",!
9CHKD 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
10 I X="^ALL" F S PSAU=$O(^PSD(58.8,+PSALOC,1,PSAU)) Q:'PSAU S PSA(PSAU)=""
11START ;begin
12 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
13 F S PSAU=$O(PSA(PSAU)) Q:'PSAU D Q:$G(PSAOUT)
14LOOP .D:$Y+8>IOSL HEADER Q:$G(PSAOUT)
15 .W !,$P($G(^PSDRUG(+PSAU,0)),U)
16 .S PSAU(9)=$G(^PSDRUG(+PSAU,660))
17 .W !!,"DRUG file prices: "
18 .S X=$P(PSAU(9),U,3),X2="2$",X3=4 D COMMA^%DTC W X,"/"
19 .S PSAU(8)=$P($G(^DIC(51.5,+$P(PSAU(9),U,2),0)),U)
20 .W PSAU(8)," (",$P(PSAU(9),U,5)," ",$P(PSAU(9),U,8),"/",PSAU(8)
21 .S X=$P(PSAU(9),U,6),X2="3$",X3=4 D COMMA^%DTC
22 .W ") => ",X,"/",$P(PSAU(9),U,8),!!
23 .G:'$O(^PSDRUG(+PSAU,441,0)) PRI
24 .F PSAU(1)=0:0 S PSAU(1)=$O(^PSDRUG(+PSAU,441,PSAU(1))) Q:'PSAU(1) D
25 ..S PSAU(2)=$P($G(^PSDRUG(+PSAU,441,+PSAU(1),0)),U) Q:'PSAU(2)
26 ..Q:'$O(^PRCP(445,"AE",+PSAU(2),0))
27 ..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))
28 ...S PSAU(5)=$G(PSAU(5))+1
29 ...W $$DESCR^PRCPUX1(PSAU(3),PSAU(2))
30 ...W !!,$$INVNAME^PRCPUX1(PSAU(3)),"'s prices: "
31 ...S PSAU(6)=$G(^PRCP(445,+PSAU(3),1,+PSAU(2),0))
32 ...S X=$P(PSAU(6),U,15),X2="2$",X3=4 D COMMA^%DTC W X,"/"
33 ...S PSAU(11)=$$UNITCODE^PRCPUX1($P(PSAU(6),U,5))
34 ...W PSAU(11)," (",$P(PSAU(6),U,29)
35 ...W " ",$P(PSAU(6),U,28),"/",PSAU(11),")"
36 ...S X=($P(PSAU(6),U,15)/($S(($P(PSAU(6),U,29)>0):$P(PSAU(6),U,29),1:1)))
37 ...S X2="3$",X3=4 D COMMA^%DTC W " => ",X,"/",$P(PSAU(6),U,28),!!
38PRI .S DIE="^PSDRUG(",DA=PSAU,DR="13DRUG file Price per Order Unit: "
39 .D ^DIE K DIE W !! I $D(Y) S PSAOUT=1 Q
40 .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),!!
41END I 'PSAOUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR K DIR
42 Q
43HEADER ;prints header info
44 I PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
45 W:$Y @IOF S $P(PSALN,"&",81)="",PSAPG=PSAPG+1 W !?2,"DRUG File Price Update",?55,PSARPDT,?70,"PAGE: ",PSAPG,!,PSALN,!
46 Q
Note: See TracBrowser for help on using the repository browser.