PSSBPSUT ;BIRM/MFR - BPS (ECME) Utilities ;05/14/07
;;1.0;PHARMACY DATA MANAGEMENT;**127**;9/30/97;Build 41
;
NCPDPQTY(DRUG,RXQTY) ; Return the NCPDP quantity (Billing Quantity)
; Input: (r) DRUG - DRUG file (#50) IEN
; (r) RXQTY - Quantity dispensed from the PRESCRIPTION file (#52))
;0utput: NCPDPQTY - Billing Quantity (3 decimal places)^NCPDP Dispense Unit (EA, GM or ML)
;
N UNIT,MULTIP
;
S DRUG=+$G(DRUG),RXQTY=+$G(RXQTY)
;
; - Invalid DRUG IEN or DRUG not on file
I 'DRUG!'$D(^PSDRUG(DRUG,0)) Q "-1^INVALID DRUG"
;
; - Invalid NCPDP Dispense Unit
S UNIT=$$GET1^DIQ(50,DRUG,82,"I") I UNIT'="EA",UNIT'="GM",UNIT'="ML" Q RXQTY
;
; - Invalid NCPDP Conversion Multiplier
S MULTIP=+$$GET1^DIQ(50,DRUG,83) I MULTIP'>0 Q RXQTY_"^"_UNIT
;
Q $J(RXQTY*MULTIP,0,3)_"^"_UNIT
PSSBPSUT ;BIRM/MFR - BPS (ECME) Utilities ;05/14/07
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**127**;9/30/97;Build 41
+2 ;
NCPDPQTY(DRUG,RXQTY) ; Return the NCPDP quantity (Billing Quantity)
+1 ; Input: (r) DRUG - DRUG file (#50) IEN
+2 ; (r) RXQTY - Quantity dispensed from the PRESCRIPTION file (#52))
+3 ;0utput: NCPDPQTY - Billing Quantity (3 decimal places)^NCPDP Dispense Unit (EA, GM or ML)
+4 ;
+5 NEW UNIT,MULTIP
+6 ;
+7 SET DRUG=+$GET(DRUG)
SET RXQTY=+$GET(RXQTY)
+8 ;
+9 ; - Invalid DRUG IEN or DRUG not on file
+10 IF 'DRUG!'$DATA(^PSDRUG(DRUG,0))
QUIT "-1^INVALID DRUG"
+11 ;
+12 ; - Invalid NCPDP Dispense Unit
+13 SET UNIT=$$GET1^DIQ(50,DRUG,82,"I")
IF UNIT'="EA"
IF UNIT'="GM"
IF UNIT'="ML"
QUIT RXQTY
+14 ;
+15 ; - Invalid NCPDP Conversion Multiplier
+16 SET MULTIP=+$$GET1^DIQ(50,DRUG,83)
IF MULTIP'>0
QUIT RXQTY_"^"_UNIT
+17 ;
+18 QUIT $JUSTIFY(RXQTY*MULTIP,0,3)_"^"_UNIT