source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAUTL1.m@ 1800

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

revised back to 6/30/08 version

File size: 8.1 KB
RevLine 
[623]1PSAUTL1 ;BIR/JMB-Prime Vendor Invoice Data Utility ;9/19/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**3,12,15,21,48,49,54**; 10/24/97
3 ;This routine contains utilities to get the location name, display an
4 ;error-free item, display an item with errors, and display a line ready
5 ;for verification.
6 ;References to global ^PS(59.4, are covered under IA #2505
7 ;References to global ^DIC(51.5, are covered under IA #1931
8 ;References to global ^PS(59, are covered under IA #212
9 ;References to ^PSDRUG( are covered by IA #2095
10 ;
11SITES ;Gets the combined IP/OP's IP & OP site names
12 ;PSA*3*22 (DAVE B) no location defined
13 I $G(PSALOC)'>0 S (PSAISITN,PSAOSITN)="Unknown",PSACOMB=" No location identified" Q
14 ;End PSA*3*22
15 S PSAISIT=+$P($G(^PSD(58.8,PSALOC,0)),"^",3) D OPSITE
16 I $G(PSAOSIT)="" S PSAOSIT=0
17 S PSAISITN=$S($P($G(^PS(59.4,PSAISIT,0)),"^")'="":$P($G(^PS(59.4,PSAISIT,0)),"^"),1:"UNKNOWN")
18 I PSAISIT,PSAOSIT S PSACOMB=": "_PSAISITN_" (IP) "_PSAOSITN_" (OP)" Q
19 I PSAISIT S PSACOMB=": "_PSAISITN_" (IP)" Q
20 I PSAOSIT S PSACOMB=": "_PSAOSITN_" (OP)" Q
21 ;DAVE B (PSA*3*12) no DA sites defined
22 S PSACOMB="No Inpatient or Outpatient Sites defined"
23 Q
24OPSITE ;PSA*3*25 - check for multiple OP sites
25 ;VMP OIFO BAY PINES;ELR;PSA*3*49 ADDED THE FOLLOWING LINE
26 S (PSAOSIT,PSAOSITN)=""
27 K PSAOSITC
28 Q:'$D(PSALOC)
29 I '$D(^PSD(58.8,+PSALOC,7)),$P(^PSD(58.8,+PSALOC,0),"^",10)'="" S PSAOSIT=$P(^PSD(58.8,+PSALOC,0),"^",10),PSAOSITN=$P($G(^PS(59,PSAOSIT,0)),"^"),PSAOSITN=$S($G(PSAOSITN)="":"Unknown",1:PSAOSITN)
30 S XX=0 F S XX=$O(^PSD(58.8,+PSALOC,7,XX)) Q:XX'>0 S PSAOSIT=XX,PSAOSITC=$G(PSAOSITC)+1,SN=$P($G(^PS(59,XX,0)),"^") D
31 .I PSAOSITC=1 S PSAOSITN=SN Q
32 .S PSAOSITN=PSAOSITN_" & "_SN
33 I $G(PSAOSITN)="",$P(^PSD(58.8,+PSALOC,0),"^",10)'="" S PSAOSIT=$P(^PSD(58.8,+PSALOC,0),"^",10),PSAOSITN=$P($G(^PS(59,+PSAOSIT,0)),"^")
34 S PSAOSITN=$S($G(PSAOSITN)="":"unknown",1:PSAOSITN)
35 Q
36 ;
37DISPLAY ;Displays an error-free line item
38 S PSADISP=1
39 S PSAIEN=$P(PSADATA,"^",6),PSASUB=$P($P(PSADATA,"^",7),"~"),PSANDC=$P($P(PSADATA,"^",4),"~"),PSAVSN=$P($P(PSADATA,"^",5),"~")
40 W !,PSALINE_" "_$S($P($G(^PSDRUG(PSAIEN,0)),"^")'="":$P(^PSDRUG(PSAIEN,0),"^"),1:"UNKNOWN")
41 I PSAIEN D
42 .I $P($G(^PSDRUG(PSAIEN,2)),"^",3)["N" W " (Controlled Substance)" I $P($G(^PSD(58.8,+$P(PSAIN,"^",12),1,PSAIEN,0)),"^",14),$P($G(^(0)),"^",14)'>DT W !,$C(7),$C(7),"** INACTIVE IN MASTER VAULT **" Q
43 .I $P($G(^PSD(58.8,+$P(PSAIN,"^",7),1,PSAIEN,0)),"^",14),$P($G(^(0)),"^",14)'>DT W !,$C(7),$C(7),"** INACTIVE IN PHARMACY LOCATION **"
44 .I $D(^PSDRUG(PSAIEN,"I")) W !?5,"** INACTIVE IN DRUG FILE **"
45 W !,"Qty Invoiced: "_+$P(PSADATA,"^")
46 W:$P($P(PSADATA,"^",26),"~")'="" ?38,"UPC: "_$P($P(PSADATA,"^",26),"~")
47 W !,"Order Unit : "
48 S PSAOU=$S(+$P(PSADATA,"^",12):+$P(PSADATA,"^",12),+$P($P(PSADATA,"^",2),"~",2):+$P($P(PSADATA,"^",2),"~",2),PSAIEN&(PSASUB)&(+$P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",5)):+$P(^PSDRUG(PSAIEN,1,PSASUB,0),"^",5),1:0)
49 W $S(PSAOU:$P($G(^DIC(51.5,+PSAOU,0)),"^"),1:"UNKNOWN")
50 W:$E(PSANDC)'="S" ?38,"NDC: " D PSANDC1^PSAHELP W PSANDCX K PSANDCX
51 W !,"Unit Price : $"_$P(PSADATA,"^",3),?38,"VSN: "_$S(PSAVSN'="":PSAVSN,1:"Blank"),!
52 I $P(PSADATA,U,13)=.5 D ;*48 AUTO OU UPDATE FOR MCKESSON
53 . W !,"*****>",!,"Note: The order unit was changed from EACH to ",$P($G(^DIC(51.5,+PSAOU,0)),"^")," by Drug Accountability"
54 . W !," during the upload of the invoiced data. Adjustments may be necessary.",!,"*****<"
55 ;*54 display VSN XTMP Drug Description and DUOU >==>
56 N PSAFLDT S PSAFLDT="February 2006"
57 N XXX S XXX=$G(^XTMP("PSAVSN",PSAVSN)) D
58 . I $G(^XTMP("PSAVSN",0)) S PSAFLDT=$P(^XTMP("PSAVSN",0),"^",4)
59 . W !,"PV-Drug-Descrip: "
60 . I '$L(XXX) W "Not Available. Item is OTC or new after ",PSAFLDT,! Q
61 . W ?20,$P(XXX,"~",2),?55,"PV-DUOU: ",+XXX,!
62 ;*54 display VSN XTMP Drug Description and DUOU <==<
63 W !,"Dispense Units: "_$S(+PSAIEN&($P($G(^PSDRUG(+PSAIEN,660)),"^",8)'=""):$P($G(^PSDRUG(+PSAIEN,660)),"^",8),1:"Blank")
64 W !,"Dispense Units Per Order Unit: "_$S($P(PSADATA,"^",20):+$P(PSADATA,"^",20),+PSASUB&(+$P($G(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7)):+$P($G(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7),1:"Blank")
65 S PSALOC=$S($P(PSADATA,"^",19)="":+$P(PSAIN,"^",7),1:+$P(PSAIN,"^",12))
66 Q:'+$P($G(^PSD(58.8,+PSALOC,0)),"^",14)!('$G(PSAIEN))
67 S PSASTOCK=$S(+$P(PSADATA,"^",27):+$P(PSADATA,"^",27),+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3):+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3),1:"Blank")
68 W !,"Stock Level : "_PSASTOCK
69 S PSAREORD=$S(+$P(PSADATA,"^",21):+$P(PSADATA,"^",21),+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5):+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5),1:"Blank") ;*48
70 W !,"Reorder Level : "_PSAREORD,!
71 Q
72 ;
73EDITDISP ;Displays a line item with errors.
74 W @IOF,!?23,"<<< PROCESS LINE ITEM SCREEN >>>",!,"Order#: "_$P(PSAIN,"^",4)_" Invoice#: "_$P(PSAIN,"^",2)_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN),!,PSASLN
75EDIT1 S PSADATA=$G(^XTMP("PSAPV",PSACTRL,"IT",PSALINE))
76 S PSASUB=+$P(PSADATA,"^",7) ;*54
77 S PSAIEN=+$P(PSADATA,"^",15) I PSAIEN ;*54
78 E S PSAIEN=+$P(PSADATA,"^",6) ;*54
79 S PSALOC=$S($P(PSADATA,"^",19)="":+$P(PSAIN,"^",7),1:+$P(PSAIN,"^",12))
80 W !,PSALINE_" "_$S($D(^XTMP("PSAPV",PSACTRL,"IT",PSALINE,"SUP")):$P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE,"SUP"),"^",3),PSAIEN&($P($G(^PSDRUG(PSAIEN,0)),"^")'=""):$P(^PSDRUG(PSAIEN,0),"^"),1:"UNKNOWN ITEM")
81 I PSAIEN D
82 .I $P($G(^PSDRUG(PSAIEN,2)),"^",3)["N" W " (Controlled Substance)" I $P($G(^PSD(58.8,+$P(PSAIN,"^",12),1,PSAIEN,0)),"^",14),$P($G(^(0)),"^",14)'>DT W !,$C(7),$C(7),"** INACTIVE IN MASTER VAULT **" Q
83 .I $P($G(^PSD(58.8,+$P(PSAIN,"^",7),1,PSAIEN,0)),"^",14),$P($G(^(0)),"^",14)'>DT W !,$C(7),$C(7),"** INACTIVE IN PHARMACY LOCATION **"
84 ;
85 W !,"Qty Invoiced: "
86 I $P(PSADATA,"^",8)'="" W $P(PSADATA,"^",8)_" ("_$S(+PSADATA:+PSADATA,$P(PSADATA,"^")=0:0,1:"Blank")_")"
87 I $P(PSADATA,"^",8)="" W $S(+PSADATA:+PSADATA,$P(PSADATA,"^")=0:0,1:"Blank")
88 W:$P($P(PSADATA,"^",26),"~")'="" ?38,"UPC: "_$P($P(PSADATA,"^",26),"~")
89 ;
90 W !,"Order Unit : "
91 I +$P(PSADATA,"^",12) D
92 .W $P($G(^DIC(51.5,+$P(PSADATA,"^",12),0)),"^")
93 .W " ("_$S($P($P(PSADATA,"^",2),"~")'="":$P($P(PSADATA,"^",2),"~"),$P($G(^DIC(51.5,+$P($P(PSADATA,"^",2),"~",3),0)),"^")'="":$P($G(^DIC(51.5,+$P($P(PSADATA,"^",2),"~",3),0)),"^"),1:"Blank")_")"
94 I '+$P(PSADATA,"^",12) D
95 .W $S(+$P($P(PSADATA,"^",2),"~",2):$P($P(PSADATA,"^",2),"~"),PSAIEN&(PSASUB)&(+$P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",5)):$P($G(^DIC(51.5,+$P(^PSDRUG(PSAIEN,1,PSASUB,0),"^",5),0)),"^"),1:"Blank")
96 ;
97 W:$E(PSANDC)'="S" ?38,"NDC: " D PSANDC1^PSAHELP W PSANDCX K PSANDCX
98 S PSAPRICE=$P(PSADATA,"^",3)
99 I +PSAPRICE,$L($P(PSAPRICE,".",2))<2 S PSAPRICE=$P(PSAPRICE,".")_"."_$P(PSAPRICE,".",2)_$E("00",1,(2-$L($P(PSAPRICE,".",2))))
100 W !,"Unit Price : $"_$S($G(PSAPRICE):PSAPRICE,PSAPRICE=0:0,1:"Blank"),?38,"VSN: "_$S(PSAVSN'="":PSAVSN,1:"Blank"),!
101 I $P(PSADATA,U,13)=.5 D ;*48 AUTO OU UPDATE FOR MCKESSON
102 . N PSAOU S PSAOU=$P(PSADATA,U,12)
103 . W !,"*****>",!,"Note: The order unit was changed from EACH to ",$P($G(^DIC(51.5,+PSAOU,0)),"^")," by Drug Accountability"
104 . W !," during the upload of the invoiced data. Adjustments may be necessary.",!,"*****<"
105 N PSAFLDT S PSAFLDT="February 2006"
106 N XXX S XXX=$G(^XTMP("PSAVSN",PSAVSN)) D
107 .I $G(^XTMP("PSAVSN",0)) S PSAFLDT=$P(^XTMP("PSAVSN",0),"^",4)
108 . W !,"PV-Drug-Descrip: "
109 . I '$L(XXX) W "Not Available. Item is OTC or new after ",PSAFLDT,! Q
110 . W ?20,$P(XXX,"~",2),?55,"PV-DUOU: ",+XXX,!
111 ;*54 display VSN XTMP Drug Description and DUOU <==<
112 S PSAIN=^XTMP("PSAPV",PSACTRL,"IN"),PSALOC=$S($P(PSADATA,"^",19)="CS":+$P(PSAIN,"^",12),1:+$P(PSAIN,"^",7))
113DU W !,"Dispense Units: "_$S(+PSAIEN&($P($G(^PSDRUG(+PSAIEN,660)),"^",8)'=""):$P($G(^PSDRUG(+PSAIEN,660)),"^",8),1:"Blank")
114DUOU W !,"Dispense Units Per Order Unit: "_$S($P(PSADATA,"^",20):+$P(PSADATA,"^",20),+PSASUB&(+$P($G(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7)):+$P($G(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7),1:"Blank"),!
115 ;
116 Q:'+$P($G(^PSD(58.8,+PSALOC,0)),"^",14)
117 ;
118 S PSASTOCK=$S(+$P(PSADATA,"^",27):+$P(PSADATA,"^",27),+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3):+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3),1:"Blank")
119 W "Stock Level : "_PSASTOCK
120 S PSAREORD=$S(+$P(PSADATA,"^",21):+$P(PSADATA,"^",21),+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5):+$P($G(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5),1:"Blank")
121 W !,"Reorder Level : "_PSAREORD,!
122 Q
Note: See TracBrowser for help on using the repository browser.