171 lines
6.3 KiB
C#
171 lines
6.3 KiB
C#
using System;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using System.Text.RegularExpressions;
|
|
using System.IO;
|
|
using DevExpress.XtraPrinting.Drawing;
|
|
|
|
namespace OwnSoftTestSchmitzi
|
|
{
|
|
|
|
public partial class LeistungsnachweisSoziotherapie : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public LeistungsnachweisSoziotherapie()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
if (pRO.Mandator.Logo?.Original is object)
|
|
xrPictureBox3.ImageSource = new ImageSource(false, pRO.Mandator.Logo.Original);
|
|
|
|
double gesamt = 0;
|
|
double gesamtGruppe = 0;
|
|
|
|
if (pRO.Services != null)
|
|
{
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
ServicesOverviewRO.CreateSignatureString(s);
|
|
|
|
var serviceRecord = DAOFactory.GenericDAO.LoadByID<ServiceRecord>(s.ServiceRecordOid);
|
|
pRO.ReferenceNumber = serviceRecord.CostBearer2SupportConcept.CustomerReferenceNumber;
|
|
if (serviceRecord.CostBearer2SupportConcept.ApprovedStartDate != null)
|
|
pRO.ApprovedStartDate = String.Format("{0:dd.MM.yyyy}", serviceRecord.CostBearer2SupportConcept.ApprovedStartDate);
|
|
if (serviceRecord.CostBearer2SupportConcept.ApprovedEndDate != null)
|
|
pRO.ApprovedEndDate = String.Format("{0:dd.MM.yyyy}", serviceRecord.CostBearer2SupportConcept.ApprovedEndDate);
|
|
var srDc = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDC(serviceRecord);
|
|
|
|
s.GoalList = String.Empty;
|
|
if (srDc.Goals != null && srDc.Goals.Count > 0)
|
|
{
|
|
foreach (var goal in srDc.Goals)
|
|
{
|
|
if (!String.IsNullOrEmpty(goal.Abbreviation))
|
|
{
|
|
if (s.GoalList.Length > 0)
|
|
s.GoalList += ", ";
|
|
s.GoalList += goal.Abbreviation;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (s.ServiceDescription.Contains("Gruppe"))
|
|
{
|
|
s.IsGroup = true;
|
|
gesamtGruppe += s.Minutes;
|
|
s.ServiceDescription = "E";
|
|
if (s.Minutes <= 45)
|
|
s.Notice5 = "2002678";
|
|
else if (s.Minutes <= 60)
|
|
s.Notice5 = "2002677";
|
|
else
|
|
s.Notice5 = "2002672";
|
|
}
|
|
else
|
|
{
|
|
gesamt += s.Minutes;
|
|
}
|
|
|
|
if (s.ServiceDescription.Contains("Video"))
|
|
{
|
|
s.ServiceDescription = "V";
|
|
if (s.Minutes <= 30)
|
|
{
|
|
s.Notice5 = "2001615";
|
|
}
|
|
else
|
|
{
|
|
s.Notice5 = "2001616";
|
|
}
|
|
}
|
|
else if (s.ServiceDescription.Contains("Telefon"))
|
|
{
|
|
s.ServiceDescription = "T";
|
|
if (s.Minutes <= 30)
|
|
{
|
|
s.Notice5 = "2001618";
|
|
}
|
|
else
|
|
{
|
|
s.Notice5 = "2001617";
|
|
}
|
|
}
|
|
else if (s.ServiceDescription.Contains("Aufsuchende Prob"))
|
|
{
|
|
s.ServiceDescription = "A";
|
|
s.Notice5 = "2001607";
|
|
}
|
|
else
|
|
{
|
|
if (s.ServiceDescription.Contains("Büro"))
|
|
{
|
|
s.ServiceDescription = "E";
|
|
}
|
|
else if (s.ServiceDescription.Contains("Aufsuchend"))
|
|
{
|
|
s.ServiceDescription = "A";
|
|
}
|
|
|
|
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";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
cellGesamt.Text = String.Format("{0:0.00}", gesamt / 60);
|
|
if (gesamtGruppe > 0)
|
|
{
|
|
cellGesamtGruppe.Text = String.Format("{0:0.00}", gesamtGruppe / 90);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void picSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
XRPictureBox xrBox = sender as XRPictureBox;
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|