7 * @link http://www.open-emr.org
8 * @author Kevin McCormick Longview, Texas
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2012 Kevin McCormick Longview, Texas
11 * @copyright Copyright (c) 2018-2020 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once(dirname(__FILE__
) . '/../globals.php');
17 use OpenEMR\Common\Acl\AclMain
;
18 use OpenEMR\Common\Csrf\CsrfUtils
;
19 use OpenEMR\Common\Twig\TwigContainer
;
20 use OpenEMR\Core\Header
;
23 if (!AclMain
::aclCheckCore('acct', 'eob')) {
24 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("EDI History")]);
33 <title
><?php
echo xlt("EDI History"); ?
></title
>
34 <?php Header
::setupHeader(['datetime-picker', 'datatables', 'datatables-dt', 'datatables-bs', 'datatables-scroller']); ?
>
35 <?php
if ($_SESSION['language_direction'] == "rtl") { ?
>
36 <link rel
="stylesheet" href
="<?php echo $GLOBALS['themes_static_relative']; ?>/misc/rtl_edi_history_v2.css?v=<?php echo $GLOBALS['v_js_includes']; ?>" />
38 <link rel
="stylesheet" href
="<?php echo $GLOBALS['themes_static_relative']; ?>/misc/edi_history_v2.css?v=<?php echo $GLOBALS['v_js_includes']; ?>" />
41 <!-- style
for OpenEMR color
-->
43 <div
class="container mt-3">
45 <div
class="col-sm-12">
46 <div
class="clearfix">
47 <h2
><?php
echo xlt('EDI History'); ?
></h2
>
51 <div
class="container-fluid mb-3">
52 <ul
class="nav nav-tabs">
54 <a
class="nav-item nav-link font-weight-bold active" id
="nav-newfiles-tab" data
-toggle
="tab" href
="#nav-newfiles" role
="tab" aria
-controls
="nav-newfiles" aria
-selected
="true">
55 <?php
echo xlt("New Files"); ?
>
59 <a
class="nav-item nav-link font-weight-bold" id
="nav-csvtables-tab" data
-toggle
="tab" href
="#nav-csvtables" role
="tab" aria
-controls
="nav-csvtables" aria
-selected
="false">
60 <?php
echo xlt("CSV Tables"); ?
>
64 <a
class="nav-item nav-link font-weight-bold" id
="nav-edifile-tab" data
-toggle
="tab" href
="#nav-edifile" role
="tab" aria
-controls
="nav-edifile" aria
-selected
="false">
65 <?php
echo xlt("EDI File"); ?
>
69 <a
class="nav-item nav-link font-weight-bold" id
="nav-notes-tab" data
-toggle
="tab" href
="#nav-notes" role
="tab" aria
-controls
="nav-notes" aria
-selected
="false">
70 <?php
echo xlt("Notes"); ?
>
74 <a
class="nav-item nav-link font-weight-bold" id
="nav-archive-tab" data
-toggle
="tab" href
="#nav-archive" role
="tab" aria
-controls
="nav-archive" aria
-selected
="false">
75 <?php
echo xlt("Archive"); ?
>
80 <div
class="tab-content jumbotron py-4" id
="nav-tabContent">
81 <!-- New Files Section
-->
82 <div
class="tab-pane fade show active" id
="nav-newfiles" role
="tabpanel" aria
-labelledby
="nav-newfiles-tab">
83 <div
class="container">
85 <div
class="col-sm-12 col-md-6">
86 <form id
="formupl" name
="form_upl" action
="edih_main.php" method
="POST" enctype
="multipart/form-data">
87 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
88 <h4
><?php
echo xlt("Select one or more files to upload"); ?
></h4
>
89 <div
class="custom-file">
90 <label
class="custom-file-label"><?php
echo xlt("Choose file"); ?
></label
>
91 <input type
="file" class="custom-file-input" id
="uplmulti" name
="fileUplMulti[]" multiple
/>
92 <input type
="hidden" name
="NewFiles" form
="formupl" value
="ProcessNew" />
93 <div
class="btn-group mt-3">
94 <button type
="submit" class="btn btn-primary btn-add" id
="uplsubmit" name
="upl_submit" form
="formupl" value
="<?php echo xla("Submit
"); ?>">
95 <?php
echo xlt("Submit"); ?
>
97 <input type
="reset" class="btn btn-secondary" id
="uplreset" name
="upl_reset" form
="formupl" value
="<?php echo xla("Reset
"); ?>" />
102 <div
class="col-sm-12 col-md-6">
103 <form id
="processnew" name
="process_new" action
="edih_main.php" method
="GET">
104 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
105 <h4
><?php
echo xlt("Process new files for CSV records"); ?
>:</h4
>
106 <input type
="checkbox" id
="processhtml" name
="process_html" form
="processnew" value
="htm" checked
/> <?php
echo xlt("HTML Output?"); ?
>
107 <input type
="checkbox" id
="processerr" name
="process_err" form
="processnew" value
="err" checked
/> <?php
echo xlt("Show Errors Only?"); ?
>  
; 
;<br
/>
108 <input type
="hidden" name
="ProcessFiles" form
="processnew" value
="ProcessNew" />
109 <label
for="process"><?php
echo xlt("Process New Files"); ?
></label
>
110 <input type
="submit" class="btn btn-primary btn-sm" id
="fuplprocess" name
="process" form
="processnew" value
="<?php echo xla("Process
"); ?>" />
113 <div
class="col-sm-md-6 d-none" id
="fileupl1">
116 <div
class="col-sm-md-6 d-none" id
="fileupl2">
120 <div
class="alert alert-primary mt-3 d-none" id
="processed">
122 <div id
="rsp" title
="<?php echo xla("Response
"); ?>"></div
>
123 <div id
="sub" title
="<?php echo xla("Submitted
"); ?>"></div
>
124 <div id
="seg" title
="<?php echo xla("x12 Segments
"); ?>"></div
>
129 <!-- CSV Tables Section
-->
130 <div
class="tab-pane fade" id
="nav-csvtables" role
="tabpanel" aria
-labelledby
="nav-csvtables-tab">
131 <div
class="container">
133 <div
class="col-sm-12 col-md-8">
134 <form id
="formcsvtables" name
="form_csvtables" action
="edih_main.php" method
="GET">
135 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
136 <h4
><?php
echo xlt("View CSV tables"); ?
>:</h4
>
139 <td colspan
='4'><?php
echo xlt("Choose a period or dates (YYYY-MM-DD)"); ?
></td
>
142 <td
class='text-center'><?php
echo xlt("Choose CSV table"); ?
>:</td
>
143 <td
class='text-center'><?php
echo xlt("From Period"); ?
></td
>
144 <td
class='text-center'><?php
echo xlt("Start Date"); ?
>:  
; 
; <?php
echo xlt("End Date"); ?
>:</td
>
145 <td
class='text-center'><?php
echo xlt("Submit"); ?
></td
>
148 <td
class='text-center'>
149 <select
class="custom-select" id
="csvselect" name
="csvtables"></select
>
151 <td
class='text-center'>
152 <select
class="custom-select" id
="csvperiod" name
="csv_period">
153 <option value
='2w' selected
='selected'>2 <?php
echo xlt('weeks'); ?
></option
>
154 <option value
='1m'>1 <?php
echo xlt('month'); ?
></option
>
155 <option value
='2m'>2 <?php
echo xlt('months'); ?
></option
>
156 <option value
='3m'>3 <?php
echo xlt('months'); ?
></option
>
157 <option value
='6m'>6 <?php
echo xlt('months'); ?
></option
>
158 <option value
='9m'>9 <?php
echo xlt('months'); ?
></option
>
159 <option value
='1y'>1 <?php
echo xlt('year'); ?
></option
>
160 <option value
='ALL'><?php
echo xlt('All Dates'); ?
></option
>
163 <!-- datekeyup(e
, defcc
, withtime
) dateblur(e
, defcc
, withtime
) -->
164 <td
class='text-left'>
165 <input type
='text' size
='10' class='datepicker' name
="csv_date_start" id
="caldte1" value
="" title
="<?php echo xla('yyyy-mm-dd Start Date'); ?>" />
166 <input type
="text" size
="10" class="datepicker" name
="csv_date_end" id
="caldte2" value
="" title
="<?php echo xla('yyyy-mm-dd End Date'); ?>" />
168 <td
class='text-left'>
169 <input type
="hidden" name
="csvShowTable" form
="formcsvtables" value
="gettable" />
170 <button type
="submit" class="btn btn-primary btn-add" id
="csvshow" name
="csv_show" form
="formcsvtables" value
="<?php echo xla("Submit
"); ?>">
171 <?php
echo xlt("Submit"); ?
>
178 <div
class="col-sm-12 col-md-4">
179 <form id
="formcsvhist" name
="hist_csv" action
="edih_main.php" method
="get">
180 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
181 <h4
><?php
echo xlt("Per Encounter"); ?
></h4
>
184 <td colspan
='2'><?php
echo xlt("Enter Encounter Number"); ?
></td
>
187 <td
><?php
echo xlt("Encounter"); ?
></td
>
188 <td
><?php
echo xlt("Submit"); ?
></td
>
191 <td
><input id
="histenctr" type
="text" class="form-control" size
=10 name
="hist_enctr" value
="" /></td
>
193 <button type
="submit" class="btn btn-primary btn-add" id
="histsbmt" name
="hist_sbmt" form
="formcsvhist" value
="<?php echo xla("Submit
"); ?>">
194 <?php
echo xlt("Submit"); ?
>
202 <div
class='alert alert-primary mt-3 d-none' id
='tblshow'>
204 <div id
='tbcsvhist'></div
>
205 <div id
='tbrpt'></div
>
206 <div id
='tbrsp'></div
>
207 <div id
='tbsub'></div
>
208 <div id
='tbseg'></div
>
213 <!-- EDI File Section
-->
214 <div
class="tab-pane fade" id
="nav-edifile" role
="tabpanel" aria
-labelledby
="nav-edifile-tab">
215 <div
class="container">
218 <form id
="x12view" name
="x12_view" action
="edih_main.php" enctype
="multipart/form-data" method
="post">
219 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
220 <h4
><?php
echo xlt("View EDI x12 file"); ?
>:</h4
>
223 <td
class='text-left'><label
for="x12htm"><?php
echo xlt("Report?"); ?
></label
></td
>
224 <td
class='text-center'><label
for="x12file"><?php
echo xlt("Choose File"); ?
>:</label
></td
>
225 <td
class='text-left'><label
for="x12_filebtn"><?php
echo xlt("Submit"); ?
>:</label
></td
>
226 <td
class='text-center'><label
for="x12_filereset"><?php
echo xlt("Reset"); ?
>:</label
></td
>
229 <td
class='text-left'>
230 <input type
="hidden" name
="viewx12Files" value
="view_x12" />
231 <input type
="checkbox" id
="x12htm" name
="x12_html" value
="html" />
233 <td
class='text-left'>
234 <div
class="custom-file">
235 <label
class="custom-file-label"><?php
echo xlt("Choose file"); ?
></label
>
236 <input id
="x12file" type
="file" class="custom-file-input" size
=30 name
="fileUplx12" />
239 <td
class='text-center'>
240 <button type
="submit" class="btn btn-primary btn-add" id
="x12filebtn" name
="x12_filebtn" form
="x12view" value
="<?php echo xla("Submit
"); ?>">
241 <?php
echo xlt("Submit"); ?
>
244 <td
class='text-center'>
245 <button type
="button" class="btn btn-secondary btn-cancel" id
="x12filerst" name
="x12_filereset" form
="x12view" value
="<?php echo xla("Reset
"); ?>">
246 <?php
echo xlt("Reset"); ?
>
252 <div id
="x12rsp"></div
>
257 <!-- Notes Section
-->
258 <div
class="tab-pane fade" id
="nav-notes" role
="tabpanel" aria
-labelledby
="nav-notes-tab">
259 <div
class="container">
262 <a
class="text-decoration-none" href
="<?php echo $web_root; ?>/Documentation/Readme_edihistory.html" rel
="noopener" target
="_blank"><?php
echo xlt("View the README file"); ?
></a
>
264 <div
class="col-sm-12 col-md-6">
265 <form id
="formlog" name
="form_log" action
="edih_main.php" enctype
="multipart/form-data" method
="post">
266 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
267 <h4
><?php
echo xlt("Inspect the log"); ?
></h4
>
268 <label
for="logfile"><?php
echo xlt("View Log"); ?
></label
>
269 <select
class="custom-select" id
="logselect" name
="log_select"></select
>
270 <input type
="hidden" name
="logshowfile" value
="getlog">
271 <div
class="btn-group mt-3">
272 <button type
="submit" class="btn btn-primary btn-add" id
="logshow" form
="formlog" value
="<?php echo xla("Submit
"); ?>">
273 <?php
echo xlt("Submit"); ?
>
275 <button type
="button" class="btn btn-primary" id
="logarch" form
="formlog" value
="<?php echo xla("Archive
"); ?>">
276 <?php
echo xlt("Archive"); ?
>
278 <button type
="button" class="btn btn-secondary btn-cancel" id
="logclose" form
="formlog" value
="<?php echo xla("Close
"); ?>">
279 <?php
echo xlt("Close"); ?
>
284 <div
class="col-sm-12 col-md-6">
285 <form id
="formnotes" name
="form_notes" action
="edih_main.php" enctype
="multipart/form-data" method
="post">
286 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
287 <h4
><?php
echo xlt("Notes"); ?
></h4
>
288 <label
for="notesget"><?php
echo xlt("Notes"); ?
></label
>
289 <div
class="btn-group ml-2">
290 <button type
="button" class="btn btn-primary" id
="notesget" name
="notes_get" form
="formnotes" value
="<?php echo xla("Open
"); ?>">
291 <?php
echo xlt("Open"); ?
>
293 <input id
="noteshidden" type
="hidden" name
="notes_hidden" value
="putnotes" />
294 <button type
="submit" class="btn btn-primary btn-save" id
="notessave" name
="notes_save" form
="formnotes" value
="<?php echo xla("Save
"); ?>">
295 <?php
echo xlt("Save"); ?
>
297 <button type
="button" class="btn btn-secondary btn-cancel" id
="notesclose" name
="notes_close" form
="formnotes" value
="<?php echo xla("Close
"); ?>">
298 <?php
echo xlt("Close"); ?
>
304 <div id
='logrsp'></div
>
305 <div id
='notesrsp'></div
>
310 <!-- Archive Section
-->
311 <div
class="tab-pane fade" id
="nav-archive" role
="tabpanel" aria
-labelledby
="nav-archive-tab">
312 <div
class="container">
315 <span
><?php
echo xlt("Selected files and data will be removed from folders and tables"); ?
></span
>
317 <div
class="col-sm-12 col-md-6">
318 <form id
="formarchive" name
="form_archive" action
="edih_main.php" enctype
="multipart/form-data" method
="POST">
319 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
320 <h4
><?php
echo xlt("Archive old files"); ?
></h4
>
321 <label
for="archive_sel"><?php
echo xlt("Older than"); ?
>:</label
>
322 <select
class="custom-select" id
="archiveselect" name
="archive_sel">
323 <option value
="" selected
="selected"><?php
echo xlt('Choose'); ?
></option
>
324 <option value
="24m">24 <?php
echo xlt('months'); ?
></option
>
325 <option value
="18m">18 <?php
echo xlt('months'); ?
></option
>
326 <option value
="12m">12 <?php
echo xlt('months'); ?
></option
>
327 <option value
="9m">9 <?php
echo xlt('months'); ?
></option
>
328 <option value
="6m">6 <?php
echo xlt('months'); ?
></option
>
329 <option value
="3m">3 <?php
echo xlt('months'); ?
></option
>
331 <label
for="archivereport"><?php
echo xlt("Report"); ?
>:</label
>
332 <input type
="button" class="btn btn-sm btn-secondary" id
="archiverpt" name
="archivereport" form
="formarchive" value
="<?php echo xla("Report
"); ?>" />
333 <input type
="hidden" name
="ArchiveRequest" form
="formarchive" value
="requested" />
334 <label
for="archivesbmt"><?php
echo xlt("Archive"); ?
>:</label
>
335 <input type
="submit" class="btn btn-sm btn-secondary" id
="archivesbmt" name
="archive_sbmt" form
="formarchive" value
="<?php echo xla("Archive
"); ?>" />
338 <div
class="col-sm-12 col-md-6">
339 <form id
="formarchrestore" name
="form_archrestore" action
="edih_main.php" enctype
="multipart/form-data" method
="POST">
340 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
341 <h4
><?php
echo xlt("Restore Archive"); ?
></h4
>
342 <label
for="archrestore_sel"><?php
echo xlt("Restore"); ?
>:</label
>
343 <select
class="custom-select" id
="archrestoresel" name
="archrestore_sel"> </select
>
344 <input type
="hidden" name
="ArchiveRestore" form
="formarchrestore" value
="restore" />
345 <label
for="arch_restore"><?php
echo xlt("Restore"); ?
>:</label
>
346 <input type
="submit" class="btn btn-sm btn-secondary" id
="archrestore" name
="arch_restore" form
="formarchrestore" value
="<?php echo xla("Restore
"); ?>" />
350 <div id
="archiversp"></div
>
360 <!-- end DataTables js Begin local js
-->
363 // set some button disabled
364 $
('#processfiles').prop('disabled', true);
365 $
('#archivesubmit').prop('disabled', true);
366 // update list of available csv tables
367 $
(function () { csvlist() });
368 // update list of available log files
369 $
(function () { loglist() });
370 // update list of archive files
371 $
(function () { archlist() });
372 // hide these div elements until used
373 $
("#fileupl1").toggle(false);
374 $
("#fileupl2").toggle(false);
376 $
('.datepicker').datetimepicker({
377 <?php
$datetimepicker_timepicker = false; ?
>
378 <?php
$datetimepicker_showseconds = false; ?
>
379 <?php
$datetimepicker_formatInput = false; ?
>
380 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
381 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
385 * end of document ready() $
388 /* **** from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ *** */
389 function bytesToSize(bytes
) {
390 var sizes
= ['Bytes', 'KB', 'MB', 'GB', 'TB'];
391 if (bytes
== 0) return 'n/a';
392 var i
= parseInt(Math
.floor(Math
.log(bytes
) / Math
.log(1024)));
393 if (i
== 0) return bytes +
' ' + sizes
[i
];
394 return (bytes
/ Math
.pow(1024, i
)).toFixed(1) +
' ' + sizes
[i
];
396 /* *** variables for upload maximums *** */
397 /* *** phpserver: 'maxfsize''maxfuploads''postmaxsize''tmpdir' phpserver['postmaxsize'] *** */
401 url
: 'edih_main.php',
404 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
407 success
: function(rsp
){ phpserver
= rsp
}
412 * update the list of available csv tables
417 url
: 'edih_main.php',
420 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
423 success
: function(data
) {
424 var options
= $
('#csvselect').attr('options');
425 var optct
= $
.isPlainObject(data
); // data.length
428 options
.push("<option value='' selected='selected'><?php echo xla("Choose from
list"); ?></option>");
429 $
.each(data
.claims
, function(idx
, value
) {
430 options
.push("<option value=" + value
.fname +
">" + value
.desc +
"</option>");
432 $
.each(data
.files
, function(idx
, value
) {
433 options
.push("<option value=" + value
.fname +
">" + value
.desc +
"</option>");
435 $
("#csvselect").html(options
.join(''));
440 /* *** update the list of log files *** */
444 url
: 'edih_main.php',
447 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
450 success
: function(data
) {
451 var options
= $
('#logselect').attr('options');
452 var optct
= data
.length
;
455 options
.push('<option selected="selected"><?php echo xla("Choose from list"); ?></option>');
456 for (var i
=0; i
<optct
; i++
) {
457 options
.push('<option value=' + data
[i
] +
'>' + data
[i
] +
'</option>');
459 $
("#logselect").html(options
.join(''));
464 /* *** update the list of archive files *** id="archrestoresel name="archrestore_sel" */
465 function archlist() {
468 url
: 'edih_main.php',
471 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
474 success
: function(data
) {
475 //var options = $('#archrestoresel').attr('options');
476 $
('#archrestoresel').empty();
477 var optct
= data
.length
;
480 options
.push("<option selected='selected'><?php echo xla("Choose from
list"); ?></option>");
481 for (var i
=0; i
<optct
; i++
) {
482 options
.push("<option value=" + data
[i
] +
">" + data
[i
] +
"</option>");
485 options
.push("<option selected='selected'><?php echo xla("No Archives
"); ?></option>");
487 $
('#archrestoresel').html(options
.join(""));
492 $
('#tbcsvhist').on('click', 'a', function(e
) {
495 $
('<div/>', {'class':'edihDlg', 'id':'link-'+
($
(this
).index()+
1)})
496 .load($
(this
).attr('href')).appendTo('#tbcsvhist');
500 $
('#tblshow').on('click', 'a', function(e
) {
503 $
('<div/>', {'class':'edihDlg', 'id':'link-'+
($
(this
).index()+
1)})
504 .load($
(this
).attr('href')).appendTo('#tblshow');
507 /* **** links in dialog in uploads - processed div **** */
508 $
('#processed').on('click', 'a', function(e
) {
511 $
('<div/>', {'class':'edihDlg', 'id':'link-'+
($
(this
).index()+
1)})
512 .load($
(this
).attr('href')).appendTo('#processed');
514 /* ****************************
516 * === upload multiple files
517 * buttons are enabled/disabled
518 * selected and uploaded files are listed
519 * the process files script html output displayed,
521 /* **** if files have been uploaded **** */
523 /* ***** list files selected in the multifile upload input **** */
524 $
('#uplmulti').on('change', function(){
525 // clear uploaded files list, since new selected files list is coming
526 $
('#fileupl2').html('');
527 $
('#fileupl2').addClass('d-none');
528 $
('#fileupl2').removeClass('flist');
529 $
('#processed').html('');
530 $
('#processed').addClass('d-none');
531 var uplfiles
= this
.files
; //event.target.files;
532 var fct
= uplfiles
.length
;
534 var fl1
= $
('#fileupl1');
537 fl1
.addClass('flist1');
538 fl1
.removeClass('d-none')
539 var fmaxupl
= phpserver
['maxfuploads']; // $("#srvvals").data('mf');
540 var pmaxsize
= phpserver
['postmaxsize']
541 var str
= "<p><em><?php echo xla('Selected Files'); ?>:</em></p>";
542 str
= str +
"<ul id='uplsel' class='fupl'>";
543 for(var i
= 0; i
< fct
; i++
) {
544 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>';
545 str
= str +
"<li>" + uplfiles
[i
].name +
"</li>"; //' ' +
546 fsize +
= uplfiles
[i
].size
;
548 str
= str +
'</ul><p><?php echo xla('Total size
'); ?>: ' +
bytesToSize(fsize
) +
' (<?php echo xla('max
'); ?> ' + pmaxsize +
')</p>';
549 $
('#uplsubmit').prop('disabled', false);
550 if (upld_ct
=== 0 ) {
551 $
('#processupl').prop('disabled', true);
555 // uplreset button click the file input is reset and associated values cleared
556 $
('#uplreset').on('click', function( event
) {
557 event
.preventDefault();
558 event
.stopPropagation();
559 $
('#fileupl1').html('');
560 $
('#fileupl2').html('');
561 $
('#fileupl1').hide();
562 $
('#fileupl2').hide();
563 $
('#processed').html('');
564 $
('#processed').addClass('d-none');
565 $
('#uplsubmit').prop('disabled', true);
567 $
('#fuplprocess').prop('disabled', true);
569 $
('#fuplprocess').prop('disabled', false);
571 // $('#fupl').reset();
572 document
.getElementById('formupl').reset();
576 /* ***** uplsubmit button click --upload files are scanned and copied into folders *** */
577 /* ***** files are listed next to file selected list by css *** */
578 $
('#formupl').on('submit', function( event
) {
579 event
.stopPropagation();
580 event
.preventDefault();
581 var uplForm
= document
.getElementById("formupl");
582 var upldata
= new FormData( document
.getElementById('formupl') );
583 var rspElem
= $
('#fileupl2');
585 rspElem
.addClass('d-none');
587 url
: $
('#formupl').attr('action'),
594 success
: function(data
) {
597 rspElem
.removeClass('d-none');
598 $
('#fuplprocess').prop('disabled', false );
599 $
('#fuplupload').prop('disabled', true);
603 error
: function( xhr
, status
) { alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> ); },
607 /* **** process button, files parsed and csv rows displayed *** */
608 $
('#processnew').on('submit', function(e
) {
612 url
: $
('#processnew').attr('action'),
614 data
: $
('#processnew').serialize(), //prcForm.serialize(),
617 $
('#fileupl1').html('');
618 $
('#fileupl1').addClass('d-none');
619 $
('#fileupl2').html('');
620 $
('#fileupl2').addClass('d-none');
621 $
('#processed').html(data
);
622 $
('#processed').removeClass('d-none');
625 error
: function( xhr
, status
) {
626 alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> ),
627 $
('#processed').html(status
);
628 $
('#processed').removeClass('d-none');
632 /* *** update list of csv tables *** */
634 $
('#fuplprocess').prop('disabled', true );
638 /* *********************************************
640 * ==== file upload lists match uploaded to selected
641 * when mouse is over element in one list, matching element
642 * in other list is highlighted also
644 function outlineMatch(matchElem
, matchText
) {
645 if (matchText
== 'none') {
646 matchElem
.css('font-weight', 'normal');
649 matchElem
.each(function( index
) {
650 if ( matchText
== $
(this
).text() ) {
651 $
(this
).siblings().css('font-weight', 'normal');
652 $
(this
).css('font-weight', 'bolder');
660 /* *** do not use .hover event */
661 $
('#fileupl2').on('mouseenter', 'li', function(event
){
662 var fl1
= $
('#fileupl1').find('li');
663 var fname
= $
(this
).text();
664 $
(this
).css('font-weight', 'bolder');
665 $
(this
).siblings().css('font-weight', 'normal');
666 outlineMatch(fl1
, fname
);
668 $
('#fileupl2').on('mouseleave', 'li', function(){
669 var fl1
= $
('#fileupl1').find('li');
670 $
(this
).css('font-weight', 'normal');
671 outlineMatch(fl1
, 'none');
673 $
('#fileupl1').on('mouseenter', 'li', function(event
){
674 $
(this
).css('font-weight', 'bolder');
675 if ( $
('#fileupl2').length
) {
676 var fl2
= $
('#fileupl2').find('li');
677 var fname
= $
(this
).text();
678 outlineMatch(fl2
, fname
);
681 $
('#fileupl1').on('mouseleave', 'li', function(){
682 $
(this
).css('font-weight', 'normal');
683 if ( $
('#fileupl2').length
) {
684 var fl2
= $
('#fileupl2').find('li');
685 var fname
= $
(this
).text();
686 outlineMatch(fl2
, 'none');
690 /* ***** ==== end file upload lists match uploaded to selected
691 /* ****************************
692 * === end upload multiple files section
696 * begin csv tables section
697 * the csv tables are displayed using jquery dataTables plugin
698 * here, the 'success' action is to execute an array of functions
699 * the helper function bindlinks() applies jquery .on method
700 * so most links will open a jquery-ui dialog
702 $
('#formcsvtables').on('submit', function(e
) {
705 // verify a csv file is selected
706 if ($
('#csvselect').val() == '') {
707 $
("#tblshow").html('<?php echo xla("No table selected! Select a table."); ?>');
708 $
('#tblshow').removeClass('d-none');
713 url
: "edih_main.php",
714 data
: $
('#formcsvtables').serialize(),
718 $
('#tblshow').html(data
);
719 $
('#tblshow').css('maxWidth', 'fit-contents');
720 $
('#tblshow').removeClass('d-none');
721 $
('#tblshow table#csvTable').DataTable({
724 'scrollCollapse': true,
727 <?php
// Bring in the translations ?>
728 <?php
require($GLOBALS['srcdir'] . '/js/xl/datatables-net.js.php'); ?
>
735 // csv encounter history
736 $
('#formcsvhist').on('submit', function(e
) {
738 $
('#tbcsvhist').empty();
739 var chenctr
= $
('#histenctr').value
;
742 url
: $
('#formcsvhist').attr('action'),
743 data
: $
('#formcsvhist').serialize(), //{ csvenctr: chenctr },
745 success
: [ function(data
){
746 $
('<div/>', {'class':'edihDlg', 'id':'link-'+
($
(this
).index()+
1)})
747 .appendTo('#tbcsvhist').html($
.trim(data
));
753 $
('#csvClear').on('click', function(e
) {
755 $
("#tblshow").html('');
756 $
('#tblshow').addClass('d-none');
759 * === end of csv tables and claim history
762 * === view x12 file form form"view_x12" file"x12file" submit"fx12" check"ifhtml" newWin"x12nwin"
764 $
('#x12view').on('submit', function(e
) {
768 var rspElem
= $
('#x12rsp');
769 var frmData
= new FormData( document
.getElementById('x12view') );
771 url
: $
('#x12view').attr('action'),
777 success
: function(data
) {
780 $
('#x12filesbmt').prop('disabled', true);
782 error
: function( xhr
, status
) { alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> ); }
786 $
('#x12file').on('change', function(){
787 // clear file display
788 $
('#x12rsp').html('');
789 $
('#x12filesbmt').prop('disabled', false);
792 $
('#x12filerst').on('click', function(e
){
795 // clear file display
796 $
('#x12rsp').html('');
797 $
('#x12filesbmt').prop('disabled', true);
798 $
('#x12view').trigger('reset');
802 * === functions for logs, notes, and archive "frm_archive" "archiveselect""archivesubmit"
804 $
('#logarch').on('click', function(e
) {
810 url
: $
('#formlog').attr('action'),
813 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
816 success
: function(data
) {
817 var str
= "<p><?php echo xla('Archive Log Files'); ?></p><ul id='logarchlist'>";
818 var fct
= data
.length
;
820 str
= str +
"<li><?php echo xla('No logs older than 7 days'); ?></li>";
822 for(var i
= 0; i
< fct
; i++
) {
823 str
= str +
"<li>" + data
[i
] +
"</li>";
827 $
('#notesrsp').hide();
828 $
('#logrsp').html('');
829 $
('#logrsp').html(str
);
832 error
: function( xhr
, status
) { alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> ); }
838 $
('#logclose').on('click', function(e
) {
840 $
('#logrsp').html('');
842 $
('#notesrsp').show();
845 $
('#logselect').on('change', function(e
) {
846 $
('#logshow').prop('disabled', false );
849 $
('#logshow').on('click', function(e
) {
852 var fn
= $
('#logselect').val();
855 url
: $
('#formlog').attr('action'),
856 //data: { archivelog: 'yes', logfile: fn },
857 data
: $
('#formlog').serialize(),
859 success
: function(data
){
860 $
('#notesrsp').hide();
861 $
('#logrsp').html(''),
862 $
('#logrsp').html($
.trim(data
));
868 $
('#notesget').on('click', function(e
) {
873 url
: $
('#formnotes').attr('action'),
876 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
879 success
: function(data
){
880 $
('#notesrsp').html('');
881 $
('#notesrsp').html("<H4>Notes:</H4>");
882 $
('#notesrsp').append("<textarea class='form-control' id='txtnotes', name='txtnotes',form='formnotes',rows='10',cols='600',wrap='hard' autofocus='autofocus'></textarea>");
883 // necessary to trim the data since php from script has leading newlines (UTF-8 issue) '|:|'
885 $
('#notesrsp \\:textarea').val($
.trim(data
));
886 $
('#notesrsp').show();
891 $
('#notessave').on('click', function(e
) {
893 var notetxt
= $
('#txtnotes').val();
894 var noteURL
= $
('#formnotes').attr('action');
895 $
.post(noteURL
, { putnotes
: 'yes', tnotes
: notetxt
, csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
> },
896 function(data
){ $
('#notesrsp').append(data
); });
899 $
('#notesclose').on('click', function(e
) {
901 $
('#notesrsp').html('');
902 $
('#notesrsp').toggle(false);
906 * ==== Archive form id="formarchive"
909 $
('#formarchive').on('submit', function(e
) {
910 //e.stopPropagation();
912 var archForm
= document
.getElementById('formarchive');
913 var archdata
= new FormData(archForm
);
914 var rspElem
= $
('#archiversp');
917 url
: $
('#formarchive').attr('action'),
924 success
: function(data
) {
926 $
('#archivesubmit').prop('disabled', true );
930 error
: function( xhr
, status
) { alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> ); },
931 // code to run regardless of success or failure
932 // complete: function( xhr, status ) { alert( "The request is complete!" ); }
939 $
('#archiverpt').on('click', function(event
) {
940 event
.preventDefault();
941 event
.stopPropagation();
943 var rspElem
= $
('#archiversp');
945 var sprd
= $
('#archiveselect').val();
946 var surl
= $
('#formarchive').attr('action');
950 url
: 'edih_main.php',
954 data
: { archivereport
: 'yes', period
: sprd
, csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
> },
956 success
: function(data
) {
957 //rspElem.html(data);
959 $
('#archiversp').html(data
);
961 error
: function( xhr
, status
) {
962 alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> );
963 rspElem
.html(status
);
970 $
('#archiveselect').on('change', function(e
) {
971 $
('#archivesubmit').prop('disabled', false );
975 $
('#formarchrestore').on('submit', function(e
) {
976 //e.stopPropagation();
979 var sel
= $
( "#archrestoresel option:selected" ).text();
981 if (sel
== "No Archives") {
982 alert(<?php
echo xlj('No archive files present'); ?
>);
985 var archrstForm
= document
.getElementById('formarchrestore');
986 var archrstdata
= new FormData(archrstForm
);
987 var rspElem
= $
('#archiversp');
988 //var archf = $('#archrestoresel').val();
989 //archrstdata = { archrestore: 'yes', archfile: archf };
991 url
: $
('#formarchrestore').attr('action'),
997 success
: function(data
) {
1001 error
: function( xhr
, status
) { alert( <?php
echo xlj('Sorry, there was a problem!'); ?
> ); },
1005 archrstForm
.reset();
1010 * end of javascript block