Files
BeWoPlaner/ReportImp/BeWoPyramide/EmployeeDataReport.cs

166 lines
6.6 KiB
C#
Raw Permalink Normal View History

2024-09-16 11:12:15 +02:00
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using BeWo.Report;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using System.Text;
using BS.Shared.DataContracts;
using System.Collections.Generic;
namespace BeWoPyramide
{
public partial class Personalstammblatt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<EmployeeDataRO>
{
public Personalstammblatt()
{
InitializeComponent();
}
public void SetReportDataSource(EmployeeDataRO pRO)
{
String qualifications = null;
if (pRO.Employee.Qualifications != null)
{
foreach (var qua in pRO.Employee.Qualifications)
{
if (qualifications != null)
qualifications += ", ";
qualifications += qua.TypeDescription;
}
}
String focus = null;
if (pRO.Employee.Focuses != null)
{
foreach (var foc in pRO.Employee.Focuses)
{
if (focus != null)
focus += ", ";
focus += foc.TypeDescription;
}
}
lblFachkraft.Text = "nein";
if (pRO.Employee.IsQualified == true)
lblFachkraft.Text = "ja";
lblQualifikationen.Text = qualifications;
lblArbeitsschwerpunkte.Text = focus;
2024-09-17 15:02:29 +02:00
CreateClientsTable(pRO.Employee.RelatedCustomers);
CreateContractsTable(pRO.Employee.Contracts);
2024-09-16 11:12:15 +02:00
CreateOvertimeTable(pRO.Employee.Overtimes);
CreateAbsenceTimeTable(pRO.Employee.AbsenceTimes);
this.bindingSource1.DataSource = pRO;
}
2024-09-17 15:02:29 +02:00
private void CreateContractsTable(List<ContractDC> contracts)
{
if (contracts != null)
{
XRTableRow newRow = null;
foreach (var c in contracts)
{
if (newRow == null)
newRow = tableVertraege.Rows[1];
else
newRow = tableVertraege.InsertRowBelow(tableVertraege.Rows[tableVertraege.Rows.Count - 1]);
string start = "";
string ende = "";
if (c.EntryDate.HasValue)
start = string.Format("{0:dd.MM.yy}", c.EntryDate.Value);
if (c.ContractEndDate.HasValue)
ende = string.Format("{0:dd.MM.yy}", c.ContractEndDate.Value);
newRow.Font = new Font("Arial", 9F);
newRow.Cells[0].Text = c.ContractTypeValueListEntry != null ? c.ContractTypeValueListEntry.DisplayName : ""; // Vertragsart
newRow.Cells[1].Text = c.EmploymentType != null ? c.EmploymentType.Name : ""; // Besch<63>ftigt als
newRow.Cells[2].Text = ende != "" ? start + " - " + ende : start + " - unbefr."; // von/bis
newRow.Cells[3].Text = string.Format("{0:0.00}", c.WeeklyFLS); // FLS/Woche
newRow.Cells[4].Text = string.Format("{0:0.00}", c.MonthlyFLS); // FLS/Monat
newRow.Cells[5].Text = string.Format("{0:0.00}", c.WeeklyTotalHours); // Stunden/Woche
newRow.Cells[6].Text = string.Format("{0:0.00}", c.MonthlyTotalHours); // Stunden/Monat
}
}
}
2024-09-16 11:12:15 +02:00
private void CreateClientsTable(List<CustomerEmployeeRelationDC> customers)
{
if (customers != null)
{
XRTableRow newRow = null;
foreach (var c in customers)
{
if (newRow == null)
newRow = tableClients.Rows[0];
else
newRow = tableClients.InsertRowBelow(tableClients.Rows[tableClients.Rows.Count - 1]);
newRow.Font = new System.Drawing.Font("Arial", 9F);
newRow.Cells[0].Text = String.Format("{0} {1}", c.Customer.FirstName, c.Customer.LastName);
newRow.Cells[1].Text = String.Format("{0}", c.RelationRole.TypeDescription);
newRow.Cells[2].Text = c.Notice;
}
}
}
private void CreateOvertimeTable(List<OvertimeDC> overtimes)
{
if (overtimes != null)
{
2024-09-16 11:31:18 +02:00
var summe = 0m;
2024-09-16 11:12:15 +02:00
XRTableRow newRow = null;
foreach (var o in overtimes)
{
if (newRow == null)
newRow = tableUeberstunden.Rows[1];
else
newRow = tableUeberstunden.InsertRowBelow(tableUeberstunden.Rows[tableUeberstunden.Rows.Count - 1]);
newRow.Font = new System.Drawing.Font("Arial", 9F);
newRow.Cells[0].Text = String.Format("{0:dd.MM.yyyy}", o.Date);
newRow.Cells[1].Text = String.Format("{0:0.00}", o.Betrag);
newRow.Cells[2].Text = o.Auszahlungsart.Name;
newRow.Cells[3].Text = o.Notice;
2024-09-16 11:31:18 +02:00
summe += o.Betrag;
2024-09-16 11:12:15 +02:00
}
2024-09-16 11:31:18 +02:00
lblSummeUeberstunden.Text = string.Format("{0:0.00}", summe);
2024-09-16 11:12:15 +02:00
}
}
private void CreateAbsenceTimeTable(List<AbsenceTimeDC> absenceTimes)
{
if (absenceTimes != null)
{
XRTableRow newRow = null;
foreach (var abs in absenceTimes)
{
if (newRow == null)
newRow = tableAbwesenheiten.Rows[1];
else
newRow = tableAbwesenheiten.InsertRowBelow(tableAbwesenheiten.Rows[tableAbwesenheiten.Rows.Count - 1]);
string start = "";
string ende = "";
if (abs.Start.HasValue)
start = abs.Start.Value.Hour == 0 && abs.Start.Value.Minute == 0 ? string.Format("{0:dd.MM.yyyy}", abs.Start.Value) : string.Format("{0:dd.MM.yyyy HH:mm}", abs.Start.Value);
if (abs.End.HasValue)
ende = abs.End.Value.Hour == 0 && abs.End.Value.Minute == 0 ? string.Format("{0:dd.MM.yyyy}", abs.End.Value) : string.Format("{0:dd.MM.yyyy HH:mm}", abs.End.Value);
newRow.Font = new Font("Arial", 9F);
newRow.Cells[0].Text = start;
newRow.Cells[1].Text = ende;
newRow.Cells[2].Text = abs.Reason.Description;
newRow.Cells[3].Text = abs.Notice;
}
}
}
}
}