6 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2015 Ensoftek, Inc
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../interface/globals.php");
16 require_once "$srcdir/report_database.inc";
17 require_once("$srcdir/options.inc.php");
18 require_once("qrda_category1.inc");
20 use OpenEMR\Core\Header
;
22 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
26 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
27 $provider_id = (isset($_GET['provider_id'])) ?
trim($_GET['provider_id']) : "";
29 $report_view = collectReportDatabase($report_id);
30 $dataSheet = json_decode($report_view['data'], true);
31 $type_report = $report_view['type'];
32 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
33 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
39 <?php Header
::setupHeader(['no_bootstrap', 'no_fontawesome', 'common', 'opener', 'jquery-ui']); ?
>
41 <script language
="JavaScript">
42 var reportID
= <?php
echo js_escape($report_id); ?
>;
43 var provider_id
= <?php
echo js_escape($provider_id);?
>;
44 var zipFileArray
= new Array();
45 var failureMessage
= "";
47 $
("#checkAll").on("change", function() {
48 var checked
= ( $
("#checkAll").prop("checked") ) ?
true : false;
49 $
("#thisForm input:checkbox").each(function() {
50 $
(this
).prop("checked", checked
);
55 function downloadSelected() {
56 zipFileArray
.length
= 0;
57 var criteriaArray
= new Array();
58 $
("#thisForm input:checkbox:checked").each(function() {
59 if ( $
(this
).attr("id") == "checkAll")
61 criteriaArray
.push($
(this
).attr("id"));
63 if ( criteriaArray
.length
== 0 ) {
64 alert(<?php
echo xlj('Please select at least one criteria to download');?
>);
67 for( var i
=0 ; i
< criteriaArray
.length
; i++
) {
68 var checkBoxCounterArray
= criteriaArray
[i
].split("check");
69 var ruleID
= $
("#text" + checkBoxCounterArray
[1]).val();
70 //console.log(ruleID);
71 var lastOne
= ( ( i +
1 ) == criteriaArray
.length
) ?
1 : 0;
72 downloadXML(checkBoxCounterArray
[1],lastOne
,ruleID
);
76 function downloadXML(counter
,lastOne
) {
77 $
("#download" + counter
).css("display","none");
78 $
("#spin" + counter
).css("display","inline");
81 url
: "ajax_download.php",
85 ruleID
: $
("#text" + counter
).val(),
86 provider_id
: provider_id
,
87 csrf_token_form
: <?php
echo js_escape(collectCsrfToken()); ?
>
89 context
: document
.body
,
92 // Check if download is complete
93 var status
= data
.substr(0, 8);
94 if ( status
== "FAILURE:") {
95 data
= data
.substr(8);
97 failureMessage +
= data +
"\n";
99 zipFileArray
.push(data
);
100 $
("#checkmark" + counter
).css("display","inline");
102 $
("#download" + counter
).css("display","inline");
103 $
("#spin" + counter
).css("display","none");
104 if ( lastOne
== 1 ) {
105 if ( zipFileArray
.length
) {
106 var zipFiles
= zipFileArray
.join(",");
107 //console.log(zipFiles);
108 window
.location
= 'ajax_download.php?fileName=' +
encodeURIComponent(zipFiles
) +
'&csrf_token_form=' +
<?php
echo js_url(collectCsrfToken()); ?
>;
109 zipFileArray
.length
= 0;
111 if ( failureMessage
) {
112 console
.log(failureMessage
);
113 alert(failureMessage
);
126 .downloadIcon
:hover
{
135 <body
class="body_top">
136 <form id
="thisForm" name
="thisForm">
139 <td
><span
class="title"><?php
echo xlt("Generate/Download QRDA I - 2014"); ?
> 
;</span
></td
>
141 <a
class="css_button multiDownload" href
="#" onclick
="downloadSelected();"><span
><?php
echo xlt("Download"); ?
></span
></a
>
142 <a
class="css_button" href
="#" onclick
="closeMe();"><span
><?php
echo xlt("Close"); ?
></span
></a
>
147 <div id
="report_results" style
="width:95%">
148 <table
class="oemr_list text">
150 <th scope
="col" class="multiDownload">
151 <input type
="checkbox" name
="checkAll" id
="checkAll"/>
152 <div style
="display:none" id
=downloadAll
>
153 <img
class="downloadIcon" src
="<?php echo $GLOBALS['images_static_relative'];?>/downbtn.gif" onclick
=downloadAllXML(); />
155 <div style
="display:none" id
=spinAll
>;
156 <img src
="<?php echo $GLOBALS['webroot'];?>/interface/pic/ajax-loader.gif"/>
160 <?php
echo xlt('Title'); ?
>
164 <?php
echo xlt('Download'); ?
>
166 <th scope
="col"> 
; 
; 
;</th
>
171 foreach ($dataSheet as $row) {
172 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
173 if (count($cqmCodes) && in_array($row['cqm_nqf_code'], $cqmCodes)) {
178 $cqmCodes[] = $row['cqm_nqf_code'];
179 echo "<td class=multiDownload>";
180 echo "<input id=check" . attr($counter) . " type=checkbox />";
182 echo "<td class='detail'>";
183 if (isset($row['is_main'])) {
184 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'), $row['id'])."</b>";
185 $tempCqmAmcString = "";
186 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
187 if (!empty($row['cqm_pqri_code'])) {
188 $tempCqmAmcString .= " " . xl('PQRI') . ":" . $row['cqm_pqri_code'] . " ";
191 if (!empty($row['cqm_nqf_code'])) {
192 $tempCqmAmcString .= " " . xl('NQF') . ":" . $row['cqm_nqf_code'] . " ";
196 if (!empty($tempCqmAmcString)) {
197 echo "(".text($tempCqmAmcString).")";
200 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $row['action_category']);
201 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $row['action_item']);
204 echo "<input type=hidden id=text" . attr($counter) . " name=text" . attr($counter) . " value='" . attr($row['cqm_nqf_code']) . "'/>";
206 echo "<td align=center>";
207 echo "<div id=download" . attr($counter) . ">";
208 echo "<img class='downloadIcon' src='" . $GLOBALS['images_static_relative'] . "/downbtn.gif' onclick=downloadXML(" . attr_js($counter) . ",1); />";
210 echo "<div style='display:none' id=spin" . attr($counter) . ">";
211 echo "<img src='" . $GLOBALS['webroot'] . "/interface/pic/ajax-loader.gif'/>";
215 echo "<div style='display:none' id=checkmark" . attr($counter) . ">";
216 echo "<img src='" . $GLOBALS['images_static_relative'] . "/checkmark.png' />";