- IBNCPDP ;OAK/ELZ - APIS FOR NCPCP/ECME ;1/9/08 17:27
- ;;2.0;INTEGRATED BILLING;**223,276,363,383,384,411,435,452,550**;21-MAR-94;Build 25
- ;;Per VA Directive 6402, this routine should not be modified.
- ;
- ;Reference to $$PSSBILSD^PSS50 supported by IA# 6245
- ;
- RX(DFN,IBD) ; IB Billing Determination
- ; this is called by PSO for all prescriptions issued, return is
- ; a response to bill ECME or not with array for billing data elements
- ; third piece of return is an Eligibility indicator for the prescription
- ;
- ; IBD("IEN") = Prescription IEN
- ; ("FILL NUMBER") = Fill number (0 is initial)
- ; ("DOS") = Date of Service
- ; ("RELEASE DATE")= Date of the Rx release in FileMan format
- ; ("NDC") = NDC number for drug
- ; ("DEA") = DEA special handling info
- ; ("COST") = cost of medication being dispensed
- ; ("AO") = Agent Orange (0,1 OR Null)
- ; ("EC") = Environmental Contaminant (0,1 OR Null)
- ; ("HNC") = Head/neck cancer (0,1 OR Null)
- ; ("IR") = Ionizing radiation (0,1 OR Null)
- ; ("MST") = Military sexual trauma (0,1 OR Null)
- ; ("SC") = Service connected (0,1 OR Null)
- ; ("CV") = Combat Veteran (0,1 OR Null)
- ; ("QTY") = Quantity of med dispensed
- ; ("EPHARM") = #9002313.56 ien (E-PHARMACY division)
- ;
- ;
- ; IBD("INS",n,1) = insurance array to bill in n order (see SETINSUR^IBNCPDP1 for details)
- ; file 355.3 ien (group)^bin^pcn^Payer Sheet B1^group id^
- ; cardholder id^patient relationship code^
- ; cardholder first name^cardholder last name^
- ; home plan state^Payer Sheet B2^Payer Sheet B3^
- ; Software/Vendor Cert ID ^ Ins Name^Payer Sheet E1^
- ; Payer Sheet B1 ien^B2 ien^B3 ien^E1 ien^Pharmacy Person Code
- ;
- ;
- ; ("INS",n,2) = dispensing fee^basis of cost determination^
- ; awp or tort rate or cost^gross amount due^
- ; administrative fee^ingredient cost^usual & customary charge
- ; (see RATEPRIC^IBNCPDP1 for details)
- ;
- ; for basis of cost determination the following is used:
- ; "07" would be sent for Usual & Customary
- ; "01" would be sent for AWP
- ; "05" would be sent for Cost calculations
- ;
- ; ("INS",n,3) = group name^ins co ph 3^plan ID^
- ; insurance type (V=VETERAN, T=TRICARE, C=CHAMPVA)^
- ; insurance company (#36) ien^COB field (.2) in 2.312 subfile^
- ; 2.312 subfile ien (pt. insurance policy ien)^
- ; maximum NCPDP transactions (366.03,10.1)
- ; (see SETINSUR^IBNCPDP1 for details)
- ;
- N IBRES,IBNB
- S IBRES=$$RX^IBNCPDP1(DFN,.IBD)
- ;remove "Not ECME billable: " from the reason text
- S IBNB="Not ECME billable: "
- I IBRES[IBNB S IBRES=$P(IBRES,U)_U_$P($P(IBRES,U,2),IBNB,2)_U_$P(IBRES,U,3)
- Q IBRES
- ;
- ;
- STORESP(DFN,IBD) ; this is an API for pharmacy/ecme to use to relay
- ; results of billing using the ecme software. If electronic billing is
- ; successful, then bills will be established. If not, then we will
- ; flag the entry in ct for paper or not billable.
- ;
- ; IBD("STATUS") = Bill status (PAID, REJECTED,REVERSED
- ; CLOSED,RELEASED,or SUBMITTED)
- ; ("DOS") = Date of Service
- ; ("PRESCRIPTION") = Prescription IEN from drug file (#52)
- ; ("FILL NUMBER") = Fill or refill number
- ; ("BILLED") = Amount billed
- ; ("PAID") = Amount paid
- ; ("BCID") = Reference number to the claim for payment
- ; BCID stands for Bill Claim ID
- ; ("PLAN") = IEN of the the entry in the GROUP INSURANCE
- ; PLAN file(#355.3)(captured from the
- ; $$RX^IBNCPDP call)
- ; ("COPAY") = Patient's copay from ECME response
- ; ("RX NO") = RX number from file 52
- ; ("DRUG") = IEN of file #50 DRUG
- ; ("DAYS SUPPLY") = Days Supply
- ; ("QTY") = Quantity Dispensed (should be from the Rx fill or refill 52/52.1)
- ; ("NDC") = NDC
- ; ("CLOSE REASON") = Optional, Pointer to the IB file #356.8
- ; "CLAIMS TRACKING NON-BILLABLE REASONS"
- ; ("CLOSE COMMENT")= Optional, if the close reason is defined
- ; then the Close Comment parameter may be
- ; sent to IB
- ; ("DROP TO PAPER")= Optional, this parameter may be set to 1(TRUE)
- ; for certain Close Claim Reasons, indicating
- ; that that the closed episode still may be
- ; "dropped to paper" - passed to the Autobiller
- ; ("RELEASE COPAY")= Optional, if the claim is being closed, setting
- ; this parameter to 1 (TRUE) indicates that the
- ; patients copay should be released off hold
- ; ("DIVISION") = Pointer to the MC DIVISION file (#40.8)
- ; ("AUTH #") = ECME approval/authorization number
- ; ("CLAIMID") = Reference Number to ECME
- ; ("EPHARM") = Optional, #9002313.56 ien (E-PHARMACY division)
- ; ("RTYPE") = Optional, rate type specified by user during
- ; manual ePharmacy processing
- ; ("PRIMARY BILL") = Optional, if this is to be a secondary bill,
- ; this is the primary bill the secondary relates
- ; ("PRIOR PAYMENT")= Optional, on secondary bills this is the offset
- ; to be applied from the primary payment.
- ; ("RXCOB") = Optional, COB indicator (secondary = 2)
- ;
- ;
- ; Return is the bill number for success or 1 if not billable.
- ; "0^reason" indicates not success
- ;
- ;
- Q $$ECME^IBNCPDP2(DFN,.IBD)
- ;
- ;
- UPAWP(IBNDC,IBAWP,IBADT) ; used to update AWPs. This is an API that
- ; pharmacy will call.
- ;
- ; IBNDC = NDC number to update with the price.
- ; IBAWP = average wholesale price of the NDC
- ; IBADT = effective date of change (optional, default it today)
- ;
- ; return will be a positive number indicating success.
- ; if it is unsuccessful, then "0^reason" will be returned.
- ;
- Q $$UPAWP^IBNCPDP3(IBNDC,IBAWP,$G(IBADT,DT))
- ;
- BILLABLE(DRUG,ELIG,IBRMARK,IBBDAR) ; used to pass the ePharmacy Billable Status
- ;
- ;Input:
- ; DRUG = PRESCRIPTION File #52 IEN (required)
- ; ELIG = BILLING ELIGIBILITY INDICATOR (T,C,V) field #85 of file 52 or 52.1. If not defined, assume "V".
- ;
- ;Output:
- ; IBRMARK = "DRUG NOT BILLABLE" - only set if drug not billable (pass by reference)
- ; IBBDAR = (optional) array values returned regarding drug file billable fields (pass by reference)
- ; Function Value: 1 if drug is billable, 0 if drug is not billable
- ;
- N IBRES,EPHNODE
- S IBRES=0,IBRMARK="DRUG NOT BILLABLE" ; assume not billable as default
- ;
- I '$G(DRUG) G BILLQ
- I $G(ELIG)="" S ELIG="V"
- ;
- S EPHNODE=$$PSSBILSD^PSS50(DRUG) ;using PSS API to obtain this information IA# 6245
- ;
- ; set the values into the array
- S IBBDAR("DRUG-BILLABLE")=$P(EPHNODE,U,1)
- S IBBDAR("DRUG-BILLABLE TRICARE")=$P(EPHNODE,U,2)
- S IBBDAR("DRUG-BILLABLE CHAMPVA")=$P(EPHNODE,U,3)
- ;
- ; If Elig is VET:
- ; and ePharmacy Billable field is YES, then drug is billable.
- ; Otherwise, drug is non-billable.
- I ELIG="V" D G BILLQ
- . I $P(EPHNODE,U,1) S IBRES=1 K IBRMARK Q
- . Q
- ;
- ;If Elig is TRICARE:
- ; And ePharmacy Billable TRICARE field is YES, then drug is billable
- ; And ePharmacy Billable TRICARE field is NO, then drug is non-billable
- ; And ePharmacy Billable field is YES and ePharmacy Billable TRICARE field is unanswered, then drug is billable
- ; Otherwise, drug is non-billable
- ;
- I ELIG="T" D G BILLQ
- . I $P(EPHNODE,U,2) S IBRES=1 K IBRMARK Q ; TRICARE billable true
- . I $P(EPHNODE,U,1),$P(EPHNODE,U,2)="" S IBRES=1 K IBRMARK Q ; TRICARE billable unanswered + ePharm billable true
- . Q
- ;
- ;If Elig is CHAMPVA:
- ; And ePharmacy Billable CHAMPVA field is YES, then drug is billable
- ; And ePharmacy Billable CHAMPVA field is NO, then drug is non-billable
- ; And ePharmacy Billable field is YES and ePharmacy Billable CHAMPVA is unanswered, then drug is billable
- ; Otherwise, drug is non-billable
- ;
- I ELIG="C" D G BILLQ
- . I $P(EPHNODE,U,3) S IBRES=1 K IBRMARK Q ; CHAMPVA billable true
- . I $P(EPHNODE,U,1),$P(EPHNODE,U,3)="" S IBRES=1 K IBRMARK Q ; CHAMPVA billable unanswered + ePharm billable true
- . Q
- ;
- BILLQ ;
- Q IBRES
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBNCPDP 8741 printed Jan 18, 2025@03:25:47 Page 2
- IBNCPDP ;OAK/ELZ - APIS FOR NCPCP/ECME ;1/9/08 17:27
- +1 ;;2.0;INTEGRATED BILLING;**223,276,363,383,384,411,435,452,550**;21-MAR-94;Build 25
- +2 ;;Per VA Directive 6402, this routine should not be modified.
- +3 ;
- +4 ;Reference to $$PSSBILSD^PSS50 supported by IA# 6245
- +5 ;
- RX(DFN,IBD) ; IB Billing Determination
- +1 ; this is called by PSO for all prescriptions issued, return is
- +2 ; a response to bill ECME or not with array for billing data elements
- +3 ; third piece of return is an Eligibility indicator for the prescription
- +4 ;
- +5 ; IBD("IEN") = Prescription IEN
- +6 ; ("FILL NUMBER") = Fill number (0 is initial)
- +7 ; ("DOS") = Date of Service
- +8 ; ("RELEASE DATE")= Date of the Rx release in FileMan format
- +9 ; ("NDC") = NDC number for drug
- +10 ; ("DEA") = DEA special handling info
- +11 ; ("COST") = cost of medication being dispensed
- +12 ; ("AO") = Agent Orange (0,1 OR Null)
- +13 ; ("EC") = Environmental Contaminant (0,1 OR Null)
- +14 ; ("HNC") = Head/neck cancer (0,1 OR Null)
- +15 ; ("IR") = Ionizing radiation (0,1 OR Null)
- +16 ; ("MST") = Military sexual trauma (0,1 OR Null)
- +17 ; ("SC") = Service connected (0,1 OR Null)
- +18 ; ("CV") = Combat Veteran (0,1 OR Null)
- +19 ; ("QTY") = Quantity of med dispensed
- +20 ; ("EPHARM") = #9002313.56 ien (E-PHARMACY division)
- +21 ;
- +22 ;
- +23 ; IBD("INS",n,1) = insurance array to bill in n order (see SETINSUR^IBNCPDP1 for details)
- +24 ; file 355.3 ien (group)^bin^pcn^Payer Sheet B1^group id^
- +25 ; cardholder id^patient relationship code^
- +26 ; cardholder first name^cardholder last name^
- +27 ; home plan state^Payer Sheet B2^Payer Sheet B3^
- +28 ; Software/Vendor Cert ID ^ Ins Name^Payer Sheet E1^
- +29 ; Payer Sheet B1 ien^B2 ien^B3 ien^E1 ien^Pharmacy Person Code
- +30 ;
- +31 ;
- +32 ; ("INS",n,2) = dispensing fee^basis of cost determination^
- +33 ; awp or tort rate or cost^gross amount due^
- +34 ; administrative fee^ingredient cost^usual & customary charge
- +35 ; (see RATEPRIC^IBNCPDP1 for details)
- +36 ;
- +37 ; for basis of cost determination the following is used:
- +38 ; "07" would be sent for Usual & Customary
- +39 ; "01" would be sent for AWP
- +40 ; "05" would be sent for Cost calculations
- +41 ;
- +42 ; ("INS",n,3) = group name^ins co ph 3^plan ID^
- +43 ; insurance type (V=VETERAN, T=TRICARE, C=CHAMPVA)^
- +44 ; insurance company (#36) ien^COB field (.2) in 2.312 subfile^
- +45 ; 2.312 subfile ien (pt. insurance policy ien)^
- +46 ; maximum NCPDP transactions (366.03,10.1)
- +47 ; (see SETINSUR^IBNCPDP1 for details)
- +48 ;
- +49 NEW IBRES,IBNB
- +50 SET IBRES=$$RX^IBNCPDP1(DFN,.IBD)
- +51 ;remove "Not ECME billable: " from the reason text
- +52 SET IBNB="Not ECME billable: "
- +53 IF IBRES[IBNB
- SET IBRES=$PIECE(IBRES,U)_U_$PIECE($PIECE(IBRES,U,2),IBNB,2)_U_$PIECE(IBRES,U,3)
- +54 QUIT IBRES
- +55 ;
- +56 ;
- STORESP(DFN,IBD) ; this is an API for pharmacy/ecme to use to relay
- +1 ; results of billing using the ecme software. If electronic billing is
- +2 ; successful, then bills will be established. If not, then we will
- +3 ; flag the entry in ct for paper or not billable.
- +4 ;
- +5 ; IBD("STATUS") = Bill status (PAID, REJECTED,REVERSED
- +6 ; CLOSED,RELEASED,or SUBMITTED)
- +7 ; ("DOS") = Date of Service
- +8 ; ("PRESCRIPTION") = Prescription IEN from drug file (#52)
- +9 ; ("FILL NUMBER") = Fill or refill number
- +10 ; ("BILLED") = Amount billed
- +11 ; ("PAID") = Amount paid
- +12 ; ("BCID") = Reference number to the claim for payment
- +13 ; BCID stands for Bill Claim ID
- +14 ; ("PLAN") = IEN of the the entry in the GROUP INSURANCE
- +15 ; PLAN file(#355.3)(captured from the
- +16 ; $$RX^IBNCPDP call)
- +17 ; ("COPAY") = Patient's copay from ECME response
- +18 ; ("RX NO") = RX number from file 52
- +19 ; ("DRUG") = IEN of file #50 DRUG
- +20 ; ("DAYS SUPPLY") = Days Supply
- +21 ; ("QTY") = Quantity Dispensed (should be from the Rx fill or refill 52/52.1)
- +22 ; ("NDC") = NDC
- +23 ; ("CLOSE REASON") = Optional, Pointer to the IB file #356.8
- +24 ; "CLAIMS TRACKING NON-BILLABLE REASONS"
- +25 ; ("CLOSE COMMENT")= Optional, if the close reason is defined
- +26 ; then the Close Comment parameter may be
- +27 ; sent to IB
- +28 ; ("DROP TO PAPER")= Optional, this parameter may be set to 1(TRUE)
- +29 ; for certain Close Claim Reasons, indicating
- +30 ; that that the closed episode still may be
- +31 ; "dropped to paper" - passed to the Autobiller
- +32 ; ("RELEASE COPAY")= Optional, if the claim is being closed, setting
- +33 ; this parameter to 1 (TRUE) indicates that the
- +34 ; patients copay should be released off hold
- +35 ; ("DIVISION") = Pointer to the MC DIVISION file (#40.8)
- +36 ; ("AUTH #") = ECME approval/authorization number
- +37 ; ("CLAIMID") = Reference Number to ECME
- +38 ; ("EPHARM") = Optional, #9002313.56 ien (E-PHARMACY division)
- +39 ; ("RTYPE") = Optional, rate type specified by user during
- +40 ; manual ePharmacy processing
- +41 ; ("PRIMARY BILL") = Optional, if this is to be a secondary bill,
- +42 ; this is the primary bill the secondary relates
- +43 ; ("PRIOR PAYMENT")= Optional, on secondary bills this is the offset
- +44 ; to be applied from the primary payment.
- +45 ; ("RXCOB") = Optional, COB indicator (secondary = 2)
- +46 ;
- +47 ;
- +48 ; Return is the bill number for success or 1 if not billable.
- +49 ; "0^reason" indicates not success
- +50 ;
- +51 ;
- +52 QUIT $$ECME^IBNCPDP2(DFN,.IBD)
- +53 ;
- +54 ;
- UPAWP(IBNDC,IBAWP,IBADT) ; used to update AWPs. This is an API that
- +1 ; pharmacy will call.
- +2 ;
- +3 ; IBNDC = NDC number to update with the price.
- +4 ; IBAWP = average wholesale price of the NDC
- +5 ; IBADT = effective date of change (optional, default it today)
- +6 ;
- +7 ; return will be a positive number indicating success.
- +8 ; if it is unsuccessful, then "0^reason" will be returned.
- +9 ;
- +10 QUIT $$UPAWP^IBNCPDP3(IBNDC,IBAWP,$GET(IBADT,DT))
- +11 ;
- BILLABLE(DRUG,ELIG,IBRMARK,IBBDAR) ; used to pass the ePharmacy Billable Status
- +1 ;
- +2 ;Input:
- +3 ; DRUG = PRESCRIPTION File #52 IEN (required)
- +4 ; ELIG = BILLING ELIGIBILITY INDICATOR (T,C,V) field #85 of file 52 or 52.1. If not defined, assume "V".
- +5 ;
- +6 ;Output:
- +7 ; IBRMARK = "DRUG NOT BILLABLE" - only set if drug not billable (pass by reference)
- +8 ; IBBDAR = (optional) array values returned regarding drug file billable fields (pass by reference)
- +9 ; Function Value: 1 if drug is billable, 0 if drug is not billable
- +10 ;
- +11 NEW IBRES,EPHNODE
- +12 ; assume not billable as default
- SET IBRES=0
- SET IBRMARK="DRUG NOT BILLABLE"
- +13 ;
- +14 IF '$GET(DRUG)
- GOTO BILLQ
- +15 IF $GET(ELIG)=""
- SET ELIG="V"
- +16 ;
- +17 ;using PSS API to obtain this information IA# 6245
- SET EPHNODE=$$PSSBILSD^PSS50(DRUG)
- +18 ;
- +19 ; set the values into the array
- +20 SET IBBDAR("DRUG-BILLABLE")=$PIECE(EPHNODE,U,1)
- +21 SET IBBDAR("DRUG-BILLABLE TRICARE")=$PIECE(EPHNODE,U,2)
- +22 SET IBBDAR("DRUG-BILLABLE CHAMPVA")=$PIECE(EPHNODE,U,3)
- +23 ;
- +24 ; If Elig is VET:
- +25 ; and ePharmacy Billable field is YES, then drug is billable.
- +26 ; Otherwise, drug is non-billable.
- +27 IF ELIG="V"
- Begin DoDot:1
- +28 IF $PIECE(EPHNODE,U,1)
- SET IBRES=1
- KILL IBRMARK
- QUIT
- +29 QUIT
- End DoDot:1
- GOTO BILLQ
- +30 ;
- +31 ;If Elig is TRICARE:
- +32 ; And ePharmacy Billable TRICARE field is YES, then drug is billable
- +33 ; And ePharmacy Billable TRICARE field is NO, then drug is non-billable
- +34 ; And ePharmacy Billable field is YES and ePharmacy Billable TRICARE field is unanswered, then drug is billable
- +35 ; Otherwise, drug is non-billable
- +36 ;
- +37 IF ELIG="T"
- Begin DoDot:1
- +38 ; TRICARE billable true
- IF $PIECE(EPHNODE,U,2)
- SET IBRES=1
- KILL IBRMARK
- QUIT
- +39 ; TRICARE billable unanswered + ePharm billable true
- IF $PIECE(EPHNODE,U,1)
- IF $PIECE(EPHNODE,U,2)=""
- SET IBRES=1
- KILL IBRMARK
- QUIT
- +40 QUIT
- End DoDot:1
- GOTO BILLQ
- +41 ;
- +42 ;If Elig is CHAMPVA:
- +43 ; And ePharmacy Billable CHAMPVA field is YES, then drug is billable
- +44 ; And ePharmacy Billable CHAMPVA field is NO, then drug is non-billable
- +45 ; And ePharmacy Billable field is YES and ePharmacy Billable CHAMPVA is unanswered, then drug is billable
- +46 ; Otherwise, drug is non-billable
- +47 ;
- +48 IF ELIG="C"
- Begin DoDot:1
- +49 ; CHAMPVA billable true
- IF $PIECE(EPHNODE,U,3)
- SET IBRES=1
- KILL IBRMARK
- QUIT
- +50 ; CHAMPVA billable unanswered + ePharm billable true
- IF $PIECE(EPHNODE,U,1)
- IF $PIECE(EPHNODE,U,3)=""
- SET IBRES=1
- KILL IBRMARK
- QUIT
- +51 QUIT
- End DoDot:1
- GOTO BILLQ
- +52 ;
- BILLQ ;
- +1 QUIT IBRES
- +2 ;