6 * Copyright (C) 2015 Ensoftek, Inc
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
21 * @link http://www.open-emr.org
28 require_once("../interface/globals.php");
29 require_once "$srcdir/report_database.inc";
30 require_once("$srcdir/options.inc.php");
31 require_once("qrda_category1.inc");
33 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
37 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
38 $provider_id = (isset($_GET['provider_id'])) ?
trim($_GET['provider_id']) : "";
40 $report_view = collectReportDatabase($report_id);
41 $dataSheet = json_decode($report_view['data'], true);
42 $type_report = $report_view['type'];
43 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
44 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
51 <?php
html_header_show();?
>
53 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
54 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
55 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
56 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
57 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-1-4-3/jquery.js"></script
>
58 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui-1.8.5.custom.min.js"></script
>
59 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script
>
60 <script language
="JavaScript">
61 var reportID
= '<?php echo attr($report_id); ?>';
62 var provider_id
= '<?php echo attr($provider_id);?>';
63 var zipFileArray
= new Array();
64 var failureMessage
= "";
65 $
(document
).ready(function(){
66 $
("#checkAll").change(function() {
67 var checked
= ( $
("#checkAll").attr("checked") ) ?
true : false;
68 $
("#thisForm input:checkbox").each(function() {
69 $
(this
).attr("checked", checked
);
74 function downloadSelected() {
75 zipFileArray
.length
= 0;
76 var criteriaArray
= new Array();
77 $
("#thisForm input:checkbox:checked").each(function() {
78 if ( $
(this
).attr("id") == "checkAll")
80 criteriaArray
.push($
(this
).attr("id"));
82 if ( criteriaArray
.length
== 0 ) {
83 alert("<?php echo xls('Please select at least one criteria to download');?>");
86 for( var i
=0 ; i
< criteriaArray
.length
; i++
) {
87 var checkBoxCounterArray
= criteriaArray
[i
].split("check");
88 var ruleID
= $
("#text" + checkBoxCounterArray
[1]).val();
89 //console.log(ruleID);
90 var lastOne
= ( ( i +
1 ) == criteriaArray
.length
) ?
1 : 0;
91 downloadXML(checkBoxCounterArray
[1],lastOne
,ruleID
);
95 function downloadXML(counter
,lastOne
) {
96 $
("#download" + counter
).css("display","none");
97 $
("#spin" + counter
).css("display","inline");
100 url
: "ajax_download.php",
104 ruleID
: $
("#text" + counter
).val(),
105 provider_id
: provider_id
,
106 csrf_token_form
: '<?php echo attr(collectCsrfToken()); ?>'
108 context
: document
.body
,
111 // Check if download is complete
112 var status
= data
.substr(0, 8);
113 if ( status
== "FAILURE:") {
114 data
= data
.substr(8);
116 failureMessage +
= data +
"\n";
118 zipFileArray
.push(data
);
119 $
("#checkmark" + counter
).css("display","inline");
121 $
("#download" + counter
).css("display","inline");
122 $
("#spin" + counter
).css("display","none");
123 if ( lastOne
== 1 ) {
124 if ( zipFileArray
.length
) {
125 var zipFiles
= zipFileArray
.join(",");
126 //console.log(zipFiles);
127 window
.location
= 'ajax_download.php?fileName=' +
encodeURIComponent(zipFiles
) +
'&csrf_token_form=' +
'<?php echo attr(urlencode($_SESSION['csrf_token
'])); ?>';
128 zipFileArray
.length
= 0;
130 if ( failureMessage
) {
131 console
.log(failureMessage
);
132 alert(failureMessage
);
145 .downloadIcon
:hover
{
154 <body
class="body_top">
155 <form id
="thisForm" name
="thisForm">
158 <td
><span
class="title"><?php
echo xlt("Generate/Download QRDA I - 2014"); ?
> 
;</span
></td
>
160 <a
class="css_button multiDownload" href
="#" onclick
="downloadSelected();"><span
><?php
echo xlt("Download"); ?
></span
></a
>
161 <a
class="css_button" href
="#" onclick
="closeMe();"><span
><?php
echo xlt("Close"); ?
></span
></a
>
166 <div id
="report_results" style
="width:95%">
167 <table
class="oemr_list text">
169 <th scope
="col" class="multiDownload">
170 <input type
="checkbox" name
="checkAll" id
="checkAll"/>
171 <div style
="display:none" id
=downloadAll
>
172 <img
class='downloadIcon' src
='<?php echo $GLOBALS['webroot
'];?>/images/downbtn.gif' onclick
=downloadAllXML(); />
174 <div style
='display:none' id
=spinAll
>;
175 <img src
='<?php echo $GLOBALS['webroot
'];?>/interface/pic/ajax-loader.gif'/>
179 <?php
echo xlt('Title'); ?
>
183 <?php
echo xlt('Download'); ?
>
185 <th scope
="col"> 
; 
; 
;</th
>
190 foreach ($dataSheet as $row) {
191 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
192 if (count($cqmCodes) && in_array($row['cqm_nqf_code'], $cqmCodes)) {
197 $cqmCodes[] = $row['cqm_nqf_code'];
198 echo "<td class=multiDownload>";
199 echo "<input id=check" . attr($counter) . " type=checkbox />";
201 echo "<td class='detail'>";
202 if (isset($row['is_main'])) {
203 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'), $row['id'])."</b>";
204 $tempCqmAmcString = "";
205 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
206 if (!empty($row['cqm_pqri_code'])) {
207 $tempCqmAmcString .= " " . xl('PQRI') . ":" . $row['cqm_pqri_code'] . " ";
210 if (!empty($row['cqm_nqf_code'])) {
211 $tempCqmAmcString .= " " . xl('NQF') . ":" . $row['cqm_nqf_code'] . " ";
215 if (!empty($tempCqmAmcString)) {
216 echo "(".text($tempCqmAmcString).")";
219 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $row['action_category']);
220 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $row['action_item']);
223 echo "<input type=hidden id=text" . attr($counter) . " name=text" . attr($counter) . " value='" . attr($row['cqm_nqf_code']) . "'/>";
225 echo "<td align=center>";
226 echo "<div id=download" . attr($counter) . ">";
227 echo "<img class='downloadIcon' src='" . $GLOBALS['webroot'] . "/images/downbtn.gif' onclick=downloadXML(" . attr($counter) . ",1); />";
229 echo "<div style='display:none' id=spin" . attr($counter) . ">";
230 echo "<img src='" . $GLOBALS['webroot'] . "/interface/pic/ajax-loader.gif'/>";
234 echo "<div style='display:none' id=checkmark" . attr($counter) . ">";
235 echo "<img src='" . $GLOBALS['webroot'] . "/images/checkmark.png' />";