source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDREC2.m@ 724

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1PSDREC2 ;BIR/LTL-CS Receiving (cont'd) ; 8 Aug 94
2 ;;3.0; CONTROLLED SUBSTANCES ;**30,66**;13 Feb 97;Build 3
3 ;Reference to ^DIC(51.5 supported by IA # 1931
4 ;Reference to ^PRCS(410 supported by IA #214
5 ;Reference to ^PSD(58.8 are covered by DBIA #2711
6 ;Reference to ^PSD(58.81 are covered by DBIA #2808
7 ;References to ^PSDRUG( are covered by IA #221
8CON S DIC="^PRCS(410,",DIC(0)="AEMQZ",DIC("A")="Select Pharmacy Transaction number: ",DIC("B")=$S($D(PSDCON):$P($G(^PRCS(410,+PSDCON,0)),U),1:""),DIC("S")="I $P($G(^(0)),U,2)=""O"",$P($G(^(3)),U,3)[822400"
9 D ^DIC K DIC G:$D(DTOUT)!($D(DUOUT)) QUIT S PSDCON=$S(Y>0:+Y,1:"")
10 I $G(PSDPO)+$G(PSDCON)<1 W !!,"Sorry, we really can't allow receiving without a P.O. or CP transaction.",!! G QUIT
11 I '$O(^PRCS(410,+PSDCON,"IT",1)),'$P($G(^PRCS(410,+PSDCON,"IT",1,0)),U,5) G INV
12 G:$D(PSDPO(1))&($O(^PRCS(410,+PSDCON,"IT",0))) ^PSDREC4
13INV I $G(PSAPV) S DIR(0)="58.81,71O",DIR("A")="Please enter the Prime Vendor Invoice number" D ^DIR K DIR G:Y'=""&($D(DIRUT)) QUIT S PSAPV=Y
14 I $G(PSAPV)=" " S PSAPV=1 W $C(7),!!,"Sorry, the space bar won't work here.",! G INV
15 I $G(PSAPV)]"",$O(^PSD(58.81,"PV",Y,"")) S PSD(2)=PSAPV W !!,"Previous receipts have been processed for this invoice.",!! S DIR(0)="Y",DIR("A")="Would you like to review",DIR("B")="Yes" D ^DIR K DIR G:$D(DIRUT) QUIT G:Y=1 DEV^PSDREPV
16 N X,X1 D SIG^XUSESIG I X1="" S PSDOUT=1 G QUIT
17DRUG F S DIC="^PSD(58.8,PSDLOC,1,",DIC(0)="AEMQ",DIC("A")="Select "_PSDLOCN_" drug: ",DIC("S")="I $S($P($G(^(0)),U,14):$P($G(^(0)),U,14)>DT,1:1)",DA(1)=PSDLOC D Q:$G(PSDOUT)
18 .W ! D ^DIC I Y<0 S PSDOUT=1 Q
19 .K DIC S PSDRUG=+Y,PSDRUGN=$P($G(^PSDRUG(+Y,0)),U),PSDB=$P($G(^PSD(58.8,+PSDLOC,1,+PSDRUG,0)),U,4)
20PRIC .W ! S DIE="^PSDRUG(",DA=PSDRUG,DR="15Dispense units per order unit: ;13Price per order unit: " D ^DIE K DIE I $D(Y) S PSDOUT=1 Q
21QTY .W ! S DIR(0)="NA^0:999999:0",DIR("A")="Number of "_$P($G(^DIC(51.5,+$P($G(^PSDRUG(+PSDRUG,660)),U,2),0)),U)_"(S) to receive: " D ^DIR K DIR S (PSDREC,PSDREC(1))=Y I $D(DIRUT) S PSDOUT=1 Q
22DISP .W ?50,"Converted quantity: ",PSDREC*$P($G(^PSDRUG(+PSDRUG,660)),U,5) S PSDREC=$P($G(^(660)),U,5)*PSDREC
23 .;PSD*3*29 (Dave B) Check to see if drug actually stocked
24 .I '$D(^PSD(58.8,+PSDLOC,1,+PSDRUG,0)) W !,"Sorry, but this drug is not stocked in this pharmacy location.",! Q
25PQ .S DIR(0)="Y",DIR("A")="OK to post",DIR("B")="Yes",DIR("?")="If yes, the balance will be updated and a transaction stored." D ^DIR K DIR D:Y=1 I $D(DIRUT) S PSDOUT=1 Q
26 ..W !!,"There were ",$S($P($G(^PSD(58.8,+PSDLOC,1,+PSDRUG,0)),U,4):$P($G(^(0)),U,4),1:0)," on hand.",?40,"There are now ",$P($G(^(0)),U,4)+PSDREC," on hand.",!
27 ..F L +^PSD(58.8,+PSDLOC,1,+PSDRUG,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
28 ..D NOW^%DTC S PSDAT=+%
29 ..S PSDB=$P($G(^PSD(58.8,+PSDLOC,1,+PSDRUG,0)),U,4)
30 ..S $P(^PSD(58.8,+PSDLOC,1,+PSDRUG,0),U,4)=PSDREC+PSDB
31 ..L -^PSD(58.8,+PSDLOC,1,+PSDRUG,0)
32 ..S:'$D(^PSD(58.8,+PSDLOC,1,+PSDRUG,5,0)) ^(0)="^58.801A^^"
33 ..I '$D(^PSD(58.8,+PSDLOC,1,+PSDRUG,5,$E(DT,1,5)*100,0)) S DIC="^PSD(58.8,+PSDLOC,1,+PSDRUG,5,",DIC(0)="L",DLAYGO=58.8,X=$E(DT,1,5)*100,DINUM=X,DA(2)=PSDLOC,DA(1)=PSDRUG D ^DIC K DIC,DLAYGO
34 ..S DIE="^PSD(58.8,+PSDLOC,1,+PSDRUG,5,",DA(2)=PSDLOC,DA(1)=PSDRUG,DA=$E(DT,1,5)*100,DR="5////^S X=$P($G(^(0)),U,3)+PSDREC" D ^DIE
35 ..W !,"Updating monthly receipts and transaction history.",!
36TR ..F L +^PSD(58.81,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
37FIND ..S PSDT=$P(^PSD(58.81,0),U,3)+1 I $D(^PSD(58.81,PSDT)) S $P(^PSD(58.81,0),U,3)=$P(^PSD(58.81,0),U,3)+1 G FIND
38 ..S DIC="^PSD(58.81,",DIC(0)="L",DLAYGO=58.81,(DINUM,X)=PSDT D ^DIC K DIC,DLAYGO L -^PSD(58.81,0)
39 ..S DIE="^PSD(58.81,",DA=PSDT,DR="1////1;2////^S X=PSDLOC;3////^S X=PSDAT;4////^S X=PSDRUG;5////^S X=PSDREC;6////^S X=DUZ;7////^S X=PSDCON;8////^S X=PSDPO;9////^S X=PSDB;100////1;71////^S X=$G(PSAPV)" D ^DIE
40 ..S:'$D(^PSD(58.8,+PSDLOC,1,+PSDRUG,4,0)) ^(0)="^58.800119PA^^"
41 ..S DIC="^PSD(58.8,+PSDLOC,1,+PSDRUG,4,",DIC(0)="L",DLAYGO=58.8
42 ..S (X,DINUM)=PSDT
43 ..S DA(2)=PSDLOC,DA(1)=PSDRUG D ^DIC K DIC,DA,DLAYGO,PSDRUG
44QUIT Q
Note: See TracBrowser for help on using the repository browser.