Files
BeWoPlaner/ReportImp/AdikKleve/ServicesOverviewReport.cs

72 lines
2.4 KiB
C#
Raw Normal View History

2018-06-26 17:18:59 +02:00
using System;
2016-06-27 01:45:38 +02:00
using System.Collections.Generic;
2018-06-26 17:18:59 +02: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;
2018-06-26 17:18:59 +02:00
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
2016-06-27 01:45:38 +02:00
namespace AdikKleve
{
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
{
2023-04-14 09:45:37 +02:00
if (s.IsBillable || s.ServiceDescription.ToLower().Contains("fehlkontakt"))
2018-06-26 17:18:59 +02:00
{
2023-04-14 09:45:37 +02:00
if (s.ServiceDescription.ToLower().Contains("fehlkontakt"))
s.StartDateString = "(Fehlkontakt) " + s.StartDateString;
2018-06-26 17:18:59 +02:00
ServicesOverviewRO.CreateSignatureString(s);
2016-06-27 01:45:38 +02:00
servicesBillable.Add(s);
2018-06-26 17:18:59 +02:00
}
2016-06-27 01:45:38 +02:00
}
pRO.Services = servicesBillable;
}
this.bindingSource1.DataSource = pRO;
}
2018-06-26 17:18:59 +02:00
private void xrPictureBox1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
XRPictureBox xrBox = sender as XRPictureBox;
//var test = this.GetCurrent
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)
{
Image returnImage = null;
MemoryStream ms = new System.IO.MemoryStream(byteArrayIn);
returnImage = Image.FromStream(ms);
return returnImage;
}
2016-06-27 01:45:38 +02:00
}
}