82 lines
2.5 KiB
C#
82 lines
2.5 KiB
C#
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 DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWo.ChristopherusHaus
|
|
{
|
|
public partial class Stundenzettel : 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)
|
|
{
|
|
if (s.StartDate.Second == 0)
|
|
{
|
|
s.TimeRangeString = String.Format("{0} - {1}", s.StartDate.ToShortTimeString(), s.EndDateNotRounded.ToShortTimeString());
|
|
}
|
|
if (s.IsBillable)
|
|
servicesBillable.Add(s);
|
|
|
|
ServicesOverviewRO.CreateGoalList(s);
|
|
|
|
ServicesOverviewRO.CreateSignatureString(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;
|
|
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);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|