Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBNCPDP

IBNCPDP.m

Go to the documentation of this file.
  1. 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
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;Reference to $$PSSBILSD^PSS50 supported by IA# 6245
  1. ;
  1. RX(DFN,IBD) ; IB Billing Determination
  1. ; this is called by PSO for all prescriptions issued, return is
  1. ; a response to bill ECME or not with array for billing data elements
  1. ; third piece of return is an Eligibility indicator for the prescription
  1. ;
  1. ; IBD("IEN") = Prescription IEN
  1. ; ("FILL NUMBER") = Fill number (0 is initial)
  1. ; ("DOS") = Date of Service
  1. ; ("RELEASE DATE")= Date of the Rx release in FileMan format
  1. ; ("NDC") = NDC number for drug
  1. ; ("DEA") = DEA special handling info
  1. ; ("COST") = cost of medication being dispensed
  1. ; ("AO") = Agent Orange (0,1 OR Null)
  1. ; ("EC") = Environmental Contaminant (0,1 OR Null)
  1. ; ("HNC") = Head/neck cancer (0,1 OR Null)
  1. ; ("IR") = Ionizing radiation (0,1 OR Null)
  1. ; ("MST") = Military sexual trauma (0,1 OR Null)
  1. ; ("SC") = Service connected (0,1 OR Null)
  1. ; ("CV") = Combat Veteran (0,1 OR Null)
  1. ; ("QTY") = Quantity of med dispensed
  1. ; ("EPHARM") = #9002313.56 ien (E-PHARMACY division)
  1. ;
  1. ;
  1. ; IBD("INS",n,1) = insurance array to bill in n order (see SETINSUR^IBNCPDP1 for details)
  1. ; file 355.3 ien (group)^bin^pcn^Payer Sheet B1^group id^
  1. ; cardholder id^patient relationship code^
  1. ; cardholder first name^cardholder last name^
  1. ; home plan state^Payer Sheet B2^Payer Sheet B3^
  1. ; Software/Vendor Cert ID ^ Ins Name^Payer Sheet E1^
  1. ; Payer Sheet B1 ien^B2 ien^B3 ien^E1 ien^Pharmacy Person Code
  1. ;
  1. ;
  1. ; ("INS",n,2) = dispensing fee^basis of cost determination^
  1. ; awp or tort rate or cost^gross amount due^
  1. ; administrative fee^ingredient cost^usual & customary charge
  1. ; (see RATEPRIC^IBNCPDP1 for details)
  1. ;
  1. ; for basis of cost determination the following is used:
  1. ; "07" would be sent for Usual & Customary
  1. ; "01" would be sent for AWP
  1. ; "05" would be sent for Cost calculations
  1. ;
  1. ; ("INS",n,3) = group name^ins co ph 3^plan ID^
  1. ; insurance type (V=VETERAN, T=TRICARE, C=CHAMPVA)^
  1. ; insurance company (#36) ien^COB field (.2) in 2.312 subfile^
  1. ; 2.312 subfile ien (pt. insurance policy ien)^
  1. ; maximum NCPDP transactions (366.03,10.1)
  1. ; (see SETINSUR^IBNCPDP1 for details)
  1. ;
  1. N IBRES,IBNB
  1. S IBRES=$$RX^IBNCPDP1(DFN,.IBD)
  1. ;remove "Not ECME billable: " from the reason text
  1. S IBNB="Not ECME billable: "
  1. I IBRES[IBNB S IBRES=$P(IBRES,U)_U_$P($P(IBRES,U,2),IBNB,2)_U_$P(IBRES,U,3)
  1. Q IBRES
  1. ;
  1. ;
  1. 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
  1. ; successful, then bills will be established. If not, then we will
  1. ; flag the entry in ct for paper or not billable.
  1. ;
  1. ; IBD("STATUS") = Bill status (PAID, REJECTED,REVERSED
  1. ; CLOSED,RELEASED,or SUBMITTED)
  1. ; ("DOS") = Date of Service
  1. ; ("PRESCRIPTION") = Prescription IEN from drug file (#52)
  1. ; ("FILL NUMBER") = Fill or refill number
  1. ; ("BILLED") = Amount billed
  1. ; ("PAID") = Amount paid
  1. ; ("BCID") = Reference number to the claim for payment
  1. ; BCID stands for Bill Claim ID
  1. ; ("PLAN") = IEN of the the entry in the GROUP INSURANCE
  1. ; PLAN file(#355.3)(captured from the
  1. ; $$RX^IBNCPDP call)
  1. ; ("COPAY") = Patient's copay from ECME response
  1. ; ("RX NO") = RX number from file 52
  1. ; ("DRUG") = IEN of file #50 DRUG
  1. ; ("DAYS SUPPLY") = Days Supply
  1. ; ("QTY") = Quantity Dispensed (should be from the Rx fill or refill 52/52.1)
  1. ; ("NDC") = NDC
  1. ; ("CLOSE REASON") = Optional, Pointer to the IB file #356.8
  1. ; "CLAIMS TRACKING NON-BILLABLE REASONS"
  1. ; ("CLOSE COMMENT")= Optional, if the close reason is defined
  1. ; then the Close Comment parameter may be
  1. ; sent to IB
  1. ; ("DROP TO PAPER")= Optional, this parameter may be set to 1(TRUE)
  1. ; for certain Close Claim Reasons, indicating
  1. ; that that the closed episode still may be
  1. ; "dropped to paper" - passed to the Autobiller
  1. ; ("RELEASE COPAY")= Optional, if the claim is being closed, setting
  1. ; this parameter to 1 (TRUE) indicates that the
  1. ; patients copay should be released off hold
  1. ; ("DIVISION") = Pointer to the MC DIVISION file (#40.8)
  1. ; ("AUTH #") = ECME approval/authorization number
  1. ; ("CLAIMID") = Reference Number to ECME
  1. ; ("EPHARM") = Optional, #9002313.56 ien (E-PHARMACY division)
  1. ; ("RTYPE") = Optional, rate type specified by user during
  1. ; manual ePharmacy processing
  1. ; ("PRIMARY BILL") = Optional, if this is to be a secondary bill,
  1. ; this is the primary bill the secondary relates
  1. ; ("PRIOR PAYMENT")= Optional, on secondary bills this is the offset
  1. ; to be applied from the primary payment.
  1. ; ("RXCOB") = Optional, COB indicator (secondary = 2)
  1. ;
  1. ;
  1. ; Return is the bill number for success or 1 if not billable.
  1. ; "0^reason" indicates not success
  1. ;
  1. ;
  1. Q $$ECME^IBNCPDP2(DFN,.IBD)
  1. ;
  1. ;
  1. UPAWP(IBNDC,IBAWP,IBADT) ; used to update AWPs. This is an API that
  1. ; pharmacy will call.
  1. ;
  1. ; IBNDC = NDC number to update with the price.
  1. ; IBAWP = average wholesale price of the NDC
  1. ; IBADT = effective date of change (optional, default it today)
  1. ;
  1. ; return will be a positive number indicating success.
  1. ; if it is unsuccessful, then "0^reason" will be returned.
  1. ;
  1. Q $$UPAWP^IBNCPDP3(IBNDC,IBAWP,$G(IBADT,DT))
  1. ;
  1. BILLABLE(DRUG,ELIG,IBRMARK,IBBDAR) ; used to pass the ePharmacy Billable Status
  1. ;
  1. ;Input:
  1. ; DRUG = PRESCRIPTION File #52 IEN (required)
  1. ; ELIG = BILLING ELIGIBILITY INDICATOR (T,C,V) field #85 of file 52 or 52.1. If not defined, assume "V".
  1. ;
  1. ;Output:
  1. ; IBRMARK = "DRUG NOT BILLABLE" - only set if drug not billable (pass by reference)
  1. ; IBBDAR = (optional) array values returned regarding drug file billable fields (pass by reference)
  1. ; Function Value: 1 if drug is billable, 0 if drug is not billable
  1. ;
  1. N IBRES,EPHNODE
  1. S IBRES=0,IBRMARK="DRUG NOT BILLABLE" ; assume not billable as default
  1. ;
  1. I '$G(DRUG) G BILLQ
  1. I $G(ELIG)="" S ELIG="V"
  1. ;
  1. S EPHNODE=$$PSSBILSD^PSS50(DRUG) ;using PSS API to obtain this information IA# 6245
  1. ;
  1. ; set the values into the array
  1. S IBBDAR("DRUG-BILLABLE")=$P(EPHNODE,U,1)
  1. S IBBDAR("DRUG-BILLABLE TRICARE")=$P(EPHNODE,U,2)
  1. S IBBDAR("DRUG-BILLABLE CHAMPVA")=$P(EPHNODE,U,3)
  1. ;
  1. ; If Elig is VET:
  1. ; and ePharmacy Billable field is YES, then drug is billable.
  1. ; Otherwise, drug is non-billable.
  1. I ELIG="V" D G BILLQ
  1. . I $P(EPHNODE,U,1) S IBRES=1 K IBRMARK Q
  1. . Q
  1. ;
  1. ;If Elig is TRICARE:
  1. ; And ePharmacy Billable TRICARE field is YES, then drug is billable
  1. ; And ePharmacy Billable TRICARE field is NO, then drug is non-billable
  1. ; And ePharmacy Billable field is YES and ePharmacy Billable TRICARE field is unanswered, then drug is billable
  1. ; Otherwise, drug is non-billable
  1. ;
  1. I ELIG="T" D G BILLQ
  1. . I $P(EPHNODE,U,2) S IBRES=1 K IBRMARK Q ; TRICARE billable true
  1. . I $P(EPHNODE,U,1),$P(EPHNODE,U,2)="" S IBRES=1 K IBRMARK Q ; TRICARE billable unanswered + ePharm billable true
  1. . Q
  1. ;
  1. ;If Elig is CHAMPVA:
  1. ; And ePharmacy Billable CHAMPVA field is YES, then drug is billable
  1. ; And ePharmacy Billable CHAMPVA field is NO, then drug is non-billable
  1. ; And ePharmacy Billable field is YES and ePharmacy Billable CHAMPVA is unanswered, then drug is billable
  1. ; Otherwise, drug is non-billable
  1. ;
  1. I ELIG="C" D G BILLQ
  1. . I $P(EPHNODE,U,3) S IBRES=1 K IBRMARK Q ; CHAMPVA billable true
  1. . I $P(EPHNODE,U,1),$P(EPHNODE,U,3)="" S IBRES=1 K IBRMARK Q ; CHAMPVA billable unanswered + ePharm billable true
  1. . Q
  1. ;
  1. BILLQ ;
  1. Q IBRES
  1. ;