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 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
34 $provider_id = (isset($_GET['provider_id'])) ?
trim($_GET['provider_id']) : "";
36 $report_view = collectReportDatabase($report_id);
37 $dataSheet = json_decode($report_view['data'], true);
38 $type_report = $report_view['type'];
39 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
40 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
47 <?php
html_header_show();?
>
49 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
50 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
51 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
52 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
53 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-4-3/index.js"></script
>
54 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui-1.8.5.custom.min.js"></script
>
55 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script
>
56 <script language
="JavaScript">
57 var reportID
= '<?php echo attr($report_id); ?>';
58 var provider_id
= '<?php echo attr($provider_id);?>';
59 var zipFileArray
= new Array();
60 var failureMessage
= "";
61 $
(document
).ready(function(){
62 $
("#checkAll").change(function() {
63 var checked
= ( $
("#checkAll").attr("checked") ) ?
true : false;
64 $
("#thisForm input:checkbox").each(function() {
65 $
(this
).attr("checked", checked
);
70 function downloadSelected() {
71 zipFileArray
.length
= 0;
72 var criteriaArray
= new Array();
73 $
("#thisForm input:checkbox:checked").each(function() {
74 if ( $
(this
).attr("id") == "checkAll")
76 criteriaArray
.push($
(this
).attr("id"));
78 if ( criteriaArray
.length
== 0 ) {
79 alert("<?php echo xls('Please select at least one criteria to download');?>");
82 for( var i
=0 ; i
< criteriaArray
.length
; i++
) {
83 var checkBoxCounterArray
= criteriaArray
[i
].split("check");
84 var ruleID
= $
("#text" + checkBoxCounterArray
[1]).val();
85 //console.log(ruleID);
86 var lastOne
= ( ( i +
1 ) == criteriaArray
.length
) ?
1 : 0;
87 downloadXML(checkBoxCounterArray
[1],lastOne
,ruleID
);
91 function downloadXML(counter
,lastOne
) {
92 $
("#download" + counter
).css("display","none");
93 $
("#spin" + counter
).css("display","inline");
96 url
: "ajax_download.php",
100 ruleID
: $
("#text" + counter
).val(),
101 provider_id
: provider_id
103 context
: document
.body
,
106 // Check if download is complete
107 var status
= data
.substr(0, 8);
108 if ( status
== "FAILURE:") {
109 data
= data
.substr(8);
111 failureMessage +
= data +
"\n";
113 zipFileArray
.push(data
);
114 $
("#checkmark" + counter
).css("display","inline");
116 $
("#download" + counter
).css("display","inline");
117 $
("#spin" + counter
).css("display","none");
118 if ( lastOne
== 1 ) {
119 if ( zipFileArray
.length
) {
120 var zipFiles
= zipFileArray
.join(",");
121 //console.log(zipFiles);
122 window
.location
= 'ajax_download.php?fileName=' + zipFiles
;
123 zipFileArray
.length
= 0;
125 if ( failureMessage
) {
126 console
.log(failureMessage
);
127 alert(failureMessage
);
140 .downloadIcon
:hover
{
149 <body
class="body_top">
150 <form id
="thisForm" name
="thisForm">
153 <td
><span
class="title"><?php
echo xlt("Generate/Download QRDA I - 2014"); ?
> 
;</span
></td
>
155 <a
class="css_button multiDownload" href
="#" onclick
="downloadSelected();"><span
><?php
echo xlt("Download"); ?
></span
></a
>
156 <a
class="css_button" href
="#" onclick
="closeMe();"><span
><?php
echo xlt("Close"); ?
></span
></a
>
161 <div id
="report_results" style
="width:95%">
162 <table
class="oemr_list text">
164 <th scope
="col" class="multiDownload">
165 <input type
="checkbox" name
="checkAll" id
="checkAll"/>
166 <div style
="display:none" id
=downloadAll
>
167 <img
class='downloadIcon' src
='<?php echo $GLOBALS['webroot
'];?>/images/downbtn.gif' onclick
=downloadAllXML(); />
169 <div style
='display:none' id
=spinAll
>;
170 <img src
='<?php echo $GLOBALS['webroot
'];?>/interface/pic/ajax-loader.gif'/>
174 <?php
echo xlt('Title'); ?
>
178 <?php
echo xlt('Download'); ?
>
180 <th scope
="col"> 
; 
; 
;</th
>
185 foreach ($dataSheet as $row) {
186 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
187 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'] . " ";
205 if (!empty($row['cqm_nqf_code'])) {
206 $tempCqmAmcString .= " " . xl('NQF') . ":" . $row['cqm_nqf_code'] . " ";
210 if (!empty($tempCqmAmcString)) {
211 echo "(".text($tempCqmAmcString).")";
214 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $row['action_category']);
215 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $row['action_item']);
218 echo "<input type=hidden id=text" . attr($counter) . " name=text" . attr($counter) . " value='" . attr($row['cqm_nqf_code']) . "'/>";
220 echo "<td align=center>";
221 echo "<div id=download" . attr($counter) . ">";
222 echo "<img class='downloadIcon' src='" . $GLOBALS['webroot'] . "/images/downbtn.gif' onclick=downloadXML(" . attr($counter) . ",1); />";
224 echo "<div style='display:none' id=spin" . attr($counter) . ">";
225 echo "<img src='" . $GLOBALS['webroot'] . "/interface/pic/ajax-loader.gif'/>";
229 echo "<div style='display:none' id=checkmark" . attr($counter) . ">";
230 echo "<img src='" . $GLOBALS['webroot'] . "/images/checkmark.png' />";