143 lines
4.9 KiB
C#
143 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWoImFlow
|
|
{
|
|
public partial class Rechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public Rechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation == "Herr")
|
|
{
|
|
pRO.CustomerSalutation = "Herrn";
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
if (!pRO.RecipientOrganisation.ToLower().Contains("jugendamt"))
|
|
{
|
|
lblAndere.Visible = true;
|
|
lblJA.Visible = false;
|
|
}
|
|
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
sb.AppendLine("");
|
|
}
|
|
|
|
String line = "";
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
|
|
{
|
|
line = pRO.RecipientDivision;
|
|
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
|
|
{
|
|
if (line.Length > 0)
|
|
line += ", ";
|
|
line += pRO.RecipientContactPerson;
|
|
}
|
|
|
|
if (!String.IsNullOrWhiteSpace(line))
|
|
{
|
|
sb.AppendLine(line);
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
decimal std = 0;
|
|
decimal hourlyRate = 0;
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
var u = ii.UnitCount ?? 0;
|
|
|
|
if (!String.IsNullOrEmpty(ii.RateFactor))
|
|
{
|
|
var rfStr = ii.RateFactor.Replace("%", "").Replace(",00", "").Trim();
|
|
int rfInt = 0;
|
|
Int32.TryParse(rfStr, out rfInt);
|
|
|
|
decimal rateFactor = (100m + rfInt) / 100m;
|
|
|
|
u *= rateFactor;
|
|
}
|
|
|
|
std += u;
|
|
if (ii.HourlyRate.HasValue)
|
|
{
|
|
hourlyRate = ii.HourlyRate.Value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pRO.InvoiceBase != null)
|
|
{
|
|
cellBewilligungszeitraum.Text = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", pRO.InvoiceBase.SupportConceptCostBearerRelDc.StartDate, pRO.InvoiceBase.SupportConceptCostBearerRelDc.EndDate);
|
|
|
|
foreach (var scap in pRO.InvoiceBase.SupportConceptCostBearerRelDc.ApprovalPeriodList)
|
|
{
|
|
if (scap.StartDate <= pRO.AccountingPeriodEnd && scap.EndDate >= pRO.AccountingPeriodStart && scap.ApprovedBEPerInterval.HasValue)
|
|
{
|
|
cellBewilligtProWoche.Text = String.Format("{0:0.00} FLS", scap.ApprovedBEPerInterval);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
cellAbrechnungszeitraum.Text = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", pRO.AccountingPeriodStart, pRO.AccountingPeriodEnd);
|
|
cellGeleisteteStd.Text = String.Format("{0:0.00} FLS", std);
|
|
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
ii.ServiceDescription = String.Format("{0:0.00} FLS (Erbrachte Leistungen) x {1:c} =", ii.Hours, ii.HourlyRate);
|
|
|
|
|
|
//lblAbrechnungsText.Text = String.Format("{0:0.00} FLS (Erbrachte Leistungen) x {1:c} =", std, hourlyRate);
|
|
}
|
|
}
|
|
|
|
|
|
//DateTime start = pRO.AccountingPeriodStart;
|
|
//DateTime end = pRO.AccountingPeriodEnd;
|
|
//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);
|
|
//}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
}
|