source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAVER5.m@ 1093

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1PSAVER5 ;BIR/JMB-Verify Invoices - CONT'D ;10/6/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;;**1**; 10/24/97
3 ;This routine assigns an invoice to a pharmacy location or master vault
4 ;if the location changes during verification.
5 ;
6MASTER ;Assigns invoice to Master Vault
7 S (PSAMVN,PSAMV)=0 F S PSAMV=+$O(^PSD(58.8,"ADISP","M",PSAMV)) Q:'PSAMV D
8 .S PSAMVN=PSAMVN+1,PSAONEMV=PSAMV,PSAMV($P(^PSD(58.8,PSAMV,0),"^"),PSAMV)=""
9 I 'PSAMVN W !!,"No master vaults are set up. You must set up a master vault then",!,"select the Process Uploaded Prime Vendor Invoices Data option." S PSAOUT=1 Q
10 I PSAMVN=1 D Q
11 .W !!,"Controlled substances on the invoice has been",!,"automatically assigned to the Master Vault."
12 .W !,$P(^PSD(58.8,PSAONEMV,0),"^")
13 .W !!,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN)
14 .S DR="13///^S X="_PSAONEMV D PHARM^PSAVER2
15 I PSAMVN>1 D DISPMV W !,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN) D SELMV
16 Q
17 ;
18DISPMV ;Displays active master vaults
19 W @IOF,!?22,"<<< ASSIGN A MASTER VAULT SCREEN >>>",!,PSASLN
20 S PSA=0,PSAMVA="" F S PSAMVA=$O(PSAMV(PSAMVA)) Q:PSAMVA="" D
21 .S PSAMVIEN=0 F S PSAMVIEN=$O(PSAMV(PSAMVA,PSAMVIEN)) Q:'PSAMVIEN D
22 ..S PSA=PSA+1,PSAVAULT(PSA,PSAMVA,PSAMVIEN)=""
23 ..W !,$J(PSA,2)_".",?4,PSAMVA
24 W !
25 Q
26 ;
27SELMV ;Select displayed master vaults
28 W ! S DIR(0)="NO^1:"_PSA,DIR("A")="Select Master Vault",DIR("?")="Select the Master Vault that received the invoice's drugs"
29 S DIR("??")="^D MV^PSAPROC" D ^DIR K DIR Q:Y="" I $G(DIRUT) S PSAOUT=1 Q
30 S PSASEL=Y
31 S PSAMVA=$O(PSAVAULT(PSASEL,"")) Q:PSAMVA="" S PSAMVIEN=+$O(PSAVAULT(PSASEL,PSAMVA,0)) Q:'PSAMVIEN S DR="13///^S X="_PSAMVIEN D PHARM^PSAVER2
32 Q
33 ;
34GETLOC ;Gets pharmacy locations
35 S (PSALOC,PSANUM)=0 F S PSALOC=+$O(^PSD(58.8,"ADISP","P",PSALOC)) Q:'PSALOC D
36 .Q:'$D(^PSD(58.8,PSALOC,0))!($P($G(^PSD(58.8,PSALOC,0)),"^")="")
37 .I +$G(^PSD(58.8,PSALOC,"I")),+^PSD(58.8,PSALOC,"I")'>DT Q
38 .S PSANUM=PSANUM+1,PSAONE=PSALOC,PSAISIT=+$P(^PSD(58.8,PSALOC,0),"^",3),PSAOSIT=+$P(^(0),"^",10)
39 .D SITES^PSAUTL1 S PSALOCA($P(^PSD(58.8,PSALOC,0),"^")_PSACOMB,PSALOC)=PSAISIT_"^"_PSAOSIT
40 G:'PSANUM NONE G:PSANUM=1 ONE G:PSANUM>1 MANY
41 ;
42NONE ;No DA pharmacy locations
43 W !!,"There are no Drug Accountability pharmacy locations.",!!,"Use the Set Up/Edit a Pharmacy Location option on Pharmacy Location menu"
44 W !,"to setup one or more pharmacy locations. Then select the Process Uploaded",!,"Prime Vendor Invoice Data option to process the invoices."
45 Q
46 ;
47ONE ;Only one location
48 S PSACNT=0,PSALOC=PSAONE,PSALOCN=$O(PSALOCA(""))
49 W !!,"The non-controlled substance items on the invoice have",!,"been automatically assigned to the Pharmacy Location."
50 W:$L(PSALOCN)>76 !,$P(PSALOCN,"(IP)",1)_"(IP)",!?17,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<77 PSALOCN
51 W !!,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN)
52 S DR="4///^S X="_PSAONE D PHARM^PSAVER2
53 Q
54 ;
55MANY ;If more than one pharmacy location, display invoices.
56 D DISPLOC W !,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN) D SELLOC
57 Q
58 ;
59DISPLOC ;Displays the active pharmacy locations.
60 W @IOF,!?19,"<<< ASSIGN A PHARMACY LOCATION SCREEN >>>",!,PSASLN
61 S PSACNT=0,PSALOCN="" F S PSALOCN=$O(PSALOCA(PSALOCN)) Q:PSALOCN="" D
62 .S PSALOC=0 F S PSALOC=$O(PSALOCA(PSALOCN,PSALOC)) Q:'PSALOC D
63 ..S PSACNT=PSACNT+1,PSAMENU(PSACNT,PSALOCN,PSALOC)=PSALOC
64 ..W !,$J(PSACNT,2)_"." W:$L(PSALOCN)>72 ?4,$P(PSALOCN,"(IP)",1)_"(IP)",!?21,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<73 ?4,PSALOCN
65 W !
66 Q
67 ;
68SELLOC ;Select the Pharmacy Location to be assigned to the order.
69 W ! K DIR S DIR(0)="NO^1:"_PSACNT,DIR("A")="Pharmacy Location",DIR("?")="Select the pharmacy location that received the invoice's drugs"
70 S DIR("??")="^D LOCHELP^PSAVER5" D ^DIR K DIR Q:Y="" I $G(DIRUT) S PSAOUT=1 Q
71 S PSASEL=Y
72 S PSALOCN=$O(PSAMENU(PSASEL,"")) Q:PSALOCN="" S PSALOC=$O(PSAMENU(PSASEL,PSALOCN,0)) Q:'PSALOC S DR="4///^S X="_PSALOC D PHARM^PSAVER2
73 Q
74 ;
75CS ;Sets invoice's CONTROLLED SUBSTANCES field if a drug changed from CS to
76 ;non-CS or vice-versa.
77 S (PSA10,PSAL,PSAN10)=0 F S PSAL=+$O(^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSAL)) Q:'PSAL D
78 .I +$P($G(^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSAL,0)),"^",10) S PSA10=PSA10+1 Q
79 .S PSAN10=PSA10+1
80 S $P(^PSD(58.811,PSAIEN,1,PSAIEN1,0),"^",8)=$S(PSA10&(PSAN10):"S",PSA10&('PSAN10):"A",1:"N")
81 S PSAIN=^PSD(58.811,PSAIEN,1,PSAIEN1,0)
82 Q
83 ;
84LOCHELP ;Extended help for the select "Pharmacy Location" prompt
85 W !?5,"Enter the number of the pharmacy location for which you want to assign",!?5,"the order. The invoiced drugs in the assigned pharmacy location will be"
86 W !?5,"incremented with the quantity received after the order is verified."
87 Q
Note: See TracBrowser for help on using the repository browser.