source: FOIAVistA/tag/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSOSCA.m@ 628

Last change on this file since 628 was 628, checked in by George Lilly, 14 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1BPSOSCA ;BHAM ISC/FCS/DRS - Create BPS Claims entries ;06/01/2004
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ; Create BPS Claims entries for RXILIST(*) claims.
7 ; Called from PACKET^BPSOSQG
8 ;
9 ; Input:
10 ; RXILIST(IEN59) - Array of pointers to 9002313.59
11 ; A list of prescriptions for the same visit/patient/etc.
12 ; to be bundled into one or more 9002313.02 claims
13 ;
14 ; Outputs:
15 ; CLAIMIEN(CLAIMIEN)="", pointers to the ^BPSC(CLAIMIEN,
16 ; claim records created.
17 ; ERROR
18 ;
19 ; BPSOSCA calls:
20 ; BPSOSCB to build BPS(*) array
21 ; (and BPSOSCB calls BPSOSCC and BPSOSCD)
22 ; BPSOSCE to build the ^BPSC( entry
23 ;
24EN(CLAIMIEN) ;EP - from BPSOSQG
25 I $D(RXILIST)<10 D Q "306^No RXILIST defined"
26 . N RETVAL S RETVAL=$$IMPOSS^BPSOSUE("P","TI","Bad RXILIST",,,$T(+0))
27 . D LOG2LIST^BPSOSL($T(+0)_"-No RXILIST passed into BPSOSCA")
28 ;
29 ; Manage local variables
30 N BPS,START,END,TOTAL,NCLAIMS,CLAIMN,ERROR
31 S ERROR=$$BPS^BPSOSCB()
32 I ERROR D LOG2LIST^BPSOSL($T(+0)_"-$$BPS^BPSOSCB(.BPS) returned "_ERROR)
33 I $G(BPS("RX",0))="" S:'ERROR ERROR="301^BPS(""RX"" not created" Q ERROR
34 I $G(BPS("NCPDP","# Meds/Claim"))="" Q "302^Number of Meds not returned"
35 ;
36 ; Calculate number of claim records to be generated for Billing Item
37 S NCLAIMS=((BPS("RX",0)-1)\BPS("NCPDP","# Meds/Claim"))+1
38 I NCLAIMS=0 Q "303^Number of claims is zero"
39 ;
40 ;Generate claim submission records
41 F CLAIMN=1:1:NCLAIMS D Q:$G(ERROR)
42 . S START=((CLAIMN-1)*BPS("NCPDP","# Meds/Claim"))+1
43 . S END=START+BPS("NCPDP","# Meds/Claim")-1
44 . S:END>BPS("RX",0) END=BPS("RX",0)
45 . S TOTAL=END-START+1
46 . S ERROR=$$NEWCLAIM^BPSOSCE(START,END,TOTAL)
47 . I ERROR]"" Q
48 . S CLAIMIEN=BPS(9002313.02)
49 . S CLAIMIEN(CLAIMIEN)=""
50 . ; Mark each of the .59s with the claim number and position within
51 . F I=START:1:END D
52 .. ;
53 .. ; IEN59 handling 06/23/2000. The ELSE should never happen again.
54 .. ; and the $G() can probably be gotten rid of, safely.
55 .. N IEN59 S IEN59=$G(BPS("RX",I,"IEN59"))
56 .. I IEN59 D
57 ... N DIE,DA,DR S DIE=9002313.59
58 ... ;
59 ... ; Field #3-CLAIM, #14-POSITION
60 ... ; POSITION: Not the relative position within the packet,
61 ... ; but the index in BPS("RX",n,.... This is the position in which
62 ... ; it will be stored in ^BPSC(ien,400,POSITION
63 ... ; and likewise for 9002313.03 when the response comes in.
64 ... S DA=IEN59,DR=3_"////"_CLAIMIEN_";14////"_I N I D ^DIE
65 .. E D
66 ... S $P(^BPST(BPS("RX",I,"RX IEN"),0),"^",4)=CLAIMIEN
67 ... S ^BPST("AE",CLAIMIEN,BPS("RX",I,"RX IEN"))=""
68 ... S $P(^BPST(BPS("RX",I,"RX IEN"),0),"^",9)=I
69 Q ERROR
Note: See TracBrowser for help on using the repository browser.