163 lines
5.5 KiB
C#
163 lines
5.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 MalteserJohanniterJohanneshaus
|
|
{
|
|
|
|
public partial class LeistungsnachweisSoziotherapie : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public LeistungsnachweisSoziotherapie()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
double gesamt = 0;
|
|
double gesamtGruppe = 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;
|
|
}
|
|
if (s.ServiceDescription.Contains("Gruppe")) //die erstellen meist über Mehrfachbuchung
|
|
{
|
|
s.IsGroup = true;
|
|
}
|
|
|
|
if (s.IsGroup)
|
|
{
|
|
gesamtGruppe += s.Minutes;
|
|
if (s.Minutes <= 45)
|
|
{
|
|
s.Notice5 = "2002678"; // 2 bis 5 Teilnehmer
|
|
}
|
|
else if (s.Minutes <= 60)
|
|
{
|
|
s.Notice5 = "2002677"; // 2 bis 5 Teilnehmer
|
|
}
|
|
else
|
|
{
|
|
s.Notice5 = "2002672"; // 2 bis 5 Teilnehmer - 90 Min
|
|
}
|
|
}
|
|
else
|
|
{
|
|
gesamt += s.Minutes;
|
|
}
|
|
|
|
if (s.ServiceDescription.Contains("Video"))
|
|
{
|
|
s.ServiceDescription = "V";
|
|
if (s.Minutes <= 30)
|
|
{
|
|
s.Notice5 = "2001616";
|
|
}
|
|
else
|
|
{
|
|
s.Notice5 = "2001615";
|
|
}
|
|
}
|
|
else if (s.ServiceDescription.Contains("Telefon"))
|
|
{
|
|
s.ServiceDescription = "T";
|
|
if (s.Minutes <= 30)
|
|
{
|
|
s.Notice5 = "2001618";
|
|
}
|
|
else
|
|
{
|
|
s.Notice5 = "2001617";
|
|
}
|
|
}
|
|
else if (s.ServiceDescription.ToLower().Contains("prob"))
|
|
{
|
|
s.Notice5 = "2001607";
|
|
}
|
|
else
|
|
{
|
|
if (s.ServiceDescription.Contains("Aufsuchend"))
|
|
{
|
|
s.ServiceDescription = "A";
|
|
}
|
|
else if (s.ServiceDescription.Contains("Büro"))
|
|
{
|
|
s.ServiceDescription = "E";
|
|
}
|
|
if (s.Minutes <= 10)
|
|
{
|
|
s.Notice5 = "2001613";
|
|
}
|
|
else if (s.Minutes <= 30)
|
|
{
|
|
s.Notice5 = "2001612";
|
|
}
|
|
else if (s.Minutes <= 45)
|
|
{
|
|
s.Notice5 = "2001611";
|
|
}
|
|
else
|
|
{
|
|
s.Notice5 = "2001610";
|
|
}
|
|
}
|
|
ServicesOverviewRO.CreateSignatureString(s);
|
|
}
|
|
pRO.Services = servicesBillable;
|
|
cellGesamt.Text = String.Format("{0:0.00}", gesamt / 60);
|
|
if (gesamtGruppe > 0)
|
|
{
|
|
cellGesamtGruppe.Text = String.Format("{0:0.00}", gesamtGruppe / 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);
|
|
}
|
|
}
|
|
}
|
|
}
|