using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; using System.Text.RegularExpressions; using BeWo.Report; using BeWo.Report.ReportObjects; using BS.Shared.Core; using BS.Shared.Extensions; using DevExpress.XtraReports.UI; namespace BeWo.ASBHammReports { public partial class Stundenzettel : XtraReport, IBeWoReport { public Stundenzettel() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { if (pRO.Services != null) { List servicesBillable = new List(); foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services) { if (s.IsBillable) { if (!s.ServiceDescription.IsNullOrEmpty() && s.ServiceDescription.ToLower().Contains("fehlkontakt")) { s.TimeRangeString += " (Fehlkontakt)"; } ServicesOverviewRO.CreateSignatureString(s); servicesBillable.Add(s); } } pRO.Services = servicesBillable; } bindingSource1.DataSource = pRO; // rechnungsDatum.Text = DateTime.Now.ToShortDateString(); //summeMinuten.Text = string.Format("{0:0.##}", pRO.TotalFLMBillable); //if (pRO.SupportConceptCostBearer != null) // aktenzeichenLV.Text = pRO.SupportConceptCostBearer.CustomerReferenceNumber ?? string.Empty; //bewilligteFLSW.Text = string.Format("{0:0.##}", pRO.ApprovedFLSPerWeek); } private void picSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs 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/(?.+?),(?.+)").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; } } }