79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
using BS.Shared.Core;
|
|
|
|
namespace BeWo.LebenshilfeDuisburgReports
|
|
{
|
|
public partial class StundenzettelTBT : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public StundenzettelTBT()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
double minTotal = 0;
|
|
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
if (s.IsBillable)
|
|
{
|
|
ServicesOverviewRO.CreateSignatureString(s);
|
|
|
|
servicesBillable.Add(s);
|
|
minTotal += s.Minutes;
|
|
}
|
|
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
lblFLSTotal.Text = String.Format("{0:0.00}", minTotal / 60);
|
|
|
|
bindingSource1.DataSource = pRO;
|
|
|
|
}
|
|
|
|
private void picSignature_BeforePrint(object sender, 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/(?<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;
|
|
}
|
|
}
|
|
}
|