110 lines
3.5 KiB
C#
110 lines
3.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using System.IO;
|
|
using System.Drawing;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace SpzRatingen
|
|
{
|
|
|
|
public partial class LeistungsnachweisSoziotherapie : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public LeistungsnachweisSoziotherapie()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
double gesamt = 0;
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
if (s.IsBillable)
|
|
{
|
|
servicesBillable.Add(s);
|
|
s.Minutes = s.Minutes * (double)pRO.RateFactor;
|
|
gesamt += s.Minutes;
|
|
}
|
|
s.Notice5 = "E"; //Einzel
|
|
|
|
if (s.ServiceDescription.Contains("Probation") || s.ServiceDescription.Contains("(P)"))
|
|
{
|
|
s.Notice5 = "P";
|
|
}
|
|
else if (s.ServiceDescription.Contains("(G)"))
|
|
{
|
|
s.Notice5 = "G";
|
|
}
|
|
|
|
if (s.ServiceDescription.Contains("(A)"))
|
|
{
|
|
s.ServiceDescription = "(A)";
|
|
}
|
|
else if (s.ServiceDescription.Contains("(V)"))
|
|
{
|
|
s.ServiceDescription = "(V)";
|
|
}
|
|
else if (s.ServiceDescription.Contains("(T)"))
|
|
{
|
|
s.ServiceDescription = "(T)";
|
|
}
|
|
else if (s.ServiceDescription.Contains("(E)") || s.ServiceDescription.Contains("(G)"))
|
|
{
|
|
s.ServiceDescription = "(E)";
|
|
}
|
|
|
|
|
|
ServicesOverviewRO.CreateSignatureString(s);
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
|
|
cellGesamt.Text = String.Format("{0:0.00}", gesamt / 60);
|
|
|
|
//SetzeAdresseUndIk(pRO);
|
|
|
|
|
|
this.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)
|
|
{
|
|
using (var memoryStream = new MemoryStream(byteArrayIn))
|
|
{
|
|
return Image.FromStream(memoryStream);
|
|
}
|
|
}
|
|
}
|
|
}
|