source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBACUS.m@ 1578

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1IBACUS ;ALB/CPM - TRICARE BILLING UTILITIES ; 02-AUG-96
2 ;;2.0;INTEGRATED BILLING;**52,240,274**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5CUS(DFN,IBDT) ; Does the patient have TRICARE coverage?
6 ; Input: DFN -- Pointer to the patient in file #2
7 ; DATE -- Date on which coverage is to be determined
8 ; Output: IBCOV -- 0, if the vet has no billable TRICARE coverage
9 ; >0 => pointer to such coverage in file #2.312
10 ;
11 N IBCOV,IBPOL,IBI
12 S IBCOV=0
13 I '$G(DFN) G CUSQ
14 S:'$G(IBDT) IBDT=DT
15 ;
16 ; - find a billable TRICARE policy
17 D ALL^IBCNS1(DFN,"IBPOL",1,IBDT)
18 S IBI=0 F S IBI=$O(IBPOL(IBI)) Q:'IBI D Q:IBCOV
19 .Q:$P($G(IBPOL(IBI,3)),"^",4) ; ignore billing this policy
20 .I $P($G(^IBE(355.1,+$P($G(IBPOL(IBI,355.3)),"^",9),0)),"^",3)=7 S IBCOV=IBI
21CUSQ Q IBCOV
22 ;
23 ;
24TRI() ; Is the Tricare Billing engine up and running?
25 ; Input: none
26 ; Output: 0 - No 1 - Yes
27 ;
28 Q $P($G(^IBE(350.9,1,9)),"^",4)>0
29 ;
30 ;
31CHPUS(DFN,DATE,IBRX,IBREF,IBLAB,IBRSITE,IBDUZ) ; Bill this patient for TRICARE?
32 ; Input: DFN -- Pointer to the patient in file #2
33 ; DATE -- Date on which coverage is to be determined
34 ; IBRX -- Pointer to the prescription in file #52
35 ; IBREF -- Pointer to the refill in file #52.1, or
36 ; 0 if billing the original prescription
37 ; IBLAB -- Pharmacy label printing device
38 ; IBRSITE -- Pointer to the Pharmacy in file #59
39 ; IBDUZ -- Pointer to the Pharmacy user in file #200
40 ; Output: IBCHK -- 0 => can't bill rx || 1 => bill rx
41 ;
42 N IBCHK,IBKEY S IBCHK=0
43 I '$G(DFN) G CHPUSQ
44 D POL^IBCNSU41(DFN)
45 ;
46 ; - make sure system is running and the patient has TRICARE coverage
47 I '$$TRI() G CHPUSQ
48 I '$$CUS(DFN,DATE) G CHPUSQ
49 ;
50 ; - check remaining user input
51 I '$G(IBRX) G CHPUSQ
52 I $G(IBREF)="" G CHPUSQ
53 I $G(IBLAB)=""!('$G(IBRSITE))!('$G(IBDUZ)) G CHPUSQ
54 ;
55 ; - perform all Pharmacy edits
56 I '$$CHK^PSOCPTRI(IBRX,IBREF) G CHPUSQ
57 ;
58 ; - queue rx for billing
59 S IBCHK=1,IBKEY=IBRX_";"_IBREF
60 S ^IBA(351.5,"APOST",IBKEY)=IBLAB_"^"_IBRSITE_"^"_IBDUZ
61 ;
62CHPUSQ Q IBCHK
63 ;
64 ;
65 ;
66 ;
67 ; The following three queued entry points are invoked by the
68 ; TRICARE Rx Billing engine. The following two variables are
69 ; defined for each of the jobs:
70 ;
71 ; IBCHTRN -- Pointer to the transaction entry in file #351.5
72 ; IBKEYD -- 1 ^ 2 ^ 3, where
73 ; 1 = Rx label printing device
74 ; 2 = Pointer to the Pharmacy in file #59
75 ; 3 = Pointer to the Pharmacy user in file #200
76 ;
77RXLAB ; Queued entry point to print the TRICARE Rx label.
78 I $G(IBKEYD)="" G RXLABQ
79 S IBCOP=$J(+$G(^IBA(351.5,+$G(IBCHTRN),2)),0,2)
80 I 'IBCOP G RXLABQ
81 D LABEL^PSOCPTRI(+$G(^IBA(351.5,IBCHTRN,0)),$P(IBKEYD,"^"),$P(IBKEYD,"^",2),$P(IBKEYD,"^",3),IBCOP)
82RXLABQ K IBCOP
83 Q
84 ;
85 ;
86RXBIL ; Queued entry point to create TRICARE Rx Billing charges.
87 ;
88 ; - check some basic input
89 I '$$RXSET G RXBILQ
90 ;
91 ; - create copay charge
92 D BILL^IBACUS1(IBKEY,IBCHTRN)
93 ;
94 ; - create fiscal intermediary claim
95 D BILL^IBACUS2(IBKEY,IBCHTRN)
96 ;
97RXBILQ Q
98 ;
99 ;
100RXCAN ; Queued entry point to cancel TRICARE Rx Billing charges.
101 ;
102 ; - check some basic input
103 I '$$RXSET G RXCANQ
104 ;
105 ; - cancel copay charge
106 D CANC^IBACUS1(IBCHTRN)
107 ;
108 ; - cancel fiscal intermediary claim
109 D CANC^IBACUS2(IBCHTRN)
110 ;
111RXCANQ Q
112 ;
113 ;
114RXSET() ; Establish the session.
115 N IBOK S IBOK=0
116 ;
117 ; - check some basic input
118 I '$G(IBCHTRN) G RXSETQ
119 S IBKEY=$P($G(^IBA(351.5,IBCHTRN,0)),"^")
120 I IBKEY="" G RXSETQ
121 S DUZ=+$P(IBKEYD,"^",3)
122 I $G(^VA(200,DUZ,0))="" G RXSETQ
123 ;
124 N DIQUIET S DIQUIET=1 D DT^DICRW
125 S IBOK=1
126 ;
127RXSETQ Q IBOK
Note: See TracBrowser for help on using the repository browser.