101 lines
3.7 KiB
C#
101 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraPrinting.Drawing;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace SelbstWerk
|
|
{
|
|
public partial class Quittierungsbeleg : XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Quittierungsbeleg()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
if (pRO.Mandator.Logo?.Original is object)
|
|
xrPictureBox3.ImageSource = new ImageSource(false, pRO.Mandator.Logo.Original);
|
|
|
|
decimal hauptbetreuerMinuten = 0;
|
|
decimal vertretungsMinuten= 0;
|
|
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (var sd in pRO.Services)
|
|
{
|
|
if (sd.IsBillable || sd.ServiceDescription.ToLower().Contains("fehlkontakt") || sd.ServiceCategory.ToLower().Contains("fehlkontakt"))
|
|
{
|
|
ServicesOverviewRO.CreateSignatureString(sd);
|
|
sd.Notice5 = "DAL";
|
|
if (sd.IsGroup)
|
|
{
|
|
sd.Notice5 = "GR";
|
|
}
|
|
if (sd.ServiceDescription.ToLower().Contains("fehlkontakt") || sd.ServiceCategory.ToLower().Contains("fehlkontakt") || (sd.ProzentAbrechenbar < 100))
|
|
{
|
|
sd.Notice5 = "FK";
|
|
}
|
|
servicesBillable.Add(sd);
|
|
|
|
if (pRO.MainAttendantCommaSeperated == sd.EmployeeNameCommaSeparated)
|
|
{
|
|
sd.Notice3 = sd.EmployeeNameCommaSeparated;
|
|
hauptbetreuerMinuten += Convert.ToDecimal(sd.Minutes);
|
|
}
|
|
else
|
|
{
|
|
sd.Notice4 = sd.EmployeeNameCommaSeparated;
|
|
vertretungsMinuten += Convert.ToDecimal(sd.Minutes);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
lblSummeMitFaktor.Text = string.Format("{0:0.##}", (pRO.TotalFLMBillable * 1.2));
|
|
lblSummeRegelbetreuung.Text = string.Format("{0:0.##}", hauptbetreuerMinuten);
|
|
lblSummeVertretung.Text = string.Format("{0:0.##}", vertretungsMinuten);
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
|
|
bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
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/(?<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);
|
|
}
|
|
}
|
|
}
|
|
}
|