2024-01-25 18:03:12 +01:00
|
|
|
using System;
|
2017-06-11 15:50:31 +02:00
|
|
|
using System.Collections.Generic;
|
2026-02-23 13:58:12 +01:00
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text.RegularExpressions;
|
2016-06-27 01:45:38 +02:00
|
|
|
using BeWo.Report;
|
|
|
|
|
using BeWo.Report.ReportObjects;
|
2026-02-23 13:58:12 +01:00
|
|
|
using BS.Shared.Core;
|
|
|
|
|
using DevExpress.XtraReports.UI;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
2023-06-13 17:17:30 +02:00
|
|
|
namespace SpzRatingen
|
2016-06-27 01:45:38 +02:00
|
|
|
{
|
2017-06-11 15:50:31 +02:00
|
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
2016-06-27 01:45:38 +02:00
|
|
|
{
|
|
|
|
|
public Stundenzettel()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
|
|
|
{
|
2017-06-11 15:50:31 +02:00
|
|
|
if (pRO.Services != null)
|
2016-06-27 01:45:38 +02:00
|
|
|
{
|
2017-06-11 15:50:31 +02:00
|
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
2016-06-27 01:45:38 +02:00
|
|
|
|
2023-05-31 13:30:27 +02:00
|
|
|
foreach (ServicesOverviewRO.ServiceDetail sd in pRO.Services)
|
2017-06-11 15:50:31 +02:00
|
|
|
{
|
2023-05-31 13:30:27 +02:00
|
|
|
if (sd.IsBillable || sd.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
|
|
|
{
|
2026-02-23 13:58:12 +01:00
|
|
|
ServicesOverviewRO.CreateSignatureString(sd);
|
|
|
|
|
|
2023-05-31 13:30:27 +02:00
|
|
|
sd.Notice5 = "E";
|
|
|
|
|
if (sd.IsGroup)
|
|
|
|
|
{
|
|
|
|
|
sd.Notice5 = "GR";
|
|
|
|
|
}
|
|
|
|
|
if (sd.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
|
|
|
{
|
|
|
|
|
sd.Notice5 = "F";
|
|
|
|
|
}
|
|
|
|
|
servicesBillable.Add(sd);
|
|
|
|
|
}
|
2017-06-11 15:50:31 +02:00
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
2024-01-25 18:03:12 +01:00
|
|
|
if (String.IsNullOrWhiteSpace(pRO.AbsenceTimes))
|
|
|
|
|
{
|
|
|
|
|
lblHatAbwesenheiten.Text = "X";
|
|
|
|
|
}
|
|
|
|
|
ErstelleAbwesenheitenTabelle(pRO);
|
|
|
|
|
|
2017-06-11 15:50:31 +02:00
|
|
|
pRO.Services = servicesBillable;
|
2016-06-27 01:45:38 +02:00
|
|
|
}
|
2017-06-11 15:50:31 +02:00
|
|
|
this.bindingSource1.DataSource = pRO;
|
2016-06-27 01:45:38 +02:00
|
|
|
}
|
2017-06-11 15:50:31 +02:00
|
|
|
|
2024-01-25 18:03:12 +01:00
|
|
|
private void ErstelleAbwesenheitenTabelle(ServicesOverviewRO pRo)
|
|
|
|
|
{
|
|
|
|
|
if (pRo.Abwesenheiten != null)
|
|
|
|
|
{
|
|
|
|
|
int newRows = 0;
|
|
|
|
|
int index = 1;
|
|
|
|
|
foreach (var at in pRo.Abwesenheiten)
|
|
|
|
|
{
|
|
|
|
|
DevExpress.XtraReports.UI.XRTableRow row = null;
|
|
|
|
|
if (index < xrTableAbwesenheiten.Rows.Count)
|
|
|
|
|
{
|
|
|
|
|
row = xrTableAbwesenheiten.Rows[index];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
row = xrTableAbwesenheiten.InsertRowBelow(xrTableAbwesenheiten.Rows[xrTableAbwesenheiten.Rows.Count - 1]);
|
|
|
|
|
newRows++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row.Cells[0].Text = String.Format("{0:dd.MM.yyyy}", at.Start);
|
|
|
|
|
int? days = null;
|
|
|
|
|
|
|
|
|
|
if (at.End.HasValue)
|
|
|
|
|
{
|
|
|
|
|
row.Cells[1].Text = String.Format("{0:dd.MM.yyyy}", at.End);
|
|
|
|
|
days = (int)at.End.Value.Subtract(at.Start.Value).TotalDays + 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
row.Cells[1].Text = "unbekannt";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row.Cells[2].Text = String.Format("{0:0}", days);
|
|
|
|
|
|
|
|
|
|
index++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-23 13:58:12 +01:00
|
|
|
|
|
|
|
|
private void picSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
XRPictureBox xrBox = sender as XRPictureBox;
|
|
|
|
|
string base64String = xrBox.Tag as string;
|
|
|
|
|
if (!String.IsNullOrWhiteSpace(base64String))
|
|
|
|
|
{
|
|
|
|
|
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
|
|
|
|
|
var binData = Convert.FromBase64String(base64Data);
|
|
|
|
|
Image img = ByteArrayToImage(binData);
|
|
|
|
|
xrBox.Image = Utils.CropImage(img);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xrBox.Image = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Image ByteArrayToImage(byte[] byteArrayIn)
|
|
|
|
|
{
|
|
|
|
|
using (var memoryStream = new MemoryStream(byteArrayIn))
|
|
|
|
|
{
|
|
|
|
|
return Image.FromStream(memoryStream);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
}
|
|
|
|
|
}
|