115 lines
3.6 KiB
C#
115 lines
3.6 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BS.Shared.Extensions;
|
|
using System.Text.RegularExpressions;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
namespace BfpDus
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
private Settlement2RO ro;
|
|
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public Settlement2RO SettlementRo
|
|
{
|
|
get { return ro; }
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
ro = pRO;
|
|
|
|
decimal rateFactor = 1;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (ii.RateFactor.HasValue && ii.RateFactor.Value > 1)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pRO.RateFactor = (double)rateFactor;
|
|
pRO.RateFactorText2 = String.Format("{0:0.0#}", rateFactor);
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
//ii.DetailDescription = String.Format("{0} {1}", ii.ItemDescription, ii.AbrechnungsText);
|
|
|
|
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
|
|
{
|
|
Zwischensumme.Visible = true;
|
|
if (!ii.ItemDescription.IsNullOrEmpty())
|
|
{
|
|
ii.DetailDescription = Regex.Replace(ii.DetailDescription, ii.ItemDescription, "Fehlkontakte");
|
|
}
|
|
ii.ItemDescription = "Fehlkontakte";
|
|
}
|
|
else
|
|
{
|
|
ii.DetailDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} FLS {3}x {4:c}", ii.PeriodStartDate,
|
|
ii.PeriodEndDate, ii.UnitCount, ii.RateFactor == 0 ? "" : "x " + pRO.RateFactorText2 + " ", ii.AmountPerUnit);
|
|
}
|
|
}
|
|
InsertAbsenceTimes(pRO);
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void InsertAbsenceTimes(Settlement2RO pRO)
|
|
{
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRO.InvoiceBaseOid.Value);
|
|
var customer = ib.CostBearer2SupportConcept.SupportConcept.Customer;
|
|
|
|
int index = 2;
|
|
foreach (var at in customer.AbsenceTimes)
|
|
{
|
|
if (at.AbsenceReason.BillableMinutes.HasValue && at.AbsenceReason.BillableMinutes.Value > 0)
|
|
{
|
|
DevExpress.XtraReports.UI.XRTableRow row = null;
|
|
if (index == 2)
|
|
{
|
|
row = tableRowKHAufenthalte;
|
|
}
|
|
else
|
|
{
|
|
row = tableCustomer.InsertRowBelow(tableCustomer.Rows[tableCustomer.Rows.Count - 3]);
|
|
}
|
|
|
|
String text = String.Format("{0:dd.MM.yyyy} - ", at.Start);
|
|
int? days = null;
|
|
|
|
if (at.End.HasValue)
|
|
{
|
|
days = (int)at.End.Value.Subtract(at.Start.Value).TotalDays + 1;
|
|
|
|
text += String.Format("{0:dd.MM.yyyy} = {1:0.#} Tage", at.End, days);
|
|
|
|
}
|
|
else
|
|
{
|
|
text += "unbekannt";
|
|
}
|
|
|
|
row.Cells[1].Text = text;
|
|
|
|
index++;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|