137 lines
5.1 KiB
C#
137 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text.RegularExpressions;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace FlexibleJugendarbeitFrankfurtEV
|
|
{
|
|
public partial class LeistungnachweisJhsAutismus : XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public LeistungnachweisJhsAutismus()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
Dictionary<int, ServicesOverviewRO.ServiceDetail> day2Detail = new Dictionary<int, ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (var sd in pRO.Services)
|
|
{
|
|
if (sd.IsBillable)
|
|
{
|
|
ServicesOverviewRO.CreateSignatureString(sd);
|
|
if (sd.ServiceDescription.Contains("Fehlkontakt"))
|
|
{
|
|
sd.Minutes = 60;
|
|
sd.Notice2 = "1";
|
|
}
|
|
servicesBillable.Add(sd);
|
|
}
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
SetzeBewilligung(pRO);
|
|
pRO.MainAttendant = GetSozialarbeiter(pRO);
|
|
bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private string GetSozialarbeiter(ServicesOverviewRO pRO)
|
|
{
|
|
string asd = "";
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.CustomerOid);
|
|
foreach (var c2p in c.Customer2PersonList)
|
|
{
|
|
foreach (var v2o in c2p.ValueList)
|
|
{
|
|
if (v2o.Entry.Type == ValueListEntryType.EnvironmentPersonType && v2o.Entry.Value.Contains("Zuständiger ASD"))
|
|
{
|
|
|
|
if (asd != "")
|
|
{
|
|
asd += ", ";
|
|
}
|
|
asd += c2p.Person.LastName;
|
|
}
|
|
}
|
|
}
|
|
|
|
return asd;
|
|
}
|
|
|
|
private void SetzeBewilligung(ServicesOverviewRO pRo)
|
|
{
|
|
if (pRo.CostBearer2SupportConceptList != null && pRo.CostBearer2SupportConceptList.Count > 0)
|
|
{
|
|
pRo.MainAttendantCommaSeperated = "";
|
|
var c2s = pRo.CostBearer2SupportConceptList[0];
|
|
c2s.ApprovalPeriodList = c2s.ApprovalPeriodList.OrderBy(a => a.StartDate).ToList();
|
|
foreach (var scap in c2s.ApprovalPeriodList)
|
|
{
|
|
if (scap.StartDate <= pRo.EndDate && scap.EndDate >= pRo.StartDate)
|
|
{
|
|
if (scap.ApprovedBETotal.HasValue)
|
|
{
|
|
pRo.ApprovedFLSTotal = scap.ApprovedBETotal ?? 0;
|
|
}
|
|
lblBewStart.Text = String.Format("{0:dd.MM.yyyy}", scap.StartDate.Value);
|
|
lblBewEnd.Text = String.Format("{0:dd.MM.yyyy}", scap.EndDate.Value);
|
|
|
|
if (scap.SupportConceptApprovalPeriod2Employee != null && scap.SupportConceptApprovalPeriod2Employee.Count > 0)
|
|
{
|
|
pRo.MainAttendantCommaSeperated = "";
|
|
foreach (var e in scap.SupportConceptApprovalPeriod2Employee)
|
|
{
|
|
if (pRo.MainAttendantCommaSeperated.Length > 0)
|
|
{
|
|
pRo.MainAttendantCommaSeperated += ", ";
|
|
}
|
|
pRo.MainAttendantCommaSeperated += e.Employee.Person.LastName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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);
|
|
System.Drawing.Image img = ByteArrayToImage(binData);
|
|
xrBox.Image = Utils.CropImage(img);
|
|
}
|
|
else
|
|
{
|
|
xrBox.Image = null;
|
|
}
|
|
}
|
|
|
|
public System.Drawing.Image ByteArrayToImage(byte[] byteArrayIn)
|
|
{
|
|
using(var memoryStream = new MemoryStream(byteArrayIn))
|
|
{
|
|
return System.Drawing.Image.FromStream(memoryStream);
|
|
}
|
|
}
|
|
}
|
|
}
|