﻿<?xml version="1.0" encoding="utf-8"?>
<ReportsExport>
  <Reports>
    <Report id="5e9dbce4-aa7a-4d01-a381-febe5708833d" codekey="ERGO_e-Campus_TrainingTitleDetails" categoryCodekey="Trainings" name="Seminartitel Details" description="Gibt die Details aller Seminartitel aus">
      <MetaData created="2024-08-29T11:07:09" createdBy="BITTE NICHT LÖSCHEN, ADMINISTRATOR (Administrator)" createdBy_user_id="150406" />
      <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" />
      <Roles>
        <Role id="36" />
      </Roles>
      <command>-- DECLARE @current_mandator_id UNIQUEIDENTIFIER = (SELECT id FROM tblMandators WHERE name = 'ERGO_e-Campus')

IF OBJECT_ID('tempdb..#LearningTypeMapping') IS NOT NULL
    DROP TABLE #LearningTypeMapping;

CREATE TABLE #LearningTypeMapping
(
    id int,
    title nvarchar(100)
);

INSERT INTO
    #LearningTypeMapping
VALUES
    (1, 	'Präsenzveranstaltung'),
    (2, 	'Einzeltraining'),
    (3, 	'Blended Learning'),
    (4, 	'Gesteuertes E-Learning'),
    (5, 	'Selbstgesteuertes E-Learning/Lernen'),
    (6, 	'Lernen am Arbeitsplatz');


IF OBJECT_ID('tempdb..#LearningContentMapping') IS NOT NULL
    DROP TABLE #LearningContentMapping;

CREATE TABLE #LearningContentMapping
(
    code nvarchar(50) PRIMARY KEY,
    learningContent nvarchar(100)
);

INSERT INTO
    #LearningContentMapping
VALUES
    ('Insurance1', 'Privat-Vorsorge-Lebens-/Rentenversicherung'),
    ('Insurance2', 'Privat-Vorsorge-Kranken-/Pflegeversicherung'),
    ('Insurance3', 'Privat-Sach-/Schadenversicherung'),
    ('Insurance4', 'Firmenkunden-Sach-/Schadenversicherung'),
    ('Insurance5General', 'Mehrere versicherungsrelevante Themen'),
    ('Insurance6Business', 'Firmenkunden-Vorsorge (bAV/Personenversicherung)'),
    ('Consulting', 'Kundenorientierte Beratung im Versicherungsvertrieb'),
    ('Insurance7', 'Management einer Vertriebseinheit in der Versicherungswirtschaft'),
    ('Insurance8', 'Wirtschaftswissenschaften mit Bezug zur Versicherungsvermittlung/-beratung'),
    ('Insurance9', 'Personalführung mit Bezug zur Versicherungsvermittlung/-beratung'),
    ('Insurance10', 'Versicherungsspezifische Software')

SELECT  i.title AS "Seminartitel", 
        i.titleForLearners AS "SeminarTitel für den Lerner",
        tt.participantCount AS "Teilnehmeranzahl",
        durationMinutes AS "Dauer in Minuten",
        mt.codekey AS "Einladungs-Mail",
        c.name AS "Teilnahmebestätigung",
        types.name AS Veranstaltungssart,
        CASE 
        WHEN tt.allowReservation = 0 THEN 'deaktiviert'
        ELSE 'aktiviert'
        END AS "Vormerken aktiviert/deaktiviert",
        dbo.fn_GetEducationTimeString(i.educationTime) AS "erwerbbare Bildungszeit",
        ISNULL(LTM.title,i.learningType_id) AS Lernform,
        ISNULL(LCM.learningContent,i.learningContent) AS Lerninhalt
FROM    tblTrainingTitles tt
JOIN    tblItems i
        ON i.id = tt.id
LEFT JOIN    tblMailTemplates mt
        ON mt.id = tt.invitationMailTemplate_id

LEFT JOIN    tblCertificates c
        ON i.certificate_id = c.id
LEFT JOIN    tblTrainingTypes types
        on tt.trainingType_id = types.id
LEFT JOIN   #LearningTypeMapping LTM
            ON i.learningType_id = LTM.id
LEFT JOIN   #LearningContentMapping LCM
                ON i.learningContent = LCM.code
WHERE   tt.mandator_id = @current_mandator_id
ORDER BY Seminartitel ASC

DROP TABLE #LearningTypeMapping;</command>
    </Report>
    <Report id="1923c408-625b-4b50-b456-444122edaeb8" codekey="ERGO_TrainingUserStatus" categoryCodekey="Trainings" name="PTD_Gesamtdatenbankabzug_Seminare" description="Der Report soll für alle bzw. den ausgewählten Seminartitel pro Benutzer den aktuellen Buchungsstatus ausgeben.">
      <MetaData created="2023-12-13T15:26:02" createdBy="Kaiser, Jan-Patrick (245527)" createdBy_user_id="101393" modified="2024-02-08T10:23:18" modifiedBy="Administrator, Albrecht (Administrator)" modifiedBy_user_id="1" />
      <ExecutionDetails format="TableResult" commandType="SqlCommandOrQuery" exportHandler="" adminControl="" exportMultipleTablesToSheets="False" datesWithTime="False" extraParams="" />
      <Mandators mandatorMode="IncludeMandators" 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>--declare @dateRange_start DATETIME
--declare @dateRange_end DATETIME
--declare @trainingTitle_id UNIQUEIDENTIFIER 
declare @today DATETIME = GETDATE()

         SELECT  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,
          CASE actionclass_id
          WHEN 20  THEN 'gebucht' -- 'BOOK'
          WHEN 30 THEN 'Einladung erfolgt' --'INVITE' 
          WHEN 60 THEN 'Einladung bestätigt' --'INVITE_ACK'
          WHEN 70 THEN 
            CASE WHEN isClosed = 1 
                THEN 'abgeschloßen'
                ELSE 'Anwesenheit bestätigt' --  'WAS_PRESENT'
            END
          WHEN 80 THEN 
            CASE WHEN tblUserTrainingStatus.status = 2 -- if user status 0 (grey) in this booking status =&gt; there were feedbacks and they are not fill out yet
                THEN 'Teilnahme bestätigt' -- 'PARTICIPATED' 
                ELSE 'Teilnahme bestätigt (nicht alle Feedbackbögen ausgeführt)'  --WHEN 'S85_PARTICIPATED_NO_POLLS' THEN 'Teilnahme bestätigt (nicht alle Feedbackbögen ausgeführt)'          
            END
          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 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 (50,10,40) -- 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>