2021-12-09 14:25:27 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
using BeWo.Report;
|
|
|
|
|
|
using BeWo.Report.ReportObjects;
|
2022-04-25 18:08:08 +02:00
|
|
|
|
using BeWo.Service.ServiceImplementations;
|
2021-12-09 14:25:27 +01:00
|
|
|
|
using BS.Shared.Core;
|
2022-04-25 18:08:08 +02:00
|
|
|
|
using BS.Shared.DataContracts;
|
2021-12-09 14:25:27 +01:00
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
|
|
|
2022-04-14 12:51:15 +02:00
|
|
|
|
namespace Akgg
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class Quittierungsbeleg : XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
|
|
|
|
{
|
|
|
|
|
|
public Quittierungsbeleg()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// Get calling method name
|
|
|
|
|
|
//StackTrace stackTrace = new StackTrace();
|
|
|
|
|
|
//Debug.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);
|
|
|
|
|
|
|
|
|
|
|
|
//if (pRO == null)
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
2022-09-07 15:59:28 +02:00
|
|
|
|
var approved = pRO.ApprovedFLSPerWeek;
|
|
|
|
|
|
|
|
|
|
|
|
var stats = GetStatistics(pRO);
|
|
|
|
|
|
if (stats != null)
|
|
|
|
|
|
approved = stats.MinutesApprovedPerWeek / 60;
|
|
|
|
|
|
|
|
|
|
|
|
lblBewilligteStunden.Text = string.Format("{0:0.##} Std./w<>chentlich", approved);
|
|
|
|
|
|
|
2021-12-09 14:25:27 +01:00
|
|
|
|
if (pRO.Services != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var sd in pRO.Services)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sd.IsBillable)
|
|
|
|
|
|
{
|
|
|
|
|
|
ServicesOverviewRO.CreateSignatureString(sd);
|
2022-04-25 18:08:08 +02:00
|
|
|
|
if (sd.ServiceCategory.Contains("FBF") && sd.ServiceCategory.Contains("FLS"))
|
|
|
|
|
|
lblKategorie.Text = "Fachleistungsstunde (FBF)";
|
|
|
|
|
|
else if (sd.ServiceCategory.Contains("FBF") && sd.ServiceCategory.Contains("Gruppe"))
|
|
|
|
|
|
lblKategorie.Text = "Gruppenunterst<73>tzung";
|
|
|
|
|
|
else if (sd.ServiceCategory.Contains("Ass"))
|
|
|
|
|
|
lblKategorie.Text = "Assistenz";
|
|
|
|
|
|
|
|
|
|
|
|
sd.Minutes = sd.Minutes / 60;
|
2021-12-09 14:25:27 +01:00
|
|
|
|
servicesBillable.Add(sd);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pRO.Services = servicesBillable;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bindingSource1.DataSource = pRO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-25 18:08:08 +02:00
|
|
|
|
private SupportConceptPeriodStatisticsDC GetStatistics(ServicesOverviewRO ro)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
2022-04-25 18:08:08 +02:00
|
|
|
|
if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
2022-04-25 18:08:08 +02:00
|
|
|
|
var service = new OperationsServiceImp();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var cb2sc in ro.CostBearer2SupportConceptList)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
2022-04-25 18:08:08 +02:00
|
|
|
|
long cb2scOid = cb2sc.Oid.Value;
|
2021-12-09 14:25:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
2022-04-25 18:08:08 +02:00
|
|
|
|
var stats = service.CreateSupportConceptStatistics(cb2scOid, ro.EndDate);
|
|
|
|
|
|
|
|
|
|
|
|
if (stats.PeriodStatistics != null && stats.PeriodStatistics.Count > 0)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
2022-04-25 18:08:08 +02:00
|
|
|
|
foreach (var ps in stats.PeriodStatistics)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ps.SupportConceptApprovalPeriod != null && ps.SupportConceptApprovalPeriod.ServiceCategory != null &&
|
|
|
|
|
|
ps.SupportConceptApprovalPeriod.ServiceCategory.Name == ro.Services[0].ServiceCategory)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ps;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-12-09 14:25:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-04-25 18:08:08 +02:00
|
|
|
|
return null;
|
2021-12-09 14:25:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Wie anzeigen? Alle?
|
2024-03-04 15:55:19 +01:00
|
|
|
|
private void EmployeeSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(sender is XRPictureBox pictureBox)
|
|
|
|
|
|
{
|
|
|
|
|
|
var base64String = pictureBox.Tag as string;
|
|
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(base64String))
|
|
|
|
|
|
{
|
|
|
|
|
|
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
|
|
|
|
|
|
var binaryData = Convert.FromBase64String(base64Data);
|
|
|
|
|
|
var image = ByteArrayToImage(binaryData);
|
|
|
|
|
|
|
|
|
|
|
|
pictureBox.Image = image;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
pictureBox.Image = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Wie anzeigen? Alle?
|
|
|
|
|
|
// TODO: Visibile der Datumstextboxen auf true setzen!
|
2024-03-04 15:55:19 +01:00
|
|
|
|
private void CustomerSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(sender is XRPictureBox pictureBox)
|
|
|
|
|
|
{
|
|
|
|
|
|
var base64String = pictureBox.Tag as string;
|
|
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(base64String))
|
|
|
|
|
|
{
|
|
|
|
|
|
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
|
|
|
|
|
|
var binaryData = Convert.FromBase64String(base64Data);
|
|
|
|
|
|
var image = ByteArrayToImage(binaryData);
|
|
|
|
|
|
|
|
|
|
|
|
pictureBox.Image = image;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
pictureBox.Image = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-04 15:55:19 +01:00
|
|
|
|
private void picSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
2021-12-09 14:25:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|