PSAUTL1 ;BIR/JMB-Prime Vendor Invoice Data Utility ;9/19/97
;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**3,12,15,21,48,49,54,67**; 10/24/97;Build 15
;This routine contains utilities to get the location name, display an
;error-free item, display an item with errors, and display a line ready
;for verification.
;References to global ^PS(59.4, are covered under IA #2505
;References to global ^DIC(51.5, are covered under IA #1931
;References to global ^PS(59, are covered under IA #212
;References to ^PSDRUG( are covered by IA #2095
;
SITES ;Gets the combined IP/OP's IP & OP site names
;PSA*3*22 (DAVE B) no location defined
I $G(PSALOC)'>0 S (PSAISITN,PSAOSITN)="Unknown",PSACOMB=" No location identified" Q
;End PSA*3*22
S PSAISIT=+$P($G(^PSD(58.8,PSALOC,0)),"^",3) D OPSITE
I $G(PSAOSIT)="" S PSAOSIT=0
S PSAISITN=$S($P($G(^PS(59.4,PSAISIT,0)),"^")'="":$P($G(^PS(59.4,PSAISIT,0)),"^"),1:"UNKNOWN")
I PSAISIT,PSAOSIT S PSACOMB=": "_PSAISITN_" (IP) "_PSAOSITN_" (OP)" Q
I PSAISIT S PSACOMB=": "_PSAISITN_" (IP)" Q
I PSAOSIT S PSACOMB=": "_PSAOSITN_" (OP)" Q
;DAVE B (PSA*3*12) no DA sites defined
S PSACOMB="No Inpatient or Outpatient Sites defined"
Q
OPSITE ;PSA*3*25 - check for multiple OP sites
;VMP OIFO BAY PINES;ELR;PSA*3*49 ADDED THE FOLLOWING LINE
S (PSAOSIT,PSAOSITN)=""
K PSAOSITC
Q:'$D(PSALOC)
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)
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
.I PSAOSITC=1 S PSAOSITN=SN Q
.S PSAOSITN=PSAOSITN_" & "_SN
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)),"^")
S PSAOSITN=$S($G(PSAOSITN)="":"unknown",1:PSAOSITN)
Q
;
DISPLAY ;Displays an error-free line item
S PSADISP=1
S PSAIEN=$P(PSADATA,"^",6),PSASUB=$P($P(PSADATA,"^",7),"~"),PSANDC=$P($P(PSADATA,"^",4),"~"),PSAVSN=$P($P(PSADATA,"^",5),"~")
W !,PSALINE_" "_$S($P($G(^PSDRUG(PSAIEN,0)),"^")'="":$P(^PSDRUG(PSAIEN,0),"^"),1:"UNKNOWN")
I PSAIEN D
.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
.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 **"
.I $D(^PSDRUG(PSAIEN,"I")) W !?5,"** INACTIVE IN DRUG FILE **"
W !,"Qty Invoiced: "_+$P(PSADATA,"^")
W:$P($P(PSADATA,"^",26),"~")'="" ?38,"UPC: "_$P($P(PSADATA,"^",26),"~")
W !,"Order Unit : "
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)
W $S(PSAOU:$P($G(^DIC(51.5,+PSAOU,0)),"^"),1:"UNKNOWN")
W:$E(PSANDC)'="S" ?38,"NDC: " D PSANDC1^PSAHELP W PSANDCX K PSANDCX
W !,"Unit Price : $"_$P(PSADATA,"^",3),?38,"VSN: "_$S(PSAVSN'="":PSAVSN,1:"Blank"),!
I $P(PSADATA,U,13)=.5 D ;*48 AUTO OU UPDATE FOR MCKESSON
.W !,"*****>",!,"Note: The order unit was changed from EACH to ",$P($G(^DIC(51.5,+PSAOU,0)),"^")," by Drug Accountability"
.W !," during the upload of the invoiced data. Adjustments may be necessary.",!,"*****<"
;bgn *67
W !,"PV-Drug-Description : ",$S($P(PSADATA,"^",28)'="":$P(PSADATA,"^",28),1:"Unknown")
W ?55,"PV-DUOU : ",$S($P(PSADATA,"^",31)'="":$P(PSADATA,"^",31),1:"Unknown")
W !,"PV-Drug-Generic Name : ",$S($P(PSADATA,"^",29)'="":$P(PSADATA,"^",29),1:"Unknown")
W ?55,"PV-UNITS : ",$S($P(PSADATA,"^",30)'="":$P(PSADATA,"^",30),1:"Unknown"),!
;end *67
W !,"Dispense Units: "_$S(+PSAIEN&($P($G(^PSDRUG(+PSAIEN,660)),"^",8)'=""):$P($G(^PSDRUG(+PSAIEN,660)),"^",8),1:"Blank")
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")
S PSALOC=$S($P(PSADATA,"^",19)="":+$P(PSAIN,"^",7),1:+$P(PSAIN,"^",12))
Q:'+$P($G(^PSD(58.8,+PSALOC,0)),"^",14)!('$G(PSAIEN))
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")
W !,"Stock Level : "_PSASTOCK
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
W !,"Reorder Level : "_PSAREORD,!
Q
;
EDITDISP ;Displays a line item with errors.
W @IOF,!?23,"<<< PROCESS LINE ITEM SCREEN >>>",!,"Order#: "_$P(PSAIN,"^",4)_" Invoice#: "_$P(PSAIN,"^",2)_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN),!,PSASLN
EDIT1 S PSADATA=$G(^XTMP("PSAPV",PSACTRL,"IT",PSALINE))
S PSASUB=+$P(PSADATA,"^",7) ;*54
S PSAIEN=+$P(PSADATA,"^",15) I PSAIEN ;*54
E S PSAIEN=+$P(PSADATA,"^",6) ;*54
S PSALOC=$S($P(PSADATA,"^",19)="":+$P(PSAIN,"^",7),1:+$P(PSAIN,"^",12))
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")
I PSAIEN D
.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
.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 **"
;
W !,"Qty Invoiced: "
I $P(PSADATA,"^",8)'="" W $P(PSADATA,"^",8)_" ("_$S(+PSADATA:+PSADATA,$P(PSADATA,"^")=0:0,1:"Blank")_")"
I $P(PSADATA,"^",8)="" W $S(+PSADATA:+PSADATA,$P(PSADATA,"^")=0:0,1:"Blank")
W:$P($P(PSADATA,"^",26),"~")'="" ?38,"UPC: "_$P($P(PSADATA,"^",26),"~")
;
W !,"Order Unit : "
I +$P(PSADATA,"^",12) D
.W $P($G(^DIC(51.5,+$P(PSADATA,"^",12),0)),"^")
.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")_")"
I '+$P(PSADATA,"^",12) D
.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")
;
W:$E(PSANDC)'="S" ?38,"NDC: " D PSANDC1^PSAHELP W PSANDCX K PSANDCX
S PSAPRICE=$P(PSADATA,"^",3)
I +PSAPRICE,$L($P(PSAPRICE,".",2))<2 S PSAPRICE=$P(PSAPRICE,".")_"."_$P(PSAPRICE,".",2)_$E("00",1,(2-$L($P(PSAPRICE,".",2))))
W !,"Unit Price : $"_$S($G(PSAPRICE):PSAPRICE,PSAPRICE=0:0,1:"Blank"),?38,"VSN: "_$S(PSAVSN'="":PSAVSN,1:"Blank"),!
I $P(PSADATA,U,13)=.5 D ;*48 AUTO OU UPDATE FOR MCKESSON
.N PSAOU S PSAOU=$P(PSADATA,U,12)
.W !,"*****>",!,"Note: The order unit was changed from EACH to ",$P($G(^DIC(51.5,+PSAOU,0)),"^")," by Drug Accountability"
.W !," during the upload of the invoiced data. Adjustments may be necessary.",!,"*****<"
;bgn *67
W !,"PV-Drug-Description : ",$S($P(PSADATA,"^",28)'="":$P(PSADATA,"^",28),1:"Unknown")
W ?55,"PV-DUOU : ",$S($P(PSADATA,"^",31)'="":$P(PSADATA,"^",31),1:"Unknown")
W !,"PV-Drug-Generic Name : ",$S($P(PSADATA,"^",29)'="":$P(PSADATA,"^",29),1:"Unknown")
W ?55,"PV-UNITS : ",$S($P(PSADATA,"^",30)'="":$P(PSADATA,"^",30),1:"Unknown"),!
;end *67
S PSAIN=^XTMP("PSAPV",PSACTRL,"IN"),PSALOC=$S($P(PSADATA,"^",19)="CS":+$P(PSAIN,"^",12),1:+$P(PSAIN,"^",7))
DU W !,"Dispense Units: "_$S(+PSAIEN&($P($G(^PSDRUG(+PSAIEN,660)),"^",8)'=""):$P($G(^PSDRUG(+PSAIEN,660)),"^",8),1:"Blank")
DUOU 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"),!
;
Q:'+$P($G(^PSD(58.8,+PSALOC,0)),"^",14)
;
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")
W "Stock Level : "_PSASTOCK
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")
W !,"Reorder Level : "_PSAREORD,!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSAUTL1 8422 printed Oct 16, 2024@17:51:43 Page 2
PSAUTL1 ;BIR/JMB-Prime Vendor Invoice Data Utility ;9/19/97
+1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**3,12,15,21,48,49,54,67**; 10/24/97;Build 15
+2 ;This routine contains utilities to get the location name, display an
+3 ;error-free item, display an item with errors, and display a line ready
+4 ;for verification.
+5 ;References to global ^PS(59.4, are covered under IA #2505
+6 ;References to global ^DIC(51.5, are covered under IA #1931
+7 ;References to global ^PS(59, are covered under IA #212
+8 ;References to ^PSDRUG( are covered by IA #2095
+9 ;
SITES ;Gets the combined IP/OP's IP & OP site names
+1 ;PSA*3*22 (DAVE B) no location defined
+2 IF $GET(PSALOC)'>0
SET (PSAISITN,PSAOSITN)="Unknown"
SET PSACOMB=" No location identified"
QUIT
+3 ;End PSA*3*22
+4 SET PSAISIT=+$PIECE($GET(^PSD(58.8,PSALOC,0)),"^",3)
DO OPSITE
+5 IF $GET(PSAOSIT)=""
SET PSAOSIT=0
+6 SET PSAISITN=$SELECT($PIECE($GET(^PS(59.4,PSAISIT,0)),"^")'="":$PIECE($GET(^PS(59.4,PSAISIT,0)),"^"),1:"UNKNOWN")
+7 IF PSAISIT
IF PSAOSIT
SET PSACOMB=": "_PSAISITN_" (IP) "_PSAOSITN_" (OP)"
QUIT
+8 IF PSAISIT
SET PSACOMB=": "_PSAISITN_" (IP)"
QUIT
+9 IF PSAOSIT
SET PSACOMB=": "_PSAOSITN_" (OP)"
QUIT
+10 ;DAVE B (PSA*3*12) no DA sites defined
+11 SET PSACOMB="No Inpatient or Outpatient Sites defined"
+12 QUIT
OPSITE ;PSA*3*25 - check for multiple OP sites
+1 ;VMP OIFO BAY PINES;ELR;PSA*3*49 ADDED THE FOLLOWING LINE
+2 SET (PSAOSIT,PSAOSITN)=""
+3 KILL PSAOSITC
+4 if '$DATA(PSALOC)
QUIT
+5 IF '$DATA(^PSD(58.8,+PSALOC,7))
IF $PIECE(^PSD(58.8,+PSALOC,0),"^",10)'=""
SET PSAOSIT=$PIECE(^PSD(58.8,+PSALOC,0),"^",10)
SET PSAOSITN=$PIECE($GET(^PS(59,PSAOSIT,0)),"^")
SET PSAOSITN=$SELECT($GET(PSAOSITN)="":"Unknown",1:PSAOSITN)
+6 SET XX=0
FOR
SET XX=$ORDER(^PSD(58.8,+PSALOC,7,XX))
if XX'>0
QUIT
SET PSAOSIT=XX
SET PSAOSITC=$GET(PSAOSITC)+1
SET SN=$PIECE($GET(^PS(59,XX,0)),"^")
Begin DoDot:1
+7 IF PSAOSITC=1
SET PSAOSITN=SN
QUIT
+8 SET PSAOSITN=PSAOSITN_" & "_SN
End DoDot:1
+9 IF $GET(PSAOSITN)=""
IF $PIECE(^PSD(58.8,+PSALOC,0),"^",10)'=""
SET PSAOSIT=$PIECE(^PSD(58.8,+PSALOC,0),"^",10)
SET PSAOSITN=$PIECE($GET(^PS(59,+PSAOSIT,0)),"^")
+10 SET PSAOSITN=$SELECT($GET(PSAOSITN)="":"unknown",1:PSAOSITN)
+11 QUIT
+12 ;
DISPLAY ;Displays an error-free line item
+1 SET PSADISP=1
+2 SET PSAIEN=$PIECE(PSADATA,"^",6)
SET PSASUB=$PIECE($PIECE(PSADATA,"^",7),"~")
SET PSANDC=$PIECE($PIECE(PSADATA,"^",4),"~")
SET PSAVSN=$PIECE($PIECE(PSADATA,"^",5),"~")
+3 WRITE !,PSALINE_" "_$SELECT($PIECE($GET(^PSDRUG(PSAIEN,0)),"^")'="":$PIECE(^PSDRUG(PSAIEN,0),"^"),1:"UNKNOWN")
+4 IF PSAIEN
Begin DoDot:1
+5 IF $PIECE($GET(^PSDRUG(PSAIEN,2)),"^",3)["N"
WRITE " (Controlled Substance)"
IF $PIECE($GET(^PSD(58.8,+$PIECE(PSAIN,"^",12),1,PSAIEN,0)),"^",14)
IF $PIECE($GET(^(0)),"^",14)'>DT
WRITE !,$CHAR(7),$CHAR(7),"** INACTIVE IN MASTER VAULT **"
QUIT
+6 IF $PIECE($GET(^PSD(58.8,+$PIECE(PSAIN,"^",7),1,PSAIEN,0)),"^",14)
IF $PIECE($GET(^(0)),"^",14)'>DT
WRITE !,$CHAR(7),$CHAR(7),"** INACTIVE IN PHARMACY LOCATION **"
+7 IF $DATA(^PSDRUG(PSAIEN,"I"))
WRITE !?5,"** INACTIVE IN DRUG FILE **"
End DoDot:1
+8 WRITE !,"Qty Invoiced: "_+$PIECE(PSADATA,"^")
+9 if $PIECE($PIECE(PSADATA,"^",26),"~")'=""
WRITE ?38,"UPC: "_$PIECE($PIECE(PSADATA,"^",26),"~")
+10 WRITE !,"Order Unit : "
+11 SET PSAOU=$SELECT(+$PIECE(PSADATA,"^",12):+$PIECE(PSADATA,"^",12),+$PIECE($PIECE(PSADATA,"^",2),"~",2):+$PIECE($PIECE(PSADATA,"^",2),"~",2),PSAIEN&(PSASUB)&(+$PIECE($GET(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",5)):+$PIECE(^PSDRUG(PSAIEN,1,PSASUB,0),"^"
,5),1:0)
+12 WRITE $SELECT(PSAOU:$PIECE($GET(^DIC(51.5,+PSAOU,0)),"^"),1:"UNKNOWN")
+13 if $EXTRACT(PSANDC)'="S"
WRITE ?38,"NDC: "
DO PSANDC1^PSAHELP
WRITE PSANDCX
KILL PSANDCX
+14 WRITE !,"Unit Price : $"_$PIECE(PSADATA,"^",3),?38,"VSN: "_$SELECT(PSAVSN'="":PSAVSN,1:"Blank"),!
+15 ;*48 AUTO OU UPDATE FOR MCKESSON
IF $PIECE(PSADATA,U,13)=.5
Begin DoDot:1
+16 WRITE !,"*****>",!,"Note: The order unit was changed from EACH to ",$PIECE($GET(^DIC(51.5,+PSAOU,0)),"^")," by Drug Accountability"
+17 WRITE !," during the upload of the invoiced data. Adjustments may be necessary.",!,"*****<"
End DoDot:1
+18 ;bgn *67
+19 WRITE !,"PV-Drug-Description : ",$SELECT($PIECE(PSADATA,"^",28)'="":$PIECE(PSADATA,"^",28),1:"Unknown")
+20 WRITE ?55,"PV-DUOU : ",$SELECT($PIECE(PSADATA,"^",31)'="":$PIECE(PSADATA,"^",31),1:"Unknown")
+21 WRITE !,"PV-Drug-Generic Name : ",$SELECT($PIECE(PSADATA,"^",29)'="":$PIECE(PSADATA,"^",29),1:"Unknown")
+22 WRITE ?55,"PV-UNITS : ",$SELECT($PIECE(PSADATA,"^",30)'="":$PIECE(PSADATA,"^",30),1:"Unknown"),!
+23 ;end *67
+24 WRITE !,"Dispense Units: "_$SELECT(+PSAIEN&($PIECE($GET(^PSDRUG(+PSAIEN,660)),"^",8)'=""):$PIECE($GET(^PSDRUG(+PSAIEN,660)),"^",8),1:"Blank")
+25 WRITE !,"Dispense Units Per Order Unit: "_$SELECT($PIECE(PSADATA,"^",20):+$PIECE(PSADATA,"^",20),+PSASUB&(+$PIECE($GET(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7)):+$PIECE($GET(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7),1:"Blank")
+26 SET PSALOC=$SELECT($PIECE(PSADATA,"^",19)="":+$PIECE(PSAIN,"^",7),1:+$PIECE(PSAIN,"^",12))
+27 if '+$PIECE($GET(^PSD(58.8,+PSALOC,0)),"^",14)!('$GET(PSAIEN))
QUIT
+28 SET PSASTOCK=$SELECT(+$PIECE(PSADATA,"^",27):+$PIECE(PSADATA,"^",27),+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3):+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3),1:"Blank")
+29 WRITE !,"Stock Level : "_PSASTOCK
+30 ;*48
SET PSAREORD=$SELECT(+$PIECE(PSADATA,"^",21):+$PIECE(PSADATA,"^",21),+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5):+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5),1:"Blank")
+31 WRITE !,"Reorder Level : "_PSAREORD,!
+32 QUIT
+33 ;
EDITDISP ;Displays a line item with errors.
+1 WRITE @IOF,!?23,"<<< PROCESS LINE ITEM SCREEN >>>",!,"Order#: "_$PIECE(PSAIN,"^",4)_" Invoice#: "_$PIECE(PSAIN,"^",2)_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN),!,PSASLN
EDIT1 SET PSADATA=$GET(^XTMP("PSAPV",PSACTRL,"IT",PSALINE))
+1 ;*54
SET PSASUB=+$PIECE(PSADATA,"^",7)
+2 ;*54
SET PSAIEN=+$PIECE(PSADATA,"^",15)
IF PSAIEN
+3 ;*54
IF '$TEST
SET PSAIEN=+$PIECE(PSADATA,"^",6)
+4 SET PSALOC=$SELECT($PIECE(PSADATA,"^",19)="":+$PIECE(PSAIN,"^",7),1:+$PIECE(PSAIN,"^",12))
+5 WRITE !,PSALINE_" "_$SELECT($DATA(^XTMP("PSAPV",PSACTRL,"IT",PSALINE,"SUP")):$PIECE(^XTMP("PSAPV",PSACTRL,"IT",PSALINE,"SUP"),"^",3),PSAIEN&($PIECE($GET(^PSDRUG(PSAIEN,0)),"^")'=""):$PIECE(^PSDRUG(PSAIEN,0),"^"),1:"UNKNOWN ITEM")
+6 IF PSAIEN
Begin DoDot:1
+7 IF $PIECE($GET(^PSDRUG(PSAIEN,2)),"^",3)["N"
WRITE " (Controlled Substance)"
IF $PIECE($GET(^PSD(58.8,+$PIECE(PSAIN,"^",12),1,PSAIEN,0)),"^",14)
IF $PIECE($GET(^(0)),"^",14)'>DT
WRITE !,$CHAR(7),$CHAR(7),"** INACTIVE IN MASTER VAULT **"
QUIT
+8 IF $PIECE($GET(^PSD(58.8,+$PIECE(PSAIN,"^",7),1,PSAIEN,0)),"^",14)
IF $PIECE($GET(^(0)),"^",14)'>DT
WRITE !,$CHAR(7),$CHAR(7),"** INACTIVE IN PHARMACY LOCATION **"
End DoDot:1
+9 ;
+10 WRITE !,"Qty Invoiced: "
+11 IF $PIECE(PSADATA,"^",8)'=""
WRITE $PIECE(PSADATA,"^",8)_" ("_$SELECT(+PSADATA:+PSADATA,$PIECE(PSADATA,"^")=0:0,1:"Blank")_")"
+12 IF $PIECE(PSADATA,"^",8)=""
WRITE $SELECT(+PSADATA:+PSADATA,$PIECE(PSADATA,"^")=0:0,1:"Blank")
+13 if $PIECE($PIECE(PSADATA,"^",26),"~")'=""
WRITE ?38,"UPC: "_$PIECE($PIECE(PSADATA,"^",26),"~")
+14 ;
+15 WRITE !,"Order Unit : "
+16 IF +$PIECE(PSADATA,"^",12)
Begin DoDot:1
+17 WRITE $PIECE($GET(^DIC(51.5,+$PIECE(PSADATA,"^",12),0)),"^")
+18 WRITE " ("_$SELECT($PIECE($PIECE(PSADATA,"^",2),"~")'="":$PIECE($PIECE(PSADATA,"^",2),"~"),$PIECE($GET(^DIC(51.5,+$PIECE($PIECE(PSADATA,"^",2),"~",3),0)),"^")'="":$PIECE($GET(^DIC(51.5,+$PIECE($PIECE(PSADATA,"^",2),"~",3),0)),"^"),1:"Bl
ank")_")"
End DoDot:1
+19 IF '+$PIECE(PSADATA,"^",12)
Begin DoDot:1
+20 WRITE $SELECT(+$PIECE($PIECE(PSADATA,"^",2),"~",2):$PIECE($PIECE(PSADATA,"^",2),"~"),PSAIEN&(PSASUB)&(+$PIECE($GET(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",5)):$PIECE($GET(^DIC(51.5,+$PIECE(^PSDRUG(PSAIEN,1,PSASUB,0),"^",5),0)),"^"),1:"Blank")
End DoDot:1
+21 ;
+22 if $EXTRACT(PSANDC)'="S"
WRITE ?38,"NDC: "
DO PSANDC1^PSAHELP
WRITE PSANDCX
KILL PSANDCX
+23 SET PSAPRICE=$PIECE(PSADATA,"^",3)
+24 IF +PSAPRICE
IF $LENGTH($PIECE(PSAPRICE,".",2))<2
SET PSAPRICE=$PIECE(PSAPRICE,".")_"."_$PIECE(PSAPRICE,".",2)_$EXTRACT("00",1,(2-$LENGTH($PIECE(PSAPRICE,".",2))))
+25 WRITE !,"Unit Price : $"_$SELECT($GET(PSAPRICE):PSAPRICE,PSAPRICE=0:0,1:"Blank"),?38,"VSN: "_$SELECT(PSAVSN'="":PSAVSN,1:"Blank"),!
+26 ;*48 AUTO OU UPDATE FOR MCKESSON
IF $PIECE(PSADATA,U,13)=.5
Begin DoDot:1
+27 NEW PSAOU
SET PSAOU=$PIECE(PSADATA,U,12)
+28 WRITE !,"*****>",!,"Note: The order unit was changed from EACH to ",$PIECE($GET(^DIC(51.5,+PSAOU,0)),"^")," by Drug Accountability"
+29 WRITE !," during the upload of the invoiced data. Adjustments may be necessary.",!,"*****<"
End DoDot:1
+30 ;bgn *67
+31 WRITE !,"PV-Drug-Description : ",$SELECT($PIECE(PSADATA,"^",28)'="":$PIECE(PSADATA,"^",28),1:"Unknown")
+32 WRITE ?55,"PV-DUOU : ",$SELECT($PIECE(PSADATA,"^",31)'="":$PIECE(PSADATA,"^",31),1:"Unknown")
+33 WRITE !,"PV-Drug-Generic Name : ",$SELECT($PIECE(PSADATA,"^",29)'="":$PIECE(PSADATA,"^",29),1:"Unknown")
+34 WRITE ?55,"PV-UNITS : ",$SELECT($PIECE(PSADATA,"^",30)'="":$PIECE(PSADATA,"^",30),1:"Unknown"),!
+35 ;end *67
+36 SET PSAIN=^XTMP("PSAPV",PSACTRL,"IN")
SET PSALOC=$SELECT($PIECE(PSADATA,"^",19)="CS":+$PIECE(PSAIN,"^",12),1:+$PIECE(PSAIN,"^",7))
DU WRITE !,"Dispense Units: "_$SELECT(+PSAIEN&($PIECE($GET(^PSDRUG(+PSAIEN,660)),"^",8)'=""):$PIECE($GET(^PSDRUG(+PSAIEN,660)),"^",8),1:"Blank")
DUOU WRITE !,"Dispense Units Per Order Unit: "_$SELECT($PIECE(PSADATA,"^",20):+$PIECE(PSADATA,"^",20),+PSASUB&(+$PIECE($GET(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7)):+$PIECE($GET(^PSDRUG(+PSAIEN,1,PSASUB,0)),"^",7),1:"Blank"),!
+1 ;
+2 if '+$PIECE($GET(^PSD(58.8,+PSALOC,0)),"^",14)
QUIT
+3 ;
+4 SET PSASTOCK=$SELECT(+$PIECE(PSADATA,"^",27):+$PIECE(PSADATA,"^",27),+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3):+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",3),1:"Blank")
+5 WRITE "Stock Level : "_PSASTOCK
+6 SET PSAREORD=$SELECT(+$PIECE(PSADATA,"^",21):+$PIECE(PSADATA,"^",21),+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5):+$PIECE($GET(^PSD(58.8,+PSALOC,1,+PSAIEN,0)),"^",5),1:"Blank")
+7 WRITE !,"Reorder Level : "_PSAREORD,!
+8 QUIT