minor fix in hover for prior commit
[openemr.git] / interface / billing / era_payments.php
blob782b1143897506bf3a7c6cddb8b9cb6277abf138
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2010 Z&H Consultancy Services Private Limited <sam@zhservices.com>
4 //
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 //
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Paul Simon K <paul@zhservices.com>
26 // +------------------------------------------------------------------------------+
27 //===============================================================================
28 //Electronic posting is handled here.
29 //===============================================================================
30 require_once("../globals.php");
31 require_once("$srcdir/patient.inc");
32 require_once("$srcdir/invoice_summary.inc.php");
33 require_once($GLOBALS['OE_SITE_DIR'] . "/statement.inc.php");
34 require_once("$srcdir/parse_era.inc.php");
35 require_once("$srcdir/sl_eob.inc.php");
36 require_once("$srcdir/formatting.inc.php");
37 //===============================================================================
38 // This is called back by parse_era() if we are processing X12 835's.
39 $alertmsg = '';
40 $where = '';
41 $eraname = '';
42 $eracount = 0;
43 $Processed=0;
44 function era_callback(&$out) {
45 global $where, $eracount, $eraname;
46 ++$eracount;
47 $eraname = $out['gs_date'] . '_' . ltrim($out['isa_control_number'], '0') .
48 '_' . ltrim($out['payer_id'], '0');
49 list($pid, $encounter, $invnumber) = slInvoiceNumber($out);
50 if ($pid && $encounter) {
51 if ($where) $where .= ' OR ';
52 $where .= "( f.pid = '$pid' AND f.encounter = '$encounter' )";
55 //===============================================================================
56 // Handle X12 835 file upload.
57 if ($_FILES['form_erafile']['size']) {
58 $tmp_name = $_FILES['form_erafile']['tmp_name'];
59 // Handle .zip extension if present. Probably won't work on Windows.
60 if (strtolower(substr($_FILES['form_erafile']['name'], -4)) == '.zip') {
61 rename($tmp_name, "$tmp_name.zip");
62 exec("unzip -p $tmp_name.zip > $tmp_name");
63 unlink("$tmp_name.zip");
65 $alertmsg .= parse_era($tmp_name, 'era_callback');
66 $erafullname = $GLOBALS['OE_SITE_DIR'] . "/era/$eraname.edi";
67 if (is_file($erafullname)) {
68 $alertmsg .= xl("Warning").': '. xl("Set").' '.$eraname.' '. xl("was already uploaded").' ';
69 if (is_file($GLOBALS['OE_SITE_DIR'] . "/era/$eraname.html"))
71 $Processed=1;
72 $alertmsg .= xl("and processed.").' ';
74 else
75 $alertmsg .= xl("but not yet processed.").' ';;
77 rename($tmp_name, $erafullname);
78 } // End 835 upload
79 //===============================================================================
80 $DateFormat=DateFormatRead();
81 //===============================================================================
83 <html>
84 <head>
85 <?php if (function_exists('html_header_show')) html_header_show(); ?>
87 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
88 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
90 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
91 <link rel="stylesheet" type="text/css" href="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
92 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
93 <script type="text/javascript" src="../../library/textformat.js"></script>
94 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
95 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
96 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
97 <script type="text/javascript" src="../../library/dialog.js"></script>
98 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
99 <?php include_once("{$GLOBALS['srcdir']}/ajax/payment_ajax_jav.inc.php"); ?>
100 <script type="text/javascript" src="../../library/js/common.js"></script>
101 <script type="text/javascript" src="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
102 <script language='JavaScript'>
103 var mypcc = '1';
104 </script>
105 <script type="text/javascript" language="javascript" >
106 function Validate()
108 if(document.getElementById('uploadedfile').value=='')
110 alert("<?php echo htmlspecialchars( xl('Please Choose a file'), ENT_QUOTES) ?>");
111 return false;
113 if(document.getElementById('hidden_type_code').value=='')
115 alert("<?php echo htmlspecialchars( xl('Select Insurance, by typing'), ENT_QUOTES) ?>");
116 document.getElementById('type_code').focus();
117 return false;
119 if(document.getElementById('hidden_type_code').value!=document.getElementById('div_insurance_or_patient').innerHTML)
121 alert("<?php echo htmlspecialchars( xl('Take Insurance, from Drop Down'), ENT_QUOTES) ?>");
122 document.getElementById('type_code').focus();
123 return false;
125 top.restoreSession();
126 document.forms[0].submit();
128 function OnloadAction()
129 {//Displays message after upload action,and popups the details.
130 after_value=document.getElementById('after_value').value;
131 if(after_value!='')
133 alert(after_value);
135 <?php
136 if ($_FILES['form_erafile']['size']) {
138 var f = document.forms[0];
139 var debug = <?php echo htmlspecialchars($_REQUEST['form_without']*1);?> ;
140 var paydate = f.check_date.value;
141 var post_to_date = f.post_to_date.value;
142 var deposit_date = f.deposit_date.value;
143 window.open('sl_eob_process.php?eraname=<?php echo htmlspecialchars($eraname); ?>&debug=' + debug + '&paydate=' + paydate + '&post_to_date=' + post_to_date + '&deposit_date=' + deposit_date + '&original=original' + '&InsId=<?php echo htmlspecialchars(formData('hidden_type_code')); ?>' , '_blank');
144 return false;
145 <?php
149 </script>
150 <script language="javascript" type="text/javascript">
151 document.onclick=HideTheAjaxDivs;
152 </script>
153 <style>
154 #ajax_div_insurance {
155 position: absolute;
156 z-index:10;
157 background-color: #FBFDD0;
158 border: 1px solid #ccc;
159 padding: 10px;
161 .bottom{border-bottom:1px solid black;}
162 .top{border-top:1px solid black;}
163 .left{border-left:1px solid black;}
164 .right{border-right:1px solid black;}
165 </style>
166 </head>
167 <body class="body_top" onLoad="OnloadAction()">
168 <form enctype="multipart/form-data" method='post' action='era_payments.php' style="display:inline" >
169 <table width="455" border="0" cellspacing="0" cellpadding="0">
170 <tr>
171 <td colspan="3" align="left"><b><?php echo htmlspecialchars( xl('Payments'), ENT_QUOTES) ?></b></td>
172 </tr>
173 <tr height="15">
174 <td colspan="3" align="left" ></td>
175 </tr>
176 <tr>
177 <td colspan="3" align="left">
178 <ul class="tabNav">
179 <li><a href='new_payment.php'><?php echo htmlspecialchars( xl('New Payment'), ENT_QUOTES) ?></a></li>
180 <li><a href='search_payments.php'><?php echo htmlspecialchars( xl('Search Payment'), ENT_QUOTES) ?></a></li>
181 <li class='current'><a href='era_payments.php'><?php echo htmlspecialchars( xl('ERA Posting'), ENT_QUOTES) ?></a></li>
182 </ul> </td>
183 </tr>
184 <tr>
185 <td colspan="3" align="left" >
186 <table width="455" border="0" cellspacing="0" cellpadding="10" bgcolor="#DEDEDE"><tr><td>
187 <table width="435" border="0" style="border:1px solid black" cellspacing="0" cellpadding="0">
188 <tr height="5">
189 <td width="5" align="left" ></td>
190 <td width="85" align="left" ></td>
191 <td width="105" align="left" ></td>
192 <td width="240" align="left" ></td>
193 </tr>
194 <tr>
195 <td align="left"></td>
196 <td colspan="3" align="left"><font class='title'><?php echo htmlspecialchars( xl('ERA'), ENT_QUOTES) ?></font></td>
197 </tr>
198 <tr height="5">
199 <td align="left" ></td>
200 <td colspan="3" align="left" ></td>
201 </tr>
202 <tr>
203 <td align="left" class="text"></td>
204 <td align="left" class="text"><?php echo htmlspecialchars( xl('Date'), ENT_QUOTES).':' ?></td>
205 <td align="left" class="text"><input type='text' size='6' name='check_date' id='check_date' value="<?php echo formData('check_date') ?>" class="class1 text " onKeyDown="PreventIt(event)" />
206 <img src='../../interface/main/calendar/modules/PostCalendar/pntemplates/default/images/new.jpg' align='texttop'
207 id='img_checkdate' border='0' alt='[?]' style='cursor:pointer'
208 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>' />
209 <script>
210 Calendar.setup({inputField:"check_date", ifFormat:"<?php echo $DateFormat; ?>", button:"img_checkdate"});
211 </script></td>
212 <td align="left" class="text"><input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
213 <input name="form_erafile" id="uploadedfile" type="file" class="text" size="10" style="display:inline" /></td>
214 </tr>
215 <tr>
216 <td align="left" class="text"></td>
217 <td align="left" class="text"><?php echo htmlspecialchars( xl('Post To Date'), ENT_QUOTES).':' ?></td>
218 <td align="left" class="text"><input type='text' size='6' name='post_to_date' id='post_to_date' value="<?php echo formData('post_to_date') ?>" class="class1 text " onKeyDown="PreventIt(event)" />
219 <img src='../../interface/main/calendar/modules/PostCalendar/pntemplates/default/images/new.jpg' align='texttop'
220 id='img_post_to_date' border='0' alt='[?]' style='cursor:pointer'
221 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>' />
222 <script>
223 Calendar.setup({inputField:"post_to_date", ifFormat:"<?php echo $DateFormat; ?>", button:"img_post_to_date"});
224 </script></td>
225 <td align="left" class="text"><input type='checkbox' name='form_without' value='1' <?php echo $_REQUEST['form_without']*1==1 || ($_REQUEST['form_without']*1==0 && !isset($_FILES['form_erafile'])) ? "checked" : '' ?>/> <?php echo htmlspecialchars( xl('Without Update'), ENT_QUOTES); ?></td>
226 </tr>
227 <tr>
228 <td align="left" class="text"></td>
229 <td align="left" class="text"><?php echo htmlspecialchars( xl('Deposit Date'), ENT_QUOTES).':' ?></td>
230 <td align="left" class="text"><input type='text' size='6' name='deposit_date' id='deposit_date' onKeyDown="PreventIt(event)" class="text " value="<?php echo formData('deposit_date') ?>" />
231 <img src='../../interface/main/calendar/modules/PostCalendar/pntemplates/default/images/new.jpg' align='texttop'
232 id='img_depositdate' border='0' alt='[?]' style='cursor:pointer'
233 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>' />
234 <script>
235 Calendar.setup({inputField:"deposit_date", ifFormat:"<?php echo $DateFormat; ?>", button:"img_depositdate"});
236 </script></td>
237 <td align="left" class="text"></td>
238 </tr>
239 <tr>
240 <td align="left" class="text"></td>
241 <td align="left" class="text"><?php echo htmlspecialchars( xl('Insurance'), ENT_QUOTES).':' ?></td>
242 <td colspan="2" align="left" class="text">
245 <table width="335" border="0" cellspacing="0" cellpadding="0">
246 <tr>
247 <td width="280">
248 <input type="hidden" id="hidden_ajax_close_value" value="<?php echo formData('type_code') ?>" /><input name='type_code' id='type_code' class="text "
249 style=" width:280px;" onKeyDown="PreventIt(event)" value="<?php echo formData('type_code') ?>" autocomplete="off" /><br>
250 <!--onKeyUp="ajaxFunction(event,'non','search_payments.php');"-->
251 <div id='ajax_div_insurance_section'>
252 <div id='ajax_div_insurance_error'>
253 </div>
254 <div id="ajax_div_insurance" style="display:none;"></div>
255 </div>
256 </div>
258 </td>
259 <td width="50" style="padding-left:5px;"><div name="div_insurance_or_patient" id="div_insurance_or_patient" class="text" style="border:1px solid black; padding-left:5px; width:50px; height:17px;"><?php echo formData('hidden_type_code') ?></div><input type="hidden" name="description" id="description" /></td>
260 </tr>
261 </table>
266 </td>
267 </tr>
269 <tr height="5">
270 <td colspan="4" align="center" ><table border="0" cellspacing="0" cellpadding="0">
271 <tr>
272 <td><a href="#" onClick="javascript:return Validate();" class="css_button"><span><?php echo htmlspecialchars( xl('Process ERA File'), ENT_QUOTES);?></span></a></td>
273 </tr>
274 </table></td>
275 </tr>
276 <tr height="5">
277 <td align="left" ></td>
278 <td colspan="3" align="left" ></td>
279 </tr>
280 </table>
281 </td></tr>
282 </table>
283 </td>
284 </tr>
285 </table>
286 <input type="hidden" name="after_value" id="after_value" value="<?php echo htmlspecialchars($alertmsg, ENT_QUOTES);?>"/>
287 <input type="hidden" name="hidden_type_code" id="hidden_type_code" value="<?php echo formData('hidden_type_code') ?>"/>
288 <input type='hidden' name='ajax_mode' id='ajax_mode' value='' />
289 </form>
290 </body>
291 </html>