5 * Copyright 2012 Kevin McCormick Longview, Texas
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
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">
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"); ?
>
59 <!-- Begin tabs section
-->
60 <div id
="tabs" style
="visibility:hidden">
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
>
72 <tr vertical
-align
="middle">
74 <form id
='upload_new' action
="edi_history_main.php" method
="POST" enctype
="multipart/form-data">
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
"); ?>" />
83 <form id
="process_new" action
="edi_history_main.php" method
="post">
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?"); ?
>  
; 
;<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
"); ?>" />
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
>
104 <div id
="csvdatatables">
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
>
115 <?php
echo xlt("Select a percentage of the rows or or select dates"); ?
>
120 <?php
echo xlt("Select CSV table"); ?
>:
123 <?php
echo xlt("Pct (%) of rows"); ?
>
126 <?php
echo xlt("Start Date"); ?
>:  
; 
; 
; 
; <?php
echo xlt("End Date"); ?
>:
129 <?php
echo xlt("Submit"); ?
>
134 <select id
='csvselect' name
="csvtables">
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
>
148 <!-- datekeyup(e
, defcc
, withtime
) dateblur(e
, defcc
, withtime
) -->
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'>
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"});
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
="" />
170 <input type
="hidden" name
="csvshowtable" value
="gettable">
171 <input id
="showtable" type
="button" value
="<?php echo xla("Submit
"); ?>" />
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
>
188 <?php
echo xlt("Enter Encounter Number"); ?
>
193 <?php
echo xlt("Encounter"); ?
>
196 <?php
echo xlt("Submit"); ?
>
201 <input id
="csvenctr" type
="text" size
=7 name
="chenctr" value
="" />
204 <input id
="showhistory" type
="button" value
="<?php echo xla("Submit
"); ?>" />
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
>
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
"); ?>" />
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
"); ?>" />
259 <form name
="view_claim" action
="edi_history_main.php" target
="_blank" method
="post">
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
"); ?>" />
269 <form name
="view_ansi" action
="edi_history_main.php" target
="_blank" method
="post">
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
"); ?>" />
280 <td align
='center' colspan
='2'>
281 <form name
="view_x12" action
="edi_history_main.php" target
="_blank" enctype
="multipart/form-data" method
="post">
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
"); ?>" />
291 <div id
='txtclmstat'></div
>
292 <div id
='txtbatchclm'></div
>
293 <div id
='txtera'></div
>
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
>
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
"); ?>" />
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
"); ?>" />
327 <div id
='logshow'></div
>
328 <div id
='mynotes'></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
343 $
("#tabs").tabs().css('visibility','visible');
346 //Reset all these text fields to their default
347 $
("input:text, input:file").val(function() {
348 return this
.defaultValue
;
354 * functions for ajax and popups
356 $
('#srvvals').ajaxError(function() {
357 $
(this
).html( "<?php echo xla("Error retrieving values
."); ?>" );
362 url
: 'edi_history_main.php',
363 data
: { srvinfo
: 'yes' },
365 success
: function(rsp
){
366 $
('#srvvals').data("mf", rsp
.mfuploads
);
367 $
('#srvvals').html('');
373 url
: 'edi_history_main.php',
374 data
: { csvtbllist
: 'yes' },
376 success
: function(data
) {
377 var options
= $
('#csvselect').attr('options');
378 var optct
= data
.length
;
381 options
.push("<option value='' selected='selected'><?php echo xla("Choose from
list"); ?></option>");
382 for (var i
=0; i
<optct
; i++
) {
383 options
.push("<option value=" + data
[i
].fname +
">" + data
[i
].desc +
"</option>");
385 $
("#csvselect").html(options
.join(''));
392 * end of document ready() jquery
395 // the process files script html output is requested and displayed,
396 // replacing the tab panel contents
397 // also, the 'success' event calls an array of functions
398 $
('#processfiles').click(function() {
401 url
: "edi_history_main.php",
402 data
: $
('#process_new').serialize(),
405 function(data
){ $
("#pfresult").html(data
); },
406 bindlinks('#pfresult', 'click', '.clmstatus', 'click', '#clmstat', '<?php echo xla("Claim Status"); ?>'),
407 bindlinks('#pfresult', 'click', '.btclm', 'click', '#batchclm', '<?php echo xla("Batch Claim"); ?>')
412 // list files selected in the multifile upload input
413 $
('#upload_file').change(function(){
414 $
('#srvvar').html('');
415 $
('#pfresult').html('');
416 var fmax
= $
('#srvvals').data("mf");
417 var far
= this
.files
;
418 var fct
= far
.length
;
419 for(var i
= 0; i
< fct
; i++
) {
420 if (i
== fmax
) $
('#pfresult').append("<p><?php echo xla("max file count reached
- reload names below
"); ?></p>");
421 $
('#pfresult').append('file: ' + far
[i
].name +
'<br />');
424 // submit files for sorting and storage -- accepted/rejected, already uploaded, etc
425 // shows a popup window (idea is to allow comparison with upload files display)
426 $
('#upload_new').submit(function() {
427 if (! window
.focus
) return true;
428 window
.open('', 'Uploads', 'height=400,width=600,left=300,top=100,menubar=yes,resizable=yes,scrollbars=yes');
429 this
.target
='Uploads';
433 $
('#csvClear').click(function() {
434 $
("#tblshow").html('');
437 $
('#logClear').click(function() {
438 $
("#logshow").html('');
441 $
('#logArchive').click(function() {
444 url
: "edi_history_main.php",
445 data
: { archivelog
: "yes" },
447 success
: function(data
){
448 $
("#logshow").html(''),
449 $
("#logshow").html($
.trim(data
));
454 $
('#logfile').click(function() {
457 url
: "edi_history_main.php",
458 data
: { showlog
: "yes" },
460 success
: function(data
){ $
("#logshow").html($
.trim(data
)); }
464 $
('#getnotes').click(function() {
465 $
('#logshow').html('');
466 $
('#mynotes').html('');
469 url
: "edi_history_main.php",
470 data
: { getnotes
: "yes"},
472 success
: function(data
){
473 $
('#mynotes').html("<H4>Notes:</H4>"
474 +
"<textarea id='txtnotes',name='txtnotes',rows='10',cols='600',auotfocus='autofocus'></textarea>"
477 // necessary to trim the data since php from script has leading newlines (UTF-8 issue)
478 $
('#txtnotes').val($
.trim(data
));
483 $
('#savenotes').click(function() {
484 var notetxt
= $
("#txtnotes").val();
485 $
.post("edi_history_main.php", { putnotes
: "yes", tnotes
: notetxt
},
486 function(data
){ $
('#mynotes').append(data
); });
489 $
('#closenotes').click(function() {
490 $
('#mynotes').html('');
494 * called to bind links in ajax retrieved content for dialog display
495 * .on( events [, selector] [, data], handler(eventObject) )
497 function bindlinks(dElem
, dEvt
, cClass
, cEvt
, cElem
, mytitle
){
498 $
(dElem
).on(dEvt
, cClass
, cEvt
, function(e
) {
500 $
(cElem
).css({'max-height': 372, 'overflow-y': 'auto'});
501 $
(this
).parentsUntil('tr').parent().siblings().removeClass('outlinetr');
502 $
(this
).parentsUntil('tr').parent().addClass('outlinetr');
503 $
.get($
(this
).attr('href'), function(data
){ $
(cElem
).html(data
); })
504 var statDialog
= $
(cElem
).dialog({
508 buttons
: [{ text
: "Close", click
: function() { $
(this
).dialog("close"); } }],
510 title
: mytitle
, //$(this).attr('title'),
511 height
: 'auto', //400, maxHeight does not work until resize; css fix is possible
514 statDialog
.dialog('open');
518 // the csv tables are displayed using jquery dataTables plugin
519 // here, the 'success' action is to execute an array of functions
520 // calls the helper function bindlinks() which applies jquery .on method
521 $
('#showtable').click(function() {
522 // verify a csv file is selected
523 if ($
('#csvselect').val() == '') {
524 $
("#tblshow").html('<?php echo xla("No table selected! Select a table."); ?>');
529 url
: "edi_history_main.php",
530 data
: $
('#formcsvtables').serialize(),
534 var tbltl
= "<div class='csvcptn'>" + $
(data
).filter('#dttl').html() +
"</div>";
535 var mytbl
= "<table id='csvTable' class='csvDisplay'>" + $
(data
).not('#dttl').html() +
"</table>";
536 $
("#tblshow").html($
.trim(mytbl
));
537 $
('#csvTable').dataTable({
540 bScrollInfinite
: true,
541 bScrollCollapse
: true,
545 sScrollXInner
: '100%'
547 $
("#csvTable_filter").before(tbltl
);
549 bindlinks('#tblshow', 'click', '.clmstatus', 'click', '#tbclmstat', '<?php echo xla("Claim Status"); ?>'),
550 bindlinks('#tblshow', 'click', '.btclm', 'click', '#tbbatchclm', '<?php echo xla("Batch Claim"); ?>'),
551 bindlinks('#tblshow', 'click', '.codeval', 'click', '#tbcodetxt', '<?php echo xla("Code Text"); ?>')
556 // csv encounter history
557 $
('#showhistory').click(function() {
558 $
('#tbcsvhist').html('');
559 var chenctr
= $
('#chenctr').value
;
560 var encrecord
= $
('#tbcsvhist').dialog({
561 buttons
: [{ text
: "Close", click
: function() { $
(this
).dialog("close"); } }],
563 title
: "<?php echo xla("Encounter EDI Record
"); ?>",
569 url
: "edi_history_main.php",
570 data
: $
('#formcsvhist').serialize(), //{ csvenctr: chenctr },
573 function(data
){ $
('#tbcsvhist').html($
.trim(data
)); },
574 bindlinks('#tbcsvhist', 'click', '.clmstatus', 'click', '#tbclmstat', '<?php echo xla("Claim Status"); ?>'),
575 bindlinks('#tbcsvhist', 'click', '.btclm', 'click', '#tbbatchclm', '<?php echo xla("Batch Claim"); ?>'),
576 bindlinks('#tbcsvhist', 'click', '.codeval', 'click', '#tbcodetxt', '<?php echo xla("Code Text"); ?>'),
577 encrecord
.dialog('open')
583 * end of javascript block