source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAREC.m@ 1154

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

initial load of WorldVistAEHR

File size: 5.7 KB
Line 
1PSAREC ;BIR/LTL,JMB-Receiving Directly into Drug Accountability ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**10**; 10/24/97
3 ;This routine receives non-prime vendor's drugs into pharmacy locations.
4 ;The balances are incremented in the pharmacy location & the DRUG file.
5 ;
6SETUP S (PSACNT,PSAOUT)=0 D ^PSAUTL3 G:PSAOUT EXIT
7 S PSACHK=$O(PSALOC(""))
8 I PSACHK="",'PSALOC W !,"There are no active pharmacy locations." G EXIT
9 S PSAPO=$P($G(^PSD(58.8,+PSALOC,0)),"^",9)
10 I +$E($P($G(^PRC(442,+PSAPO,12)),"^",5),4,5)'=+$E(DT,4,5) W !!,"The current PO# for this location doesn't seem current.",! D G:$D(DIRUT) EXIT
11 .S DIR(0)="Y",DIR("A")="Would you like to correct it",DIR("B")="No",DIR("?")="You can store a obligation number and it will be presented as the default.",DIR("??")="^D CORRECT^PSAREC"
12 .D ^DIR K DIR Q:$D(DIRUT)!(Y<1)
13 .S DIE="^PSD(58.8,",DA=PSALOC,DR="13" D ^DIE K DIE
14 .S DIC("B")=$P($G(^PRC(442,+$P($G(^PSD(58.8,+PSALOC,0)),"^",9),0)),"^")
15PO S PSAOUT=0 W ! S DIC="^PRC(442,",DIC(0)="AEMQZ"
16 S DIC("A")="Select Obligation Number: ",DIC("S")="I $P($G(^(0)),""^"",5)[822400" D ^DIC K DIC G:Y<1 EXIT S PSAPO=+Y,PSACON=$P($G(Y(0)),"^",12)
17 S DIE="^PSD(58.8,",DA=PSALOC,DR="13///^S X="+PSAPO D ^DIE K DIE
18PART D START G PO
19 ;
20EXIT K %,DA,DIE,DINUM,DIRUT,DR,DTOUT,DUOUT,PSA,PSA50SYN,PSACBAL,PSACHK,PSACNT,PSACOMB,PSACON,PSACOST,PSADASH,PSADRG,PSADRGN,PSADT,PSADUOU
21 K PSAIEN,PSAIEN1,PSAISIT,PSAISITN,PSALEN,PSALINE,PSALOC,PSALOCN,PSANDC,PSANODE,PSANPDU,PSANPOU,PSAODASH,PSAONDC,PSAOSIT,PSAOSITN,PSAOU,PSAOUT
22 K PSAPDU,PSAPO,PSAPOU,PSA(2),PSAREC,PSASEL,PSAT,PSATDRG,PSAVEND,X,Y
23 Q
24 ;
25START S DIC="^PRCS(410,",DIC(0)="AEMQZ",DIC("A")="Select Pharmacy Transaction number: ",DIC("B")=$S($D(PSACON):$P($G(^PRCS(410,+PSACON,0)),"^"),1:""),DIC("S")="I $P($G(^(0)),""^"",2)=""O"",$P($G(^(3)),""^"",3)[822400"
26 D ^DIC K DIC Q:Y<1 S PSACON=$S(Y>0:+Y,1:"")
27 S DIR(0)="58.81,71O",DIR("A")="Invoice number",DIR("?")="The invoice will be stored, allowing look-ups for receipts against this invoice.",DIR("??")="^D INV^PSAREC"
28 D ^DIR K DIR Q:Y'=""&($D(DIRUT)) S PSA(2)=Y
29 I $G(PSA(2))'="",$O(^PSD(58.81,"PV",Y,"")) D Q:$D(DIRUT) G:Y=1 DEV^PSAREPV
30 .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
31 ;
32DRUG W !!,$G(PSALOCN),!
33 F S DIC="^PSDRUG(",DIC(0)="AEMQ",DA(1)=PSALOC D Q:PSAOUT
34 .D ^DIC K DIC I Y<0 S PSAOUT=1 Q
35 .D GETDATA Q:$G(PSAOUT)
36 Q
37 ;
38GETDATA ;Gets receipts data
39 S PSADRG=+Y,PSADRGN=$P($G(^PSDRUG(+Y,0)),"^"),PSACBAL=$P($G(^PSD(58.8,PSALOC,1,PSADRG,0)),"^",4)
40NDC S DIR(0)="FO^1:15",DIR("A")="NDC",DIR("?")="Enter the National Drug Code for the drug received.",DIR("??")="^D NDCHELP^PSAREC"
41 D ^DIR K DIR
42 I $G(DIRUT) S (PSADASH,PSADUOU,PSANDC,PSAOU,PSAPOU)="",PSA50SYN=0 G OU
43 S:Y'="" PSADASH=Y
44 I PSADASH["-" S PSANDC=$E("000000",1,(6-$L($P(PSADASH,"-"))))_$P(PSADASH,"-")_$E("0000",1,(4-$L($P(PSADASH,"-",2))))_$P(PSADASH,"-",2)_$E("00",1,(2-$L($P(PSADASH,"-",3))))_$P(PSADASH,"-",3)
45 E S PSANDC=""
46 S:PSANDC'?12N PSANDC="" S (PSAOU,PSADUOU,PSAPOU)=""
47 I PSANDC'="",$O(^PSDRUG("C",PSANDC,PSADRG,0)) D
48 .S PSA50SYN=+$O(^PSDRUG("C",PSANDC,PSADRG,0))
49 .Q:'$D(^PSDRUG(PSADRG,1,PSA50SYN,0))
50 .S PSAOU=$P($G(^PSDRUG(PSADRG,1,PSA50SYN,0)),"^",5),PSADUOU=$P($G(^(0)),"^",7),PSAPOU=$P($G(^(0)),"^",6)
51 E S PSA50SYN=0
52OU S DIC(0)="QAEMZ",DIC="^DIC(51.5,",DIC("A")="Order Unit: ",DR=.01 S:PSAOU DIC("B")=PSAOU D ^DIC K DIC
53 I Y<0 S PSAOUT=1 Q
54 S PSAOU=+Y
55 W !,"Dispense Units: "_$S($P($G(^PSDRUG(PSADRG,660)),"^",8)'="":$P(^PSDRUG(PSADRG,660),"^",8),1:"Unknown")
56 ;
57 ;DAVE B (PSA*3*10) decimal digits on Disp Units per OU
58DUOU S DIR(0)="NO^::2",DIR("A")="Dispense Units per Order Unit" S:PSADUOU DIR("B")=PSADUOU
59 S DIR("?")="Enter the number of dispense units contained in one order unit.",DIR("??")="^D DUOUHELP^PSAPROC3" D ^DIR K DIR
60 I $G(DIRUT) S PSAOUT=1 Q
61 S PSADUOU=+Y
62PRICE S DIR(0)="NO^0:9999:4",DIR("A")="Price per Order Unit",DIR("?")="Enter the price for each order unit.",DIR("??")="^D PRICEHLP^PSAREC" S:PSAPOU DIR("B")=PSAPOU D ^DIR K DIR
63 I $G(DIRUT) S PSAOUT=1 Q
64 S PSAPOU=+Y S:+PSAPOU&(PSADUOU) PSAPDU=PSAPOU/PSADUOU
65QTY S DIR(0)="N^0:9999999:0",DIR("A")="Quantity received",DIR("?")="Enter the number of order units you received.",DIR("??")="^D QTYHELP^PSAREC" D ^DIR K DIR
66 I $D(DIRUT) S PSAOUT=1 Q
67 S (PSAREC,PSAREC(1))=Y,PSAVEND=$P($G(^PRC(440,+$P($G(^PRC(442,PSAPO,1)),"^"),0)),"^"),PSACOST=PSAREC*PSAPOU,PSAREC=PSADUOU*PSAREC
68DISP W ?50,"Converted quantity: ",PSAREC
69 ;
70 W ! S DIR(0)="Y",DIR("A")="Okay to post",DIR("B")="Yes",DIR("?",1)="Enter YES to add the received drug to the pharmacy location.",DIR("?")="Enter NO to cancel the receipt of the drug.",DIR("??")="^D POSTHELP^PSAREC"
71 D ^DIR K DIR I $D(DIRUT) S PSAOUT=1 Q
72 D:+Y POST^PSAREC1
73 Q
74 ;
75CORRECT ;Extended help for 'Would you like to correct it'
76 W !?5,"Enter YES to enter the current obligation number. It will be presented",!?5,"as the default the next time the obligation number prompt is displayed."
77 W !!?5,"Enter NO to keep the current obligation number as the default."
78 Q
79 ;
80INV ;Extended help for 'Invoice number'
81 W !?5,"Enter the invoice number for the receipts."
82 Q
83NDCHELP ;Extended help for 'NDC'
84 W !?5,"Enter the National Drug Code (NDC) for the received drug.",!?5,"Enter the NDC with dashes or 12-digits without dashes."
85 Q
86POSTHELP ;Extended help for 'Okay to post?'
87 W !?5,"Enter YES to update the balances in the pharmacy location and DRUG file",!?5,"and add a transaction."
88 W !?5,"Enter NO to abort receiving the drug."
89 Q
90PRICEHLP ;Extended help for 'Price per order unit'
91 W !?5,"Enter the cost for each order unit."
92 Q
93QTYHELP ;
94 W !?5,"The quantity entered will be multiplied by the dispense units",!?5,"per order unit to determine the number of dispense units received."
95 Q
Note: See TracBrowser for help on using the repository browser.