source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IB20P202.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 7.8 KB
Line 
1IB20P202 ;WOIFO/AAT-GMT IB PART 3 POST-INSTALL ;24-OCT-02
2 ;;2.0;INTEGRATED BILLING;**202**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 Q
6 ;
7POST ;Post-Install procedure
8 ;
9 K ^TMP($J,"IB20P202")
10 D PRNMSG ; Print message to the user
11 D RELALL ; Force conversion for all remaining patients
12 ; Remove temporary global nodes
13 K ^XTMP("IB GMT CONVERSION")
14 K ^IB("AGMT")
15 K ^IB("AGMTP")
16 K ^TMP($J,"IB20P202")
17 Q
18 ;
19 ; Add the patient to the log message
20ADDPAT(DFN,IBRES,IBNUM) N IBPT,IBSTA
21 S IBPT=$P($G(^DPT(DFN,0)),U) ;Patient's name
22 S IBSTA=$P($$LST^DGMTU(DFN),"^",3) ;Patient's Copayment Status
23 S IBSTA=$E(IBSTA,1,20),IBSTA=IBSTA_$J("",20-$L(IBSTA))
24 D ADDLN($J(IBNUM,3)_" "_IBPT_$J("",30-$L(IBPT))_" "_IBSTA_" "_(+IBRES)_" Charge"_$S(IBRES=1:"",1:"s"))
25 Q
26 ;
27 ;Add a line to the text array
28ADDLN(IBTXT) N IBC
29 D MES^XPDUTL(" "_$G(IBTXT))
30 S IBC=$O(^TMP($J,"IB20P202",""),-1)+1
31 S ^TMP($J,"IB20P202",IBC)=$G(IBTXT," ")
32 Q
33 ;
34RELALL ;Release all remaining held charges off hold;
35 N DFN,IBRES,IBNUM,XMSUB,XMY,XMDUZ,XMTEXT,XMGROUP,DIFROM
36 D ADDLN("Geographic Means Test Clean-up, patch IB*2.0*202 post-install procedure.")
37 D ADDLN("During the GMT IB Clean-up procedure all Inpatient Means Test charges, placed")
38 D ADDLN("ON HOLD (RATE) since October 1, 2002, will be released and passed to the")
39 D ADDLN("Accounts Receivable package.")
40 D ADDLN("For patients with 'GMT COPAY REQUIRED' status charges will be recalculated.")
41 D ADDLN("Process started on "_$$NOW())
42 D ADDLN()
43 D ADDLN("Searching and processing patients, who did not pass the GMT conversion...")
44 D ADDLN()
45 S IBNUM=0
46 S DFN=0 F S DFN=$O(^IB("AGMTP",DFN)) Q:'DFN D
47 . S IBRES=$$RELHOLD(DFN)
48 . S IBNUM=IBNUM+1
49 . D ADDPAT(DFN,IBRES,IBNUM)
50 I IBNUM=0 D ADDLN("none found.")
51 I $D(^IB("AC",20)) D FORCEREL ; Force releasing of hold charges on hold (rate)
52 D ADDLN()
53 D ADDLN("Process finished at "_$$NOW())
54 D ADDLN()
55 I $D(^IB("AC",20)) D
56 . D ADDLN("Some charges still remain on hold (rate), they may be not related to GMT.")
57 . D ADDLN("Use 'List Charges Awaiting New Copay Rate' menu option to make sure, that ")
58 . D ADDLN("there is no GMT-related charges, placed on hold, because of unknown rate.")
59 I IBNUM>0 D ADDLN(),ADDLN("Use the 'Means Test Single Patient Billing Profile' report to review charges.")
60 ;
61 ; Send log message to IB MEANS TEST mail group.
62 S XMSUB="GEOGRAPHIC MEANS TEST CLEAN-UP PROCEDURE"
63 S XMDUZ="PATCH IB*2.0*202 POST-INIT"
64 S XMGROUP=$$GET1^DIQ(350.9,"1,",.11) ; Means Test billing Group
65 S XMY(DUZ)="" ; Send the message to the user (at least)
66 I XMGROUP'="" S XMY("G."_XMGROUP)=""
67 S XMTEXT="^TMP($J,""IB20P202"","
68 ;
69 D ^XMD
70 Q
71 ;
72FORCEREL ; Force releasing remaining charges on hold (rate)
73 N IBACT,IBCNT
74 S IBCNT=0
75 S IBACT=0 F S IBACT=$O(^IB("AC",20,IBACT)) Q:'IBACT I $$RELCRG(IBACT) S IBCNT=IBCNT+1
76 I IBCNT D ADDLN(IBCNT_" inpatient charges were released off hold additionally.")
77 Q
78 ;
79 ;Perform "conversion" for the given patient
80RELHOLD(DFN) N IBACT,IBDT,X,IBLIMIT,IBCNT
81 S DFN=+DFN
82 S IBLIMIT=$$PLUS($$GMTEFD^IBAGMT(),-30)
83 S IBCNT=0
84 ;For each Patient's IB Action starting from the last, back to the GMT Effective Date:
85 S IBDT="" F S IBDT=$O(^IB("APTDT",DFN,IBDT),-1) Q:IBDT="" Q:IBDT<IBLIMIT D
86 . S IBACT="" F S IBACT=$O(^IB("APTDT",DFN,IBDT,IBACT),-1) Q:'IBACT S IBCNT=IBCNT+$$RELCRG(IBACT)
87 K ^IB("AGMTP",DFN) ; Remove the flag
88 Q IBCNT
89 ;
90 ;
91 ; Release/recalculate the single charge
92 ; Also adjust MT Billing Clock Data, if this is a Copay charge.
93 ; Input: IB ACTION IEN
94 ; Output: 1 - Processed, 0 - Charge does not need to be processed (or error)
95RELCRG(IBACT) N DFN,IBZ,IBSTA,IBDT,IBCRG,IBNOS,IBSEQNO,IBDUZ,IBFDA,IBGMT,Y,IBCLK,IB90D,IBCLKZ,IBAMT,IBATYP
96 S IBZ=$G(^IB(IBACT,0)) Q:IBZ="" 0 ;Corrupted cross-reference
97 S DFN=$P(IBZ,U,2)
98 S IBSTA=$P(IBZ,U,5) I IBSTA'=20,IBSTA'=1 Q 0 ;Not a 'HOLD-RATE' and not an 'INCOMPLETE'
99 S IBATYP=+$P(IBZ,U,3) ; IB Action Type
100 S IBDT=$P(IBZ,U,14) ; Date Billed From
101 I IBDT<$$GMTEFD^IBAGMT() Q 0 ;Never touch charges 'billed from' before the GMT Effective Date
102 I '$$ISGMTTYP^IBAGMT(IBATYP) Q 0 ;Not a MT Inpatient charge
103 S X="RCERR^IB20P202",@^%ZOSF("TRAP")
104 S IBCRG=$P(IBZ,U,7) ;Charge Amount
105 S IBGMT=$$ISGMTPT^IBAGMT(DFN,IBDT) ; GMT Status for the patient
106 ;Recalculate the charge
107 I IBGMT>0,'$P(^IB(IBACT,0),U,21) D ;If the patient has GMT Copayment Status
108 . S $P(^IB(IBACT,0),U,7)=$$REDUCE^IBAGMT(IBCRG) ;Reduce the amount to 20%
109 . S $P(^IB(IBACT,0),U,21)=1 ;Mark the charge as GMT RELATED
110 . Q:'$G(^IB("AGMT",IBACT)) ; Quit if that is not COPAY charge.
111 . ; The temporary node "AGMT" exists only for Inpatient Copay Charges.
112 . ; Adjusting MT Billing Clock Amount
113 . S IBCLK=+$P(^IB("AGMT",IBACT),U),IB90D=+$P(^(IBACT),U,2) Q:IB90D<1 Q:IB90D>4
114 . S IBCLKZ=$G(^IBE(351,IBCLK,0)) Q:IBCLKZ=""
115 . S IBAMT=+$P(IBCLKZ,"^",4+IB90D) S IBAMT=IBAMT-IBCRG+$$REDUCE^IBAGMT(IBCRG) S:IBAMT<0 IBAMT=0
116 . S $P(^IBE(351,IBCLK,0),U,4+IB90D)=IBAMT
117 K ^IB("AGMT",IBACT) ; Remove temporary node
118 ; Now pass the held charge to the AR package (Incomplete charges will not be released)
119 I IBSTA'=1 S IBNOS=IBACT,IBSEQNO=$P($G(^IBE(350.1,IBATYP,0)),U,5) S:IBSEQNO="" IBSEQNO=1 S IBDUZ=DUZ D ^IBR I Y<0 D ERRMSG(IBACT,$P(Y,U,2,99))
120 I IBGMT'>0,IBSTA=1 Q 0 ; Incomplete charges for non-GMT patients
121 Q 1
122 ;
123RCERR N IBERR ;Error trapping for RELCRG
124 S IBERR=$$EC^%ZOSV
125 D ^%ZTER
126 D ERRMSG(IBACT,"Program Error "_IBERR)
127 Q 0
128 ;
129PLUS(IBDT,IBDAYS) N X,X1,X2,%H
130 S X1=IBDT,X2=IBDAYS
131 D C^%DTC
132 Q X
133 ;
134 ; Send error message to IB MEANS TEST group.
135 ; "Please review the IB ACTION"
136ERRMSG(IBACT,IBERR) N IBTXT,XMSUB,XMY,XMDUZ,XMTEXT,XMGROUP,DIFROM,IBGRP,IBI,DFN,IBPT,IBZ,IBC,IBDT,IBATYP
137 S XMSUB="IB GMT CLEAN-UP ERROR"
138 S XMDUZ="PATCH IB*2.0*202 POST-INIT"
139 S XMGROUP=$$GET1^DIQ(350.9,"1,",.11) ; Means Test billing Group
140 I XMGROUP="" S XMGROUP=DUZ ; No billing groups defined - send to the user
141 E S XMGROUP="G."_XMGROUP
142 S XMTEXT="IBTXT(",XMY(XMGROUP)=""
143 ;
144 S IBZ=$G(^IB(IBACT,0))
145 S DFN=$P(IBZ,U,2),IBPT=$P($G(^DPT(DFN,0)),U)
146 S IBDT=$P(IBZ,U,14),IBATYP=+$P(IBZ,U,3)
147 S IBC=0
148 S IBC=IBC+1,IBTXT(IBC)="The Geographic Means Test software failed to process the Inpatient Means Test"
149 S IBC=IBC+1,IBTXT(IBC)="charge IEN "_IBACT_", placed on HOLD - RATE (or Incomplete) after the GMT Effective Date."
150 S IBC=IBC+1,IBTXT(IBC)=" "
151 S IBC=IBC+1,IBTXT(IBC)="The error occurred when trying to pass the charge to Accounts Receivable."
152 S IBC=IBC+1,IBTXT(IBC)="Please review the IB ACTION IEN "_IBACT_"."
153 S IBC=IBC+1,IBTXT(IBC)=" "
154 I $G(IBERR)'="" D
155 . S IBC=IBC+1,IBTXT(IBC)="Error code: "_IBERR
156 . S IBC=IBC+1,IBTXT(IBC)=" "
157 S IBC=IBC+1,IBTXT(IBC)="DIAGNOSTIC INFORMATION:"
158 S IBC=IBC+1,IBTXT(IBC)="Patient: "_IBPT
159 S IBC=IBC+1,IBTXT(IBC)="IB Action IEN: "_IBACT_", Date billed from: "_$$DAT($P(IBZ,"^",14))_", Date billed to: "_$$DAT($P(IBZ,"^",15))
160 S IBC=IBC+1,IBTXT(IBC)="IB Action Type: "_$E($$ACTNM^IBOUTL(IBATYP),1,30)
161 S IBC=IBC+1,IBTXT(IBC)="Total Charge Amount: "_$J($P(IBZ,U,7),"",2)_", The charge is "_$S($P(IBZ,U,21):"",1:"not ")_"marked as GMT Related."
162 I '$P(IBZ,U,21),IBDT'<$$GMTEFD^IBAGMT(),$$ISGMTTYP^IBAGMT(IBATYP),$$ISGMTPT^IBAGMT(DFN,IBDT)>0 D
163 . S IBC=IBC+1,IBTXT(IBC)="The amount must be decreased to 20% of initial value (GMT rate)."
164 . I '$P(IBZ,U,21) S IBC=IBC+1,IBTXT(IBC)="The charge is supposed to be GMT Related."
165 ;
166 D ^XMD
167 Q
168 ;
169 ;
170DAT(IBDT) ; Convert FM date to (mm/dd/yy) format.
171 I 'IBDT Q ""
172 Q $$FMTE^XLFDT(IBDT,"2MZ")
173 ;
174NOW() N %,%H,%I,X,Y
175 D NOW^%DTC S Y=%
176 D DD^%DT
177 S Y=$P(Y,"@")_" at "_$P(Y,"@",2)
178 Q Y
179 ;
180PRNMSG ;
181 N IBTXT
182 S IBTXT(1)=""
183 S IBTXT(2)=" Geographic Means Test, IB Part 3, Post-Install Starting"
184 S IBTXT(3)=""
185 S IBTXT(4)=" The procedure will find, adjust and bill all remaining"
186 S IBTXT(5)=" GMT-related IB charges, placed on hold since 10/1/2002,"
187 S IBTXT(6)=" because of unknown rate."
188 S IBTXT(7)=""
189 S IBTXT(8)=" The process will take some time ..."
190 S IBTXT(9)=""
191 D MES^XPDUTL(.IBTXT)
192 Q
Note: See TracBrowser for help on using the repository browser.