source: WorldVistAEHR/trunk/r/ENROLLMENT_APPLICATION_SYSTEM-EAS/EASUFNC3.m@ 1438

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1EASUFNC3 ;ALB/CPM/EJG/GN - BILLING TRANSMISSION UTILITIES ; 13-JUN-94 [12/22/03 10:30am]
2 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**23,47**; 21-OCT-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ;IVM Project Interface w/Edb
6 ;
7 ;EAS*1*47 - break up Z09's by Income year, via new "ATR" xref
8 ;
9REV(IVMREF,DFN,IVMCL,IVMTYP,IVMBF,IVMBT,IVMAB,IVMHLD) ; Interface w/ Rev fct.
10 ; Input: IVMREF -- Bill reference number
11 ; DFN -- Pointer to the patient in file #2
12 ; IVMCL -- Bill Classification [ 1-Inpt, 2-Opt ]
13 ; IVMTYP -- Bill Type [ 2-Copayment, 3-Per Diem ]
14 ; IVMBF -- Bill From Date in FM format
15 ; IVMBT -- Bill To Date in FM format
16 ; IVMAB -- Amount Billed
17 ; IVMHLD -- Charge placed on hold? [ 1-Yes, 0-No ]
18 ;
19 ; Output: New entry created in file #301.61
20 ;
21 N IVMTDA,DA,DIK
22 I $G(IVMREF)=""!'$G(DFN) G REVQ
23 S IVMTDA=$O(^IVM(301.61,"B",IVMREF,0))
24 I 'IVMTDA S IVMTDA=$$ADD(IVMREF) I 'IVMTDA G REVQ
25 ;
26 D NOW^%DTC
27 S $P(^IVM(301.61,IVMTDA,0),"^",2,12)=DFN_"^"_IVMCL_"^"_IVMTYP_"^"_IVMBF_"^"_IVMBT_"^"_$S($G(IVMHLD):"",1:DT)_"^"_IVMAB_"^^^^"_$S($G(IVMHLD):0,1:1),$P(^(1),"^",3,4)=%_"^"_DUZ
28 S DA=IVMTDA,DIK="^IVM(301.61," D IX1^DIK
29REVQ Q
30 ;
31ADD(X) ; Add a new entry to file #301.61
32 ; Input: X -- Reference number to be used as the .01 field
33 ; Output: IVM -- Internal entry number to new entry, or 0.
34 ;
35 N DA,DD,DO,DIE,DIC,DLAYGO,IVM,Y
36 I $G(X)="" S IVM=0 G ADDQ
37 S DIC="^IVM(301.61,",DIC(0)="L",DLAYGO=301.61 D FILE^DICN
38 S (DA,IVM)=+Y I DA<0 S IVM=0 G ADDQ
39 ;
40 D NOW^%DTC
41 S DIE=DIC,DR="1.01////"_%_";1.02////"_DUZ D ^DIE
42ADDQ Q IVM
43 ;
44 ;
45CHK(DFN) ; Is the insurance patient recorded in file #301.61?
46 ; Input: DFN -- Pointer to the patient in file #2
47 ; Output: 1 -- Patient recorded in #301.61; otherwise, 0
48 ;
49 Q $O(^IVM(301.61,"C",+$G(DFN),0))>0
50 ;
51 ;
52FT1(IVMTDA) ; Entry point to build FT1 segment from file #301.61
53 ; Input: IVMTDA -- Pointer to the transmission record in #301.61
54 ; The HL7 variables HLFS, HLQ and HLECH must also be defined
55 ; Output: String in the form of the HL7 FT1 segment
56 ;
57 N IVMN,IVMY,IVMSEP
58 I '$G(IVMTDA) G FT1Q
59 S IVMN=$G(^IVM(301.61,IVMTDA,0)) I IVMN="" G FT1Q
60 S IVMSEP=$E(HLECH)
61 ;
62 S $P(IVMY,HLFS,1)=1 ; set id
63 S $P(IVMY,HLFS,4)=$S($P(IVMN,"^",7):$$HLDATE^HLFNC($P(IVMN,"^",7)),1:HLQ) ; date generated
64 S $P(IVMY,HLFS,6)=$S($P(IVMN,"^",11):2,$P(IVMN,"^",10)&$P(IVMN,"^",13):4,$P(IVMN,"^",9)&$P(IVMN,"^",13):3,1:1) ; transaction type
65 S $P(IVMY,HLFS,7)=$P(IVMN,"^") ; transaction code
66 ;
67 ; - build extended transaction description
68 S $P(IVMY,HLFS,9)=$P(IVMN,"^",3)_IVMSEP_$P(IVMN,"^",4)_IVMSEP_$S($P(IVMN,"^",5):$$HLDATE^HLFNC($P(IVMN,"^",5)),1:HLQ)_IVMSEP_$S($P(IVMN,"^",6):$$HLDATE^HLFNC($P(IVMN,"^",6)),1:HLQ)
69 ;
70 ; - build extended transaction amount
71 S $P(IVMY,HLFS,11)=$S($P(IVMN,"^",10)&$P(IVMN,"^",13):+$P(IVMN,"^",9),$P(IVMN,"^",9)&$P(IVMN,"^",13):$P(IVMN,"^",9),1:"") ;Amount Collected
72 S $P(IVMY,HLFS,12)=$P(IVMN,"^",8) ;Amount Billed
73 ;
74FT1Q Q "FT1"_HLFS_$G(IVMY)
75 ;
76SETATR(DA,DFN) ; Mumps cross reference add logic ;EAS*1*47
77 Q:'DFN
78 N ICYR,TSTDT
79 S TSTDT=$P($G(^IVM(301.61,DA,0)),"^",5)
80 Q:TSTDT'>0
81 ;find last MT date via Billing From Date
82 S ICYR=$P($$LST^DGMTU(DFN,TSTDT,1),"^",2)
83 ;calculate income year
84 S ICYR=$E(ICYR,1,3)-1_"0000"
85 Q:ICYR'>0
86 ;set if xmit is Yes
87 S:$P($G(^IVM(301.61,DA,0)),"^",12) ^IVM(301.61,"ATR",ICYR,DFN,DA)=""
88 Q
89KILLATR(DA,DFN) ; Mumps cross reference kill logic ;EAS*1*47
90 Q:'DFN
91 N ICYR,TSTDT
92 S TSTDT=$P($G(^IVM(301.61,DA,0)),"^",5)
93 ;find last MT date for Billing From Date
94 S ICYR=$P($$LST^DGMTU(DFN,TSTDT,1),"^",2)
95 ;calculate income year
96 S ICYR=$E(ICYR,1,3)-1_"0000"
97 K ^IVM(301.61,"ATR",ICYR,DFN,DA)
98 Q
Note: See TracBrowser for help on using the repository browser.