source: FOIAVistA/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAUTL3.m@ 635

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1PSAUTL3 ;BIR/JMB-Upload and Process Prime Vendor Invoice Data Utility - CONT'D ;7/23/97
2 ;;3.0;DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**49**; 10/24/97
3 ;This utility displays locations & allows user to select one, many, or
4 ;all locations.
5 ;
6 S PSALOC=+$O(^PSD(58.8,"ADISP","P",0))
7 I 'PSALOC W !!?5,"No Drug Accountability location has been created yet." S PSAOUT=1 G EXIT
8 ;
9ORDER ;If more than one pharmacy location, collect them in alpha order.
10 S (PSACNT,PSALOC)=0 W !
11 F S PSALOC=+$O(^PSD(58.8,"ADISP","P",PSALOC)) Q:'PSALOC D
12 .Q:'$D(^PSD(58.8,PSALOC,0))!($P($G(^PSD(58.8,PSALOC,0)),"^")="")
13 .I +$G(^PSD(58.8,PSALOC,"I")),+^PSD(58.8,PSALOC,"I")'>DT Q
14 .I '$D(PSATRAN) Q:'$O(^PSD(58.8,PSALOC,1,0))
15 .;VMP OIFO BAY PINES;ELR;PSA*3*49
16 .S (PSAOSIT,PSAOSITN)=""
17 .D SITES^PSAUTL1
18 .S PSACNT=PSACNT+1,PSAONE=+PSALOC
19 .S PSALOCA($P(^PSD(58.8,PSALOC,0),"^")_PSACOMB,PSALOC)=$P(^(0),"^",3)_"^"_$P(^(0),"^",10)_"^"_$P($G(^PSD(58.8,PSALOC,"I")),"^")
20 I PSACNT=1 G:$G(PSATRAN)="" ONE W !?5,"There is only one active pharmacy location.",!?5,"There must be at least two to transfer drugs." S PSAOUT=1 Q
21 S PSACHK=$O(PSALOCA("")) I PSACHK="" G EXIT
22 G DISP
23 ;
24ONE ;only one
25 S PSALOC=PSAONE
26 I '$D(^PSD(58.8,PSALOC,0))!($P($G(^PSD(58.8,PSALOC,0)),"^")="") W !,"There are no Drug Accountability pharmacy locations with data." Q
27 S PSALOCN="",PSALOCN=$O(PSALOCA(PSALOCN)) Q:PSALOCN="" S PSALOC=0,PSALOC=+$O(PSALOCA(PSALOCN,PSALOC)) Q:'PSALOC S PSALOC(PSALOCN,PSALOC)=PSALOCA(PSALOCN,PSALOC)
28 G EXIT
29 ;
30DISP ;Displays the available pharmacy locations.
31 W @IOF,!
32 W:$G(PSATRAN)="F" "Choose the pharmacy location transferring the drugs:"
33 W:$G(PSATRAN)="T" "Choose the pharmacy location receiving the transferred drugs:"
34 W:$G(PSATRAN)="" "Choose one or many pharmacy locations:"
35 W ! S PSACNT=0,PSALOCN=""
36 F S PSALOCN=$O(PSALOCA(PSALOCN)) Q:PSALOCN="" D
37 .S PSALOC=0 F S PSALOC=+$O(PSALOCA(PSALOCN,PSALOC)) Q:'PSALOC D
38 ..S PSACNT=PSACNT+1,PSAMENU(PSACNT,PSALOCN,PSALOC)=""
39 ..W !,$J(PSACNT,2)
40 ..W:$L(PSALOCN)>76 ?4,$P(PSALOCN,"(IP)",1)_"(IP)",!?21,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<77 ?4,PSALOCN
41 W !
42 ;
43SELECT I $G(PSATRAN)="" S DIR(0)="L^1:"_PSACNT,DIR("A")="Select PHARMACY LOCATION",DIR("??")="^D HELP^PSAUTL3"
44 I $G(PSATRAN)="F"!($G(PSATRAN)="T") S DIR(0)="N^1:"_PSACNT D
45 .I $G(PSATRAN)="F" S DIR("A")="Select Transfer from Pharmacy",DIR("??")="^D FROMHELP^PSAUTL3"
46 .I $G(PSATRAN)="T" S DIR(0)="N^1:"_PSACNT,DIR("A")="Select Transfer to Pharmacy",DIR("??")="^D TOHELP^PSAUTL3"
47 S DIR("?")="Enter the number(s) of the pharmacy location"
48 D ^DIR K DIR I 'Y S PSAOUT=1 G EXIT
49 S PSASEL=Y F PSAPC=1:1 S PSANUM=+$P(PSASEL,",",PSAPC) Q:'PSANUM D
50 .S PSALOCN=$O(PSAMENU(PSANUM,"")),PSALOC=+$O(PSAMENU(PSANUM,PSALOCN,0))
51 .S PSALOC(PSALOCN,PSALOC)=PSALOCA(PSALOCN,PSALOC)
52 ;
53EXIT ;Kills all variables except PSALOC array & PSAOUT
54 K DIR,PSACOMB,PSAISIT,PSAISITN,PSAMENU,PSAONE,PSANUM,PSAOSIT,PSAOSITN,PSAPC,Y
55 Q
56 ;
57FROMHELP ;Extended help to 'Select Transfer from Pharmacy'
58 W !?5,"Enter the number of the pharmacy location that will transfer the drugs to another pharmacy."
59 Q
60HELP ;Extended help to 'Select PHARMACY LOCATION'
61 W !?5,"Enter the number of the pharmacy location you want to select.",!?5,"If you want more than one pharmacy location, enter the numbers",!?5,"separated by a comma."
62 W !!?5,"For example: Enter 1,3 or 1-3,5."
63 Q
64TOHELP ;Extended help to 'Select Transfer to Pharmacy'
65 W !?5,"Enter the number of the pharmacy location that will receive the transferred the drugs."
66 Q
67 ;
68SETAORD ;Set logic for "AORD" X-Ref
69 S PSADA(1)=$O(^PSD(58.811,"B",X,0))
70 S PSADA=0 F S PSADA=$O(^PSD(58.811,PSADA(1),1,PSADA)) Q:'PSADA D
71 .S ^PSD(58.811,"AORD",X,$P($G(^PSD(58.811,PSADA(1),1,PSADA,0)),"^"),PSADA(1),PSADA)=""
72 K PSADA
73 Q
74KILLAORD ;Kill logic for "AORD" X-Ref
75 K ^PSD(58.811,"AORD",X)
76 Q
77 ;
78SLOC ;Set logic for "ALOC" X-Ref on Pharmacy Location & Master Vault fields
79 Q:'+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",2)
80 S ^PSD(58.811,"ALOC",X,+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",2),DA(1),DA)=""
81 Q
82KLOC ;Kill logic for "ALOC" X-Ref on Pharmacy Location & Master Vault fields
83 K ^PSD(58.811,"ALOC",X,+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",2),DA(1),DA)
84 Q
85 ;
86SLOCDT ;Set logic for "ALOC" X-Ref on Invoice Date field
87 S:+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",5) ^PSD(58.811,"ALOC",+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",5),X,DA(1),DA)=""
88 S:+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",12) ^PSD(58.811,"ALOC",+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",12),X,DA(1),DA)=""
89 Q
90KLOCDT ;Kill logic for "ALOC" X-Ref
91 K ^PSD(58.811,"ALOC",+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",5),X,DA(1),DA)
92 K ^PSD(58.811,"ALOC",+$P($G(^PSD(58.811,DA(1),1,DA,0)),"^",12),X,DA(1),DA)
93 Q
Note: See TracBrowser for help on using the repository browser.