5 * Copyright 2012 Kevin McCormick Longview, Texas
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
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">
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"); ?
>
57 <!-- Begin tabs section
-->
58 <div id
="tabs" style
="visibility:hidden">
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
>
70 <tr vertical
-align
="middle">
72 <form id
='upload_new' action
="edi_history_main.php" method
="POST" enctype
="multipart/form-data">
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
"); ?>" />
81 <form id
="process_new" action
="edi_history_main.php" method
="post">
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?"); ?
>  
; 
;<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
"); ?>" />
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
>
102 <div id
="csvdatatables">
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
>
113 <?php
echo xlt("Select a percentage of the rows or or select dates"); ?
>
118 <?php
echo xlt("Select CSV table"); ?
>:
121 <?php
echo xlt("Pct (%) of rows"); ?
>
124 <?php
echo xlt("Start Date"); ?
>:  
; 
; 
; 
; <?php
echo xlt("End Date"); ?
>:
127 <?php
echo xlt("Submit"); ?
>
132 <select id
='csvselect' name
="csvtables">
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
>
146 <!-- datekeyup(e
, defcc
, withtime
) dateblur(e
, defcc
, withtime
) -->
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'>
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"});
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
="" />
168 <input type
="hidden" name
="csvshowtable" value
="gettable">
169 <input id
="showtable" type
="button" value
="<?php echo xla("Submit
"); ?>" />
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
>
186 <?php
echo xlt("Enter Encounter Number"); ?
>
191 <?php
echo xlt("Encounter"); ?
>
194 <?php
echo xlt("Submit"); ?
>
199 <input id
="csvenctr" type
="text" size
=7 name
="chenctr" value
="" />
202 <input id
="showhistory" type
="button" value
="<?php echo xla("Submit
"); ?>" />
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
>
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
"); ?>" />
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
"); ?>" />
257 <form name
="view_claim" action
="edi_history_main.php" target
="_blank" method
="post">
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
"); ?>" />
267 <form name
="view_ansi" action
="edi_history_main.php" target
="_blank" method
="post">
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
"); ?>" />
278 <td align
='center' colspan
='2'>
279 <form name
="view_x12" action
="edi_history_main.php" target
="_blank" enctype
="multipart/form-data" method
="post">
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
"); ?>" />
289 <div id
='txtclmstat'></div
>
290 <div id
='txtbatchclm'></div
>
291 <div id
='txtera'></div
>
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
>
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
"); ?>" />
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
"); ?>" />
325 <div id
='logshow'></div
>
326 <div id
='mynotes'></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
341 $
("#tabs").tabs().css('visibility','visible');
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
."); ?>" );
360 url
: 'edi_history_main.php',
361 data
: { srvinfo
: 'yes' },
363 success
: function(rsp
){
364 $
('#srvvals').data("mf", rsp
.mfuploads
);
365 $
('#srvvals').html('');
371 url
: 'edi_history_main.php',
372 data
: { csvtbllist
: 'yes' },
374 success
: function(data
) {
375 var options
= $
('#csvselect').attr('options');
376 var optct
= data
.length
;
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(''));
390 * end of document ready() jquery
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() {
399 url
: "edi_history_main.php",
400 data
: $
('#process_new').serialize(),
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"); ?>')
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 />');
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';
431 $
('#csvClear').click(function() {
432 $
("#tblshow").html('');
435 $
('#logClear').click(function() {
436 $
("#logshow").html('');
439 $
('#logArchive').click(function() {
442 url
: "edi_history_main.php",
443 data
: { archivelog
: "yes" },
445 success
: function(data
){
446 $
("#logshow").html(''),
447 $
("#logshow").html($
.trim(data
));
452 $
('#logfile').click(function() {
455 url
: "edi_history_main.php",
456 data
: { showlog
: "yes" },
458 success
: function(data
){ $
("#logshow").html($
.trim(data
)); }
462 $
('#getnotes').click(function() {
463 $
('#logshow').html('');
464 $
('#mynotes').html('');
467 url
: "edi_history_main.php",
468 data
: { getnotes
: "yes"},
470 success
: function(data
){
471 $
('#mynotes').html("<H4>Notes:</H4>"
472 +
"<textarea id='txtnotes',name='txtnotes',rows='10',cols='600',auotfocus='autofocus'></textarea>"
475 // necessary to trim the data since php from script has leading newlines (UTF-8 issue)
476 $
('#txtnotes').val($
.trim(data
));
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('');
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
) {
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({
506 buttons
: [{ text
: "Close", click
: function() { $
(this
).dialog("close"); } }],
508 title
: mytitle
, //$(this).attr('title'),
509 height
: 'auto', //400, maxHeight does not work until resize; css fix is possible
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."); ?>');
527 url
: "edi_history_main.php",
528 data
: $
('#formcsvtables').serialize(),
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({
538 bScrollInfinite
: true,
539 bScrollCollapse
: true,
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"); ?>')
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"); } }],
561 title
: "<?php echo xla("Encounter EDI Record
"); ?>",
567 url
: "edi_history_main.php",
568 data
: $
('#formcsvhist').serialize(), //{ csvenctr: chenctr },
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')
581 * end of javascript block