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" />
42 <!-- jQuery
-ui
and datatables
-->
43 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-ui-1-10-4/themes/sunny/jquery-ui.min.css" />
44 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/datatables.net-jqui-1-10-11/css/dataTables.jqueryui.min.css" />
45 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/datatables.net-scroller-jqui-1-4-1/css/scroller.jqueryui.min.css" />
47 <!-- edi_history css
-->
48 <link rel
="stylesheet" href
="<?php echo $web_root?>/library/css/edi_history_v2.css" type
="text/css" />
49 <link rel
="stylesheet" href
="<?php echo $web_root?>/library/dynarch_calendar.css" type
="text/css" />
50 <!-- OpenEMR Calendar
-->
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"); ?
>
57 <!-- style
for OpenEMR color
-->
58 <body style
='background-color:#fefdcf'>
60 <!-- Begin tabs section
class="Clear"-->
61 <div id
="tabs" style
="visibility:hidden">
63 <li
><a href
="#newfiles" id
="btn-newfiles"><?php
echo xlt("New Files"); ?
></a
></li
>
64 <li
><a href
="#csvdatatables" id
="btn-csvdatatables"><?php
echo xlt("CSV Tables"); ?
></a
></li
>
65 <li
><a href
="#x12text" id
="btn-x12text"><?php
echo xlt("EDI File"); ?
></a
></li
>
66 <li
><a href
="#edinotes" id
="btn-edinotes"><?php
echo xlt("Notes"); ?
></a
></li
>
67 <li
><a href
="#archive" id
="btn-archive"><?php
echo xlt("Archive"); ?
></a
></li
>
72 <tr vertical
-align
="middle">
74 <form id
="formupl" name
="form_upl" action
="edih_main.php" method
="POST" enctype
="multipart/form-data">
76 <legend
><?php
echo xlt("Select one or more files to upload"); ?
></legend
>
77 <input type
="file" id
="uplmulti" name
="fileUplMulti[]" multiple
/>
78 <input type
="hidden" name
="NewFiles" form
="formupl" value
="ProcessNew" />
79 <input type
="submit" id
="uplsubmit" name
="upl_submit" form
="formupl" value
=<?php
echo xla("Submit"); ?
> />
80 <input type
="reset" id
="uplreset" name
="upl_reset" form
="formupl" value
=<?php
echo xla("Reset"); ?
> />
85 <form id
="processnew" name
="process_new" action
="edih_main.php" method
="GET">
87 <legend
><?php
echo xlt("Process new files for CSV records"); ?
>:</legend
>
88 <input type
="checkbox" id
="processhtml" name
="process_html" form
="processnew" value
="htm" checked
/> <?php
echo xlt("HTML Output?"); ?
>
89 <input type
="checkbox" id
="processerr" name
="process_err" form
="processnew" value
="err" checked
/> <?php
echo xlt("Show Errors Only?"); ?
>  
; 
;<br
>
90 <input type
="hidden" name
="ProcessFiles" form
="processnew" value
="ProcessNew" />
91 <label
for="process"><?php
echo xlt("Process New Files"); ?
></label
>
92 <input type
="submit" id
="fuplprocess" name
="process" form
="processnew" value
=<?php
echo xla("Process"); ?
> />
99 <div id
="fileupl1"></div
>
100 <div id
="fileupl2"></div
>
101 <div id
="processed"></div
>
102 <div id
="rsp" title
="<?php echo xla("Response
"); ?>"></div
>
103 <div id
="sub" title
="<?php echo xla("Submitted
"); ?>"></div
>
104 <div id
="seg" title
="<?php echo xla("x12 Segments
"); ?>"></div
>
107 <div id
="csvdatatables">
112 <form id
="formcsvtables" name
="form_csvtables" action
="edih_main.php" method
="GET">
114 <legend
><?php
echo xlt("View CSV tables"); ?
>:</legend
>
117 <td colspan
=4><?php
echo xlt("Choose a period or dates (YYYY-MM-DD)"); ?
></td
>
120 <td align
='center'><?php
echo xlt("Choose CSV table"); ?
>:</td
>
121 <td align
='center'><?php
echo xlt("From Period"); ?
></td
>
122 <td align
='center'><?php
echo xlt("Start Date"); ?
>:  
; 
<?php
echo xlt("End Date"); ?
>:</td
>
123 <td align
='center'><?php
echo xlt("Submit"); ?
></td
>
127 <select id
="csvselect" name
="csvtables"></select
>
130 <select id
="csvperiod" name
="csv_period">
131 <option value
='2w' selected
='selected'>2 <?php
echo xlt('weeks'); ?
></option
>
132 <option value
='1m'>1 <?php
echo xlt('month'); ?
></option
>
133 <option value
='2m'>2 <?php
echo xlt('months'); ?
></option
>
134 <option value
='3m'>3 <?php
echo xlt('months'); ?
></option
>
135 <option value
='6m'>6 <?php
echo xlt('months'); ?
></option
>
136 <option value
='9m'>9 <?php
echo xlt('months'); ?
></option
>
137 <option value
='1y'>1 <?php
echo xlt('year'); ?
></option
>
138 <option value
='ALL'><?php
echo xlt('All Dates'); ?
></option
>
141 <!-- datekeyup(e
, defcc
, withtime
) dateblur(e
, defcc
, withtime
) -->
143 <input type
='text' size
='10' name
="csv_date_start" id
="caldte1" value
="" title
="<?php echo xla('yyyy-mm-dd Start Date'); ?>" />
144 <img src
="<?php echo $web_root?>/interface/pic/show_calendar.gif" align
='absbottom' width
='24' height
='22'
145 id
="csvdate1_cal" border
="0" alt
="[?]" style
="cursor:pointer;cursor:hand" title
="<?php echo xla('Start date'); ?>">
147 <input type
="text" size
="10" name
="csv_date_end" id
="caldte2" value
="" title
="<?php echo xla('yyyy-mm-dd End Date'); ?>" />
148 <img src
="../pic/show_calendar.gif" align
="absbottom" width
="24" height
="22"
149 id
="csvdate2_cal" border
="0" alt
="[?]" style
="cursor:pointer;cursor:hand" title
="<?php echo xla('End date'); ?>">
151 <!-- OEMR calendar srcipt
-->
152 <script type
="text/javascript">
153 Calendar
.setup({inputField
:"caldte1", ifFormat
:"%Y-%m-%d", button
:"csvdate1_cal"});
154 Calendar
.setup({inputField
:"caldte2", ifFormat
:"%Y-%m-%d", button
:"csvdate2_cal"});
158 <input type
="hidden" name
="csvShowTable" form
="formcsvtables" value
="gettable">
159 <input id
="csvshow" type
="submit" name
="csv_show" form
="formcsvtables" value
="<?php echo xla("Submit
"); ?>" />
169 <form id
="formcsvhist" name
="hist_csv" action
="edih_main.php" method
="get">
171 <legend
><?php
echo xlt("Per Encounter"); ?
></legend
>
173 <tr
><td colspan
='2'><?php
echo xlt("Enter Encounter Number"); ?
></td
></tr
>
175 <td
><?php
echo xlt("Encounter"); ?
></td
>
176 <td
><?php
echo xlt("Submit"); ?
></td
>
179 <td
><input id
="histenctr" type
="text" size
=10 name
="hist_enctr" value
="" /></td
>
180 <td
><input id
="histsbmt" type
="submit" name
="hist_sbmt" form
="formcsvhist" value
="<?php echo xla("Submit
"); ?>" /></td
>
189 <div id
='tblshow'></div
>
190 <div id
='tbcsvhist'></div
>
191 <div id
='tbrpt'></div
>
192 <div id
='tbrsp'></div
>
193 <div id
='tbsub'></div
>
194 <div id
='tbseg'></div
>
197 <!-- erafiles to be replaced by functionality in x12text
204 <form id
="x12view" name
="x12_view" action
="edih_main.php" enctype
="multipart/form-data" method
="post">
206 <legend
><?php
echo xlt("View EDI x12 file"); ?
>:</legend
>
209 <td align
='left'><label
for="x12htm"><?php
echo xlt("Report?"); ?
></label
></td
>
210 <td align
='center'><label
for="x12file"><?php
echo xlt("Choose File"); ?
>:</label
></td
>
211 <td align
='left'><label
for="x12_filebtn"><?php
echo xlt("Submit"); ?
>:</label
></td
>
212 <td align
='center'><label
for="x12_filereset"><?php
echo xlt("Reset"); ?
>:</label
></td
>
216 <input type
="hidden" name
="viewx12Files" value
="view_x12">
217 <input type
="checkbox" id
="x12htm" name
="x12_html" value
="html" />
219 <td align
='left'><input id
="x12file" type
="file" size
=30 name
="fileUplx12" /></td
>
221 <input type
="submit" id
="x12filebtn" name
="x12_filebtn" form
="x12view" value
="<?php echo xla("Submit
"); ?>" />
224 <input type
="button" id
="x12filerst" name
="x12_filereset" form
="x12view" value
="<?php echo xla("Reset
"); ?>" />
231 <div id
="x12rsp"></div
>
238 <td colspan
=2><a href
="<?php echo $web_root?>/Documentation/Readme_edihistory.html" target
="_blank"><?php
echo xlt("View the README file"); ?
></a
></td
>
242 <form id
="formlog" name
="form_log" action
="edih_main.php" enctype
="multipart/form-data" method
="post">
243 <fieldset
><legend
><?php
echo xlt("Inspect the log"); ?
></legend
>
244 <label
for="logfile"><?php
echo xlt("View Log"); ?
></label
>
245 <select id
="logselect" name
="log_select"> </select
>
246 <input type
="hidden" name
="logshowfile" value
="getlog">
247 <input id
="logshow" type
="submit" form
="formlog" value
="<?php echo xla("Submit
"); ?>" />
248 <input id
="logclose" type
="button" form
="formlog" value
="<?php echo xla("Close
"); ?>" />
249 <input id
="logarch" type
="button" form
="formlog" value
="<?php echo xla("Archive
"); ?>" />
253 <td
><form id
="formnotes" name
="form_notes" action
="edih_main.php" enctype
="multipart/form-data" method
="post">
254 <fieldset
><legend
><?php
echo xlt("Notes"); ?
></legend
>
255 <label
for="notesget"><?php
echo xlt("Notes"); ?
></label
>
256 <input id
="notesget" type
="button" name
="notes_get" form
="formnotes" value
="<?php echo xla("Open
"); ?>" />
257 <input id
="noteshidden" type
="hidden" name
="notes_hidden" value
="putnotes" />
258 <input id
="notessave" type
="submit" name
="notes_save" form
="formnotes" value
="<?php echo xla("Save
"); ?>" />
259 <input id
="notesclose" type
="button" name
="notes_close" form
="formnotes" value
="<?php echo xla("Close
"); ?>" />
266 <div id
='logrsp'></div
>
267 <div id
='notesrsp'></div
>
274 <td colspan
=3><?php
echo xlt("Selected files and data will be removed from folders and tables"); ?
></td
>
278 <form id
="formarchive" name
="form_archive" action
="edih_main.php" enctype
="multipart/form-data" method
="POST">
279 <fieldset
><legend
><?php
echo xlt("Archive old files "); ?
></legend
>
280 <label
for="archive_sel"><?php
echo xlt("Older than"); ?
>:</label
>
281 <select id
="archiveselect" name
="archive_sel">
282 <option value
="" selected
="selected"><?php
echo xlt('Choose'); ?
></option
>
283 <option value
="24m">24 <?php
echo xlt('months'); ?
></option
>
284 <option value
="18m">18 <?php
echo xlt('months'); ?
></option
>
285 <option value
="12m">12 <?php
echo xlt('months'); ?
></option
>
286 <option value
="9m">9 <?php
echo xlt('months'); ?
></option
>
287 <option value
="6m">6 <?php
echo xlt('months'); ?
></option
>
288 <option value
="3m">3 <?php
echo xlt('months'); ?
></option
>
290 <label
for="archivereport"><?php
echo xlt("Report"); ?
>:</label
>
291 <input type
="button" id
="archiverpt" name
="archivereport" form
="formarchive" value
="<?php echo xla("Report
"); ?>" />
292 <input type
="hidden" name
="ArchiveRequest" form
="formarchive" value
="requested" />
293 <label
for="archivesbmt"><?php
echo xlt("Archive"); ?
>:</label
>
294 <input type
="submit" id
="archivesbmt" name
="archive_sbmt" form
="formarchive" value
="<?php echo xla("Archive
"); ?>" />
298 <td
><form id
="formarchrestore" name
="form_archrestore" action
="edih_main.php" enctype
="multipart/form-data" method
="POST">
299 <fieldset
><legend
><?php
echo xlt("Restore Archive"); ?
></legend
>
300 <label
for="archrestore_sel"><?php
echo xlt("Restore"); ?
>:</label
>
301 <select id
="archrestoresel" name
="archrestore_sel"> </select
>
302 <input type
="hidden" name
="ArchiveRestore" form
="formarchrestore" value
="restore" />
303 <label
for="arch_restore"><?php
echo xlt("Restore"); ?
>:</label
>
304 <input type
="submit" id
="archrestore" name
="arch_restore" form
="formarchrestore" value
=<?php
echo xla("Restore"); ?
> />
311 <div id
="archiversp"></div
>
315 <!-- End tabs section
-->
317 <script src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-10-2/index.js" type
="text/javascript"></script
>
318 <script src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-ui-1-10-4/ui/minified/jquery-ui.custom.min.js" type
="text/javascript"></script
>
319 <script src
="<?php echo $GLOBALS['assets_static_relative']; ?>/datatables.net-1-10-11/js/jquery.dataTables.min.js"></script
>
320 <script src
="<?php echo $GLOBALS['assets_static_relative']; ?>/datatables.net-jqui-1-10-11/js/dataTables.jqueryui.min.js"></script
>
321 <script src
="<?php echo $GLOBALS['assets_static_relative']; ?>/datatables.net-scroller-1-4-1/js/dataTables.scroller.min.js"></script
>
322 <!-- end DataTables js Begin local js
-->
323 <script type
="text/javascript">
324 jQuery(document
).ready(function() {
325 // activate tab interface
326 jQuery("#tabs").tabs();
327 jQuery("#tabs").tabs().css('visibility','visible');
328 // set some button disabled
329 jQuery('#processfiles').prop('disabled', true);
330 jQuery('#archivesubmit').prop('disabled', true);
331 // update list of available csv tables
332 jQuery(function() { csvlist() });
333 // update list of available log files
334 jQuery(function() { loglist() });
335 // update list of archive files
336 jQuery(function() { archlist() });
337 // hide these div elements until used
338 jQuery("#fileupl1").toggle(false);
339 jQuery("#fileupl2").toggle(false);
342 * end of document ready() jquery
345 /* **** from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ *** */
346 function bytesToSize(bytes
) {
347 var sizes
= ['Bytes', 'KB', 'MB', 'GB', 'TB'];
348 if (bytes
== 0) return 'n/a';
349 var i
= parseInt(Math
.floor(Math
.log(bytes
) / Math
.log(1024)));
350 if (i
== 0) return bytes +
' ' + sizes
[i
];
351 return (bytes
/ Math
.pow(1024, i
)).toFixed(1) +
' ' + sizes
[i
];
353 /* *** variables for upload maximums *** */
354 /* *** phpserver: 'maxfsize''maxfuploads''postmaxsize''tmpdir' phpserver['postmaxsize'] *** */
358 url
: 'edih_main.php',
359 data
: { srvinfo
: 'yes' },
361 success
: function(rsp
){ phpserver
= rsp
}
364 /* *** update the list of available csv tables *** */
368 url
: 'edih_main.php',
369 data
: { csvtbllist
: 'yes' },
371 success
: function(data
) {
372 var options
= jQuery('#csvselect').attr('options');
373 var optct
= jQuery
.isPlainObject(data
); // data.length
376 options
.push("<option value='' selected='selected'><?php echo xla("Choose from
list"); ?></option>");
377 jQuery
.each(data
.claims
, function(idx
, value
) {
378 options
.push("<option value=" + value
.fname +
">" + value
.desc +
"</option>");
380 jQuery
.each(data
.files
, function(idx
, value
) {
381 options
.push("<option value=" + value
.fname +
">" + value
.desc +
"</option>");
383 jQuery("#csvselect").html(options
.join(''));
388 /* *** update the list of log files *** */
392 url
: 'edih_main.php',
393 data
: { loglist
: 'yes' },
395 success
: function(data
) {
396 var options
= jQuery('#logselect').attr('options');
397 var optct
= data
.length
;
400 options
.push('<option selected="selected"><?php echo xla("Choose from list"); ?></option>');
401 for (var i
=0; i
<optct
; i++
) {
402 options
.push('<option value=' + data
[i
] +
'>' + data
[i
] +
'</option>');
404 jQuery("#logselect").html(options
.join(''));
409 /* *** update the list of archive files *** id="archrestoresel name="archrestore_sel" */
410 function archlist() {
413 url
: 'edih_main.php',
414 data
: { archlist
: 'yes' },
416 success
: function(data
) {
417 //var options = jQuery('#archrestoresel').attr('options');
418 jQuery('#archrestoresel').empty();
419 var optct
= data
.length
;
422 options
.push("<option selected='selected'><?php echo xla("Choose from
list"); ?></option>");
423 for (var i
=0; i
<optct
; i++
) {
424 options
.push("<option value=" + data
[i
] +
">" + data
[i
] +
"</option>");
427 options
.push("<option selected='selected'><?php echo xla("No Archives
"); ?></option>");
429 jQuery('#archrestoresel').html(options
.join(""));
436 control visibility by designating to which div the dialog is appended
438 function dialogOptions(appendElem
) {
439 var tblDialogOpts
= {
440 appendTo
: appendElem
,
446 title
: 'Transaction Detail',
447 close
: function(event
, ui
)
449 jQuery(this
).dialog("close");
450 jQuery(this
).remove();
453 return tblDialogOpts
;
457 jQuery('#tbcsvhist').on('click', 'a', function(e
) {
460 var options
= dialogOptions('#tbcsvhist');
461 jQuery('<div/>', {'class':'edihDlg', 'id':'link-'+
(jQuery(this
).index()+
1)})
462 .load(jQuery(this
).attr('href')).appendTo('#tbcsvhist').dialog(options
);
465 jQuery('#tblshow').on('click', 'a', function(e
) {
468 var ttl
= jQuery(this
).attr('title');
469 var options
= dialogOptions('#tblshow');
470 jQuery('<div/>', {'class':'edihDlg', 'id':'link-'+
(jQuery(this
).index()+
1)})
471 .load(jQuery(this
).attr('href')).appendTo('#tblshow').dialog(options
);
474 jQuery('#tbrpt').on('click', 'a', function(e) {
477 var options = dialogOptions('#tblshow');
478 jQuery('<div/>', {'class':'edihDlg', 'id':'link-'+(jQuery(this).index()+1)})
479 .load(jQuery(this).attr('href')).appendTo('#tblshow').dialog(options);
482 /* **** links in dialog in uploads - processed div **** */
483 jQuery('#processed').on('click', 'a', function(e
) {
486 var options
= dialogOptions('#processed');
487 jQuery('<div/>', {'class':'edihDlg', 'id':'link-'+
(jQuery(this
).index()+
1)})
488 .load(jQuery(this
).attr('href')).appendTo('#processed').dialog(options
);
494 * jQuery-UI accordian -- for 27x file html (not used -- have not figured out how to invoke)
496 function apply_accordion(selector
) {
497 var sel
= selector +
' > #accordion';
502 heightStyle
: "content"
505 /* ****************************
507 * === upload multiple files
508 * buttons are enabled/disabled
509 * selected and uploaded files are listed
510 * the process files script html output displayed,
512 /* **** if files have been uploaded **** */
514 /* ***** list files selected in the multifile upload input **** */
515 jQuery('#uplmulti').change( function(){
516 // clear uploaded files list, since new selected files list is coming
517 jQuery('#fileupl2').html('');
518 jQuery('#fileupl2').removeClass('flist');
519 jQuery('#processed').html('');
520 var uplfiles
= this
.files
; //event.target.files;
521 var fct
= uplfiles
.length
;
523 var fl1
= jQuery('#fileupl1');
526 fl1
.addClass('flist1');
527 var fmaxupl
= phpserver
['maxfuploads']; // jQuery("#srvvals").data('mf');
528 var pmaxsize
= phpserver
['postmaxsize']
529 var str
= "<p><em><?php echo xla('Selected Files'); ?>:</em></p>";
530 str
= str +
"<ul id='uplsel' class='fupl'>";
531 for(var i
= 0; i
< fct
; i++
) {
532 if (i
== fmaxupl
) str
= str +
'</ul><p><?php echo xla('max file count reached
'); ?><br> - <?php echo xla('reload names below
'); ?> </p><ul class=fupl>';
533 str
= str +
"<li>" + uplfiles
[i
].name +
"</li>"; //' ' +
534 fsize +
= uplfiles
[i
].size
;
536 str
= str +
'</ul><p><?php echo xla('Total size
'); ?>: ' +
bytesToSize(fsize
) +
' (<?php echo xla('max
'); ?> ' + pmaxsize +
')</p>';
537 jQuery('#uplsubmit').prop('disabled', false);
538 if (upld_ct
=== 0 ) {
539 jQuery('#processupl').prop('disabled', true);
543 // uplreset button click the file input is reset and associated values cleared
544 jQuery('#uplreset').on('click', function( event
) {
545 event
.preventDefault();
546 event
.stopPropagation();
547 jQuery('#fileupl1').html('');
548 jQuery('#fileupl2').html('');
549 jQuery('#fileupl1').hide();
550 jQuery('#fileupl2').hide();
551 jQuery('#processed').html('');
552 jQuery('#uplsubmit').prop('disabled', true);
554 jQuery('#fuplprocess').prop('disabled', true);
556 jQuery('#fuplprocess').prop('disabled', false);
558 // jQuery('#fupl').reset();
559 document
.getElementById('formupl').reset();
563 /* ***** uplsubmit button click --upload files are scanned and copied into folders *** */
564 /* ***** files are listed next to file selected list by css *** */
565 jQuery('#formupl').on('submit', function( event
) {
566 event
.stopPropagation();
567 event
.preventDefault();
568 var uplForm
= document
.getElementById("formupl");
569 var upldata
= new FormData( document
.getElementById('formupl') );
570 var rspElem
= jQuery('#fileupl2');
573 url
: jQuery('#formupl').attr('action'),
580 success
: function(data
) {
583 jQuery('#fuplprocess').prop('disabled', false );
584 jQuery('#fuplupload').prop('disabled', true);
588 error
: function( xhr
, status
) { alert( "<?php echo xls('Sorry, there was a problem!'); ?>" ); },
592 /* **** process button, files parsed and csv rows displayed *** */
593 jQuery('#processnew').on('submit', function(e
) {
597 url
: jQuery('#processnew').attr('action'),
599 data
: jQuery('#processnew').serialize(), //prcForm.serialize(),
602 jQuery('#fileupl1').html('');
603 jQuery('#fileupl1').hide();
604 jQuery('#fileupl2').html('');
605 jQuery('#fileupl2').hide();
607 jQuery('#processed').html(data
);
608 jQuery('#processed').show();
611 error
: function( xhr
, status
) {
612 alert( "<?php echo xls('Sorry, there was a problem!'); ?>" ),
613 jQuery('#processed').html(status
)
617 /* *** update list of csv tables *** */
619 jQuery('#fuplprocess').prop('disabled', true );
623 /* *********************************************
625 * ==== file upload lists match uploaded to selected
626 * when mouse is over element in one list, matching element
627 * in other list is highlighted also
629 function outlineMatch(matchElem
, matchText
) {
630 if (matchText
== 'none') {
631 matchElem
.css('font-weight', 'normal');
634 matchElem
.each(function( index
) {
635 if ( matchText
== jQuery(this
).text() ) {
636 jQuery(this
).siblings().css('font-weight', 'normal');
637 jQuery(this
).css('font-weight', 'bolder');
645 /* *** do not use .hover event */
646 jQuery('#fileupl2').on('mouseenter', 'li', function(event
){
647 var fl1
= jQuery('#fileupl1').find('li');
648 var fname
= jQuery(this
).text();
649 jQuery(this
).css('font-weight', 'bolder');
650 jQuery(this
).siblings().css('font-weight', 'normal');
651 outlineMatch(fl1
, fname
);
653 jQuery('#fileupl2').on('mouseleave', 'li', function(){
654 var fl1
= jQuery('#fileupl1').find('li');
655 jQuery(this
).css('font-weight', 'normal');
656 outlineMatch(fl1
, 'none');
658 jQuery('#fileupl1').on('mouseenter', 'li', function(event
){
659 jQuery(this
).css('font-weight', 'bolder');
660 if ( jQuery('#fileupl2').length
) {
661 var fl2
= jQuery('#fileupl2').find('li');
662 var fname
= jQuery(this
).text();
663 outlineMatch(fl2
, fname
);
666 jQuery('#fileupl1').on('mouseleave', 'li', function(){
667 jQuery(this
).css('font-weight', 'normal');
668 if ( jQuery('#fileupl2').length
) {
669 var fl2
= jQuery('#fileupl2').find('li');
670 var fname
= jQuery(this
).text();
671 outlineMatch(fl2
, 'none');
675 /* ***** ==== end file upload lists match uploaded to selected
676 /* ****************************
677 * === end upload multiple files section
681 * begin csv tables section
682 * the csv tables are displayed using jquery dataTables plugin
683 * here, the 'success' action is to execute an array of functions
684 * the helper function bindlinks() applies jquery .on method
685 * so most links will open a jquery-ui dialog
687 jQuery('#formcsvtables').on('submit', function(e
) {
690 // verify a csv file is selected
691 if (jQuery('#csvselect').val() == '') {
692 jQuery("#tblshow").html('<?php echo xla("No table selected! Select a table."); ?>');
697 url
: "edih_main.php",
698 data
: jQuery('#formcsvtables').serialize(),
702 jQuery('#tblshow').html(data
);
703 jQuery('#tblshow').css('maxWidth', 'fit-contents');
704 jQuery('#tblshow table#csvTable').DataTable({
707 'scrollCollapse': true,
716 // csv encounter history
717 jQuery('#formcsvhist').on('submit', function(e
) {
719 jQuery('#tbcsvhist').empty();
720 var chenctr
= jQuery('#histenctr').value
;
721 var histopts
= { modal
: false,
722 appendTo
: '#tbcsvhist',
726 title
: "<?php echo xla("Encounter EDI Record
"); ?>",
727 close
: function(event
, ui
) {
728 jQuery(this
).empty();
729 jQuery(this
).dialog('close');
734 url
: jQuery('#formcsvhist').attr('action'),
735 data
: jQuery('#formcsvhist').serialize(), //{ csvenctr: chenctr },
737 success
: [ function(data
){
738 jQuery('<div/>', {'class':'edihDlg', 'id':'link-'+
(jQuery(this
).index()+
1)})
739 .appendTo('#tbcsvhist').html(jQuery
.trim(data
)).dialog(histopts
).dialog('open');
745 jQuery('#csvClear').on('click', function(e
) {
747 jQuery("#tblshow").html('');
750 * === end of csv tables and claim history
753 * === view x12 file form form"view_x12" file"x12file" submit"fx12" check"ifhtml" newWin"x12nwin"
755 jQuery('#x12view').on('submit', function(e
) {
759 var rspElem
= jQuery('#x12rsp');
760 var frmData
= new FormData( document
.getElementById('x12view') );
762 url
: jQuery('#x12view').attr('action'),
768 success
: function(data
) {
771 jQuery('#x12filesbmt').prop('disabled', true);
773 error
: function( xhr
, status
) { alert( "<?php echo xls('Sorry, there was a problem!'); ?>" ); }
775 // jQuery accordion requires html to be present at document ready
776 // accordion does not work for added content, so no effect here
777 jQuery('#x12rsp > #accordion')
781 heightStyle
: "content",
787 jQuery('#x12file').change( function(){
788 // clear file display
789 jQuery('#x12rsp').html('');
790 jQuery('#x12filesbmt').prop('disabled', false);
793 jQuery('#x12filerst').on('click', function(e
){
796 // clear file display
797 jQuery('#x12rsp').html('');
798 jQuery('#x12filesbmt').prop('disabled', true);
799 jQuery('#x12view').trigger('reset');
803 * === functions for logs, notes, and archive "frm_archive" "archiveselect""archivesubmit"
805 jQuery('#logarch').on('click', function(e
) {
811 url
: jQuery('#formlog').attr('action'),
812 data
: { archivelog
: 'yes' },
814 success
: function(data
) {
815 var str
= "<p><?php echo xla('Archive Log Files'); ?></p><ul id='logarchlist'>";
816 var fct
= data
.length
;
818 str
= str +
"<li><?php echo xla('No logs older than 7 days'); ?></li>";
820 for(var i
= 0; i
< fct
; i++
) {
821 str
= str +
"<li>" + data
[i
] +
"</li>";
825 jQuery('#notesrsp').hide();
826 jQuery('#logrsp').html('');
827 jQuery('#logrsp').html(str
);
828 jQuery('#logrsp').show();
830 error
: function( xhr
, status
) { alert( "<?php echo xls('Sorry, there was a problem!'); ?>" ); }
836 jQuery('#logclose').on('click', function(e
) {
838 jQuery('#logrsp').html('');
839 jQuery('#logrsp').hide();
840 jQuery('#notesrsp').show();
843 jQuery('#logselect').on('change', function(e
) {
844 jQuery('#logshow').prop('disabled', false );
847 jQuery('#logshow').on('click', function(e
) {
850 var fn
= jQuery('#logselect').val();
853 url
: jQuery('#formlog').attr('action'),
854 //data: { archivelog: 'yes', logfile: fn },
855 data
: jQuery('#formlog').serialize(),
857 success
: function(data
){
858 jQuery('#notesrsp').hide();
859 jQuery('#logrsp').html(''),
860 jQuery('#logrsp').html(jQuery
.trim(data
));
861 jQuery('#logrsp').show();
866 jQuery('#notesget').on('click', function(e
) {
871 url
: jQuery('#formnotes').attr('action'),
872 data
: { getnotes
: "yes"},
874 success
: function(data
){
875 jQuery('#notesrsp').html('');
876 jQuery('#notesrsp').html("<H4>Notes:</H4>");
877 jQuery('#notesrsp').append("<textarea id='txtnotes', name='txtnotes',form='formnotes',rows='10',cols='600',wrap='hard' autofocus='autofocus'></textarea>");
878 // necessary to trim the data since php from script has leading newlines (UTF-8 issue) '|:|'
879 jQuery('#logrsp').hide();
880 jQuery('#notesrsp \\:textarea').val(jQuery
.trim(data
));
881 jQuery('#notesrsp').show();
886 jQuery('#notessave').on('click', function(e
) {
888 var notetxt
= jQuery('#notesrsp :textarea').val();
889 var noteURL
= jQuery('#formnotes').attr('action');
890 jQuery
.post(noteURL
, { putnotes
: 'yes', tnotes
: notetxt
},
891 function(data
){ jQuery('#notesrsp').append(data
); });
894 jQuery('#notesclose').on('click', function(e
) {
896 jQuery('#notesrsp').html('');
897 jQuery('#notesrsp').toggle(false);
901 * ==== Archive form id="formarchive"
904 jQuery('#formarchive').on('submit', function(e
) {
905 //e.stopPropagation();
907 var archForm
= document
.getElementById('formarchive');
908 var archdata
= new FormData(archForm
);
909 var rspElem
= jQuery('#archiversp');
912 url
: jQuery('#formarchive').attr('action'),
919 success
: function(data
) {
921 jQuery('#archivesubmit').prop('disabled', true );
925 error
: function( xhr
, status
) { alert( "<?php echo xls('Sorry, there was a problem!'); ?>" ); },
926 // code to run regardless of success or failure
927 // complete: function( xhr, status ) { alert( "The request is complete!" ); }
934 jQuery('#archiverpt').on('click', function(event
) {
935 event
.preventDefault();
936 event
.stopPropagation();
938 var rspElem
= jQuery('#archiversp');
940 var sprd
= jQuery('#archiveselect').val();
941 var surl
= jQuery('#formarchive').attr('action');
945 url
: 'edih_main.php',
949 data
: { archivereport
: 'yes', period
: sprd
},
951 success
: function(data
) {
952 //rspElem.html(data);
954 jQuery('#archiversp').html(data
);
956 error
: function( xhr
, status
) {
957 alert( "<?php echo xls('Sorry, there was a problem!'); ?>" );
958 rspElem
.html(status
);
965 jQuery('#archiveselect').on('change', function(e
) {
966 jQuery('#archivesubmit').prop('disabled', false );
970 jQuery('#formarchrestore').on('submit', function(e
) {
971 //e.stopPropagation();
974 var sel
= jQuery( "#archrestoresel option:selected" ).text();
976 if (sel
== "No Archives") {
977 alert("<?php echo xls('No archive files present'); ?>");
980 var archrstForm
= document
.getElementById('formarchrestore');
981 var archrstdata
= new FormData(archrstForm
);
982 var rspElem
= jQuery('#archiversp');
983 //var archf = jQuery('#archrestoresel').val();
984 //archrstdata = { archrestore: 'yes', archfile: archf };
986 url
: jQuery('#formarchrestore').attr('action'),
992 success
: function(data
) {
996 error
: function( xhr
, status
) { alert( "<?php echo xls('Sorry, there was a problem!'); ?>" ); },
1000 archrstForm
.reset();
1005 * end of javascript block