﻿<?xml version="1.0" encoding="utf-8"?>
<ReportsExport>
  <Reports>
    <Report id="c593ce86-2a82-475b-929f-9e3666781688" codekey="PTD_Gesamtdatenbankabzug_Seminare2" categoryCodekey="Trainings" name="PTD_Gesamtdatenbankabzug_Seminare2" description="">
      <MetaData created="2024-11-11T15:05:41" createdBy="Kaiser, Jan-Patrick (0245527)" createdBy_user_id="101393" modified="2026-02-09T10:12:15" modifiedBy="Kaiser, Jan-Patrick (0245527)" modifiedBy_user_id="101393" />
      <ExecutionDetails format="TableResult" commandType="SqlCommandOrQuery" exportHandler="" adminControl="" exportMultipleTablesToSheets="False" datesWithTime="False" extraParams="" />
      <Mandators mandatorMode="OnlyOwner" mandator_id="bfa70f6b-484c-49da-9ad7-1ccd8f0d684c" mandatorName="ERGO_e-Campus" isStandard="False" isUsedByMenu="False" />
      <Parameters>
        <Parameter id="8eacbb69-0b54-4785-9223-3343af2b7ae6" isRequired="False" allowMultiSelect="False" name="Seminartitel" contextName="Seminartitel" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
        <Parameter id="d8e4595f-8bdd-4a54-9298-8f378450e6a0" isRequired="False" allowMultiSelect="False" name="Zeitraum" contextName="Zeitraum" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
      </Parameters>
      <Roles>
        <Role id="90" />
      </Roles>
      <command>/*today declare @dateRange_start DATETIME
declare @dateRange_end DATETIME
declare @trainingTitle_id UNIQUEIDENTIFIER
declare @today DATETIME = GETDATE()
declare @current_mandator_id UNIQUEIDENTIFIER = (SELECT id FROM tblMandators WHERE name = 'ERGO_e-Campus')
*/
SELECT  tblItems.title AS "Seminartitel intern",
tblItems.titleForLearners AS Seminartitel,
CONCAT(FORMAT(tblTrainings.startDate, 'dd.MM.yyyy HH:mm'), ' - ', FORMAT(tblTrainings.endDate, 'dd.MM.yyyy HH:mm')) AS Seminarzeitraum,
descUserCn AS Kennung, Nachname AS Name, Vorname,
STUFF((SELECT ',' + ou.title
            FROM    tblUsersOrganisationUnits uou
            JOIN    tblOrganisationUnits ou ON ou.id = uou.organisationUnit_id
            WHERE   uou.user_id = intUserCn
            FOR XML PATH('')), 1, 1, '') AS Organisationseinheit,
(SELECT     TOP 1 Vorname + ' ' + Nachname 
    FROM    v_Users 
    WHERE   (
            importer_id = 1
            AND descUserCn = RIGHT(uca.customAttribute27,7)
    )
    OR
    (
        importer_id = 2
        AND RIGHT(employeeId,7) = RIGHT(uca.customAttribute27,7)
    )
) AS "Direkter Vorgesetzter",
CASE dbo.fn_GetTrainingStatusCodeForUser(@current_mandator_id,tblTrainings.id,intUserCn)
    WHEN 'S10_NO_BOOKINGS' THEN 'keine Buchungen vorhanden'
    WHEN 'S15_NO_EVENT_ASSIGNED' THEN 'zugeordnet'
    WHEN 'S20_BOOKABLE' THEN 'buchbar'
    WHEN 'S25_EXPIRED' THEN 'Buchungsfrist abgelaufen'
    WHEN 'S27_IS_WAITING' THEN 'auf Warteliste'
    WHEN 'S30_BOOKED' THEN 'gebucht'
    WHEN 'S40_HAS_BOOKINGS' THEN 'Buchungen vorhanden'
    WHEN 'S50_INVITED' THEN 'Einladung erfolgt'
    WHEN 'S55_INVITATION_ACKNOWLEDGED' THEN 'Einladung bestätigt'
    WHEN 'S60_CANCELLED' THEN 'storniert'
    WHEN 'S65_TRAINING_CANCELLED' THEN 'abgesagt'
    WHEN 'S68_HAS_WAITLIST' THEN 'Warteliste möglich'
    WHEN 'S70_FULL' THEN 'voll belegt'
    WHEN 'S80_FINISHED' THEN 'durchgeführt'
    WHEN 'S82_WAS_PRESENT' THEN 'Anwesenheit bestätigt'
    WHEN 'S83_CLOSED' THEN 'abgeschlossen'
    WHEN 'S85_PARTICIPATED_NO_POLLS' THEN 'Teilnahme bestätigt (nicht alle Feedbackbögen ausgeführt)'
    WHEN 'S90_PARTICIPATED' THEN 'Teilnahme bestätigt'
END AS Buchungsstatus,
tblUserTrainingStatus.actionTime AS 'Status von',
tblItems.educationTime AS Bildungszeit, --cp.itemEducationTime AS BZ,
tblTrainingTitles.duration As Seminardauer, ISNULL(tblTrainings.durationMinutes, 
tblTrainingTitles.durationMinutes) AS Seminardauer2
FROM tblUserTrainingStatus
JOIN tblItems ON tblItems.id = tblUserTrainingStatus.training_id
JOIN v_users ON v_Users.intUserCn = user_id
JOIN tblUserCustomAttributes uca ON uca.[user_id] = v_Users.intUserCn               
JOIN tblTrainings ON tblTrainings.id = tblitems.id
JOIN tblTrainingTitles ON tblTrainingTitles.id = trainingTitle_id          
--CROSS APPLY dbo.[fn_GetPotentialUserCreditPoints] (tblUserTrainingStatus.user_id, tblUserTrainingStatus.training_id, 2, NULL) AS cp
WHERE tblItems.mandator_id = @current_mandator_id
AND (@trainingTitle_id IS NULL OR tblTrainings.trainingTitle_id = @trainingTitle_id)
AND (@dateRange_start IS NULL OR tbltrainings.startDate &gt;= @dateRange_start)
AND (@dateRange_end IS NULL OR tblTrainings.endDate &lt;= @dateRange_end)
--AND actionclass_id not in (20,30,70,80) -- exclude RESET, WAIT and CANCEL
ORDER BY Seminartitel,startDate, Kennung</command>
    </Report>
  </Reports>
  <Parameters>
    <Parameter id="8eacbb69-0b54-4785-9223-3343af2b7ae6" isSystem="True" name="Seminartitel" reportParameterType_id="c4fa1006-96a9-4b85-bf22-6a480289e5f3" queryParameterName="@trainingTitle_id" />
    <Parameter id="d8e4595f-8bdd-4a54-9298-8f378450e6a0" isSystem="True" name="Zeitraum" reportParameterType_id="abff13be-91c3-4ee1-93a3-7292f8e013ba" queryParameterName="@dateRange" />
  </Parameters>
  <ParameterTypes>
    <ParameterType id="c4fa1006-96a9-4b85-bf22-6a480289e5f3" isSystem="False" name="Seminartitel" datatype="GuidDDL" dataValueField="" dataTextField="">
      <query>SELECT tblItems.id AS value, 
                    tblItems.title AS text 
               FROM tblTrainingTitles 
                    INNER JOIN tblItems ON tblItems.id = tblTrainingTitles.id
              WHERE tblTrainingTitles.mandator_id = @current_mandator_id 
              AND deleted IS NULL
ORDER BY text</query>
    </ParameterType>
    <ParameterType id="abff13be-91c3-4ee1-93a3-7292f8e013ba" isSystem="True" name="DateRange" datatype="DateRange" dataValueField="" dataTextField="" />
  </ParameterTypes>
</ReportsExport>