101 lines
3.4 KiB
C#
101 lines
3.4 KiB
C#
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using BS.Shared.Core;
|
|
using BS.Shared.Extensions;
|
|
using DevExpress.XtraReports.UI;
|
|
using Mittelpunkt.Service;
|
|
using static BeWo.Report.ReportObjects.MitarbeiterstundenkontoRO;
|
|
|
|
namespace Mittelpunkt
|
|
{
|
|
//[IDSpecificClass(Identifier = "Mitarbeiterarbeitszeitkonto")]
|
|
public partial class MitarbeiterarbeitszeitkontoSeite2 : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<MitarbeiterstundenkontoRO>
|
|
{
|
|
|
|
public MitarbeiterarbeitszeitkontoSeite2()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(MitarbeiterstundenkontoRO pRO)
|
|
{
|
|
var msb = new CustomMitarbeiterstundenkontoBerechnung();
|
|
msb.CreateReport(pRO);
|
|
|
|
foreach (var ed in pRO.EmployeeDetailList)
|
|
{
|
|
if (ed.TageUrlaub.HasValue)
|
|
ed.Custom1 = ed.SollProTag * ed.TageUrlaub.Value;
|
|
if (ed.TageKrankheit.HasValue)
|
|
ed.Custom2 = ed.SollProTag * ed.TageKrankheit.Value;
|
|
|
|
foreach (var day in ed.Days)
|
|
{
|
|
if (day.Date.Date.Day == 30 || day.Date.Date.Day == 31 ||
|
|
day.Date.Date.Day == 21 || day.Date.Date.Day == 22 || day.Date.Date.Day == 28 || day.Date.Date.Day == 29)
|
|
{
|
|
|
|
}
|
|
if (day.ServiceRecords != null && day.ServiceRecords.Count > 0)
|
|
{
|
|
day.Custom2 = string.Join("; ", day.ServiceRecords
|
|
.Where(s => s.ServiceDescription.Category.Name.Trim().EndsWith("AZ"))
|
|
.Select(s => s.Notice));
|
|
}
|
|
if (day.AbsenceTimes != null && day.AbsenceTimes.Count > 0)
|
|
{
|
|
day.Custom3 = string.Join(", ", day.AbsenceTimes.Select(a => a.AbsenceReason.Description));
|
|
}
|
|
|
|
if (day.HoursSick > 0)
|
|
day.MinutesTotal += day.HoursSick * 60;
|
|
if (day.HoursInVacation > 0)
|
|
day.MinutesTotal += day.HoursInVacation * 60;
|
|
}
|
|
|
|
if (ed.UrlaubUndKrankheit.HasValue)
|
|
ed.StundenGesamtIst = ed.StundenGesamtIst + (ed.SollProTag * ed.UrlaubUndKrankheit.Value);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void xrTableCell3_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
var vs = new CustomVacationService();
|
|
|
|
XRTableCell cell = sender as XRTableCell;
|
|
|
|
// Zugriff auf das aktuelle Datenobjekt
|
|
var rowObj = cell.Report.GetCurrentRow();
|
|
|
|
if (rowObj is DayDetail myRow && myRow.Date != null)
|
|
{
|
|
var date = myRow.Date;
|
|
|
|
XRTableRow row = cell.Parent as XRTableRow;
|
|
|
|
System.Drawing.Color backColor = System.Drawing.Color.Transparent;
|
|
|
|
if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
|
|
backColor = System.Drawing.Color.LightSteelBlue;
|
|
if (vs.IstFeiertag(date))
|
|
backColor = System.Drawing.Color.Yellow;
|
|
|
|
foreach (XRTableCell c in row.Cells)
|
|
c.BackColor = backColor;
|
|
}
|
|
}
|
|
|
|
private void GroupFooter2_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|