source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSADRUG.m@ 1789

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

initial load of WorldVistAEHR

File size: 4.1 KB
RevLine 
[613]1PSADRUG ;BIR/LTL-Add/edit Pharmacy Location drugs ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**64**; 10/24/97;Build 4
3 ;
4 ;References to ^PSDRUG( are covered by IA #2095
5 ;
6 N DIC,DA,DIE,DLAYGO,DINUM,DR,DIR,DIRUT,PSA,PSAINV,PSAIT,X,Y
7 D ^PSADA G:'$G(PSALOC) QUIT
8NOINV S:'$D(^PSD(58.8,PSALOC,1,0)) ^(0)="^58.8001IP^^"
9 S DA(1)=PSALOC,DIC="^PSD(58.8,PSALOC,1,",DIC(0)="AEMQL",DIC("W")="I $S($P($G(^(0)),U,14):$P($G(^(0)),U,14)'>DT,1:0) W $C(7),"" *** INACTIVE ***""",DLAYGO=58.8 W ! D ^DIC K DIC,DLAYGO G:Y<1 QUIT S PSAIT=+Y
10 S PSAIT(2)=$P($G(^PSDRUG(+PSAIT,0)),U)
11NOT I '$O(^PSDRUG(PSAIT,441,0)) W !?10,"**This drug is not linked to the ITEM MASTER file**",!?12,"To automate receiving, a link is needed.",! D
12 .S DIR(0)="Y",DIR("A")="Attempt link now",DIR("B")="Yes" D ^DIR K DIR Q:$D(DIRUT)!(Y<1) D START^PSATI
13 I $O(^PSD(58.8,+PSALOC,4,0)),$O(^PSDRUG(+PSAIT,441,0)) S PSA(1)=0 D
14 .N PSAINV
15 .F S PSA(1)=$O(^PSDRUG(+PSAIT,441,PSA(1))) Q:'PSA(1) D
16 ..S PSAINV=0,PSA(1)=$G(^PSDRUG(+PSAIT,441,+PSA(1),0))
17 ..F S PSAINV=$O(^PRCP(445,"AE",+PSA(1),PSAINV)) Q:'PSAINV!($O(^PSD(58.8,"P",+PSAINV,+PSALOC,0)))
18 ..I 'PSAINV W !!,"**",PSAIT(2),", from the DRUG file is linked to",!!,$$DESCR^PRCPUX1($G(PSAINV),PSA(1))," from the ITEM MASTER file",!!," but has NOT been added to a linked Inventory Point.**" Q
19 ..S PSAIT(1)=$G(PSAIT(1))+1
20 ..W:PSAIT(1)=1 !!,PSAIT(2),", from the DRUG file is linked to",!!
21 ..W $$DESCR^PRCPUX1(PSAINV,PSA(1))," from the ITEM MASTER file.",!!
22 ..W $$INVNAME^PRCPUX1(PSAINV)," shows a current balance of",!!
23 ..S PSAIT(3)=$G(^PRCP(445,+PSAINV,1,+PSA(1),0))
24 ..W $S($P(PSAIT(3),U,7):$P(PSAIT(3),U,7),1:0)," ",$$UNITCODE^PRCPUX1($P(PSAIT(3),U,5))
25 ..W " times dispensing unit conv factor = "
26 ..W $P(PSAIT(3),U,7)*$S($P(PSAIT(3),U,29):$P(PSAIT(3),U,29),1:1)
27 ..W " ",$P(PSAIT(3),U,28),!
28 S PSAIT(4)=$G(^PSDRUG(+PSAIT,660))
29 K PSA G:$P($G(^PSD(58.8,+PSALOC,1,+PSAIT,0)),U,4)]"" DISP
30DRUG S DIE="^PSD(58.8,PSALOC,1,",DA=PSAIT,DR="3Please enter total "_$P(PSAIT(4),U,8)_" currently on hand: ;S PSA(2)=X",DA(1)=PSALOC
31 D:$P(PSAIT(4),U,2)]""
32 .W !!?30,"DRUG FILE info:",!
33 .W ?20,"Order unit: "_$P(^DIC(51.5,+$P(PSAIT(4),U,2),0),U,2),!?20,"Dispense units per order unit: "_$P(PSAIT(4),U,5),!?20,"Dispense unit: "_$P(PSAIT(4),U,8)
34 .W !!,"Current Inventory from the DRUG file = "_$P($G(^PSDRUG(PSAIT,660.1)),U),!
35 W:'$P(^PSD(58.8,PSALOC,1,PSAIT,0),U,4) !,"Once an initial quantity is entered it can only be updated by receiving,",!,"dispensing or adjusting.",!!,"Updating will occur to the balance in ",$G(PSALOCN),".",!!,"The Current Inventory "
36 W "from the DRUG file is only offered as an initial balance",!,"and is NOT updated."
37 F L +^PSD(58.8,+PSALOC,1,+PSAIT,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
38 D ^DIE L -^PSD(58.8,+PSALOC,1,+PSAIT,0) G:$D(Y) QUIT
39DISP W !!,"Current balance: "_$P(^PSD(58.8,PSALOC,1,PSAIT,0),U,4)," ",$P(PSAIT(4),U,8),!
40 G:$G(PSA(2))']"" AGAIN
41 N PSAT,PSADT
42 D NOW^%DTC S PSADT=+$E(%,1,12) K %
43MON S:'$D(^PSD(58.8,+PSALOC,1,+PSAIT,5,0)) ^(0)="^58.801A^^"
44 I '$D(^PSD(58.8,+PSALOC,1,+PSAIT,5,$E(DT,1,5)*100,0)) S DIC="^PSD(58.8,+PSALOC,1,+PSAIT,5,",DIC(0)="LM",(X,DINUM)=$E(DT,1,5)*100,DA(2)=PSALOC,DA(1)=PSAIT,DLAYGO=58.8 D ^DIC K DIC,DLAYGO
45 S DIE="^PSD(58.8,+PSALOC,1,+PSAIT,5,",DA(2)=PSALOC,DA(1)=PSAIT,DA=$E(DT,1,5)*100,DR="1////^S X=PSA(2);7////^S X=PSA(2)" D ^DIE K DIE
46 W !,"Updating beginning balance and transaction history.",!
47 F L +^PSD(58.81,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
48FIND S PSAT=$P(^PSD(58.81,0),U,3)+1 I $D(^PSD(58.81,PSAT)) S $P(^PSD(58.81,0),U,3)=$P(^PSD(58.81,0),U,3)+1 G FIND
49 S DIC="^PSD(58.81,",DIC(0)="L",DLAYGO=58.81,(DINUM,X)=PSAT D ^DIC
50 L -^PSD(58.81,0) K DIC,DLAYGO
51 S DIE="^PSD(58.81,",DA=PSAT,DR="1////11;2////^S X=PSALOC;3////^S X=PSADT;4////^S X=PSAIT;5////^S X=PSA(2);6////^S X=DUZ;9////0" D ^DIE K DIE
52 S:'$D(^PSD(58.8,+PSALOC,1,+PSAIT,4,0)) ^(0)="^58.800119PA^^"
53 S DIC="^PSD(58.8,+PSALOC,1,+PSAIT,4,",DIC(0)="L",(X,DINUM)=PSAT
54 S DA(2)=PSALOC,DA(1)=PSAIT,DLAYGO=58.8 D ^DIC K DA,DIC,DLAYGO
55AGAIN D:$O(^PS(52.6,"AC",+PSAIT,0))!($O(^PS(52.7,"AC",+PSAIT,0))) ^PSAPSI4 S DIR(0)="Y",DIR("A")="Another Drug",DIR("B")="No" W ! D ^DIR K DIR G:Y=1 NOINV
56QUIT Q
Note: See TracBrowser for help on using the repository browser.