67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using System;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
namespace BeWo.BeWoMobilReports
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
decimal rateFactor = 1;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
|
|
ii.DetailDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} FLS {4}x {3:c}",
|
|
ii.PeriodStartDate,
|
|
ii.PeriodEndDate,
|
|
ii.UnitCount,
|
|
ii.AmountPerUnit,
|
|
ii.RateFactor.HasValue && ii.RateFactor.Value != 0 ? String.Format("x {0:0.##} ", (ii.RateFactor + 100) / 100) : "");
|
|
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
}
|
|
pRO.RateFactor = (double)rateFactor;
|
|
|
|
if (pRO.Claim < 0)
|
|
{
|
|
pRO.FinalSentence = "";
|
|
}
|
|
|
|
if (!HatGruppen(pRO))
|
|
lblGruppe.Text = String.Format("{0} {1} hat nicht an Gruppenangeboten teilgenommen.", pRO.Salutation2, pRO.CustomerLastName);
|
|
|
|
if (pRO.FehlkontakteString != null && pRO.FehlkontakteString.Length > 0)
|
|
pRO.FehlkontakteString += " - Fehlkontakte werden von uns mit 80% des Stundensatzes abgerechnet.";
|
|
pRO.CustomerReferenceNumberAndDate = pRO.CustomerReferenceNumberAndDate.Replace("Az.", "GP");
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private bool HatGruppen(Settlement2RO pRO)
|
|
{
|
|
if (pRO.InvoiceBaseOid.HasValue)
|
|
{
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRO.InvoiceBaseOid.Value);
|
|
var cb2sc = ib.CostBearer2SupportConcept;
|
|
|
|
return cb2sc.ServiceRecords.Any(s => s.GroupOid.HasValue && s.GroupOid.Value > 0);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|