﻿<?xml version="1.0" encoding="utf-8"?>
<ReportsExport>
  <Reports>
    <Report id="00f2e1b4-6241-49b2-87cb-9e462a12e1c8" codekey="GripsCompanyStatistics" categoryCodekey="SpecialPurpose" name="Firmenstatistik" description="Listet Lerner, Zielgruppen und Lernaktivitäten je Firma. Die Anzahl der Aktiven Nutzer berücksichtigt diejenigen Nutzer, die im angegebenen Zeitraum aktiv gelernt (= ein WBT genutzt) haben.">
      <MetaData created="2013-08-11T20:27:45" createdBy="Administrator GRIPS (Administrator)" createdBy_user_id="3" modified="2015-11-25T10:43:32" modifiedBy="Administrator VIWIS" />
      <ExecutionDetails format="TableResult" commandType="SqlCommandOrQuery" exportHandler="" adminControl="" exportMultipleTablesToSheets="False" datesWithTime="False" extraParams="" />
      <Mandators mandatorMode="OnlyOwner" mandator_id="6ab56a83-b308-4361-9fec-4b867a9c9d2a" mandatorName="GRIPS" isStandard="False" isUsedByMenu="False" />
      <Parameters>
        <Parameter id="d8e4595f-8bdd-4a54-9298-8f378450e6a0" isRequired="True" allowMultiSelect="False" name="Zeitraum" contextName="Zeitraum" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
        <Parameter id="b16c61ea-1b4d-46e5-a418-46a8c6dfec11" isRequired="True" allowMultiSelect="False" name="Firma" contextName="Firma" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
      </Parameters>
      <Roles>
        <Role id="80" />
        <Role id="90" />
      </Roles>
      <command>
        -- number of users per company
        select
        count(*) as 'Anzahl Lerner'
        from v_Users
        where v_Users.companyAD = @company_ad
        and
        v_Users.created &lt;  @dateRange_end

        -- number of targetGroups per company
        select count(distinct targetGroup_id) as 'Anzahl Zielgruppen'
        from tblUsersTargetGroups, v_Users, tblTargetGroups
        where
        v_Users.intUserCn = tblUsersTargetGroups.UserCn
        and
        tblUserstargetGroups.targetGroup_id = tblTargetGroups.id
        and
        v_Users.companyAD = @company_ad
        and
        v_Users.mandator_id = @current_mandator_id
        and
        v_Users.created &lt;  @dateRange_end
        and
        tblTargetGroups.created &lt; @dateRange_end

declare @results table(descUserCn VARCHAR(64), duration VARCHAR(128))

        -- Learning Time for users
insert into @results
        select descUserCn as 'Kennung',
        CONVERT(VARCHAR(10),SUM(durationSeconds)/3600)   +':' + RIGHT('00'+CONVERT(VARCHAR(2),(SUM(durationSeconds)%3600)/60),2)   +':'  + RIGHT('00'+CONVERT(VARCHAR(2),SUM(durationSeconds)%60),2) as 'Bearbeitungsdauer WBT '
        --, '-' as 'Bearbeitungsdauer Test'
        from tblStatsThemeSessions
        join v_Users on v_Users.intUserCn = tblStatsThemeSessions.user_id
        where
        v_Users.companyAD = @company_ad
        and
        tblStatsThemeSessions.startTime between @dateRange_start  and @dateRange_end
        and
        v_Users.mandator_id = @current_mandator_id
        group by descUserCn

select count(*) as 'Anzahl der aktiven Nutzer' from @results

 select descUserCn as 'Kennung',
 duration as  'Bearbeitungsdauer WBT ',
 '-' as 'Bearbeitungsdauer Test'
 from @results      </command>
    </Report>
  </Reports>
  <Parameters>
    <Parameter id="d8e4595f-8bdd-4a54-9298-8f378450e6a0" isSystem="True" name="Zeitraum" reportParameterType_id="abff13be-91c3-4ee1-93a3-7292f8e013ba" queryParameterName="@dateRange" />
    <Parameter id="b16c61ea-1b4d-46e5-a418-46a8c6dfec11" isSystem="False" name="Firma" reportParameterType_id="f15e7c62-45ed-4cb4-9bad-d0f24799c3e9" queryParameterName="@company_ad" />
  </Parameters>
  <ParameterTypes>
    <ParameterType id="abff13be-91c3-4ee1-93a3-7292f8e013ba" isSystem="True" name="DateRange" datatype="DateRange" dataValueField="" dataTextField="" />
    <ParameterType id="f15e7c62-45ed-4cb4-9bad-d0f24799c3e9" isSystem="True" name="Auswahlliste Strings" datatype="StringDDL" dataValueField="" dataTextField="">
      <query>select distinct companyAD as value,companyAD as text from v_Users where mandator_id = @current_mandator_id and companyAD is not null</query>
    </ParameterType>
  </ParameterTypes>
</ReportsExport>