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 $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
53 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
54 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.4.3.min.js"></script
>
55 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui-1.8.5.custom.min.js"></script
>
56 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script
>
57 <script language
="JavaScript">
58 var reportID
= '<?php echo attr($report_id); ?>';
59 var provider_id
= '<?php echo attr($provider_id);?>';
60 var zipFileArray
= new Array();
61 var failureMessage
= "";
62 $
(document
).ready(function(){
63 $
("#checkAll").change(function() {
64 var checked
= ( $
("#checkAll").attr("checked") ) ?
true : false;
65 $
("#thisForm input:checkbox").each(function() {
66 $
(this
).attr("checked", checked
);
71 function downloadSelected() {
72 zipFileArray
.length
= 0;
73 var criteriaArray
= new Array();
74 $
("#thisForm input:checkbox:checked").each(function() {
75 if ( $
(this
).attr("id") == "checkAll")
77 criteriaArray
.push($
(this
).attr("id"));
79 if ( criteriaArray
.length
== 0 ) {
80 alert("<?php echo xls('Please select at least one criteria to download');?>");
83 for( var i
=0 ; i
< criteriaArray
.length
; i++
) {
84 var checkBoxCounterArray
= criteriaArray
[i
].split("check");
85 var ruleID
= $
("#text" + checkBoxCounterArray
[1]).val();
86 //console.log(ruleID);
87 var lastOne
= ( ( i +
1 ) == criteriaArray
.length
) ?
1 : 0;
88 downloadXML(checkBoxCounterArray
[1],lastOne
,ruleID
);
92 function downloadXML(counter
,lastOne
) {
93 $
("#download" + counter
).css("display","none");
94 $
("#spin" + counter
).css("display","inline");
97 url
: "ajax_download.php",
101 ruleID
: $
("#text" + counter
).val(),
102 provider_id
: provider_id
104 context
: document
.body
,
107 // Check if download is complete
108 var status
= data
.substr(0, 8);
109 if ( status
== "FAILURE:") {
110 data
= data
.substr(8);
112 failureMessage +
= data +
"\n";
114 zipFileArray
.push(data
);
115 $
("#checkmark" + counter
).css("display","inline");
117 $
("#download" + counter
).css("display","inline");
118 $
("#spin" + counter
).css("display","none");
119 if ( lastOne
== 1 ) {
120 if ( zipFileArray
.length
) {
121 var zipFiles
= zipFileArray
.join(",");
122 //console.log(zipFiles);
123 window
.location
= 'ajax_download.php?fileName=' + zipFiles
;
124 zipFileArray
.length
= 0;
126 if ( failureMessage
) {
127 console
.log(failureMessage
);
128 alert(failureMessage
);
141 .downloadIcon
:hover
{
150 <body
class="body_top">
151 <form id
="thisForm" name
="thisForm">
154 <td
><span
class="title"><?php
echo xlt("Generate/Download QRDA I - 2014"); ?
> 
;</span
></td
>
156 <a
class="css_button multiDownload" href
="#" onclick
="downloadSelected();"><span
><?php
echo xlt("Download"); ?
></span
></a
>
157 <a
class="css_button" href
="#" onclick
="closeMe();"><span
><?php
echo xlt("Close"); ?
></span
></a
>
162 <div id
="report_results" style
="width:95%">
163 <table
class="oemr_list text">
165 <th scope
="col" class="multiDownload">
166 <input type
="checkbox" name
="checkAll" id
="checkAll"/>
167 <div style
="display:none" id
=downloadAll
>
168 <img
class='downloadIcon' src
='<?php echo $GLOBALS['webroot
'];?>/images/downbtn.gif' onclick
=downloadAllXML(); />
170 <div style
='display:none' id
=spinAll
>;
171 <img src
='<?php echo $GLOBALS['webroot
'];?>/interface/pic/ajax-loader.gif'/>
175 <?php
echo xlt('Title'); ?
>
179 <?php
echo xlt('Download'); ?
>
181 <th scope
="col"> 
; 
; 
;</th
>
186 foreach ($dataSheet as $row) {
187 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
188 if ( count($cqmCodes) && in_array($row['cqm_nqf_code'],$cqmCodes) ) {
192 $cqmCodes[] = $row['cqm_nqf_code'];
193 echo "<td class=multiDownload>";
194 echo "<input id=check" . attr($counter) . " type=checkbox />";
196 echo "<td class='detail'>";
197 if (isset($row['is_main'])) {
198 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'),$row['id'])."</b>";
199 $tempCqmAmcString = "";
200 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
201 if (!empty($row['cqm_pqri_code'])) {
202 $tempCqmAmcString .= " " . xl('PQRI') . ":" . $row['cqm_pqri_code'] . " ";
204 if (!empty($row['cqm_nqf_code'])) {
205 $tempCqmAmcString .= " " . xl('NQF') . ":" . $row['cqm_nqf_code'] . " ";
208 if (!empty($tempCqmAmcString)) {
209 echo "(".text($tempCqmAmcString).")";
212 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$row['action_category']);
213 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$row['action_item']);
215 echo "<input type=hidden id=text" . attr($counter) . " name=text" . attr($counter) . " value='" . attr($row['cqm_nqf_code']) . "'/>";
217 echo "<td align=center>";
218 echo "<div id=download" . attr($counter) . ">";
219 echo "<img class='downloadIcon' src='" . $GLOBALS['webroot'] . "/images/downbtn.gif' onclick=downloadXML(" . attr($counter) . ",1); />";
221 echo "<div style='display:none' id=spin" . attr($counter) . ">";
222 echo "<img src='" . $GLOBALS['webroot'] . "/interface/pic/ajax-loader.gif'/>";
226 echo "<div style='display:none' id=checkmark" . attr($counter) . ">";
227 echo "<img src='" . $GLOBALS['webroot'] . "/images/checkmark.png' />";