Changes to the Clients>Clinical report
[openemr.git] / interface / reports / cqm.php
blobcc639ce6850eb3b3b40e2ecab3365964a03f98f4
1 <?php
2 // Copyright (C) 2010 Brady Miller <brady@sparmy.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 //SANITIZE ALL ESCAPES
10 $sanitize_all_escapes=true;
13 //STOP FAKE REGISTER GLOBALS
14 $fake_register_globals=false;
17 require_once("../globals.php");
18 require_once("../../library/patient.inc");
19 require_once("$srcdir/formatting.inc.php");
20 require_once "$srcdir/options.inc.php";
21 require_once "$srcdir/formdata.inc.php";
22 require_once "$srcdir/clinical_rules.php";
23 require_once "$srcdir/report_database.inc";
25 // This is only pertinent for users of php versions less than 5.2
26 // (ie. this wrapper is only loaded when php version is less than
27 // 5.2; otherwise the native php json functions are used)
28 require_once "$srcdir/jsonwrapper/jsonwrapper.php";
30 // See if showing an old report or creating a new report
31 $report_id = (isset($_GET['report_id'])) ? trim($_GET['report_id']) : "";
33 // Collect the back variable, if pertinent
34 $back_link = (isset($_GET['back'])) ? trim($_GET['back']) : "";
36 // If showing an old report, then collect information
37 if (!empty($report_id)) {
38 $report_view = collectReportDatabase($report_id);
39 $date_report = $report_view['date_report'];
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";
43 $rule_filter = $report_view['type'];
44 if (($type_report == "amc") || ($type_report == "amc_2011") || ($type_report == "amc_2014")) {
45 $begin_date = $report_view['date_begin'];
46 $labs_manual = $report_view['labs_manual'];
48 $target_date = $report_view['date_target'];
49 $plan_filter = $report_view['plan'];
50 $organize_method = $report_view['organize_mode'];
51 $provider = $report_view['provider'];
52 $pat_prov_rel = $report_view['pat_prov_rel'];
53 $dataSheet = json_decode($report_view['data'],TRUE);
55 else {
56 // Collect report type parameter (standard, amc, cqm)
57 // Note that need to convert amc_2011 and amc_2014 to amc and cqm_2011 and cqm_2014 to cqm
58 // to simplify for when submitting for a new report.
59 $type_report = (isset($_GET['type'])) ? trim($_GET['type']) : "standard";
60 if ( ($type_report == "cqm_2011") || ($type_report == "cqm_2014") ) {
61 $type_report = "cqm";
63 if ( ($type_report == "amc_2011") || ($type_report == "amc_2014") ) {
64 $type_report = "amc";
66 // Collect form parameters (set defaults if empty)
67 if ($type_report == "amc") {
68 $begin_date = (isset($_POST['form_begin_date'])) ? trim($_POST['form_begin_date']) : "";
69 $labs_manual = (isset($_POST['labs_manual_entry'])) ? trim($_POST['labs_manual_entry']) : "0";
71 $target_date = (isset($_POST['form_target_date'])) ? trim($_POST['form_target_date']) : date('Y-m-d H:i:s');
72 $rule_filter = (isset($_POST['form_rule_filter'])) ? trim($_POST['form_rule_filter']) : "";
73 $plan_filter = (isset($_POST['form_plan_filter'])) ? trim($_POST['form_plan_filter']) : "";
74 $organize_method = (empty($plan_filter)) ? "default" : "plans";
75 $provider = trim($_POST['form_provider']);
76 $pat_prov_rel = (empty($_POST['form_pat_prov_rel'])) ? "primary" : trim($_POST['form_pat_prov_rel']);
80 <html>
82 <head>
83 <?php html_header_show();?>
85 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
87 <?php if ($type_report == "standard") { ?>
88 <title><?php echo xlt('Standard Measures'); ?></title>
89 <?php } ?>
91 <?php if ($type_report == "cqm") { ?>
92 <title><?php echo xlt('Clinical Quality Measures (CQM)'); ?></title>
93 <?php } ?>
94 <?php if ($type_report == "cqm_2011") { ?>
95 <title><?php echo xlt('Clinical Quality Measures (CQM) - 2011'); ?></title>
96 <?php } ?>
97 <?php if ($type_report == "cqm_2014") { ?>
98 <title><?php echo xlt('Clinical Quality Measures (CQM) - 2014'); ?></title>
99 <?php } ?>
101 <?php if ($type_report == "amc") { ?>
102 <title><?php echo xlt('Automated Measure Calculations (AMC)'); ?></title>
103 <?php } ?>
104 <?php if ($type_report == "amc_2011") { ?>
105 <title><?php echo xlt('Automated Measure Calculations (AMC) - 2011'); ?></title>
106 <?php } ?>
107 <?php if ($type_report == "amc_2014") { ?>
108 <title><?php echo xlt('Automated Measure Calculations (AMC) - 2014'); ?></title>
109 <?php } ?>
112 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
113 <script type="text/javascript" src="../../library/textformat.js"></script>
114 <script type="text/javascript" src="../../library/dialog.js"></script>
115 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
117 <script LANGUAGE="JavaScript">
119 var mypcc = '<?php echo text($GLOBALS['phone_country_code']) ?>';
121 function runReport() {
123 // Validate first
124 if (!(validateForm())) {
125 alert("<?php echo xls("Rule Set and Plan Set selections are not consistent. Please fix and Submit again."); ?>");
126 return false;
129 // Showing processing wheel
130 $("#processing").show();
132 // hide Submit buttons
133 $("#submit_button").hide();
134 $("#xmla_button").hide();
135 $("#xmlb_button").hide();
137 // hide instructions
138 $("#instructions_text").hide();
140 // Collect an id string via an ajax request
141 top.restoreSession();
142 $.get("../../library/ajax/collect_new_report_id.php",
143 function(data){
144 // Set the report id in page form
145 $("#form_new_report_id").attr("value",data);
147 // Start collection status checks
148 collectStatus($("#form_new_report_id").val());
150 // Run the report
151 top.restoreSession();
152 $.post("../../library/ajax/execute_cdr_report.php",
153 {provider: $("#form_provider").val(),
154 type: $("#form_rule_filter").val(),
155 date_target: $("#form_target_date").val(),
156 date_begin: $("#form_begin_date").val(),
157 plan: $("#form_plan_filter").val(),
158 labs: $("#labs_manual_entry").val(),
159 pat_prov_rel: $("#form_pat_prov_rel").val(),
160 execute_report_id: $("#form_new_report_id").val()
165 function collectStatus(report_id) {
166 // Collect the status string via an ajax request and place in DOM at timed intervals
167 top.restoreSession();
168 // Do not send the skip_timeout_reset parameter, so don't close window before report is done.
169 $.post("../../library/ajax/status_report.php",
170 {status_report_id: report_id},
171 function(data){
172 if (data == "PENDING") {
173 // Place the pending string in the DOM
174 $('#status_span').replaceWith("<span id='status_span'><?php echo xlt("Preparing To Run Report"); ?></span>");
176 else if (data == "COMPLETE") {
177 // Go into the results page
178 top.restoreSession();
179 link_report = "cqm.php?report_id="+report_id;
180 window.open(link_report,'_self',false);
181 //$("#processing").hide();
182 //$('#status_span').replaceWith("<a id='view_button' href='cqm.php?report_id="+report_id+"' class='css_button' onclick='top.restoreSession()'><span><?php echo xlt('View Report'); ?></span></a>");
184 else {
185 // Place the string in the DOM
186 $('#status_span').replaceWith("<span id='status_span'>"+data+"</span>");
189 // run status check every 10 seconds
190 var repeater = setTimeout("collectStatus("+report_id+")", 10000);
193 function GenXml(sNested) {
194 top.restoreSession();
195 var sLoc = '../../custom/export_registry_xml.php?&target_date=' + theform.form_target_date.value + '&nested=' + sNested;
196 dlgopen(sLoc, '_blank', 600, 500);
197 return false;
200 function validateForm() {
201 <?php if ( (empty($report_id)) && ($type_report == "cqm") ) { ?>
202 // If this is a cqm and plan set not set to ignore, then need to ensure consistent with the rules set
203 if ($("#form_plan_filter").val() != '') {
204 if ($("#form_rule_filter").val() == $("#form_plan_filter").val()) {
205 return true;
206 } else {
207 return false;
210 else {
211 return true;
213 <?php } else { ?>
214 return true;
215 <?php } ?>
218 </script>
220 <style type="text/css">
222 /* specifically include & exclude from printing */
223 @media print {
224 #report_parameters {
225 visibility: hidden;
226 display: none;
228 #report_parameters_daterange {
229 visibility: visible;
230 display: inline;
232 #report_results table {
233 margin-top: 0px;
237 /* specifically exclude some from the screen */
238 @media screen {
239 #report_parameters_daterange {
240 visibility: hidden;
241 display: none;
245 </style>
246 </head>
248 <body class="body_top">
250 <!-- Required for the popup date selectors -->
251 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
253 <span class='title'><?php echo xlt('Report'); ?> -
255 <?php if ($type_report == "standard") { ?>
256 <?php echo xlt('Standard Measures'); ?>
257 <?php } ?>
259 <?php if ($type_report == "cqm") { ?>
260 <?php echo xlt('Clinical Quality Measures (CQM)'); ?>
261 <?php } ?>
262 <?php if ($type_report == "cqm_2011") { ?>
263 <?php echo xlt('Clinical Quality Measures (CQM) - 2011'); ?>
264 <?php } ?>
265 <?php if ($type_report == "cqm_2014") { ?>
266 <?php echo xlt('Clinical Quality Measures (CQM) - 2014'); ?>
267 <?php } ?>
269 <?php if ($type_report == "amc") { ?>
270 <?php echo xlt('Automated Measure Calculations (AMC)'); ?>
271 <?php } ?>
272 <?php if ($type_report == "amc_2011") { ?>
273 <?php echo xlt('Automated Measure Calculations (AMC) - 2011'); ?>
274 <?php } ?>
275 <?php if ($type_report == "amc_2014") { ?>
276 <?php echo xlt('Automated Measure Calculations (AMC) - 2014'); ?>
277 <?php } ?>
279 <?php if (!empty($report_id)) { ?>
280 <?php echo " - " . xlt('Date of Report') . ": " . text($date_report);
281 //prepare to disable form elements
282 $dis_text = " disabled='disabled' ";
284 <?php } ?>
286 </span>
288 <form method='post' name='theform' id='theform' action='cqm.php?type=<?php echo attr($type_report) ;?>' onsubmit='return validateForm()'>
290 <div id="report_parameters">
292 <table>
293 <tr>
294 <td width='470px'>
295 <div style='float:left'>
297 <table class='text'>
299 <?php if (($type_report == "amc") || ($type_report == "amc_2011") || ($type_report == "amc_2014")) { ?>
300 <tr>
301 <td class='label'>
302 <?php echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES); ?>:
303 </td>
304 <td>
305 <input <?php echo $dis_text; ?> type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo htmlspecialchars( $begin_date, ENT_QUOTES); ?>'
306 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
307 <?php if (empty($report_id)) { ?>
308 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
309 id='img_begin_date' border='0' alt='[?]' style='cursor:pointer'
310 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>'>
311 <?php } ?>
312 </td>
313 </tr>
314 <?php } ?>
316 <tr>
317 <td class='label'>
318 <?php if (($type_report == "amc") || ($type_report == "amc_2011") || ($type_report == "amc_2014")) { ?>
319 <?php echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES); ?>:
320 <?php } else { ?>
321 <?php echo htmlspecialchars( xl('Target Date'), ENT_NOQUOTES); ?>:
322 <?php } ?>
323 </td>
324 <td>
325 <input <?php echo $dis_text; ?> type='text' name='form_target_date' id="form_target_date" size='20' value='<?php echo htmlspecialchars( $target_date, ENT_QUOTES); ?>'
326 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
327 <?php if (empty($report_id)) { ?>
328 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
329 id='img_target_date' border='0' alt='[?]' style='cursor:pointer'
330 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>'>
331 <?php } ?>
332 </td>
333 </tr>
335 <?php if (($type_report == "cqm") || ($type_report == "cqm_2011") || ($type_report == "cqm_2014")) { ?>
336 <tr>
337 <td class='label'>
338 <?php echo xlt('Rule Set'); ?>:
339 </td>
340 <td>
341 <select <?php echo $dis_text; ?> id='form_rule_filter' name='form_rule_filter'>
342 <option value='cqm' <?php if ($rule_filter == "cqm") echo "selected"; ?>>
343 <?php echo xlt('All Clinical Quality Measures (CQM)'); ?></option>
344 <option value='cqm_2011' <?php if ($rule_filter == "cqm_2011") echo "selected"; ?>>
345 <?php echo xlt('2011 Clinical Quality Measures (CQM)'); ?></option>
346 <option value='cqm_2014' <?php if ($rule_filter == "cqm_2014") echo "selected"; ?>>
347 <?php echo xlt('2014 Clinical Quality Measures (CQM)'); ?></option>
348 </select>
349 </td>
350 </tr>
351 <?php } ?>
353 <?php if (($type_report == "amc") || ($type_report == "amc_2011") || ($type_report == "amc_2014")) { ?>
354 <tr>
355 <td class='label'>
356 <?php echo xlt('Rule Set'); ?>:
357 </td>
358 <td>
359 <select <?php echo $dis_text; ?> id='form_rule_filter' name='form_rule_filter'>
360 <option value='amc' <?php if ($rule_filter == "amc") echo "selected"; ?>>
361 <?php echo xlt('All Automated Measure Calculations (AMC)'); ?></option>
362 <option value='amc_2011' <?php if ($rule_filter == "amc_2011") echo "selected"; ?>>
363 <?php echo xlt('2011 Automated Measure Calculations (AMC)'); ?></option>
364 <option value='amc_2014' <?php if ($rule_filter == "amc_2014") echo "selected"; ?>>
365 <?php echo xlt('2014 Automated Measure Calculations (AMC)'); ?></option>
366 </select>
367 </td>
368 </tr>
369 <?php } ?>
371 <?php if ($type_report == "standard") { ?>
372 <tr>
373 <td class='label'>
374 <?php echo xlt('Rule Set'); ?>:
375 </td>
376 <td>
377 <select <?php echo $dis_text; ?> id='form_rule_filter' name='form_rule_filter'>
378 <option value='passive_alert' <?php if ($rule_filter == "passive_alert") echo "selected"; ?>>
379 <?php echo xlt('Passive Alert Rules'); ?></option>
380 <option value='active_alert' <?php if ($rule_filter == "active_alert") echo "selected"; ?>>
381 <?php echo xlt('Active Alert Rules'); ?></option>
382 <option value='patient_reminder' <?php if ($rule_filter == "patient_reminder") echo "selected"; ?>>
383 <?php echo xlt('Patient Reminder Rules'); ?></option>
384 </select>
385 </td>
386 </tr>
387 <?php } ?>
389 <?php if (($type_report == "amc") || ($type_report == "amc_2011") || ($type_report == "amc_2014")) { ?>
390 <input type='hidden' id='form_plan_filter' name='form_plan_filter' value=''>
391 <?php } else { ?>
392 <tr>
393 <td class='label'>
394 <?php echo htmlspecialchars( xl('Plan Set'), ENT_NOQUOTES); ?>:
395 </td>
396 <td>
397 <select <?php echo $dis_text; ?> id='form_plan_filter' name='form_plan_filter'>
398 <option value=''>-- <?php echo htmlspecialchars( xl('Ignore'), ENT_NOQUOTES); ?> --</option>
399 <?php if (($type_report == "cqm") || ($type_report == "cqm_2011") || ($type_report == "cqm_2014")) { ?>
400 <option value='cqm' <?php if ($plan_filter == "cqm") echo "selected"; ?>>
401 <?php echo htmlspecialchars( xl('All Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES); ?></option>
402 <option value='cqm_2011' <?php if ($plan_filter == "cqm_2011") echo "selected"; ?>>
403 <?php echo htmlspecialchars( xl('2011 Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES); ?></option>
404 <option value='cqm_2014' <?php if ($plan_filter == "cqm_2014") echo "selected"; ?>>
405 <?php echo htmlspecialchars( xl('2014 Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES); ?></option>
406 <?php } ?>
407 <?php if ($type_report == "standard") { ?>
408 <option value='normal' <?php if ($plan_filter == "normal") echo "selected"; ?>>
409 <?php echo htmlspecialchars( xl('Active Plans'), ENT_NOQUOTES); ?></option>
410 <?php } ?>
411 </td>
412 </tr>
413 <?php } ?>
415 <tr>
416 <td class='label'>
417 <?php echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES); ?>:
418 </td>
419 <td>
420 <?php
422 // Build a drop-down list of providers.
425 $query = "SELECT id, lname, fname FROM users WHERE ".
426 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
428 $ures = sqlStatement($query);
430 echo " <select " . $dis_text . " id='form_provider' name='form_provider'>\n";
431 echo " <option value=''>-- " . htmlspecialchars( xl('All (Cumulative)'), ENT_NOQUOTES) . " --\n";
433 echo " <option value='collate_outer'";
434 if ($provider == 'collate_outer') echo " selected";
435 echo ">-- " . htmlspecialchars( xl('All (Collated Format A)'), ENT_NOQUOTES) . " --\n";
437 echo " <option value='collate_inner'";
438 if ($provider == 'collate_inner') echo " selected";
439 echo ">-- " . htmlspecialchars( xl('All (Collated Format B)'), ENT_NOQUOTES) . " --\n";
441 while ($urow = sqlFetchArray($ures)) {
442 $provid = $urow['id'];
443 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES)."'";
444 if ($provid == $provider) echo " selected";
445 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES) . "\n";
448 echo " </select>\n";
451 </td>
452 </tr>
454 <tr>
455 <td class='label'>
456 <?php echo htmlspecialchars( xl('Provider Relationship'), ENT_NOQUOTES); ?>:
457 </td>
458 <td>
459 <?php
461 // Build a drop-down list of of patient provider relationships.
463 echo " <select ". $dis_text ." id='form_pat_prov_rel' name='form_pat_prov_rel' title='" . xlt('Only applicable if a provider or collated list was chosen above. PRIMARY only selects patients that the provider is the primary provider. ENCOUNTER selects all patients that the provider has seen.') . "'>\n";
464 echo " <option value='primary'";
465 if ($pat_prov_rel == 'primary') echo " selected";
466 echo ">" . xlt('Primary') . "\n";
467 echo " <option value='encounter'";
468 if ($pat_prov_rel == 'encounter') echo " selected";
469 echo ">" . xlt('Encounter') . "\n";
470 echo " </select>\n";
472 </td>
473 </tr>
475 <?php if (($type_report == "amc") || ($type_report == "amc_2011") || ($type_report == "amc_2014")) { ?>
476 <tr>
477 <td>
478 <?php echo htmlspecialchars( xl('Number labs'), ENT_NOQUOTES); ?>:<br>
479 (<?php echo htmlspecialchars( xl('Non-electronic'), ENT_NOQUOTES); ?>)
480 </td>
481 <td>
482 <input <?php echo $dis_text; ?> type="text" id="labs_manual_entry" name="labs_manual_entry" value="<?php echo htmlspecialchars($labs_manual,ENT_QUOTES); ?>">
483 </td>
484 </tr>
485 <?php } ?>
487 </table>
489 </div>
491 </td>
492 <td align='left' valign='middle' height="100%">
493 <table style='border-left:1px solid; width:100%; height:100%' >
494 <tr>
495 <td>
496 <div style='margin-left:15px'>
497 <?php if (empty($report_id)) { ?>
498 <a id='submit_button' href='#' class='css_button' onclick='runReport();'>
499 <span>
500 <?php echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES); ?>
501 </span>
502 </a>
503 <span id='status_span'></span>
504 <div id='processing' style='margin:10px;display:none;'><img src='../pic/ajax-loader.gif'/></div>
505 <?php if ($type_report == "cqm") { ?>
506 <a id='xmla_button' href='#' class='css_button' onclick='return GenXml("false")'>
507 <span>
508 <?php echo htmlspecialchars( xl('Generate PQRI report (Method A) - 2011'), ENT_NOQUOTES); ?>
509 </span>
510 </a>
511 <a id='xmlb_button' href='#' class='css_button' onclick='return GenXml("true")'>
512 <span>
513 <?php echo htmlspecialchars( xl('Generate PQRI report (Method E) - 2011'), ENT_NOQUOTES); ?>
514 </span>
515 </a>
516 <?php } ?>
517 <?php } ?>
518 <?php if (!empty($report_id)) { ?>
519 <a href='#' class='css_button' onclick='window.print()'>
520 <span>
521 <?php echo htmlspecialchars( xl('Print'), ENT_NOQUOTES); ?>
522 </span>
523 </a>
524 <?php if ($back_link == "list") { ?>
525 <a href='report_results.php' class='css_button' onclick='top.restoreSession()'><span><?php echo xlt("Return To Report Results"); ?></span></a>
526 <?php } else { ?>
527 <a href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit();'><span><?php echo xlt("Start Another Report"); ?></span></a>
528 <?php } ?>
529 <?php } ?>
530 </div>
531 </td>
532 </tr>
533 </table>
534 </td>
535 </tr>
536 </table>
538 </div> <!-- end of search parameters -->
540 <br>
542 <?php
543 if (!empty($report_id)) {
547 <div id="report_results">
548 <table>
550 <thead>
551 <th>
552 <?php echo htmlspecialchars( xl('Title'), ENT_NOQUOTES); ?>
553 </th>
555 <th>
556 <?php echo htmlspecialchars( xl('Total Patients'), ENT_NOQUOTES); ?>
557 </th>
559 <th>
560 <?php if ($type_report == "amc") { ?>
561 <?php echo htmlspecialchars( xl('Denominator'), ENT_NOQUOTES); ?></a>
562 <?php } else { ?>
563 <?php echo htmlspecialchars( xl('Applicable Patients') .' (' . xl('Denominator') . ')', ENT_NOQUOTES); ?></a>
564 <?php } ?>
565 </th>
567 <?php if ($type_report != "amc") { ?>
568 <th>
569 <?php echo htmlspecialchars( xl('Excluded Patients'), ENT_NOQUOTES); ?></a>
570 </th>
571 <?php } ?>
573 <th>
574 <?php if ($type_report == "amc") { ?>
575 <?php echo htmlspecialchars( xl('Numerator'), ENT_NOQUOTES); ?></a>
576 <?php } else { ?>
577 <?php echo htmlspecialchars( xl('Passed Patients') . ' (' . xl('Numerator') . ')', ENT_NOQUOTES); ?></a>
578 <?php } ?>
579 </th>
581 <th>
582 <?php echo htmlspecialchars( xl('Performance Percentage'), ENT_NOQUOTES); ?></a>
583 </th>
585 </thead>
586 <tbody> <!-- added for better print-ability -->
587 <?php
589 $firstProviderFlag = TRUE;
590 $firstPlanFlag = TRUE;
591 $existProvider = FALSE;
592 foreach ($dataSheet as $row) {
596 <tr bgcolor='<?php echo $bgcolor ?>'>
598 <?php
599 if (isset($row['is_main']) || isset($row['is_sub'])) {
600 echo "<td class='detail'>";
601 if (isset($row['is_main'])) {
602 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'),$row['id'])."</b>";
604 $tempCqmAmcString = "";
605 if (($type_report == "cqm") || ($type_report == "cqm_2011") || ($type_report == "cqm_2014")) {
606 if (!empty($row['cqm_pqri_code'])) {
607 $tempCqmAmcString .= " " . htmlspecialchars( xl('PQRI') . ":" . $row['cqm_pqri_code'], ENT_NOQUOTES) . " ";
609 if (!empty($row['cqm_nqf_code'])) {
610 $tempCqmAmcString .= " " . htmlspecialchars( xl('NQF') . ":" . $row['cqm_nqf_code'], ENT_NOQUOTES) . " ";
613 if ($type_report == "amc") {
614 if (!empty($row['amc_code'])) {
615 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2011') . ":" . $row['amc_code'], ENT_NOQUOTES) . " ";
617 if (!empty($row['amc_code_2014'])) {
618 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2014') . ":" . $row['amc_code_2014'], ENT_NOQUOTES) . " ";
621 if ($type_report == "amc_2011") {
622 if (!empty($row['amc_code'])) {
623 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2011') . ":" . $row['amc_code'], ENT_NOQUOTES) . " ";
626 if ($type_report == "amc_2014") {
627 if (!empty($row['amc_code_2014'])) {
628 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2014') . ":" . $row['amc_code_2014'], ENT_NOQUOTES) . " ";
632 if (!empty($tempCqmAmcString)) {
633 echo "(".$tempCqmAmcString.")";
636 if ( !(empty($row['concatenated_label'])) ) {
637 echo ", " . htmlspecialchars( xl( $row['concatenated_label'] ), ENT_NOQUOTES) . " ";
641 else { // isset($row['is_sub'])
642 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$row['action_category']);
643 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$row['action_item']);
645 echo "</td>";
646 echo "<td align='center'>" . $row['total_patients'] . "</td>";
647 echo "<td align='center'>" . $row['pass_filter'] . "</td>";
648 if ($type_report != "amc") {
649 echo "<td align='center'>" . $row['excluded'] . "</td>";
651 echo "<td align='center'>" . $row['pass_target'] . "</td>";
652 echo "<td align='center'>" . $row['percentage'] . "</td>";
654 else if (isset($row['is_provider'])) {
655 // Display the provider information
656 if (!$firstProviderFlag && $_POST['form_provider'] == 'collate_outer') {
657 echo "<tr><td>&nbsp</td></tr>";
659 echo "<td class='detail' align='center'><b>";
660 echo htmlspecialchars( xl("Provider").": " . $row['prov_lname'] . "," . $row['prov_fname'], ENT_NOQUOTES);
661 if (!empty($row['npi']) || !empty($row['federaltaxid'])) {
662 echo " (";
663 if (!empty($row['npi'])) {
664 echo " " . htmlspecialchars( xl('NPI') . ":" . $row['npi'], ENT_NOQUOTES) . " ";
666 if (!empty($row['federaltaxid'])) {
667 echo " " . htmlspecialchars( xl('TID') . ":" . $row['federaltaxid'], ENT_NOQUOTES) . " ";
669 echo ")";
671 echo "</b></td>";
672 $firstProviderFlag = FALSE;
673 $existProvider = TRUE;
675 else { // isset($row['is_plan'])
676 if (!$firstPlanFlag && $_POST['form_provider'] != 'collate_outer') {
677 echo "<tr><td>&nbsp</td></tr>";
679 echo "<td class='detail' align='center'><b>";
680 echo htmlspecialchars( xl("Plan"), ENT_NOQUOTES) . ": ";
681 echo generate_display_field(array('data_type'=>'1','list_id'=>'clinical_plans'),$row['id']);
682 if (!empty($row['cqm_measure_group'])) {
683 echo " (". htmlspecialchars( xl('Measure Group Code') . ": " . $row['cqm_measure_group'], ENT_NOQUOTES) . ")";
685 echo "</b></td>";
686 $firstPlanFlag = FALSE;
689 </tr>
691 <?php
694 </tbody>
695 </table>
696 </div> <!-- end of search results -->
697 <?php } else { ?>
698 <div id="instructions_text" class='text'>
699 <?php echo htmlspecialchars( xl('Please input search criteria above, and click Submit to start report.'), ENT_NOQUOTES); ?>
700 </div>
701 <?php } ?>
703 <input type='hidden' name='form_new_report_id' id='form_new_report_id' value=''/>
705 </form>
707 </body>
709 <!-- stuff for the popup calendar -->
710 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
711 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
712 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
713 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
714 <script language="Javascript">
715 <?php if ($type_report == "amc") { ?>
716 Calendar.setup({inputField:"form_begin_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_begin_date", showsTime:'true'});
717 <?php } ?>
718 Calendar.setup({inputField:"form_target_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_target_date", showsTime:'true'});
719 </script>
721 </html>