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