remove trailing spaces in license blocks.
[openemr.git] / interface / billing / edih_view.php
blob7706ac5bd06d2cd8721b819dab66a43797353ce6
1 <?php
2 /**
3 * edih_view.php
4 *
5 * Copyright 2012 Kevin McCormick Longview, Texas
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; version 3 or later. You should have
15 * received a copy of the GNU General Public License along with this program;
16 * if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * <http://opensource.org/licenses/gpl-license.php>
20 * @author Kevin McCormick
21 * @link: http://www.open-emr.org
22 * @package OpenEMR
23 * @subpackage ediHistory
26 $sanitize_all_escapes=true;
27 $fake_register_globals=false;
28 require_once(dirname(__FILE__) . "/../globals.php");
30 if (!acl_check('acct', 'eob')) die(xlt("Access Not Authorized"));
32 //include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php");
35 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
36 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
37 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
39 <head>
40 <title><?php echo xlt("edi history"); ?></title>
41 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
43 <link rel="stylesheet" href="<?php echo $web_root?>/library/dynarch_calendar.css" type="text/css" />
45 <link rel="stylesheet" href="<?php echo $web_root?>/library/css/jquery-ui-1.8.21.custom.css" type="text/css" />
46 <!-- <link rel="stylesheet" href="<?php echo $web_root?>/library/css/jquery.dataTables.css" type="text/css" /> -->
47 <link rel="stylesheet" href="<?php echo $web_root?>/library/css/edi_history.css" type="text/css" />
49 <script type="text/javascript" src="<?php echo $web_root?>/library/dynarch_calendar.js"></script>
50 <script type="text/javascript" src="<?php echo $web_root?>/library/dynarch_calendar_setup.js"></script>
51 <script type="text/javascript" src="<?php echo $web_root?>/library/textformat.js"></script>
53 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
54 </head>
55 <body>
57 <!-- Begin tabs section -->
58 <div id="tabs" style="visibility:hidden">
59 <ul class="Clear">
60 <li><a href="#newfiles" id="btn-newfiles"><?php echo xlt("New Files"); ?></a></li>
61 <li><a href="#csvdatatables" id="btn-csvdatatables"><?php echo xlt("CSV Tables"); ?></a></li>
62 <li><a href="#erafiles" id="btn-erafiles"><?php echo xlt("ERA Files"); ?></a></li>
63 <li><a href="#x12text" id="btn-x12text"><?php echo xlt("x12 Text"); ?></a></li>
64 <li><a href="#edinotes" id="btn-edinotes"><?php echo xlt("Notes"); ?></a></li>
65 </ul>
68 <div id="newfiles">
69 <table cols=2>
70 <tr vertical-align="middle">
71 <td align="center">
72 <form id='upload_new' action="edi_history_main.php" method="POST" enctype="multipart/form-data">
73 <fieldset>
74 <legend><?php echo xlt("Select one or more files to upload"); ?></legend>
75 <input id="upload_file" type="file" name="fileUplMulti[]" multiple />
76 <input type="submit" name="uplsubmt" value="<?php echo xla("Submit"); ?>" />
77 </fieldset>
78 </form>
79 </td>
80 <td align="center">
81 <form id="process_new" action="edi_history_main.php" method="post">
82 <fieldset>
83 <legend><?php echo xlt("Process new files for CSV records"); ?>:</legend>
84 <input type="checkbox" name="htmlout" checked /> <?php echo xlt("HTML Output?"); ?>
85 <input type="checkbox" name="erronly" checked /> <?php echo xlt("Show Errors Only?"); ?> &nbsp;&nbsp;<br />
86 <input type="hidden" name="NewFiles" value="ProcessNew">
87 <label for="New-Files">Process New Files:</label>
88 <input id="processfiles" name="Process" type="button" value="<?php echo xla("Process"); ?>" />
89 </fieldset>
90 </form>
91 </td>
92 </tr>
93 </table>
95 <div id='srvvals'></div>
96 <div id='pfresult'></div>
97 <div id='clmstat' title="<?php echo xla("Status of Claim"); ?>"></div>
98 <div id='batchclm' title="<?php echo xla("Segments Batch Claim"); ?>"></div>
100 </div>
102 <div id="csvdatatables">
103 <table cols='2'>
104 <tr>
105 <td colspan='4'>
107 <form id="formcsvtables" name="view_csv" action="edi_history_main.php" target="_blank" method="post">
108 <fieldset style='float:left'>
109 <legend><?php echo xlt("View CSV tables"); ?>:</legend>
110 <table cols='4'>
111 <tr>
112 <td colspan='4'>
113 <?php echo xlt("Select a percentage of the rows or or select dates"); ?>
114 </td>
115 </tr>
116 <tr>
117 <td align='center'>
118 <?php echo xlt("Select CSV table"); ?>:
119 </td>
120 <td align='center'>
121 <?php echo xlt("Pct (%) of rows"); ?>
122 </td>
123 <td align='left'>
124 <?php echo xlt("Start Date"); ?>: &nbsp;&nbsp;&nbsp;&nbsp; <?php echo xlt("End Date"); ?>:
125 </td>
126 <td align='center'>
127 <?php echo xlt("Submit"); ?>
128 </td>
129 </tr>
130 <tr height='1.5em'>
131 <td align='center'>
132 <select id='csvselect' name="csvtables">
133 </select>
134 </td>
136 <td align='center'>
137 <select id="csvpct" name="csvpctrows">
138 <option value="5" selected="selected">5%</option>
139 <option value="10">10%</option>
140 <option value="25">25%</option>
141 <option value="50">50%</option>
142 <option value="75">75%</option>
143 <option value="100">100%</option>
144 </select>
145 </td>
146 <!-- datekeyup(e, defcc, withtime) dateblur(e, defcc, withtime) -->
147 <td align='left'>
148 <input type='text' size='8' name='csv_date_start' id='caldte1' value='' title='yyyy-mm-dd Start Date' />
149 <img src="<?php echo $web_root?>/interface/pic/show_calendar.gif" align='absbottom' width='24' height='22'
150 id='csvdate1_cal' border='0' alt='[?]' style='cursor:pointer;cursor:hand' title='Start date'>
152 <input type='text' size='8' name='csv_date_end' id='caldte2' value='' title='yyyy-mm-dd End Date' />
153 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
154 id='csvdate2_cal' border='0' alt='[?]' style='cursor:pointer;cursor:hand' title='End date'>
155 </td>
157 <script type="text/javascript">
158 Calendar.setup({inputField:"caldte1", ifFormat:"%Y-%m-%d", button:"csvdate1_cal"});
159 Calendar.setup({inputField:"caldte2", ifFormat:"%Y-%m-%d", button:"csvdate2_cal"});
160 </script>
161 <!--
162 <td align='left'>
163 <input id="dte1" type="text" size=10 name="csv_date_start" value="" />
164 <input id="dte2" type="text" size=10 name="csv_date_end" value="" />
165 </td>
167 <td align='center'>
168 <input type="hidden" name="csvshowtable" value="gettable">
169 <input id="showtable" type="button" value="<?php echo xla("Submit"); ?>" />
170 </td>
172 </tr>
173 </table>
174 </fieldset>
175 </form>
177 </td>
178 <td colspan='2'>
180 <form id="formcsvhist" name="csv_ch" action="edi_history_main.php" target="_blank" method="get">
181 <fieldset style='float:left'>
182 <legend><?php echo xlt("Per Encounter"); ?></legend>
183 <table cols='2'>
184 <tr>
185 <td colspan='2'>
186 <?php echo xlt("Enter Encounter Number"); ?>
187 </td>
188 </tr>
189 <tr>
190 <td>
191 <?php echo xlt("Encounter"); ?>
192 </td>
193 <td>
194 <?php echo xlt("Submit"); ?>
195 </td>
196 </tr>
197 <tr>
198 <td>
199 <input id="csvenctr" type="text" size=7 name="chenctr" value="" />
200 </td>
201 <td>
202 <input id="showhistory" type="button" value="<?php echo xla("Submit"); ?>" />
203 </td>
204 </tr>
205 </table>
206 </fieldset>
207 </form>
209 </td></tr>
210 </table>
212 <div id='tblshow'></div>
213 <div id='tbclmstat'></div>
214 <div id='tbbatchclm'></div>
215 <div id='tbcodetxt'></div>
216 <div id='tbcsvhist'></div>
218 </div>
220 <div id='erafiles'>
221 <table cols=2>
222 <tr>
223 <td>
224 <form name="view_835" action="edi_history_main.php" target="_blank" enctype="multipart/form-data" method="post">
225 <fieldset style='float:left'>
226 <legend><?php echo xlt("View an x12-835 ERA file"); ?>:</legend>
227 <label for="era_file"><?php echo xlt("Filename"); ?>:</label>
228 <input id="era_file" type="file" size=20 name="fileUplEra" />
229 <input type="submit" name="fileERA" value="<?php echo xla("Submit"); ?>" />
230 </fieldset>
231 </form>
232 </td>
233 <td>
234 <form name="view_ra" action="edi_history_main.php" target="_blank" method="post">
235 <fieldset style='float:left'>
236 <legend><?php echo xlt("RA for Patient, Encounter, or Trace"); ?>:</legend>
237 <label for="pid835"><?php echo xlt("Patient ID"); ?>:</label>
238 <input type="text" size=10 name="pid835" value="" />
239 <input type="submit" name="subpid835" value="<?php echo xla("Submit"); ?>" /> <br />
240 <label for="enctr835"><?php echo xlt("Encounter"); ?>:</label>
241 <input type="text" size=10 name="enctr835" value="" />
242 <input type="submit" name="subenctr835" value="<?php echo xla("Submit"); ?>" /> <br />
243 <label for="trace835"><?php echo xlt("Check No"); ?>:</label>
244 <input type="text" size=10 name="trace835" value="" />
245 <input type="submit" name="subtrace835" value="<?php echo xla("Submit"); ?>" />
246 </fieldset>
247 </form>
248 </td>
249 </tr>
250 </table>
251 </div>
253 <div id="x12text" >
254 <table cols='2'>
255 <tr>
256 <td align='center'>
257 <form name="view_claim" action="edi_history_main.php" target="_blank" method="post">
258 <fieldset>
259 <legend><?php echo xlt("View Batch Claim x12 text"); ?>:</legend>
260 <label for="enctr"><?php echo xlt("Enter Encounter"); ?>:</label>
261 <input type="text" name="enctrbatch" size=10 value="" />
262 <input type="submit" name="Batch-enctr" value="<?php echo xla("Submit"); ?>" />
263 </fieldset>
264 </form>
265 </td>
266 <td align='center'>
267 <form name="view_ansi" action="edi_history_main.php" target="_blank" method="post">
268 <fieldset>
269 <legend><?php echo xlt("View ERA x12 text"); ?></legend>
270 <label for="enctrERA"><?php echo xlt("Enter Encounter"); ?>:</label>
271 <input type="text" name="enctrEra" size=10 value="" />
272 <input type="submit" name="eraText" value="<?php echo xla("Submit"); ?>" />
273 </fieldset>
274 </form>
275 </td>
276 </tr>
277 <tr>
278 <td align='center' colspan='2'>
279 <form name="view_x12" action="edi_history_main.php" target="_blank" enctype="multipart/form-data" method="post">
280 <fieldset>
281 <legend><?php echo xlt("View local x12 file"); ?>:</legend>
282 <label for="x12file"><?php echo xlt("Choose File"); ?>:</label>
283 <input id="x12file" type="file" name="fileUplx12" />
284 <input type="submit" name="fileX12" value="<?php echo xla("Submit"); ?>" />
285 </fieldset>
286 </form>
287 </td>
288 </table>
289 <div id='txtclmstat'></div>
290 <div id='txtbatchclm'></div>
291 <div id='txtera'></div>
293 </div>
295 <div id="edinotes">
296 <table cols='2'>
297 <tr>
298 <td colspan='2'><a href="<?php echo $web_root?>/Documentation/Readme_edihistory.html" target="_blank"><?php echo xlt("View the README file"); ?></a></td>
299 </tr>
300 <tr>
301 <td>
302 <form name="viewlog" action="edi_history_main.php" enctype="multipart/form-data" method="post">
303 <fieldset><legend><?php echo xlt("Inspect the log"); ?></legend>
304 <label for="logfile"><?php echo xlt("View Log"); ?>:</label>
305 <input id="logfile" type="button" value="<?php echo xla("Open"); ?>" />
306 <input id="logClear" type="button" value="<?php echo xla("Close"); ?>" />
307 <input id="logArchive" type="button" value="<?php echo xla("Archive"); ?>" />
308 </fieldset>
309 </form>
310 </td>
311 <td><form name="viewnotes" action="edi_history_main.php" enctype="multipart/form-data" method="post">
312 <fieldset><legend><?php echo xlt("Notes"); ?></legend>
313 <label for="getnotes"><?php echo xlt("Notes"); ?></label>
314 <input id="getnotes" type="button" value="<?php echo xla("Open"); ?>" />
315 <label for="savenotes"><?php echo xlt("Save"); ?></label>
316 <input id="savenotes" type="button" value="<?php echo xla("Save"); ?>" />
317 <label for="closenotes"><?php echo xlt("Close"); ?></label>
318 <input id="closenotes" type="button" value="<?php echo xla("Close"); ?>" />
319 </fieldset>
320 </form>
321 </td>
322 </tr>
323 </table>
325 <div id='logshow'></div>
326 <div id='mynotes'></div>
328 </div>
330 </div>
331 <!-- End tabs section -->
332 <!-- the jquery.dataTables.min.js possibly should be moved to library/js ? -->
333 <script src="<?php echo $web_root?>/library/js/jquery-1.7.2.min.js" type="text/javascript"></script>
334 <script src="<?php echo $web_root?>/library/js/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
335 <script src="<?php echo $web_root?>/library/js/datatables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
337 <script type="text/javascript">
338 $(document).ready(function() {
339 // activate tab interface
340 $("#tabs").tabs();
341 $("#tabs").tabs().css('visibility','visible');
342 $("#tabs").tabs({
343 select: function() {
344 //Reset all these text fields to their default
345 $("input:text, input:file").val(function() {
346 return this.defaultValue;
352 * functions for ajax and popups
354 $('#srvvals').ajaxError(function() {
355 $(this).html( "<?php echo xla("Error retrieving values."); ?>" );
356 });
358 $(function() {
359 $.ajax({
360 url: 'edi_history_main.php',
361 data: { srvinfo: 'yes' },
362 dataType: 'json',
363 success: function(rsp){
364 $('#srvvals').data("mf", rsp.mfuploads);
365 $('#srvvals').html('');
367 });
369 $(function() {
370 $.ajax({
371 url: 'edi_history_main.php',
372 data: { csvtbllist: 'yes' },
373 dataType: 'json',
374 success: function(data) {
375 var options = $('#csvselect').attr('options');
376 var optct = data.length;
377 if (optct) {
378 var options = [];
379 options.push("<option value='' selected='selected'><?php echo xla("Choose from list"); ?></option>");
380 for (var i=0; i<optct; i++) {
381 options.push("<option value=" + data[i].fname + ">" + data[i].desc + "</option>");
383 $("#csvselect").html(options.join(''));
387 });
388 });
389 /* ************
390 * end of document ready() jquery
391 * ************
393 // the process files script html output is requested and displayed,
394 // replacing the tab panel contents
395 // also, the 'success' event calls an array of functions
396 $('#processfiles').click(function() {
397 $.ajax({
398 type: "POST",
399 url: "edi_history_main.php",
400 data: $('#process_new').serialize(),
401 dataType: "html",
402 success: [
403 function(data){ $("#pfresult").html(data); },
404 bindlinks('#pfresult', 'click', '.clmstatus', 'click', '#clmstat', '<?php echo xla("Claim Status"); ?>'),
405 bindlinks('#pfresult', 'click', '.btclm', 'click', '#batchclm', '<?php echo xla("Batch Claim"); ?>')
408 });
410 // list files selected in the multifile upload input
411 $('#upload_file').change(function(){
412 $('#srvvar').html('');
413 $('#pfresult').html('');
414 var fmax = $('#srvvals').data("mf");
415 var far = this.files;
416 var fct = far.length;
417 for(var i = 0; i < fct; i++) {
418 if (i == fmax) $('#pfresult').append("<p><?php echo xla("max file count reached - reload names below"); ?></p>");
419 $('#pfresult').append('file: ' + far[i].name +'<br />');
421 });
422 // submit files for sorting and storage -- accepted/rejected, already uploaded, etc
423 // shows a popup window (idea is to allow comparison with upload files display)
424 $('#upload_new').submit(function() {
425 if (! window.focus) return true;
426 window.open('', 'Uploads', 'height=400,width=600,left=300,top=100,menubar=yes,resizable=yes,scrollbars=yes');
427 this.target='Uploads';
428 return true;
431 $('#csvClear').click(function() {
432 $("#tblshow").html('');
435 $('#logClear').click(function() {
436 $("#logshow").html('');
437 });
439 $('#logArchive').click(function() {
440 $.ajax({
441 type: "GET",
442 url: "edi_history_main.php",
443 data: { archivelog: "yes" },
444 dataType: "html",
445 success: function(data){
446 $("#logshow").html(''),
447 $("#logshow").html($.trim(data));
450 });
452 $('#logfile').click(function() {
453 $.ajax({
454 type: "GET",
455 url: "edi_history_main.php",
456 data: { showlog: "yes" },
457 dataType: "html",
458 success: function(data){ $("#logshow").html($.trim(data)); }
460 });
462 $('#getnotes').click(function() {
463 $('#logshow').html('');
464 $('#mynotes').html('');
465 $.ajax({
466 type:'GET',
467 url: "edi_history_main.php",
468 data: { getnotes: "yes"},
469 dataType: "text",
470 success: function(data){
471 $('#mynotes').html("<H4>Notes:</H4>"
472 + "<textarea id='txtnotes',name='txtnotes',rows='10',cols='600',auotfocus='autofocus'></textarea>"
473 + "<p></p>"
475 // necessary to trim the data since php from script has leading newlines (UTF-8 issue)
476 $('#txtnotes').val($.trim(data));
479 });
481 $('#savenotes').click(function() {
482 var notetxt = $("#txtnotes").val();
483 $.post("edi_history_main.php", { putnotes: "yes", tnotes: notetxt },
484 function(data){ $('#mynotes').append(data); });
487 $('#closenotes').click(function() {
488 $('#mynotes').html('');
491 /* ************
492 * called to bind links in ajax retrieved content for dialog display
493 * .on( events [, selector] [, data], handler(eventObject) )
495 function bindlinks(dElem, dEvt, cClass, cEvt, cElem, mytitle){
496 $(dElem).on(dEvt, cClass, cEvt, function(e) {
497 e.preventDefault();
498 $(cElem).css({'max-height': 372, 'overflow-y': 'auto'});
499 $(this).parentsUntil('tr').parent().siblings().removeClass('outlinetr');
500 $(this).parentsUntil('tr').parent().addClass('outlinetr');
501 $.get($(this).attr('href'), function(data){ $(cElem).html(data); })
502 var statDialog = $(cElem).dialog({
503 autoOpen: false,
504 position: "center",
505 resizable: true,
506 buttons: [{ text: "Close", click: function() { $(this).dialog("close"); } }],
507 modal: false,
508 title: mytitle, //$(this).attr('title'),
509 height: 'auto', //400, maxHeight does not work until resize; css fix is possible
510 width: 'auto'
512 statDialog.dialog('open');
516 // the csv tables are displayed using jquery dataTables plugin
517 // here, the 'success' action is to execute an array of functions
518 // calls the helper function bindlinks() which applies jquery .on method
519 $('#showtable').click(function() {
520 // verify a csv file is selected
521 if ($('#csvselect').val() == '') {
522 $("#tblshow").html('<?php echo xla("No table selected! Select a table."); ?>');
523 return false;
525 $.ajax({
526 type:'POST',
527 url: "edi_history_main.php",
528 data: $('#formcsvtables').serialize(),
529 dataType: "html",
530 success: [
531 function(data){
532 var tbltl = "<div class='csvcptn'>" + $(data).filter('#dttl').html() + "</div>";
533 var mytbl = "<table id='csvTable' class='csvDisplay'>" + $(data).not('#dttl').html() + "</table>";
534 $("#tblshow").html($.trim(mytbl));
535 $('#csvTable').dataTable({
536 DisplayLength: 10,
537 bJQueryUI: true,
538 bScrollInfinite: true,
539 bScrollCollapse: true,
540 iScrollLoadGap: 20,
541 sScrollY: '240px',
542 sScrollX: '90%',
543 sScrollXInner: '100%'
545 $("#csvTable_filter").before(tbltl);
547 bindlinks('#tblshow', 'click', '.clmstatus', 'click', '#tbclmstat', '<?php echo xla("Claim Status"); ?>'),
548 bindlinks('#tblshow', 'click', '.btclm', 'click', '#tbbatchclm', '<?php echo xla("Batch Claim"); ?>'),
549 bindlinks('#tblshow', 'click', '.codeval', 'click', '#tbcodetxt', '<?php echo xla("Code Text"); ?>')
552 });
554 // csv encounter history
555 $('#showhistory').click(function() {
556 $('#tbcsvhist').html('');
557 var chenctr = $('#chenctr').value;
558 var encrecord = $('#tbcsvhist').dialog({
559 buttons: [{ text: "Close", click: function() { $(this).dialog("close"); } }],
560 modal: false,
561 title: "<?php echo xla("Encounter EDI Record"); ?>",
562 height: 416,
563 width: 'auto'
565 $.ajax({
566 type: "GET",
567 url: "edi_history_main.php",
568 data: $('#formcsvhist').serialize(), //{ csvenctr: chenctr },
569 dataType: "html",
570 success: [
571 function(data){ $('#tbcsvhist').html($.trim(data)); },
572 bindlinks('#tbcsvhist', 'click', '.clmstatus', 'click', '#tbclmstat', '<?php echo xla("Claim Status"); ?>'),
573 bindlinks('#tbcsvhist', 'click', '.btclm', 'click', '#tbbatchclm', '<?php echo xla("Batch Claim"); ?>'),
574 bindlinks('#tbcsvhist', 'click', '.codeval', 'click', '#tbcodetxt', '<?php echo xla("Code Text"); ?>'),
575 encrecord.dialog('open')
578 });
580 /* ************
581 * end of javascript block
583 </script>
585 </body>
587 </html>