112 lines
3.8 KiB
C#
112 lines
3.8 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 BeWo.Service.ServiceImplementations;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
|
|
|
|
namespace DomizielAnsbach
|
|
{
|
|
public partial class QuittierungsbelegAbw : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public QuittierungsbelegAbw()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
String betreuungsschluessel = "";
|
|
double minuten = 0;
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
minuten += s.Minutes;
|
|
if (s.ServiceCategory.Contains("Indirekt"))
|
|
{
|
|
s.MinutesUnqualified = s.Minutes;
|
|
s.MinutesQualified = 0;
|
|
}
|
|
else
|
|
{
|
|
s.MinutesQualified = s.Minutes;
|
|
s.MinutesUnqualified = 0;
|
|
}
|
|
if (String.IsNullOrEmpty(betreuungsschluessel) && s.ServiceCategory.Contains("Ambulant Betreutes "))
|
|
{
|
|
betreuungsschluessel = s.ServiceCategory.Replace("Ambulant Betreutes Einzelwohnen", "").Trim();
|
|
}
|
|
}
|
|
|
|
lblBewilligteStunden.Text = betreuungsschluessel;
|
|
|
|
pRO.TotalFLMBillable = minuten;
|
|
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private SupportConceptPeriodStatisticsDC GetFlsStatistics(ServicesOverviewRO ro, String assName)
|
|
{
|
|
if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0)
|
|
{
|
|
var service = new OperationsServiceImp();
|
|
|
|
foreach (var cb2sc in ro.CostBearer2SupportConceptList)
|
|
{
|
|
long cb2scOid = cb2sc.Oid.Value;
|
|
|
|
|
|
var stats = service.CreateSupportConceptStatistics(cb2scOid, ro.EndDate);
|
|
|
|
if (stats.PeriodStatistics != null && stats.PeriodStatistics.Count > 0)
|
|
{
|
|
foreach (var ps in stats.PeriodStatistics)
|
|
{
|
|
if ((ps.SupportConceptApprovalPeriod != null && ps.SupportConceptApprovalPeriod.ServiceCategory != null &&
|
|
!ps.SupportConceptApprovalPeriod.ServiceCategory.Name.ToLower().Contains(assName)) || ps.SupportConceptApprovalPeriod.ServiceCategory == null)
|
|
{
|
|
return ps;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
return null;
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|