forked from science-ation/science-ation
Add fields to the award report
This commit is contained in:
parent
6e245a4c52
commit
e07f22995b
@ -60,6 +60,12 @@ $report_awards_fields = array(
|
||||
'width' => 1.0,
|
||||
'table' => 'award_types.type' ),
|
||||
|
||||
'empty_winner_box' => array(
|
||||
'name' => 'Award -- Empty Winner Box (for hand entry on printed reports)',
|
||||
'header' => 'Winner',
|
||||
'width' => 1.0,
|
||||
'table' => "CONCAT('')" ),
|
||||
|
||||
'sponsor_organization' => array(
|
||||
'start_option_group' => 'Sponsor Information',
|
||||
'name' => 'Sponsor -- Organization',
|
||||
@ -221,7 +227,92 @@ $report_awards_fields = array(
|
||||
'table' => "GROUP_CONCAT(judges.firstname, ' ', judges.lastname ORDER BY judges.lastname SEPARATOR ', ')",
|
||||
'group_by' => array('award_awards.id', 'judges_teams.num') ),
|
||||
|
||||
|
||||
'prize_name' => array(
|
||||
'start_option_group' => 'Prize Info (Duplicates award data for each prize, omits awards with no prizes)',
|
||||
'name' => 'Prize -- Name',
|
||||
'header' => 'Prize Name',
|
||||
'width' => 2,
|
||||
'table' => 'award_prizes.prize',
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_cash' => array(
|
||||
'name' => 'Prize -- Cash Amount',
|
||||
'header' => 'Cash',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.cash',
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_scholarship' => array(
|
||||
'name' => 'Prize -- Scholarship Amount',
|
||||
'header' => 'Scholarship',
|
||||
'width' => 0.75,
|
||||
'table' => 'award_prizes.scholarship',
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_value' => array(
|
||||
'name' => 'Prize -- Value Amount',
|
||||
'header' => 'Value',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.value',
|
||||
'components' => array('prizes')),
|
||||
|
||||
/* Don't have projectcategories and projectdivisions
|
||||
'prize_fullname' => array(
|
||||
'name' => 'Prize -- Name, Category, Division',
|
||||
'header' => 'Prize Name',
|
||||
'width' => 4,
|
||||
'table' => "CONCAT(award_prizes.prize,' in ',projectcategories.category,' ', projectdivisions.division)",
|
||||
'table_sort' => 'award_prizes.order',
|
||||
'components' => array('prizes')),
|
||||
*/
|
||||
'prize_trophy_any' => array(
|
||||
'name' => 'Prize -- Trophy (\'Yes\' if the award has a trophy)',
|
||||
'header' => 'Trophy',
|
||||
'width' => 0.5,
|
||||
'table' => "IF ( award_prizes.trophystudentkeeper=1
|
||||
OR award_prizes.trophystudentreturn=1
|
||||
OR award_prizes.trophyschoolkeeper=1
|
||||
OR award_prizes.trophyschoolreturn=1, 'Yes', 'No')",
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_trophy_return' => array(
|
||||
'name' => 'Prize -- Annual Trophy (\'Yes\' if the award has a school or student trophy that isn\'t a keeper)',
|
||||
'header' => 'Trophy',
|
||||
'width' => 0.5,
|
||||
'table' => "IF ( award_prizes.trophystudentreturn=1
|
||||
OR award_prizes.trophyschoolreturn=1, 'Yes', 'No')",
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_trophy_return_student' => array(
|
||||
'name' => 'Prize -- Annual Student Trophy (\'Yes\' if the award has astudent trophy that isn\'t a keeper)',
|
||||
'header' => 'Ind.',
|
||||
'width' => 0.5,
|
||||
'table' => "IF ( award_prizes.trophystudentreturn=1, 'Yes', 'No')",
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_trophy_return_school' => array(
|
||||
'name' => 'Prize -- Annual School Trophy (\'Yes\' if the award has a school trophy that isn\'t a keeper)',
|
||||
'header' => 'Sch.',
|
||||
'width' => 0.5,
|
||||
'table' => "IF ( award_prizes.trophyschoolreturn=1, 'Yes', 'No')",
|
||||
'components' => array('prizes')),
|
||||
|
||||
'prize_all' => array(
|
||||
'name' => 'Prize -- Lists all prize data (name, cash, scholarship, value, trophies)',
|
||||
'header' => 'Prize',
|
||||
'width' => 2,
|
||||
'table' => "CONCAT(
|
||||
IF(award_prizes.prize != '', CONCAT(award_prizes.prize,'\n', ''),''),
|
||||
IF(award_prizes.cash != '', CONCAT('$',award_prizes.cash,'\n'), ''),
|
||||
IF(award_prizes.scholarship != '', CONCAT('$',award_prizes.scholarship,' scholarship\n'), ''),
|
||||
IF(award_prizes.value != '', CONCAT('$',award_prizes.value,' value\n'), ''),
|
||||
IF(award_prizes.trophystudentkeeper != '', CONCAT('Student Keeper Trophy\n'), ''),
|
||||
IF(award_prizes.trophystudentreturn != '', CONCAT('Student Annual-Return Trophy\n'), ''),
|
||||
IF(award_prizes.trophyschoolkeeper != '', CONCAT('School Keeper Trophy\n'), ''),
|
||||
IF(award_prizes.trophyschoolreturn != '', CONCAT('School Annual-Return Trophy\n'), '')
|
||||
)",
|
||||
'components' => array('prizes')),
|
||||
|
||||
|
||||
);
|
||||
|
||||
@ -250,6 +341,13 @@ $report_awards_fields = array(
|
||||
$judges_members_where = "AND judges_teams_link.year='$year'";
|
||||
}
|
||||
|
||||
$prizes_join = '';
|
||||
if(in_array('prizes', $components)) {
|
||||
$prizes_join = 'LEFT JOIN award_prizes ON award_prizes.award_awards_id=award_awards.id';
|
||||
/* Don't need a where filter, the prize is attached by unique ID to an award
|
||||
* that is already from the correct year. */
|
||||
}
|
||||
|
||||
|
||||
$q = " FROM award_awards
|
||||
LEFT JOIN sponsors ON (
|
||||
@ -262,6 +360,7 @@ $report_awards_fields = array(
|
||||
PRIMARYCONTACT.users_id=PRIMARYCONTACTUSER.id)
|
||||
$judges_join
|
||||
$judges_members_join
|
||||
$prizes_join
|
||||
WHERE
|
||||
award_awards.year='$year'
|
||||
AND award_types.year='$year'
|
||||
|
Loading…
Reference in New Issue
Block a user