166 lines
6.6 KiB
C#
166 lines
6.6 KiB
C#
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;
|
|
|
|
CreateClientsTable(pRO.Employee.RelatedCustomers);
|
|
CreateContractsTable(pRO.Employee.Contracts);
|
|
CreateOvertimeTable(pRO.Employee.Overtimes);
|
|
CreateAbsenceTimeTable(pRO.Employee.AbsenceTimes);
|
|
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
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ä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
|
|
}
|
|
}
|
|
}
|
|
|
|
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)
|
|
{
|
|
var summe = 0m;
|
|
|
|
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;
|
|
|
|
summe += o.Betrag;
|
|
}
|
|
|
|
lblSummeUeberstunden.Text = string.Format("{0:0.00}", summe);
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|