Bugfix für Zeiterfassung Edit View. Anpassungen für diverse Kunden (HPH Bersenbrück, Diakonie KK Kleve, PariSozial, Bewegt)
145 lines
4.7 KiB
C#
145 lines
4.7 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BewegtSystemischeBeratung
|
|
{
|
|
public partial class Rechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public Rechnung()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
//pRO.GrossClaim = pRO.GrossClaim.Replace("€", "").Trim();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
if (pRO.RecipientOrganisation.Contains("ABW - "))
|
|
{
|
|
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("ABW - ", "");
|
|
}
|
|
if (pRO.RecipientOrganisation.Contains("aHH - "))
|
|
{
|
|
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("aHH - ", "");
|
|
}
|
|
if (pRO.RecipientOrganisation.Contains("1 SB - "))
|
|
{
|
|
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("1 SB - ", "");
|
|
}
|
|
//sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPoBox);
|
|
}
|
|
else
|
|
{
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
|
|
//if (start.Month == end.Month && start.Year == end.Year)
|
|
//{
|
|
// lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Monat {0:MMMM yyyy} folgende erbrachte Tätigkeiten:", start);
|
|
//}
|
|
//else
|
|
//{
|
|
// lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end);
|
|
//}
|
|
SetAnrede(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
|
|
private void SetAnrede(ServiceInvoiceRO pRO)
|
|
{
|
|
String anrede = "Sehr geehrte Damen und Herren";
|
|
|
|
var p = GetKontaktPerson(pRO);
|
|
|
|
if (p != null)
|
|
{
|
|
if (p.Sex.HasValue && p.Sex.Value == Sex.Male)
|
|
{
|
|
anrede = "Sehr geehrter Herr " + p.LastName;
|
|
}
|
|
else if (p.Sex.HasValue && p.Sex.Value == Sex.Female)
|
|
{
|
|
anrede = "Sehr geehrte Frau " + p.LastName;
|
|
}
|
|
}
|
|
|
|
anrede += @",
|
|
|
|
für unsere Tätigkeit im Rahmen der Betreuung für [CustomerName] erlauben wir uns folgendes zu berechnen:";
|
|
|
|
anrede = anrede.Replace("[CustomerName]", pRO.CustomerName);
|
|
|
|
//lblAbrechnungszeitraum.Text = anrede;
|
|
|
|
//String leistung = "Sozialgesetzbuch IX";
|
|
|
|
//if (pRO.ServiceInvoicePeriods.Count > 0)
|
|
//{
|
|
// var sc = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept.SupportConcept;
|
|
|
|
|
|
// foreach (var vv in sc.VarFieldValueList)
|
|
// {
|
|
// if (vv.VarFieldDefOid.Value == 1)
|
|
// {
|
|
// var varFieldValue = BS.Shared.Core.Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName));
|
|
// if (varFieldValue != null)
|
|
// {
|
|
// var vfString = varFieldValue.ToString();
|
|
|
|
// if (!String.IsNullOrEmpty(vfString))
|
|
// {
|
|
// leistung = vfString;
|
|
// }
|
|
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
private Person GetKontaktPerson(ServiceInvoiceRO pRO)
|
|
{
|
|
if (pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept;
|
|
|
|
return c2s.CostBearerContactPerson;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |