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
25 $fake_register_globals=false;
26 $sanitize_all_escapes=true;
28 require_once("../interface/globals.php");
29 require_once "$srcdir/report_database.inc";
30 require_once("$srcdir/formatting.inc.php");
31 require_once ("$srcdir/options.inc.php");
32 require_once("$srcdir/sanitize.inc.php");
33 require_once("qrda_category1.inc");
35 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
36 $provider_id = (isset($_GET['provider_id'])) ?
trim($_GET['provider_id']) : "";
38 $report_view = collectReportDatabase($report_id);
39 $dataSheet = json_decode($report_view['data'],TRUE);
40 $type_report = $report_view['type'];
41 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
42 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
49 <?php
html_header_show();?
>
51 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
52 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
53 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
54 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
55 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-4-3/index.js"></script
>
56 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui-1.8.5.custom.min.js"></script
>
57 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script
>
58 <script language
="JavaScript">
59 var reportID
= '<?php echo attr($report_id); ?>';
60 var provider_id
= '<?php echo attr($provider_id);?>';
61 var zipFileArray
= new Array();
62 var failureMessage
= "";
63 $
(document
).ready(function(){
64 $
("#checkAll").change(function() {
65 var checked
= ( $
("#checkAll").attr("checked") ) ?
true : false;
66 $
("#thisForm input:checkbox").each(function() {
67 $
(this
).attr("checked", checked
);
72 function downloadSelected() {
73 zipFileArray
.length
= 0;
74 var criteriaArray
= new Array();
75 $
("#thisForm input:checkbox:checked").each(function() {
76 if ( $
(this
).attr("id") == "checkAll")
78 criteriaArray
.push($
(this
).attr("id"));
80 if ( criteriaArray
.length
== 0 ) {
81 alert("<?php echo xls('Please select at least one criteria to download');?>");
84 for( var i
=0 ; i
< criteriaArray
.length
; i++
) {
85 var checkBoxCounterArray
= criteriaArray
[i
].split("check");
86 var ruleID
= $
("#text" + checkBoxCounterArray
[1]).val();
87 //console.log(ruleID);
88 var lastOne
= ( ( i +
1 ) == criteriaArray
.length
) ?
1 : 0;
89 downloadXML(checkBoxCounterArray
[1],lastOne
,ruleID
);
93 function downloadXML(counter
,lastOne
) {
94 $
("#download" + counter
).css("display","none");
95 $
("#spin" + counter
).css("display","inline");
98 url
: "ajax_download.php",
102 ruleID
: $
("#text" + counter
).val(),
103 provider_id
: provider_id
105 context
: document
.body
,
108 // Check if download is complete
109 var status
= data
.substr(0, 8);
110 if ( status
== "FAILURE:") {
111 data
= data
.substr(8);
113 failureMessage +
= data +
"\n";
115 zipFileArray
.push(data
);
116 $
("#checkmark" + counter
).css("display","inline");
118 $
("#download" + counter
).css("display","inline");
119 $
("#spin" + counter
).css("display","none");
120 if ( lastOne
== 1 ) {
121 if ( zipFileArray
.length
) {
122 var zipFiles
= zipFileArray
.join(",");
123 //console.log(zipFiles);
124 window
.location
= 'ajax_download.php?fileName=' + zipFiles
;
125 zipFileArray
.length
= 0;
127 if ( failureMessage
) {
128 console
.log(failureMessage
);
129 alert(failureMessage
);
142 .downloadIcon
:hover
{
151 <body
class="body_top">
152 <form id
="thisForm" name
="thisForm">
155 <td
><span
class="title"><?php
echo xlt("Generate/Download QRDA I - 2014"); ?
> 
;</span
></td
>
157 <a
class="css_button multiDownload" href
="#" onclick
="downloadSelected();"><span
><?php
echo xlt("Download"); ?
></span
></a
>
158 <a
class="css_button" href
="#" onclick
="closeMe();"><span
><?php
echo xlt("Close"); ?
></span
></a
>
163 <div id
="report_results" style
="width:95%">
164 <table
class="oemr_list text">
166 <th scope
="col" class="multiDownload">
167 <input type
="checkbox" name
="checkAll" id
="checkAll"/>
168 <div style
="display:none" id
=downloadAll
>
169 <img
class='downloadIcon' src
='<?php echo $GLOBALS['webroot
'];?>/images/downbtn.gif' onclick
=downloadAllXML(); />
171 <div style
='display:none' id
=spinAll
>;
172 <img src
='<?php echo $GLOBALS['webroot
'];?>/interface/pic/ajax-loader.gif'/>
176 <?php
echo xlt('Title'); ?
>
180 <?php
echo xlt('Download'); ?
>
182 <th scope
="col"> 
; 
; 
;</th
>
187 foreach ($dataSheet as $row) {
188 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
189 if ( count($cqmCodes) && in_array($row['cqm_nqf_code'],$cqmCodes) ) {
193 $cqmCodes[] = $row['cqm_nqf_code'];
194 echo "<td class=multiDownload>";
195 echo "<input id=check" . attr($counter) . " type=checkbox />";
197 echo "<td class='detail'>";
198 if (isset($row['is_main'])) {
199 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'),$row['id'])."</b>";
200 $tempCqmAmcString = "";
201 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
202 if (!empty($row['cqm_pqri_code'])) {
203 $tempCqmAmcString .= " " . xl('PQRI') . ":" . $row['cqm_pqri_code'] . " ";
205 if (!empty($row['cqm_nqf_code'])) {
206 $tempCqmAmcString .= " " . xl('NQF') . ":" . $row['cqm_nqf_code'] . " ";
209 if (!empty($tempCqmAmcString)) {
210 echo "(".text($tempCqmAmcString).")";
213 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$row['action_category']);
214 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$row['action_item']);
216 echo "<input type=hidden id=text" . attr($counter) . " name=text" . attr($counter) . " value='" . attr($row['cqm_nqf_code']) . "'/>";
218 echo "<td align=center>";
219 echo "<div id=download" . attr($counter) . ">";
220 echo "<img class='downloadIcon' src='" . $GLOBALS['webroot'] . "/images/downbtn.gif' onclick=downloadXML(" . attr($counter) . ",1); />";
222 echo "<div style='display:none' id=spin" . attr($counter) . ">";
223 echo "<img src='" . $GLOBALS['webroot'] . "/interface/pic/ajax-loader.gif'/>";
227 echo "<div style='display:none' id=checkmark" . attr($counter) . ">";
228 echo "<img src='" . $GLOBALS['webroot'] . "/images/checkmark.png' />";