fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [14238] Booking: more on reports


From: Sigurd Nes
Subject: [Fmsystem-commits] [14238] Booking: more on reports
Date: Sun, 25 Oct 2015 14:15:38 +0000

Revision: 14238
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14238
Author:   sigurdne
Date:     2015-10-25 14:15:37 +0000 (Sun, 25 Oct 2015)
Log Message:
-----------
Booking: more on reports

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.uireports.inc.php
    branches/dev-syncromind/booking/js/booking/report.js
    branches/dev-syncromind/booking/templates/base/report_new.xsl

Added Paths:
-----------
    
branches/dev-syncromind/booking/jasper/templates/participants_per_activity.jrxml
    
branches/dev-syncromind/booking/jasper/templates/participants_per_audience.jrxml
    
branches/dev-syncromind/booking/jasper/templates/participants_per_resource.jrxml

Modified: branches/dev-syncromind/booking/inc/class.uireports.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-10-23 
21:06:37 UTC (rev 14237)
+++ branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-10-25 
14:15:37 UTC (rev 14238)
@@ -54,135 +54,63 @@
                public function add()
                {
                        
self::set_active_menu('booking::reportcenter::add_generic');
-                       _debug_array($_POST);
                        $errors  = array();
                        $report  = array();
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
+                               array_set_default($_POST, 'resources', array());
+                               $activity_id = phpgw::get_var('activity_id', 
'int');
+                               $soactivity = 
createObject('booking.soactivity');
+                               $children = 
$soactivity->get_children($activity_id);
+                               $activity_ids = 
array_merge(array($activity_id),$children);
+                               $report['activity_ids'] = $activity_ids;
 
-                               array_set_default($_POST, 'from_', array());
-                               array_set_default($_POST, 'to_', array());
-                               $report['dates'] = array_map(array(self, 
'_combine_dates'), $_POST['from_'], $_POST['to_']);
-
-                               array_set_default($_POST, 'resources', array());
                                $report['active']        = '1';
-                               $report['completed']     = '0';
+                               $report['building_id']                  = 
phpgw::get_var('building_id', 'int');
+                               $report['building_name']                = 
phpgw::get_var('building_name', 'string', 'POST');
+                               $report['activity_id']                  = 
phpgw::get_var('activity_id', 'int');
+                               $report['description']                  = 
phpgw::get_var('description');
+                               $report['resources']                    = 
phpgw::get_var('resources');
+                               $report['weekdays']                             
= phpgw::get_var('weekdays');
 
-                               array_set_default($report, 'audience', array());
-                               array_set_default($report, 'agegroups', 
array());
-                               $report['secret']                = 
$this->generate_secret();
-                               $report['is_public']             = 1;
-                               $report['building_name']         = 
$_POST['building_name'];
+                               $report['start_date']                   = 
phpgw::get_var('start_date');
+                               $report['end_date']                             
= phpgw::get_var('end_date');
+                               $report['start_hour']                   = 
phpgw::get_var('start_hour', 'int');
+                               $report['start_minute']                 = 
phpgw::get_var('start_minute', 'int');
+                               $report['end_hour']                             
= phpgw::get_var('end_hour', 'int');
+                               $report['end_minute']                   = 
phpgw::get_var('end_minute', 'int');
+                               $report['variable_horizontal']  = 
phpgw::get_var('variable_horizontal');
+                               $report['variable_vertical']    = 
phpgw::get_var('variable_vertical');
+                               $report['all_buildings']                = 
phpgw::get_var('all_buildings', 'bool');
+       //                      _debug_array($report);
 
-                               if(!$_POST['application_id'])
+                               $report_type = phpgw::get_var('report_type');
+                               switch($report_type)
                                {
-                                       $temp_errors = array();
-                                       foreach($report['dates'] as $checkdate)
-                                       {
-                                               $report['from_']         = 
$checkdate['from_'];
-                                               $_POST['from_']  = 
$checkdate['from_'];
-                                               $report['to_']   = 
$checkdate['to_'];
-                                               $_POST['to_']    = 
$checkdate['to_'];
-                                               list($report, $errors) = 
$this->extract_and_validate($report);
-                                               $time_from               = 
explode(" ", $_POST['from_']);
-                                               $time_to                 = 
explode(" ", $_POST['to_']);
-                                               if($time_from[0] == $time_to[0])
-                                               {
-                                                       if($time_from[1] >= 
$time_to[1])
-                                                       {
-                                                               $errors['time'] 
= lang('Time is set wrong');
-                                                       }
-                                               }
-                                               if($errors != array())
-                                               {
-                                                       $temp_errors = $errors;
-                                               }
-                                       }
-                                       $errors = $temp_errors;
-                               }
-                               else
-                               {
-                                       list($report, $errors) = 
$this->extract_and_validate($report);
-                                       $time_from       = explode(" ", 
$_POST['from_']);
-                                       $time_to         = explode(" ", 
$_POST['to_']);
-                                       if($time_from[0] == $time_to[0])
-                                       {
-                                               if($time_from[1] >= $time_to[1])
-                                               {
-                                                       $errors['time'] = 
lang('Time is set wrong');
-                                               }
-                                       }
-                               }
+                                       case 'participants_per_resource':
+                                               
$this->get_participants_per_resource($report);
+                                               break;
+                                       case 'freetime':
+                                               $this->get_freetime($report);
+                                               break;
 
-                               if($_POST['cost'] != 0 and ! 
$report['customer_organization_number'] and ! $report['customer_ssn'])
-                               {
-                                       $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
+                                       default:
+                                               break;
                                }
-                               if(($_POST['organization_name'] != '' or 
$_POST['org_id2'] != '') and isset($errors['contact_name']))
-                               {
-                                       $errors['contact_name'] = 
lang('Organization is missing booking charge');
-                               }
-                               if(!$errors['report'] && !$errors['from_'] && 
!$errors['time'] && !$errors['invoice_data'] && !$errors['resource_number'] && 
!$errors['organization_number'] && !$errors['contact_name'] && !$errors['cost'] 
&& !$errors['activity_id'])
-                               {
-                                       if(!$_POST['application_id'])
-                                       {
-                                               $allids = array();
-                                               foreach($report['dates'] as 
$checkdate)
-                                               {
-                                                       $report['from_']        
 = $checkdate['from_'];
-                                                       $report['to_']   = 
$checkdate['to_'];
 
-                                                       
unset($report['comments']);
-                                                       
if(count($report['dates']) < 2)
-                                                       {
-                                                               
$this->add_comment($report, lang('Event was created'));
-                                                               $receipt = 
$this->bo->add($report);
-                                                       }
-                                                       else
-                                                       {
-                                                               
$this->add_comment($report, lang('Multiple Events was created'));
-                                                               $receipt        
 = $this->bo->add($report);
-                                                               $allids[]       
 = array($receipt['id']);
-                                                       }
-                                               }
-                                               if($allids)
-                                               {
-                                                       
$this->bo->so->update_comment($allids);
-                                                       
$this->bo->so->update_id_string();
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $this->add_comment($report, 
lang('Event was created'));
-                                               $receipt = 
$this->bo->add($report);
-                                               
$this->bo->so->update_id_string();
-                                       }
-       //                              $this->redirect(array('menuaction' => 
'booking.uireports.edit', 'id' => $receipt['id'],
-       //                                      'secret' => $report['secret'], 
'warnings' => $errors));
-                               }
                        }
                        if($errors['report'])
                        {
                                $errors['warning'] = lang('NB! No data will be 
saved, if you navigate away you will loose all.');
                        }
-                       $default_dates = array_map(array(self, 
'_combine_dates'), '', '');
-                       array_set_default($report, 'dates', $default_dates);
+                       $this->flash_form_errors($errors);
 
-                       if(!phpgw::get_var('from_report', 'POST'))
-                       {
-                               $this->flash_form_errors($errors);
-                       }
-
                        self::add_javascript('booking', 'booking', 'report.js');
                        array_set_default($report, 'resources', array());
                        $report['resources_json'] = 
json_encode(array_map('intval', $report['resources']));
                        $report['cancel_link']   = 
self::link(array('menuaction' => 'booking.uireports.index'));
                        array_set_default($report, 'cost', '0');
                        $activities                              = 
$this->activity_bo->get_top_level();
-//                     $agegroups                               = 
$this->agegroup_bo->fetch_age_groups();
-//                     $agegroups                               = 
$agegroups['results'];
-//                     $audience                                = 
$this->audience_bo->fetch_target_audience();
-//                     $audience                                = 
$audience['results'];
                        $report['days'] = array(
                                array('id' => 1, 'name' => lang('Monday')),
                                array('id' => 2, 'name' => lang('Tuesday')),
@@ -192,14 +120,25 @@
                                array('id' => 6, 'name' => lang('Saturday')),
                                array('id' => 7, 'name' => lang('Sunday'))
                        );
-                       $report['variables'] = array(
+                       $report['variables_horizontal'] = array(
+                               array('id' => 'agegroup', 'name' => 
lang('agegroup'), 'selected' => 1),
+//                             array('id' => 'resource', 'name' => 
lang('resource')),
+//                             array('id' => 'audience', 'name' => 
lang('audience')),
+//                             array('id' => 'activity', 'name' => 
lang('activities')),
+                       );
+                       $report['variables_vertical'] = array(
+//                             array('id' => 'agegroup', 'name' => 
lang('agegroup')),
                                array('id' => 'resource', 'name' => 
lang('resource')),
                                array('id' => 'audience', 'name' => 
lang('audience')),
-                               array('id' => 'agegroup', 'name' => 
lang('agegroup')),
                                array('id' => 'activity', 'name' => 
lang('activities')),
                        );
 
+                       foreach($report['variables_vertical'] as &$entry)
+                       {
+                               $entry['selected'] = $entry['id'] == 
$report['variable_vertical'] ? 1 : 0;
+                       }
 
+
                        $GLOBALS['phpgw']->jqcal->add_listener('start_date');
                        $GLOBALS['phpgw']->jqcal->add_listener('end_date');
 
@@ -209,12 +148,152 @@
 
                        $report['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
                        self::adddatetimepicker();
+                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security', 
'file'), 'report_form');
 
                        $this->add_template_helpers();
                        self::render_template_xsl('report_new', array('report' 
=> $report, 'activities' => $activities,
                                'agegroups' => $agegroups, 'audience' => 
$audience));
                }
 
+               public function get_participants_per_resource($data)
+               {
+
+                       $output_type = 'PDF';//'XLS';
+                       $db = & $GLOBALS['phpgw']->db;
+
+                       $resources = array();
+                       if($data['all_buildings'])
+                       {
+                               $sql = "SELECT DISTINCT bb_resource.id FROM 
bb_building"
+                               . " JOIN bb_resource ON bb_resource.building_id 
= bb_building.id"
+                               . " WHERE bb_building.active = 1"
+                               . " AND activity_id IN (" .implode(',', 
$data['activity_ids']) . ')';
+                               $db->query($sql);
+                               while ($db->next_record())
+                               {
+                                       $resources[] = $db->f('id');
+                               }
+
+                       }
+                       else
+                       {
+                               $resources = $data['resources'];
+                       }
+
+                       $errors          = array();
+                       $from_           = 
date($db->date_format(),phpgwapi_datetime::date_to_timestamp($data['start_date']));
+                       $to_             = 
date($db->date_format(),phpgwapi_datetime::date_to_timestamp($data['end_date']));
+
+                       switch($data['variable_vertical'])
+                       {
+                               case 'resource':
+                                       $jasper_parameters = 
sprintf("'BK_DATE_FROM|%s;BK_DATE_TO|%s;BK_RESOURCES|%s;BK_WEEKDAYS|%s'", 
$from_, $to_, implode(",", $resources), implode(',' ,$data['weekdays']));
+                                       $report_source   = PHPGW_SERVER_ROOT . 
'/booking/jasper/templates/participants_per_resource.jrxml';
+                                       break;
+                               case 'audience':
+                                       $jasper_parameters = 
sprintf("'BK_DATE_FROM|%s;BK_DATE_TO|%s;BK_RESOURCES|%s;BK_WEEKDAYS|%s'", 
$from_, $to_, implode(",", $resources), implode(',' ,$data['weekdays']));
+                                       $report_source   = PHPGW_SERVER_ROOT . 
'/booking/jasper/templates/participants_per_audience.jrxml';
+                                       break;
+                               case 'activity':
+                                       $jasper_parameters = 
sprintf("'BK_DATE_FROM|%s;BK_DATE_TO|%s;BK_RESOURCES|%s;BK_WEEKDAYS|%s'", 
$from_, $to_, implode(",", $resources), implode(',' ,$data['weekdays']));
+                                       $report_source   = PHPGW_SERVER_ROOT . 
'/booking/jasper/templates/participants_per_activity.jrxml';
+                                       break;
+
+                               default:
+                                       $errors[] = 'Valid variable not 
selected';
+
+                                       break;
+                       }
+
+
+                       if(!count($errors))
+                       {
+                               $jasper_wrapper  = 
CreateObject('phpgwapi.jasper_wrapper');
+                               try
+                               {
+                                       
$jasper_wrapper->execute($jasper_parameters, $output_type, $report_source);
+                               }
+                               catch(Exception $e)
+                               {
+                                       $errors[] = $e->getMessage();
+                               }
+                       }
+
+                       foreach($errors as $error)
+                       {
+                               phpgwapi_cache::message_set($error, 'error');
+                       }
+               }
+               /**
+                * Testing
+                * @param type $data
+                * @return string
+                */
+               private function get_freetime($data)
+               {
+                       $db = & $GLOBALS['phpgw']->db;
+
+                       $buildings = array();
+                       if($data['all_buildings'])
+                       {
+                               $sql = "SELECT id FROM bb_building WHERE active 
= 1";
+                               $db->query($sql);
+                               while ($db->next_record())
+                               {
+                                       $buildings[] = $db->f('id');
+                               }
+                       }
+                       else
+                       {
+                               $buildings[] = $data['building_id'];
+                       }
+
+                       $buildings              = implode(',' ,$buildings);
+                       $weekdays               = implode(',' 
,$data['weekdays']);
+                       $activity_ids   = implode(',' ,$data['activity_ids']);
+
+                       $from            = 
$db->to_timestamp(phpgwapi_datetime::date_to_timestamp($data['start_date']));
+                       $to                      = 
$db->to_timestamp(phpgwapi_datetime::date_to_timestamp($data['end_date']) + 24 
* 3600 -1);
+
+
+                       $sql = "select distinct al.id, al.from_, al.to_, 
EXTRACT(DOW FROM al.to_) as day_of_week, bu.id as building_id, bu.name as 
building_name, br.id as resource_id, br.name as resource_name
+                               from bb_allocation al
+                               inner join bb_allocation_resource ar on 
ar.allocation_id = al.id
+                               inner join bb_resource br on br.id = 
ar.resource_id and br.active = 1
+                               inner join bb_building bu on bu.id = 
br.building_id
+                               left join bb_booking bb on bb.allocation_id = 
al.id
+                               WHERE bb.id is null
+                               AND al.from_ >= '{$from}'
+                               AND al.to_ <= '{$to}'"
+                               . " AND br.activity_id IN ({$activity_ids}) ";
+
+                       if($buildings)
+                       {
+                               $sql .= "and building_id in (" . $buildings . 
") ";
+                       }
+
+                       if($weekdays)
+                       {
+                               $sql .= "and EXTRACT(DOW FROM al.from_) in 
({$weekdays}) ";
+                       }
+
+                       $sql .= "order by building_name, from_, to_, 
resource_name";
+                       $db->query($sql);
+
+                       $result = $db->resultSet;
+
+                       $retval                                  = array();
+                       $retval['total_records'] = count($result);
+                       $retval['results']               = $result;
+                       $retval['start']                 = 0;
+                       $retval['sort']                  = null;
+                       $retval['dir']                   = 'asc';
+       _debug_array($sql);
+       _debug_array($retval);
+                       die();
+                       return $retval;
+               }
+
                public function get_custom()
                {
                        $activity_id = phpgw::get_var('activity_id', 'int');

Added: 
branches/dev-syncromind/booking/jasper/templates/participants_per_activity.jrxml
===================================================================
--- 
branches/dev-syncromind/booking/jasper/templates/participants_per_activity.jrxml
                            (rev 0)
+++ 
branches/dev-syncromind/booking/jasper/templates/participants_per_activity.jrxml
    2015-10-25 14:15:37 UTC (rev 14238)
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports 
Library version 6.1.1  -->
+<!-- 2015-10-25T13:52:13 -->
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports 
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; 
name="BKParticipants" pageWidth="842" pageHeight="595" orientation="Landscape" 
columnWidth="802" leftMargin="20" rightMargin="20" topMargin="30" 
bottomMargin="30" isFloatColumnFooter="true" 
uuid="1873d2c1-c32a-44a8-872b-cceed58b6b0f">
+       <property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
+       <property name="net.sf.jasperreports.export.pdf.tag.language" 
value="EN-US"/>
+       <style name="Sans_Normal" isDefault="true" fontName="Serif" 
fontSize="8" isBold="false" isItalic="false" isUnderline="false" 
isStrikeThrough="false"/>
+       <style name="Sans_Bold" fontName="Serif" fontSize="8" isBold="true" 
isItalic="false" isUnderline="false" isStrikeThrough="false"/>
+       <subDataset name="ByBuilding_preview" 
uuid="c4e37eff-60df-478a-8cd1-abea5e1bd145">
+               <property name="com.jaspersoft.studio.data.defaultdataadapter" 
value="dev_syncromind_ebe"/>
+               <property name="com.jaspersoft.studio.data.sql.tables" 
value=""/>
+               <parameter name="DATE_FROM" class="java.lang.String"/>
+               <parameter name="DATE_TO" class="java.lang.String"/>
+               <parameter name="BUILDING_ID" class="java.lang.Integer"/>
+               <parameter name="RESOURCES" class="java.lang.String"/>
+               <parameter name="WEEKDAYS" class="java.lang.String"/>
+               <queryString>
+                       <![CDATA[SELECT ag.name AS aname, ba.male, ba.female, 
bu.id, bu.name, ag.sort as agegroup_sort, ac.name AS activity_name
+                               FROM bb_agegroup ag, bb_booking_agegroup ba, 
bb_booking bo, bb_allocation al, bb_season se, bb_building bu, 
bb_booking_resource br, bb_resource re, bb_activity ac
+                               WHERE ba.agegroup_id = ag.id 
+                               AND ba.booking_id = bo.id
+                               AND br.booking_id = bo.id
+                               AND br.resource_id = re.id
+                               AND re.activity_id = ac.id
+                               AND bo.allocation_id = al.id
+                               AND al.season_id = se.id 
+                               AND se.building_id = bu.id 
+                               AND ag.active = 1
+                               AND date_trunc('day' ,bo.from_) >= 
to_date($P{DATE_FROM} ,'YYYY-MM-DD')
+                               AND date_trunc('day' ,bo.from_) <= 
to_date($P{DATE_TO}, 'YYYY-MM-DD')
+                               AND re.id = ANY (string_to_array($P{RESOURCES}, 
',')::int4[])
+                               AND EXTRACT(DOW FROM bo.from_) = ANY 
(string_to_array($P{WEEKDAYS}, ',')::int4[])
+                               UNION
+                               SELECT ag.name AS aname, ea.male, ea.female, 
bu.id, bu.name, ag.sort AS agegroup_sort, ac.name AS activity_name
+                               FROM bb_event ev
+                               INNER JOIN bb_event_agegroup ea ON ea.event_id 
= ev.id
+                               INNER JOIN bb_agegroup ag ON ag.id = 
ea.agegroup_id and ag.active = 1
+                               INNER JOIN bb_event_resource er ON er.event_id 
= ev.id
+                               INNER JOIN bb_resource re ON re.id = 
er.resource_id
+                               INNER JOIN bb_activity ac ON re.activity_id = 
ac.id
+                               INNER JOIN bb_building bu ON bu.id = 
re.building_id
+                               WHERE date_trunc('day' ,ev.from_) >= 
to_date($P{DATE_FROM} ,'YYYY-MM-DD')
+                               AND date_trunc('day' ,ev.from_) <= 
to_date($P{DATE_TO}, 'YYYY-MM-DD')
+                               AND EXTRACT(DOW FROM ev.from_) = ANY 
(string_to_array($P{WEEKDAYS}, ',')::int4[])
+                               AND er.resource_id = ANY 
(string_to_array($P{RESOURCES}, ',')::int4[])
+                               ORDER BY activity_name ASC, agegroup_sort]]>
+               </queryString>
+               <field name="activity_name" class="java.lang.String"/>
+               <field name="aname" class="java.lang.String"/>
+               <field name="male" class="java.lang.Integer"/>
+               <field name="female" class="java.lang.Integer"/>
+       </subDataset>
+       <parameter name="BK_DATE_FROM" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["2013-01-01"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_DATE_TO" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["2014-01-01"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_RESOURCES" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["1,2,3,4,5,6,7,8,9,10,20,31,36,38,39,44,48,50,51,65,66,82,83,84,85,91,96,108,109,110,111,112,113,114,127,261,294,370,411,417,418,419,420,421,422"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_WEEKDAYS" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["1,2,3,4,5,6,7"]]></defaultValueExpression>
+       </parameter>
+       <queryString>
+               <![CDATA[SELECT DISTINCT bu.id AS building_id, bu.name AS 
building_name
+                       FROM bb_booking bo
+                       INNER JOIN bb_allocation al ON al.id = bo.allocation_id
+                       INNER JOIN bb_allocation_resource ar ON 
ar.allocation_id = al.id
+                       INNER JOIN bb_resource re on re.id = ar.resource_id
+                       INNER JOIN bb_season se ON se.id = al.season_id
+                       INNER JOIN bb_building bu ON bu.id = se.building_id
+                       WHERE date_trunc('day', bo.from_) >= 
to_date($P{BK_DATE_FROM}, 'YYYY-MM-DD')
+                       AND date_trunc('day', bo.from_) <= 
to_date($P{BK_DATE_TO}, 'YYYY-MM-DD')
+                       AND ar.resource_id = ANY 
(string_to_array($P{BK_RESOURCES}, ',')::int4[])
+                       AND EXTRACT(DOW FROM bo.from_) = ANY 
(string_to_array($P{BK_WEEKDAYS}, ',')::int4[])
+                       UNION
+                       SELECT DISTINCT bu.id AS building_id, bu.name AS 
building_name
+                       from bb_event ev
+                       inner join bb_event_resource er on er.event_id = ev.id
+                       inner join bb_resource re on re.id = er.resource_id
+                       inner join bb_building bu on bu.id = re.building_id
+                       WHERE date_trunc('day', ev.from_) >= 
to_date($P{BK_DATE_FROM}, 'YYYY-MM-DD')
+                       AND date_trunc('day', ev.from_) <= 
to_date($P{BK_DATE_TO}, 'YYYY-MM-DD')
+                       AND re.id = ANY (string_to_array($P{BK_RESOURCES}, 
',')::int4[])
+                       AND EXTRACT(DOW FROM ev.from_) = ANY 
(string_to_array($P{BK_WEEKDAYS}, ',')::int4[])
+                       order by building_name]]>
+       </queryString>
+       <field name="building_id" class="java.lang.Integer"/>
+       <field name="building_name" class="java.lang.String"/>
+       <title>
+               <band height="80" splitType="Prevent">
+                       <staticText>
+                               <reportElement x="20" y="5" width="750" 
height="30" uuid="e7407441-b3ae-40cf-bc16-79560cc4a81e">
+                                       <property 
name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
+                               </reportElement>
+                               <textElement textAlignment="Center">
+                                       <font size="18"/>
+                               </textElement>
+                               <text><![CDATA[Deltagere per aldersgruppe pr 
aktivitet]]></text>
+                       </staticText>
+                       <textField>
+                               <reportElement x="20" y="35" width="750" 
height="40" uuid="bdf9207a-d0f4-4be6-9013-baad45d25237">
+                                       <property 
name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
+                               </reportElement>
+                               <textElement textAlignment="Center">
+                                       <font size="16"/>
+                               </textElement>
+                               <textFieldExpression><![CDATA["(" + 
$P{BK_DATE_FROM} + " - " + $P{BK_DATE_TO} + ")"]]></textFieldExpression>
+                       </textField>
+               </band>
+       </title>
+       <detail>
+               <band height="130" splitType="Prevent">
+                       <textField>
+                               <reportElement style="Sans_Bold" x="0" y="20" 
width="500" height="35" uuid="0676bc2b-3729-44c9-8d1a-a7e348784682"/>
+                               <textElement>
+                                       <font size="10"/>
+                               </textElement>
+                               <textFieldExpression><![CDATA["Bygg/Anlegg: " + 
$F{building_name}]]></textFieldExpression>
+                       </textField>
+                       <crosstab isRepeatColumnHeaders="false">
+                               <reportElement x="0" y="60" width="782" 
height="70" uuid="bb140d14-10c9-4af5-9d0b-cdaa10397db7">
+                                       <property 
name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
+                               </reportElement>
+                               <crosstabParameter name="BUILDING_ID" 
class="java.lang.Integer">
+                                       
<parameterValueExpression><![CDATA[$F{building_id}]]></parameterValueExpression>
+                               </crosstabParameter>
+                               <crosstabDataset>
+                                       <dataset>
+                                               <datasetRun 
subDataset="ByBuilding_preview" uuid="8fbab4ad-bd52-4666-9170-64abfaa403c7">
+                                                       <datasetParameter 
name="BUILDING_ID">
+                                                               
<datasetParameterExpression><![CDATA[$F{building_id}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="DATE_FROM">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_DATE_FROM}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="DATE_TO">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_DATE_TO}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="RESOURCES">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_RESOURCES}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="WEEKDAYS">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_WEEKDAYS}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                               </datasetRun>
+                                       </dataset>
+                               </crosstabDataset>
+                               <rowGroup name="ActivityGroup" width="150" 
totalPosition="End">
+                                       <bucket class="java.lang.String">
+                                               
<bucketExpression><![CDATA[$F{activity_name}]]></bucketExpression>
+                                       </bucket>
+                                       <crosstabRowHeader>
+                                               <cellContents>
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <textField>
+                                                               <reportElement 
style="Sans_Bold" x="5" y="0" width="145" height="10" 
uuid="8c9718ee-483a-4929-a100-244a24e4ffbe">
+                                                                       
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
+                                                               </reportElement>
+                                                               <textElement>
+                                                                       <font 
fontName="Serif"/>
+                                                               </textElement>
+                                                               
<textFieldExpression><![CDATA[$V{ActivityGroup}]]></textFieldExpression>
+                                                       </textField>
+                                               </cellContents>
+                                       </crosstabRowHeader>
+                                       <crosstabTotalRowHeader>
+                                               <cellContents 
backcolor="#E0FFFF" mode="Opaque">
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="5" y="0" width="70" height="10" 
uuid="c01ea586-6f5b-4516-b2dd-6aa27b2cc56c"/>
+                                                               
<text><![CDATA[TOTAL]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabTotalRowHeader>
+                               </rowGroup>
+                               <columnGroup name="AgeGroup" height="80" 
totalPosition="End" headerPosition="Stretch">
+                                       <bucket class="java.lang.String">
+                                               
<bucketExpression><![CDATA[$F{aname}]]></bucketExpression>
+                                       </bucket>
+                                       <crosstabColumnHeader>
+                                               <cellContents>
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <textField>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="0" width="80" height="70" 
uuid="184c30a1-fa45-4ee3-8be6-8a90ebe1ef0d"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle" rotation="Left"/>
+                                                               
<textFieldExpression><![CDATA[$V{AgeGroup}]]></textFieldExpression>
+                                                       </textField>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="70" width="40" height="10" 
uuid="06209a7c-1c5e-4e95-9ecd-ad7f33059f32"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[M]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="40" y="70" width="40" height="10" 
uuid="9969bbca-5f4c-4cea-bd51-3889a8baf399"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[K]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabColumnHeader>
+                                       <crosstabTotalColumnHeader>
+                                               <cellContents 
backcolor="#FFFF60" mode="Opaque">
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="0" width="80" height="70" 
uuid="a63a51d1-aa6f-4cae-ba66-a8d5b7cfa2f8"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[TOTAL]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="70" width="40" height="10" 
uuid="11b3cb34-8980-40dc-87d5-662e4d79ec75"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[M]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="40" y="70" width="40" height="10" 
uuid="97644c1d-5c61-4a01-be1b-c98ae8497f56"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[K]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabTotalColumnHeader>
+                               </columnGroup>
+                               <measure name="MaleMesure" 
class="java.lang.Integer" calculation="Sum">
+                                       
<measureExpression><![CDATA[$F{male}]]></measureExpression>
+                               </measure>
+                               <measure name="FemaleMesure" 
class="java.lang.Integer" calculation="Sum">
+                                       
<measureExpression><![CDATA[$F{female}]]></measureExpression>
+                               </measure>
+                               <crosstabCell width="80" height="10">
+                                       <cellContents backcolor="#FFFFFF" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="22264a3a-7193-4892-bf29-b75899cc2b80"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="93429dda-20a2-411b-8c7c-48de11729143"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
columnTotalGroup="AgeGroup">
+                                       <cellContents backcolor="#FFFF60" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="4956a86e-de4d-4ae4-aab7-ebc757987f4e"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="7c281a12-3cd0-422f-9689-fb480b311127"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
rowTotalGroup="ActivityGroup">
+                                       <cellContents backcolor="#E0FFFF" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="90c25670-614f-48d4-8da2-d77b3ea3cd6e"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="8852a81d-3234-4216-b364-3f61abd35f5c"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
rowTotalGroup="ActivityGroup" columnTotalGroup="AgeGroup">
+                                       <cellContents backcolor="#C0C0C0" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement 
style="Sans_Bold" x="0" y="0" width="40" height="10" 
uuid="ad6c304a-8e57-48e4-b7fb-3870a1f35401"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement 
style="Sans_Bold" x="40" y="0" width="40" height="10" 
uuid="b24d7c43-17b9-4c89-9f2b-f0e3bfa5e1bb"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <whenNoDataCell>
+                                       <cellContents>
+                                               <staticText>
+                                                       <reportElement x="0" 
y="0" width="250" height="25" uuid="59b20104-6c6f-4eb1-b324-25b2b746f423"/>
+                                                       <text><![CDATA[No 
data]]></text>
+                                               </staticText>
+                                       </cellContents>
+                               </whenNoDataCell>
+                       </crosstab>
+               </band>
+       </detail>
+</jasperReport>

Added: 
branches/dev-syncromind/booking/jasper/templates/participants_per_audience.jrxml
===================================================================
--- 
branches/dev-syncromind/booking/jasper/templates/participants_per_audience.jrxml
                            (rev 0)
+++ 
branches/dev-syncromind/booking/jasper/templates/participants_per_audience.jrxml
    2015-10-25 14:15:37 UTC (rev 14238)
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports 
Library version 6.1.1  -->
+<!-- 2015-10-25T13:22:34 -->
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports 
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; 
name="BKParticipants" pageWidth="842" pageHeight="595" orientation="Landscape" 
columnWidth="802" leftMargin="20" rightMargin="20" topMargin="30" 
bottomMargin="30" isFloatColumnFooter="true" 
uuid="1873d2c1-c32a-44a8-872b-cceed58b6b0f">
+       <property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
+       <property name="net.sf.jasperreports.export.pdf.tag.language" 
value="EN-US"/>
+       <style name="Sans_Normal" isDefault="true" fontName="Serif" 
fontSize="8" isBold="false" isItalic="false" isUnderline="false" 
isStrikeThrough="false"/>
+       <style name="Sans_Bold" fontName="Serif" fontSize="8" isBold="true" 
isItalic="false" isUnderline="false" isStrikeThrough="false"/>
+       <subDataset name="ByBuilding_preview" 
uuid="c4e37eff-60df-478a-8cd1-abea5e1bd145">
+               <property name="com.jaspersoft.studio.data.defaultdataadapter" 
value="dev_syncromind_ebe"/>
+               <property name="com.jaspersoft.studio.data.sql.tables" 
value=""/>
+               <parameter name="DATE_FROM" class="java.lang.String"/>
+               <parameter name="DATE_TO" class="java.lang.String"/>
+               <parameter name="BUILDING_ID" class="java.lang.Integer"/>
+               <parameter name="RESOURCES" class="java.lang.String"/>
+               <parameter name="WEEKDAYS" class="java.lang.String"/>
+               <queryString>
+                       <![CDATA[SELECT ag.name AS aname, ba.male, ba.female, 
bu.id, bu.name, ag.sort as agegroup_sort, ta.name AS audience_name
+                               FROM bb_agegroup ag, bb_booking_agegroup ba, 
bb_booking bo, bb_allocation al, bb_season se, bb_building bu, 
bb_booking_resource br, bb_resource re, bb_booking_targetaudience bt, 
bb_targetaudience ta
+                               WHERE ba.agegroup_id = ag.id 
+                               AND ba.booking_id = bo.id
+                               AND br.booking_id = bo.id
+                               AND br.resource_id = re.id
+                               AND bt.booking_id = bo.id
+                               AND bt.targetaudience_id = ta.id
+                               AND bo.allocation_id = al.id
+                               AND al.season_id = se.id 
+                               AND se.building_id = bu.id 
+                               AND ag.active = 1
+                               AND date_trunc('day' ,bo.from_) >= 
to_date($P{DATE_FROM} ,'YYYY-MM-DD')
+                               AND date_trunc('day' ,bo.from_) <= 
to_date($P{DATE_TO}, 'YYYY-MM-DD')
+                               AND re.id = ANY (string_to_array($P{RESOURCES}, 
',')::int4[])
+                               AND EXTRACT(DOW FROM bo.from_) = ANY 
(string_to_array($P{WEEKDAYS}, ',')::int4[])
+                               UNION
+                               SELECT ag.name AS aname, ea.male, ea.female, 
bu.id, bu.name, ag.sort AS agegroup_sort, ta.name AS audience_name
+                               FROM bb_event ev
+                               INNER JOIN bb_event_agegroup ea ON ea.event_id 
= ev.id
+                               INNER JOIN bb_agegroup ag ON ag.id = 
ea.agegroup_id and ag.active = 1
+                               INNER JOIN bb_event_resource er ON er.event_id 
= ev.id
+                               INNER JOIN bb_resource re ON re.id = 
er.resource_id
+                               INNER JOIN bb_event_targetaudience et ON 
et.event_id = ev.id
+                               INNER JOIN bb_targetaudience ta ON ta.id = 
et.targetaudience_id
+                               INNER JOIN bb_building bu ON bu.id = 
re.building_id
+                               WHERE date_trunc('day' ,ev.from_) >= 
to_date($P{DATE_FROM} ,'YYYY-MM-DD')
+                               AND date_trunc('day' ,ev.from_) <= 
to_date($P{DATE_TO}, 'YYYY-MM-DD')
+                               AND EXTRACT(DOW FROM ev.from_) = ANY 
(string_to_array($P{WEEKDAYS}, ',')::int4[])
+                               AND er.resource_id = ANY 
(string_to_array($P{RESOURCES}, ',')::int4[])
+                               ORDER BY audience_name ASC, agegroup_sort]]>
+               </queryString>
+               <field name="audience_name" class="java.lang.String"/>
+               <field name="aname" class="java.lang.String"/>
+               <field name="male" class="java.lang.Integer"/>
+               <field name="female" class="java.lang.Integer"/>
+       </subDataset>
+       <parameter name="BK_DATE_FROM" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["2013-01-01"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_DATE_TO" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["2014-01-01"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_RESOURCES" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["1,2,3,4,5,6,7,8,9,10,20,31,36,38,39,44,48,50,51,65,66,82,83,84,85,91,96,108,109,110,111,112,113,114,127,261,294,370,411,417,418,419,420,421,422"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_WEEKDAYS" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["1,2,3,4,5,6,7"]]></defaultValueExpression>
+       </parameter>
+       <queryString>
+               <![CDATA[SELECT DISTINCT bu.id AS building_id, bu.name AS 
building_name
+                       FROM bb_booking bo
+                       INNER JOIN bb_allocation al ON al.id = bo.allocation_id
+                       INNER JOIN bb_allocation_resource ar ON 
ar.allocation_id = al.id
+                       INNER JOIN bb_resource re on re.id = ar.resource_id
+                       INNER JOIN bb_season se ON se.id = al.season_id
+                       INNER JOIN bb_building bu ON bu.id = se.building_id
+                       WHERE date_trunc('day', bo.from_) >= 
to_date($P{BK_DATE_FROM}, 'YYYY-MM-DD')
+                       AND date_trunc('day', bo.from_) <= 
to_date($P{BK_DATE_TO}, 'YYYY-MM-DD')
+                       AND ar.resource_id = ANY 
(string_to_array($P{BK_RESOURCES}, ',')::int4[])
+                       AND EXTRACT(DOW FROM bo.from_) = ANY 
(string_to_array($P{BK_WEEKDAYS}, ',')::int4[])
+                       UNION
+                       SELECT DISTINCT bu.id AS building_id, bu.name AS 
building_name
+                       from bb_event ev
+                       inner join bb_event_resource er on er.event_id = ev.id
+                       inner join bb_resource re on re.id = er.resource_id
+                       inner join bb_building bu on bu.id = re.building_id
+                       WHERE date_trunc('day', ev.from_) >= 
to_date($P{BK_DATE_FROM}, 'YYYY-MM-DD')
+                       AND date_trunc('day', ev.from_) <= 
to_date($P{BK_DATE_TO}, 'YYYY-MM-DD')
+                       AND re.id = ANY (string_to_array($P{BK_RESOURCES}, 
',')::int4[])
+                       AND EXTRACT(DOW FROM ev.from_) = ANY 
(string_to_array($P{BK_WEEKDAYS}, ',')::int4[])
+                       order by building_name]]>
+       </queryString>
+       <field name="building_id" class="java.lang.Integer"/>
+       <field name="building_name" class="java.lang.String"/>
+       <title>
+               <band height="80" splitType="Prevent">
+                       <staticText>
+                               <reportElement x="20" y="5" width="750" 
height="30" uuid="e7407441-b3ae-40cf-bc16-79560cc4a81e">
+                                       <property 
name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
+                               </reportElement>
+                               <textElement textAlignment="Center">
+                                       <font size="18"/>
+                               </textElement>
+                               <text><![CDATA[Deltagere per aldersgruppe pr 
målgruppe]]></text>
+                       </staticText>
+                       <textField>
+                               <reportElement x="20" y="35" width="750" 
height="40" uuid="bdf9207a-d0f4-4be6-9013-baad45d25237">
+                                       <property 
name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
+                               </reportElement>
+                               <textElement textAlignment="Center">
+                                       <font size="16"/>
+                               </textElement>
+                               <textFieldExpression><![CDATA["(" + 
$P{BK_DATE_FROM} + " - " + $P{BK_DATE_TO} + ")"]]></textFieldExpression>
+                       </textField>
+               </band>
+       </title>
+       <detail>
+               <band height="130" splitType="Prevent">
+                       <textField>
+                               <reportElement style="Sans_Bold" x="0" y="20" 
width="500" height="35" uuid="0676bc2b-3729-44c9-8d1a-a7e348784682"/>
+                               <textElement>
+                                       <font size="10"/>
+                               </textElement>
+                               <textFieldExpression><![CDATA["Bygg/Anlegg: " + 
$F{building_name}]]></textFieldExpression>
+                       </textField>
+                       <crosstab isRepeatColumnHeaders="false">
+                               <reportElement x="0" y="60" width="782" 
height="70" uuid="bb140d14-10c9-4af5-9d0b-cdaa10397db7">
+                                       <property 
name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
+                               </reportElement>
+                               <crosstabParameter name="BUILDING_ID" 
class="java.lang.Integer">
+                                       
<parameterValueExpression><![CDATA[$F{building_id}]]></parameterValueExpression>
+                               </crosstabParameter>
+                               <crosstabDataset>
+                                       <dataset>
+                                               <datasetRun 
subDataset="ByBuilding_preview" uuid="8fbab4ad-bd52-4666-9170-64abfaa403c7">
+                                                       <datasetParameter 
name="BUILDING_ID">
+                                                               
<datasetParameterExpression><![CDATA[$F{building_id}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="DATE_FROM">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_DATE_FROM}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="DATE_TO">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_DATE_TO}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="RESOURCES">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_RESOURCES}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="WEEKDAYS">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_WEEKDAYS}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                               </datasetRun>
+                                       </dataset>
+                               </crosstabDataset>
+                               <rowGroup name="AudienceGroup" width="150" 
totalPosition="End">
+                                       <bucket class="java.lang.String">
+                                               
<bucketExpression><![CDATA[$F{audience_name}]]></bucketExpression>
+                                       </bucket>
+                                       <crosstabRowHeader>
+                                               <cellContents>
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <textField>
+                                                               <reportElement 
style="Sans_Bold" x="5" y="0" width="145" height="10" 
uuid="8c9718ee-483a-4929-a100-244a24e4ffbe">
+                                                                       
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
+                                                               </reportElement>
+                                                               <textElement>
+                                                                       <font 
fontName="Serif"/>
+                                                               </textElement>
+                                                               
<textFieldExpression><![CDATA[$V{AudienceGroup}]]></textFieldExpression>
+                                                       </textField>
+                                               </cellContents>
+                                       </crosstabRowHeader>
+                                       <crosstabTotalRowHeader>
+                                               <cellContents 
backcolor="#E0FFFF" mode="Opaque">
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="5" y="0" width="70" height="10" 
uuid="c01ea586-6f5b-4516-b2dd-6aa27b2cc56c"/>
+                                                               
<text><![CDATA[TOTAL]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabTotalRowHeader>
+                               </rowGroup>
+                               <columnGroup name="AgeGroup" height="80" 
totalPosition="End" headerPosition="Stretch">
+                                       <bucket class="java.lang.String">
+                                               
<bucketExpression><![CDATA[$F{aname}]]></bucketExpression>
+                                       </bucket>
+                                       <crosstabColumnHeader>
+                                               <cellContents>
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <textField>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="0" width="80" height="70" 
uuid="184c30a1-fa45-4ee3-8be6-8a90ebe1ef0d"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle" rotation="Left"/>
+                                                               
<textFieldExpression><![CDATA[$V{AgeGroup}]]></textFieldExpression>
+                                                       </textField>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="70" width="40" height="10" 
uuid="06209a7c-1c5e-4e95-9ecd-ad7f33059f32"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[M]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="40" y="70" width="40" height="10" 
uuid="9969bbca-5f4c-4cea-bd51-3889a8baf399"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[K]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabColumnHeader>
+                                       <crosstabTotalColumnHeader>
+                                               <cellContents 
backcolor="#FFFF60" mode="Opaque">
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="0" width="80" height="70" 
uuid="a63a51d1-aa6f-4cae-ba66-a8d5b7cfa2f8"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[TOTAL]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="70" width="40" height="10" 
uuid="11b3cb34-8980-40dc-87d5-662e4d79ec75"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[M]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="40" y="70" width="40" height="10" 
uuid="97644c1d-5c61-4a01-be1b-c98ae8497f56"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[K]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabTotalColumnHeader>
+                               </columnGroup>
+                               <measure name="MaleMesure" 
class="java.lang.Integer" calculation="Sum">
+                                       
<measureExpression><![CDATA[$F{male}]]></measureExpression>
+                               </measure>
+                               <measure name="FemaleMesure" 
class="java.lang.Integer" calculation="Sum">
+                                       
<measureExpression><![CDATA[$F{female}]]></measureExpression>
+                               </measure>
+                               <crosstabCell width="80" height="10">
+                                       <cellContents backcolor="#FFFFFF" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="22264a3a-7193-4892-bf29-b75899cc2b80"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="93429dda-20a2-411b-8c7c-48de11729143"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
columnTotalGroup="AgeGroup">
+                                       <cellContents backcolor="#FFFF60" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="4956a86e-de4d-4ae4-aab7-ebc757987f4e"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="7c281a12-3cd0-422f-9689-fb480b311127"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
rowTotalGroup="AudienceGroup">
+                                       <cellContents backcolor="#E0FFFF" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="90c25670-614f-48d4-8da2-d77b3ea3cd6e"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="8852a81d-3234-4216-b364-3f61abd35f5c"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
rowTotalGroup="AudienceGroup" columnTotalGroup="AgeGroup">
+                                       <cellContents backcolor="#C0C0C0" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement 
style="Sans_Bold" x="0" y="0" width="40" height="10" 
uuid="ad6c304a-8e57-48e4-b7fb-3870a1f35401"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement 
style="Sans_Bold" x="40" y="0" width="40" height="10" 
uuid="b24d7c43-17b9-4c89-9f2b-f0e3bfa5e1bb"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <whenNoDataCell>
+                                       <cellContents>
+                                               <staticText>
+                                                       <reportElement x="0" 
y="0" width="250" height="25" uuid="59b20104-6c6f-4eb1-b324-25b2b746f423"/>
+                                                       <text><![CDATA[No 
data]]></text>
+                                               </staticText>
+                                       </cellContents>
+                               </whenNoDataCell>
+                       </crosstab>
+               </band>
+       </detail>
+</jasperReport>
+

Added: 
branches/dev-syncromind/booking/jasper/templates/participants_per_resource.jrxml
===================================================================
--- 
branches/dev-syncromind/booking/jasper/templates/participants_per_resource.jrxml
                            (rev 0)
+++ 
branches/dev-syncromind/booking/jasper/templates/participants_per_resource.jrxml
    2015-10-25 14:15:37 UTC (rev 14238)
@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports 
Library version 6.1.1  -->
+<!-- 2015-10-24T18:50:20 -->
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports 
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; 
name="BKParticipants" pageWidth="842" pageHeight="595" orientation="Landscape" 
columnWidth="802" leftMargin="20" rightMargin="20" topMargin="30" 
bottomMargin="30" isFloatColumnFooter="true" 
uuid="1873d2c1-c32a-44a8-872b-cceed58b6b0f">
+       <property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
+       <property name="net.sf.jasperreports.export.pdf.tag.language" 
value="EN-US"/>
+       <style name="Sans_Normal" isDefault="true" fontName="Serif" 
fontSize="8" isBold="false" isItalic="false" isUnderline="false" 
isStrikeThrough="false"/>
+       <style name="Sans_Bold" fontName="Serif" fontSize="8" isBold="true" 
isItalic="false" isUnderline="false" isStrikeThrough="false"/>
+       <subDataset name="ByBuilding_preview" 
uuid="c4e37eff-60df-478a-8cd1-abea5e1bd145">
+               <property name="com.jaspersoft.studio.data.defaultdataadapter" 
value="dev_syncromind_ebe"/>
+               <property name="com.jaspersoft.studio.data.sql.tables" 
value=""/>
+               <parameter name="DATE_FROM" class="java.lang.String"/>
+               <parameter name="DATE_TO" class="java.lang.String"/>
+               <parameter name="BUILDING_ID" class="java.lang.Integer"/>
+               <parameter name="RESOURCES" class="java.lang.String"/>
+               <parameter name="WEEKDAYS" class="java.lang.String"/>
+               <queryString>
+                       <![CDATA[SELECT ag.name AS aname, ba.male, ba.female, 
bu.id, bu.name, ag.sort as agegroup_sort, re.name AS resource_name
+                               FROM bb_agegroup ag, bb_booking_agegroup ba, 
bb_booking bo, bb_allocation al, bb_season se, bb_building bu, 
bb_booking_resource br, bb_resource re
+                               WHERE ba.agegroup_id = ag.id 
+                               AND ba.booking_id = bo.id
+                               AND br.booking_id = bo.id
+                               AND br.resource_id = re.id
+                               AND bo.allocation_id = al.id
+                               AND al.season_id = se.id 
+                               AND se.building_id = bu.id 
+                               AND ag.active = 1
+                               AND date_trunc('day' ,bo.from_) >= 
to_date($P{DATE_FROM} ,'YYYY-MM-DD')
+                               AND date_trunc('day' ,bo.from_) <= 
to_date($P{DATE_TO}, 'YYYY-MM-DD')
+                               AND re.id = ANY (string_to_array($P{RESOURCES}, 
',')::int4[])
+                               AND EXTRACT(DOW FROM bo.from_) = ANY 
(string_to_array($P{WEEKDAYS}, ',')::int4[])
+                               UNION
+                               SELECT ag.name AS aname, ea.male, ea.female, 
bu.id, bu.name, ag.sort AS agegroup_sort, re.name AS resource_name
+                               FROM bb_event ev
+                               INNER JOIN bb_event_agegroup ea ON ea.event_id 
= ev.id
+                               INNER JOIN bb_agegroup ag ON ag.id = 
ea.agegroup_id and ag.active = 1
+                               INNER JOIN bb_event_resource er ON er.event_id 
= ev.id
+                               INNER JOIN bb_resource re ON re.id = 
er.resource_id
+                               INNER JOIN bb_building bu ON bu.id = 
re.building_id
+                               WHERE date_trunc('day' ,ev.from_) >= 
to_date($P{DATE_FROM} ,'YYYY-MM-DD')
+                               AND date_trunc('day' ,ev.from_) <= 
to_date($P{DATE_TO}, 'YYYY-MM-DD')
+                               AND EXTRACT(DOW FROM ev.from_) = ANY 
(string_to_array($P{WEEKDAYS}, ',')::int4[])
+                               AND er.resource_id = ANY 
(string_to_array($P{RESOURCES}, ',')::int4[])
+                               ORDER BY resource_name ASC, agegroup_sort]]>
+               </queryString>
+               <field name="resource_name" class="java.lang.String"/>
+               <field name="aname" class="java.lang.String"/>
+               <field name="male" class="java.lang.Integer"/>
+               <field name="female" class="java.lang.Integer"/>
+       </subDataset>
+       <parameter name="BK_DATE_FROM" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["2013-01-01"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_DATE_TO" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["2014-01-01"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_RESOURCES" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["1,2,3,4,5,6,7,8,9,10,20,31,36,38,39,44,48,50,51,65,66,82,83,84,85,91,96,108,109,110,111,112,113,114,127,261,294,370,411,417,418,419,420,421,422"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="BK_WEEKDAYS" class="java.lang.String">
+               
<defaultValueExpression><![CDATA["1,2,3,4,5,6,7"]]></defaultValueExpression>
+       </parameter>
+       <queryString>
+               <![CDATA[SELECT DISTINCT bu.id AS building_id, bu.name AS 
building_name
+                       FROM bb_booking bo
+                       INNER JOIN bb_allocation al ON al.id = bo.allocation_id
+                       INNER JOIN bb_allocation_resource ar ON 
ar.allocation_id = al.id
+                       INNER JOIN bb_resource re on re.id = ar.resource_id
+                       INNER JOIN bb_season se ON se.id = al.season_id
+                       INNER JOIN bb_building bu ON bu.id = se.building_id
+                       WHERE date_trunc('day', bo.from_) >= 
to_date($P{BK_DATE_FROM}, 'YYYY-MM-DD')
+                       AND date_trunc('day', bo.from_) <= 
to_date($P{BK_DATE_TO}, 'YYYY-MM-DD')
+                       AND ar.resource_id = ANY 
(string_to_array($P{BK_RESOURCES}, ',')::int4[])
+                       AND EXTRACT(DOW FROM bo.from_) = ANY 
(string_to_array($P{BK_WEEKDAYS}, ',')::int4[])
+                       UNION
+                       SELECT DISTINCT bu.id AS building_id, bu.name AS 
building_name
+                       from bb_event ev
+                       inner join bb_event_resource er on er.event_id = ev.id
+                       inner join bb_resource re on re.id = er.resource_id
+                       inner join bb_building bu on bu.id = re.building_id
+                       WHERE date_trunc('day', ev.from_) >= 
to_date($P{BK_DATE_FROM}, 'YYYY-MM-DD')
+                       AND date_trunc('day', ev.from_) <= 
to_date($P{BK_DATE_TO}, 'YYYY-MM-DD')
+                       AND re.id = ANY (string_to_array($P{BK_RESOURCES}, 
',')::int4[])
+                       AND EXTRACT(DOW FROM ev.from_) = ANY 
(string_to_array($P{BK_WEEKDAYS}, ',')::int4[])
+                       order by building_name]]>
+       </queryString>
+       <field name="building_id" class="java.lang.Integer"/>
+       <field name="building_name" class="java.lang.String"/>
+       <title>
+               <band height="80" splitType="Prevent">
+                       <staticText>
+                               <reportElement x="20" y="5" width="750" 
height="30" uuid="e7407441-b3ae-40cf-bc16-79560cc4a81e">
+                                       <property 
name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
+                               </reportElement>
+                               <textElement textAlignment="Center">
+                                       <font size="18"/>
+                               </textElement>
+                               <text><![CDATA[Deltagere per aldersgruppe pr 
ressurs]]></text>
+                       </staticText>
+                       <textField>
+                               <reportElement x="20" y="35" width="750" 
height="40" uuid="bdf9207a-d0f4-4be6-9013-baad45d25237">
+                                       <property 
name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
+                               </reportElement>
+                               <textElement textAlignment="Center">
+                                       <font size="16"/>
+                               </textElement>
+                               <textFieldExpression><![CDATA["(" + 
$P{BK_DATE_FROM} + " - " + $P{BK_DATE_TO} + ")"]]></textFieldExpression>
+                       </textField>
+               </band>
+       </title>
+       <detail>
+               <band height="130" splitType="Prevent">
+                       <textField>
+                               <reportElement style="Sans_Bold" x="0" y="20" 
width="500" height="35" uuid="0676bc2b-3729-44c9-8d1a-a7e348784682"/>
+                               <textElement>
+                                       <font size="10"/>
+                               </textElement>
+                               <textFieldExpression><![CDATA["Bygg/Anlegg: " + 
$F{building_name}]]></textFieldExpression>
+                       </textField>
+                       <crosstab isRepeatColumnHeaders="false">
+                               <reportElement x="0" y="60" width="782" 
height="70" uuid="bb140d14-10c9-4af5-9d0b-cdaa10397db7">
+                                       <property 
name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
+                               </reportElement>
+                               <crosstabParameter name="BUILDING_ID" 
class="java.lang.Integer">
+                                       
<parameterValueExpression><![CDATA[$F{building_id}]]></parameterValueExpression>
+                               </crosstabParameter>
+                               <crosstabDataset>
+                                       <dataset>
+                                               <datasetRun 
subDataset="ByBuilding_preview" uuid="8fbab4ad-bd52-4666-9170-64abfaa403c7">
+                                                       <datasetParameter 
name="BUILDING_ID">
+                                                               
<datasetParameterExpression><![CDATA[$F{building_id}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="DATE_FROM">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_DATE_FROM}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="DATE_TO">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_DATE_TO}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="RESOURCES">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_RESOURCES}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                                       <datasetParameter 
name="WEEKDAYS">
+                                                               
<datasetParameterExpression><![CDATA[$P{BK_WEEKDAYS}]]></datasetParameterExpression>
+                                                       </datasetParameter>
+                                               </datasetRun>
+                                       </dataset>
+                               </crosstabDataset>
+                               <rowGroup name="ResourceGroup" width="75" 
totalPosition="End">
+                                       <bucket class="java.lang.String">
+                                               
<bucketExpression><![CDATA[$F{resource_name}]]></bucketExpression>
+                                       </bucket>
+                                       <crosstabRowHeader>
+                                               <cellContents>
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <textField>
+                                                               <reportElement 
style="Sans_Bold" x="5" y="0" width="70" height="10" 
uuid="8c9718ee-483a-4929-a100-244a24e4ffbe"/>
+                                                               
<textFieldExpression><![CDATA[$V{ResourceGroup}]]></textFieldExpression>
+                                                       </textField>
+                                               </cellContents>
+                                       </crosstabRowHeader>
+                                       <crosstabTotalRowHeader>
+                                               <cellContents 
backcolor="#E0FFFF" mode="Opaque">
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="5" y="0" width="70" height="10" 
uuid="c01ea586-6f5b-4516-b2dd-6aa27b2cc56c"/>
+                                                               
<text><![CDATA[TOTAL]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabTotalRowHeader>
+                               </rowGroup>
+                               <columnGroup name="AgeGroup" height="80" 
totalPosition="End" headerPosition="Stretch">
+                                       <bucket class="java.lang.String">
+                                               
<bucketExpression><![CDATA[$F{aname}]]></bucketExpression>
+                                       </bucket>
+                                       <crosstabColumnHeader>
+                                               <cellContents>
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <textField>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="0" width="80" height="70" 
uuid="184c30a1-fa45-4ee3-8be6-8a90ebe1ef0d"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle" rotation="Left"/>
+                                                               
<textFieldExpression><![CDATA[$V{AgeGroup}]]></textFieldExpression>
+                                                       </textField>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="70" width="40" height="10" 
uuid="06209a7c-1c5e-4e95-9ecd-ad7f33059f32"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[M]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="40" y="70" width="40" height="10" 
uuid="9969bbca-5f4c-4cea-bd51-3889a8baf399"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[K]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabColumnHeader>
+                                       <crosstabTotalColumnHeader>
+                                               <cellContents 
backcolor="#FFFF60" mode="Opaque">
+                                                       <box>
+                                                               <pen 
lineWidth="0.5"/>
+                                                       </box>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="0" width="80" height="70" 
uuid="a63a51d1-aa6f-4cae-ba66-a8d5b7cfa2f8"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[TOTAL]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="0" y="70" width="40" height="10" 
uuid="11b3cb34-8980-40dc-87d5-662e4d79ec75"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[M]]></text>
+                                                       </staticText>
+                                                       <staticText>
+                                                               <reportElement 
style="Sans_Bold" x="40" y="70" width="40" height="10" 
uuid="97644c1d-5c61-4a01-be1b-c98ae8497f56"/>
+                                                               <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                               
<text><![CDATA[K]]></text>
+                                                       </staticText>
+                                               </cellContents>
+                                       </crosstabTotalColumnHeader>
+                               </columnGroup>
+                               <measure name="MaleMesure" 
class="java.lang.Integer" calculation="Sum">
+                                       
<measureExpression><![CDATA[$F{male}]]></measureExpression>
+                               </measure>
+                               <measure name="FemaleMesure" 
class="java.lang.Integer" calculation="Sum">
+                                       
<measureExpression><![CDATA[$F{female}]]></measureExpression>
+                               </measure>
+                               <crosstabCell width="80" height="10">
+                                       <cellContents backcolor="#FFFFFF" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="22264a3a-7193-4892-bf29-b75899cc2b80"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="93429dda-20a2-411b-8c7c-48de11729143"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
columnTotalGroup="AgeGroup">
+                                       <cellContents backcolor="#FFFF60" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="4956a86e-de4d-4ae4-aab7-ebc757987f4e"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="7c281a12-3cd0-422f-9689-fb480b311127"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
rowTotalGroup="ResourceGroup">
+                                       <cellContents backcolor="#E0FFFF" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement x="0" 
y="0" width="40" height="10" uuid="90c25670-614f-48d4-8da2-d77b3ea3cd6e"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement x="40" 
y="0" width="40" height="10" uuid="8852a81d-3234-4216-b364-3f61abd35f5c"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <crosstabCell width="80" height="10" 
rowTotalGroup="ResourceGroup" columnTotalGroup="AgeGroup">
+                                       <cellContents backcolor="#C0C0C0" 
mode="Opaque">
+                                               <box>
+                                                       <pen lineWidth="0.5"/>
+                                               </box>
+                                               <textField>
+                                                       <reportElement 
style="Sans_Bold" x="0" y="0" width="40" height="10" 
uuid="ad6c304a-8e57-48e4-b7fb-3870a1f35401"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{MaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                               <textField>
+                                                       <reportElement 
style="Sans_Bold" x="40" y="0" width="40" height="10" 
uuid="b24d7c43-17b9-4c89-9f2b-f0e3bfa5e1bb"/>
+                                                       <textElement 
textAlignment="Center" verticalAlignment="Middle"/>
+                                                       
<textFieldExpression><![CDATA[$V{FemaleMesure}]]></textFieldExpression>
+                                               </textField>
+                                       </cellContents>
+                               </crosstabCell>
+                               <whenNoDataCell>
+                                       <cellContents>
+                                               <staticText>
+                                                       <reportElement x="0" 
y="0" width="250" height="25" uuid="59b20104-6c6f-4eb1-b324-25b2b746f423"/>
+                                                       <text><![CDATA[No 
data]]></text>
+                                               </staticText>
+                                       </cellContents>
+                               </whenNoDataCell>
+                       </crosstab>
+               </band>
+       </detail>
+</jasperReport>

Modified: branches/dev-syncromind/booking/js/booking/report.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/report.js        2015-10-23 
21:06:37 UTC (rev 14237)
+++ branches/dev-syncromind/booking/js/booking/report.js        2015-10-25 
14:15:37 UTC (rev 14238)
@@ -33,21 +33,20 @@
 }
 
 $(document).ready(function(){
-/*
+
        $( "#check_all_buildings" ).on( "click", function() {
                if($(this).prop("checked"))
                {
-                       $("#field_building_name").val('');
                        $("#building_container").hide();
-                       $("#resources_container").html('');
+                       $("#resources_container").hide();
                }
                else
                {
                        $("#building_container").show();
-                       $("#resources_container").html(lang['Select a building 
first']);
+                       $("#resources_container").show();
                }
        });
-*/
+
        $("#field_activity").change(function () {
                oArgs = {menuaction: 'booking.uireports.get_custom'};
                var requestUrl = phpGWLink('index.php', oArgs, true);
@@ -88,7 +87,7 @@
                                                htmlString += message;
                                                htmlString += '</div>';
                                                
//$("#receipt").html(htmlString);
-                                               
$("#custom_elements_horizontal").html( variable_horizontal );
+                               //              
$("#custom_elements_horizontal").html( variable_horizontal );
                                                
$("#custom_elements_vertical").html( variable_vertical );
                                        }
                                }

Modified: branches/dev-syncromind/booking/templates/base/report_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/report_new.xsl       
2015-10-23 21:06:37 UTC (rev 14237)
+++ branches/dev-syncromind/booking/templates/base/report_new.xsl       
2015-10-25 14:15:37 UTC (rev 14238)
@@ -10,7 +10,7 @@
        <xsl:call-template name="msgbox"/>
        <!--xsl:call-template name="yui_booking_i18n"/-->
 
-       <form action="" method="POST" id='form' class="pure-form 
pure-form-stacked" name="form">
+    <form action="" method="POST" id='report_form' class="pure-form 
pure-form-stacked" name="form">
                <input type="hidden" name="tab" value=""/>
                <div id="tab-content">
                        <xsl:value-of disable-output-escaping="yes" 
select="report/tabs"/>
@@ -34,11 +34,11 @@
                                                                        </h4>
                                                                </label>
                                                                <select 
name="report_type" id="report_type" class="pure-u-1 pure-u-sm-1-2 
pure-u-lg-1-3">
-                                                                       <option 
value="1">
-                                                                               
<xsl:value-of select="php:function('lang', 'counting')" />
+                                                                       <option 
value="participants_per_resource">
+                                                                               
<xsl:value-of select="php:function('lang', 'participants_per_resource')" />
                                                                        
</option>
-                                                                       <option 
value="2">
-                                                                               
<xsl:value-of select="php:function('lang', 'time')" />
+                                                                       <option 
value="freetime">
+                                                                               
<xsl:value-of select="php:function('lang', 'freetime')" />
                                                                        
</option>
                                                                </select>
                                                        </div>
@@ -49,6 +49,15 @@
                                                                        </h4>
                                                                </label>
                                                                <select 
name="activity_id" id="field_activity" class="pure-u-1 pure-u-sm-1-2 
pure-u-lg-1-3">
+                                    <xsl:attribute name="data-validation">
+                                        <xsl:text>number</xsl:text>
+                                    </xsl:attribute>
+                                   <xsl:attribute 
name="data-validation-allowing">
+                                        <xsl:text>positive</xsl:text>
+                                    </xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="php:function('lang', '-- select an activity --')" />
+                                    </xsl:attribute>
                                                                        <option 
value="-1">
                                                                                
<xsl:value-of select="php:function('lang', '-- select an activity --')" />
                                                                        
</option>
@@ -137,24 +146,28 @@
                                                        </div>
                                                        <div class="pure-g">
                                                                <div 
id="dates-container" class="pure-control-group pure-u-1 pure-u-md-1-2 
pure-u-lg-1">
-                                                                       
<xsl:for-each select="report/dates">
-                                                                               
<div class="date-container">
-                                                                               
        <div class="pure-control-group">
-                                                                               
                <label for="start_date">
-                                                                               
                        <xsl:value-of select="php:function('lang', 'From')" />
-                                                                               
                </label>
-                                                                               
                <input class="datetime pure-input-1-2" id="start_date" 
name="start_date" type="text">
-                                                                               
                </input>
-                                                                               
        </div>
-                                                                               
        <div class="pure-control-group">
-                                                                               
                <label for="end_date">
-                                                                               
                        <xsl:value-of select="php:function('lang', 'To')" />
-                                                                               
                </label>
-                                                                               
                <input class="datetime pure-input-1-2" id="end_date" 
name="end_date" type="text">
-                                                                               
                </input>
-                                                                               
        </div>
+                                                                       <div 
class="date-container">
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label for="start_date">
+                                                                               
                <xsl:value-of select="php:function('lang', 'From')" />
+                                                                               
        </label>
+                                                                               
        <input class="datetime pure-input-1-2" id="start_date" 
name="start_date" type="text" value="{report/start_date}">
+                                                                               
                <xsl:attribute name="data-validation">
+                                                                               
                        <xsl:text>required</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
                                                                                
</div>
-                                                                       
</xsl:for-each>
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label for="end_date">
+                                                                               
                <xsl:value-of select="php:function('lang', 'To')" />
+                                                                               
        </label>
+                                                                               
        <input class="datetime pure-input-1-2" id="end_date" name="end_date" 
type="text" value="{report/end_date}">
+                                                                               
                <xsl:attribute name="data-validation">
+                                                                               
                        <xsl:text>required</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
</div>
+                                                                       </div>
                                                                        
                                                                        <div 
class="pure-g" >
                                                                                
<div class="pure-u-lg-5-5 pure-u-md-1-1 pure-u-sm-1-1" ><xsl:value-of 
select="php:function('lang', 'start time')" /></div>
@@ -195,6 +208,8 @@
                                                                                
<li>
                                                                                
        <label>
                                                                                
                <input type="checkbox" value="{id}" name="weekdays[]" >
+                                                                               
                        <xsl:attribute 
name="data-validation">checkbox_group</xsl:attribute>
+                                                                               
                        <xsl:attribute 
name="data-validation-qty">min1</xsl:attribute>
                                                                                
                        <!--xsl:if test="selected = 1"-->
                                                                                
                                <xsl:attribute 
name="checked">checked</xsl:attribute>
                                                                                
                        <!--/xsl:if-->
@@ -223,7 +238,7 @@
                                                                                
</h4>
                                                                        </label>
                                                                        <ul id= 
"variable_horizontal" 
style="display:inline-block;list-style:none;padding:0px;margin:0px;">
-                                                                               
<xsl:for-each select="report/variables">
+                                                                               
<xsl:for-each select="report/variables_horizontal">
                                                                                
        <li>
                                                                                
                <label>
                                                                                
                        <input type="radio" value="{id}" 
name="variable_horizontal" >
@@ -245,7 +260,7 @@
                                                                                
</h4>
                                                                        </label>
                                                                        <ul id= 
"variable_vertical" 
style="display:inline-block;list-style:none;padding:0px;margin:0px;">
-                                                                               
<xsl:for-each select="report/variables">
+                                                                               
<xsl:for-each select="report/variables_vertical">
                                                                                
        <li>
                                                                                
                <label>
                                                                                
                        <input type="radio" value="{id}" 
name="variable_vertical" >




reply via email to

[Prev in Thread] Current Thread [Next in Thread]