- Add an advanced options tab to the report generator

- Add an advanced option: Include Incompelete Registrations - Ignores the
  registrations.status and just includes everyone.  Downside: registrations
  must have a division and category selected because the mysql query matches on
  cat.year and div.year too.
This commit is contained in:
dave 2009-11-06 08:57:13 +00:00
parent ba808050d0
commit bf3485c24a
3 changed files with 28 additions and 2 deletions

View File

@ -701,6 +701,7 @@ foreach($report_stock as $n=>$v) {
$q = "SELECT $sel $q $filter_query $group_query ORDER BY $order";
$r = mysql_query($q);
// print_r($report);
// print_r($report['filter']);
// echo "$q";

View File

@ -32,6 +32,7 @@
$type = stripslashes($_GET['type']);
$stock = stripslashes($_GET['stock']);
$year = intval($_GET['year']);
$include_incomplete_registrations = ($_GET['include_incomplete_registrations'] == 'yes') ? 'yes' : '';
$show_options = array_key_exists('show_options', $_GET);
if($year < 1000) $year = $config['FAIRYEAR'];
@ -57,7 +58,12 @@ switch($_GET['action']) {
case 'dialog_gen':
?>
<div id="report_dialog_gen" title="Generate Report" style="display: none">
<div id="report_gen_tabs">
<ul><li><a href="#report_gen_tab_info"><span><?=i18n('Report Information')?></span></a></li>
<li><a href="#report_gen_tab_advanced"><span><?=i18n('Advanced Options')?></span></a></li>
</ul>
<form id="report_dialog_form" >
<div id="report_gen_tab_info">
<input type="hidden" name="id" value="<?=$id?>" />
<table class="editor" style="width:95%"><tr>
<td colspan="2"><br /><h3><?=i18n('Report Information')?></h3><br /></td>
@ -121,7 +127,20 @@ case 'dialog_gen':
echo "</select></td></tr>";
?>
</table>
</div>
<div id="report_gen_tab_advanced">
<table class="editor" style="width:95%"><tr>
<td colspan="2"><br /><h4><?=i18n('Advanced Options')?></h4><br /></td>
</tr><tr>
<td class="label"><input type="checkbox" name="include_incomplete_registrations" value="yes" /></td>
<td class="input"><?=i18n('Include student and project data from incomplete registrations')?></td>
</table>
</div>
</form>
</div></div>
<script type="text/javascript">
$("#report_gen_tabs").tabs();
$("#report_dialog_gen").dialog({
bgiframe: true, autoOpen: true,
modal: true, resizable: false,
@ -139,6 +158,7 @@ case 'dialog_gen':
"<?=i18n("Download PDF")?>": function() {
var dlargs = $('#report_dialog_form').serialize()+"<?=$filter_args?>";
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_gen.php?"+dlargs;
$('#debug').html(dlurl);
// alert(dlurl);
// $('#content').attr('src',dlurl);
window.location.href=dlurl;
@ -159,6 +179,7 @@ case 'dialog_gen':
$report['year'] = $year;
if($type != '') $report['option']['type'] = $type;
if($stock != '') $report['option']['stock'] = $stock;
if($include_incomplete_registrations != '') $report['option']['include_incomplete_registrations'] = 'yes';
report_gen($report);
} else {
exit;

View File

@ -845,7 +845,11 @@ $report_students_fields = array(
$mentor_where = "AND mentors.year='$year'";
}
if($report['option']['include_incomplete_registrations'] == 'yes')
$reg_where = '';
else
$reg_where = "AND (registrations.status='complete' OR registrations.status='paymentpending')";
$q = " FROM students
LEFT JOIN registrations ON registrations.id=students.registrations_id
@ -864,7 +868,7 @@ $report_students_fields = array(
AND registrations.year='$year'
AND projectcategories.year='$year'
AND projectdivisions.year='$year'
AND (registrations.status='complete' OR registrations.status='paymentpending')
$reg_where
$mentor_where
$awards_where
$tour_where