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

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

initial load of WorldVistAEHR

File size: 3.5 KB
RevLine 
[613]1IBAUTL5 ;ALB/CPM - MEANS TEST BILLING UTILITIES (CON'T.) ; 02-JAN-92
2 ;;Version 2.0 ; INTEGRATED BILLING ;**15**; 21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5PASS ; Find unbilled charges for an event and pass to Accounts Receivable.
6 ; Input: IBEVDA, IBY Output: IBCHCDA, IBCHPDA are reset to 0.
7 N IBNOS,IBACTN
8 S IBACTN=0 F S IBACTN=$O(^IB("AF",IBEVDA,IBACTN)) Q:'IBACTN!(IBY<1) I IBACTN'=IBEVDA,$P($G(^IB(IBACTN,0)),"^",5)=1 S IBNOS=IBACTN D FILER
9 S (IBCHCDA,IBCHPDA)=0 Q
10 ;
11FILER ; Pass charge to Accounts Receivable. Input: IBNOS
12 ; - first, get a bill number and build a complete charge..
13 N IBATYP,IBNOW D NOW^%DTC S IBNOW=%
14 ;S IBTOTL=0,IBATYP=$P($G(^IB(IBNOS,0)),"^",3)
15 ;D BILLNO^IBAUTL K IBARTYP I Y<1 S IBY=Y G FILERQ
16 ;S DIE="^IB(",DA=IBNOS,DR=".05////2;.11////"_IBIL_";.12////"_IBTRAN
17 ;D ^DIE K DIE,DR,DA I $D(Y) S IBY="-1^IB020" G FILERQ
18 ;
19 ; - doing IVM-related back-billing?
20 I $G(IBJOB)=9 S DIE="^IB(",DA=IBNOS,DR=".05////21" D ^DIE K DIE,DA,DR G FILERQ
21 ;
22 ; - and then pass the charge to A/R.
23 S IBSEQNO=1,IBDUZ=DUZ D ^IBR K IBSEQNO,IBDUZ,IBARTYP,IBN
24 I Y<1 S IBY=Y,IBWHER=IBWHER+25 G FILERQ
25 ;I $G(IBJOB)=1,IBNOS S ^TMP($J,"IBAMTC","I",+$G(DFN),IBNOS)=""
26FILERQ Q
27 ;
28LAST ; Find Last Billed date, if one exists, for pts. w/o billable events
29 ; Input: DFN, IBADMDT Output: IBBDT (if past event exists)
30 N IBD,IBDATE,IBTEMP,J,DA S IBD=IBADMDT\1,J=-9999999,(IBDATE,DA)=0
31 F S J=$O(^IB("AFDT",DFN,J)) Q:'J!(-J<IBD) D
32 . F S DA=$O(^IB("AFDT",DFN,J,DA)) Q:'DA D
33 .. I $P($G(^IB(DA,0)),"^",8)["ADMISSION" S IBTEMP=$P(^(0),"^",18) D
34 ... I 'IBDATE S IBDATE=IBTEMP Q
35 ... I IBTEMP>IBDATE S IBDATE=IBTEMP
36 I IBDATE S X=IBDATE D H^%DTC S IBBDT=%H+1
37 Q
38 ;
39DIEM() ; Find the earliest date for which the per diem charge may be billed.
40 Q $S($P($G(^IBE(350.9,1,0)),"^",12):$P(^(0),"^",12),1:9999999)
41 ;
42SECT(FTS) ; Find the billable bedsection.
43 ; Input: Facility Treating Specialty (IEN from file #45.7)
44 ; Returned: Billable bedsection from file 399.1 (MCCR UTILITY), or
45 ; 0 if the specialty does not have a corresp. bedsection
46 S FTS=$P($G(^DIC(42.4,+$P($G(^DIC(45.7,+FTS,0)),"^",2),0)),"^",5)
47 Q $S(FTS]"":+$O(^DGCR(399.1,"B",FTS,0)),1:0)
48 ;
49CONT(DFN) ; Find continuous patient discharge date.
50 ; Input: DFN Returned: 0 - not continuous
51 ; 9999999 - still continuous, or
52 ; actual discharge date from continuous stay
53 N X S X=0
54 I $O(^IBE(351.1,"B",DFN,0)) S X=$P($G(^IBE(351.1,+$O(^(0)),0)),"^",2) S:'X X=9999999
55 Q X
56 ;
57STD(DFN) ; Is the patient's A/R Statement date 4 days from now?
58 ; Input: DFN Returned: Statement date in 4 days? (1 - yes, 0 - no)
59 S X1=DT,X2=4 D C^%DTC
60 Q $$PST^PRCAFN(DFN_";DPT(")=+$E(X,6,7)
61 ;
62OE(DGPMDA) ; Was the patient admitted for Observation & Examination?
63 ; Input: DGPMDA - pointer to 0th node of pt mvt (adm) in file #405
64 ; Returned: O&E Admission? (1 - yes, 0 - no)
65 N AR,SOA,DGPM0
66 S DGPM0=$G(^DGPM(+DGPMDA,0))
67 S AR=+$P(DGPM0,"^",12),SOA=+$G(^DGPT(+$P(DGPM0,"^",16),101))
68 Q $D(^DIC(43.4,"D",17.45,AR))!($D(^DIC(45.1,"B","1T",SOA)))
69 ;
70ASIH(PM) ; Is patient movement an ASIH movement?
71 ; Input: PM - 0th node of patient movement in file #405
72 ; Returned: ASIH Movement? (1 - yes, 0 - no)
73 Q "^13^14^40^41^42^43^44^45^46^47^"[("^"_$P($G(PM),"^",18)_"^")
74 ;
75CVA(DFN) ; Is CHAMPVA the patient's Primary Eligibility?
76 ; Input: DFN Returned: Prim Elig = CHAMPVA? (1 - yes, 0 - no)
77 Q $P($G(^DIC(8,+$G(^DPT(+$G(DFN),.36)),0)),"^",9)=12
Note: See TracBrowser for help on using the repository browser.