source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSECX1.m@ 1739

Last change on this file since 1739 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1BPSECX1 ;BHAM ISC/FCS/DRS/VA/DLF - Create new Claim ID for Claim Submission file ;05/17/2004
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,2,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;----------------------------------------------------------------------
5 ;Create new Claim ID for Claim Submission file (9002313.02)
6 ;
7 ;Function Returns: VA<YYYY>=<Pharmacy ID>=<Plan ID>=<Sequence Number>
8 ; Where: <YYYY> is the year
9 ; <Pharmacy ID> NPI or NCPDPP of the BPS Pharmacy
10 ; <Plan ID> is the VA National Plan ID w/o leading alphas
11 ; <Sequence #> is a unique counter stored in BPS SETUP
12 ;----------------------------------------------------------------------
13 ;
14CLAIMID(IEN59) ;EP - Called from BPSOSCE (billing requests) and BPSECA8 (reversals)
15 ; Check parameters
16 I '$G(IEN59) Q ""
17 ;
18 ; Initialization
19 N PHARMACY,FACID,THIRD,DEL,PLAN,I,SEQNUM
20 ;
21 ; Get and format the Facility ID (second piece of the transmission ID)
22 ; 1. Try to get NPI first.
23 ; 2. If we do not get the NPI, get the NCPDP and left-pad it with zeros
24 ; up to seven characters.
25 ; 3. Right-pad the final ID with spaces up to 10 characters
26 S PHARMACY=+$P($G(^BPST(IEN59,1)),U,7)
27 S FACID=$P($G(^BPS(9002313.56,PHARMACY,"NPI")),U,1)
28 I FACID="" D
29 . S FACID=$P($G(^BPS(9002313.56,PHARMACY,0)),U,2)
30 . S FACID=$TR($J("",7-$L(FACID))," ","0")_FACID
31 S FACID=$RE($J($RE(FACID),10))
32 ;
33 ; Get the third piece of the transmission ID
34 ; If the National Plan ID is available, use it with '=' delimiter (new format)
35 ; If not, it will need to be the BIN with the '-' delimiter (old format)
36 S THIRD="",PLAN=$$GET1^DIQ(9002313.59902,"1,"_IEN59_",","902.27")
37 I PLAN]"" D
38 . F I=1:1:$L(PLAN) I $E(PLAN,I)?1N Q
39 . S PLAN=$E(PLAN,I,$L(PLAN))
40 . S THIRD=PLAN,DEL="="
41 ;
42 ; If no plan, get BIN and use '-' delimiter (old format)
43 I THIRD="" S DEL="-",THIRD=$$GET1^DIQ(9002313.59902,"1,"_IEN59_",","902.03")
44 ;
45 ; Pad third piece with zeros
46 S THIRD=$TR($J("",6-$L(THIRD))," ","0")_THIRD
47 ;
48 ; Get and format the sequence number (fourth piece)
49 L +^BPS(9002313.99,1,3):15
50 I '$T D IMPOSS^BPSOSUE("DB,P","TI","",,"Can't lock BPS(9002313.99,1,3)",$T(+0))
51 S SEQNUM=+$G(^BPS(9002313.99,1,3)),^BPS(9002313.99,1,3)=SEQNUM+1
52 I $L(SEQNUM<7) S SEQNUM=$E($TR($J("",7-$L(SEQNUM))," ","0")_SEQNUM,1,7)
53 L -^BPS(9002313.99,1,3)
54 ;
55 ; Create the Transmission ID
56 Q "VA"_($E(DT,1,3)+1700)_DEL_FACID_DEL_THIRD_DEL_SEQNUM
Note: See TracBrowser for help on using the repository browser.