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

BPSECX1.m

Go to the documentation of this file.
  1. BPSECX1 ;BHAM ISC/FCS/DRS/VA/DLF - Create new Claim ID for Claim Submission file ;05/17/2004
  1. ;;1.0;E CLAIMS MGMT ENGINE;**1,2,5,33,38**;JUN 2004;Build 7
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;----------------------------------------------------------------------
  1. ;Create new Claim ID for Claim Submission file (9002313.02)
  1. ;
  1. ;Function Returns: VA<YYYY>=<Pharmacy ID>=<Plan ID>=<Sequence Number>
  1. ; Where: <YYYY> is the year
  1. ; <Pharmacy ID> NPI or NCPDP# of the BPS Pharmacy
  1. ; <Plan ID> is the VA National Plan ID w/o leading alphas
  1. ; <Sequence #> is a unique counter stored in BPS SETUP
  1. ;----------------------------------------------------------------------
  1. ;
  1. CLAIMID(IEN59) ;EP - Called from BPSOSCE (billing requests) and BPSECA8 (reversals)
  1. ; Check parameters
  1. I '$G(IEN59) Q ""
  1. ;
  1. ; Initialization
  1. N BPSCS,FIRST,FOURTH,I,PHARMACY,PLAN,RFL,RX,SECOND,THIRD
  1. ;
  1. ; First piece of Transmission ID = "VA"_Year
  1. ; Length=6
  1. ;
  1. S FIRST="VA"_($E(DT,1,3)+1700)
  1. ;
  1. ; Second piece of Transmission ID = NPI or NCPDP#
  1. ; 1. Try to get NPI first.
  1. ; 2. If we do not get the NPI, get the NCPDP and left-pad it with zeros
  1. ; up to seven characters.
  1. ; 3. Right-pad the final ID with spaces up to 10 characters
  1. ;
  1. S PHARMACY=+$P($G(^BPST(IEN59,1)),U,7)
  1. S SECOND=$P($G(^BPS(9002313.56,PHARMACY,"NPI")),U,1)
  1. ;
  1. ; Check for Controlled Substance Drug and if BPS Pharmacy for CS
  1. ; has been defined. If so, use NPI for the CS Pharmacy.
  1. S RX=$$GET1^DIQ(9002313.59,IEN59,1.11,"I")
  1. S RFL=$$GET1^DIQ(9002313.59,IEN59,9)
  1. S BPSCS=$$CSNPI^BPSUTIL(RX,RFL)
  1. I $P(BPSCS,"^")'="-1" D
  1. . S SECOND=$P(BPSCS,"^",2)
  1. . I SECOND="" S SECOND=$P(BPSCS,"^")
  1. ;
  1. I SECOND="" D
  1. . S SECOND=$P($G(^BPS(9002313.56,PHARMACY,0)),U,2)
  1. . S SECOND=$TR($J("",7-$L(SECOND))," ","0")_SECOND
  1. S SECOND=$RE($J($RE(SECOND),10))
  1. ;
  1. ; Third piece of Transmission ID = National Plan ID
  1. ; Left-padded with zeros
  1. ; Length = 6
  1. ;
  1. S THIRD="",PLAN=$$GET1^DIQ(9002313.59902,"1,"_IEN59_",","902.27")
  1. I PLAN]"" D
  1. . F I=1:1:$L(PLAN) I $E(PLAN,I)?1N Q
  1. . S PLAN=$E(PLAN,I,$L(PLAN))
  1. . S THIRD=PLAN
  1. ;
  1. S THIRD=$TR($J("",6-$L(THIRD))," ","0")_THIRD
  1. ;
  1. ; Fourth piece of Transmission ID = Sequence Number
  1. ; Left-padded with zeros
  1. ; Length = 7
  1. ;
  1. L +^BPS(9002313.99,1,3):15
  1. I '$T D IMPOSS^BPSOSUE("DB,P","TI","",,"Can't lock BPS(9002313.99,1,3)",$T(+0))
  1. S FOURTH=+$G(^BPS(9002313.99,1,3)),^BPS(9002313.99,1,3)=FOURTH+1
  1. I $L(FOURTH<7) S FOURTH=$E($TR($J("",7-$L(FOURTH))," ","0")_FOURTH,1,7)
  1. L -^BPS(9002313.99,1,3)
  1. ;
  1. ; Create the Transmission ID
  1. Q FIRST_"="_SECOND_"="_THIRD_"="_FOURTH