95 lines
2.8 KiB
C#
95 lines
2.8 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BS.Shared;
|
|
|
|
namespace AdikKleve
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
if (pRO.Claim < 0)
|
|
{
|
|
pRO.FinalSentence = "Bitte ziehen Sie die Überzahlung bei Ihren nächsten Zahlungen ab.";
|
|
}
|
|
|
|
if (String.IsNullOrEmpty(pRO.Notice))
|
|
{
|
|
lblNotice.Visible = false;
|
|
}
|
|
|
|
decimal rateFactor = 1;
|
|
var summeFLS = 0m;
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (ii.ItemDescription == "Fehlkontakte")
|
|
ii.AbrechnungsText = ii.AbrechnungsText.Replace("FLS", "Fehlkontakte");
|
|
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
summeFLS += ii.UnitCount.Value * rateFactor;
|
|
}
|
|
|
|
pRO.RateFactor = (double)rateFactor;
|
|
tcGesamtGeleistet.Text = string.Format("Gesamtforderung für {0:0.00} FLS:", summeFLS);
|
|
|
|
SetFaxNrAndAnsprechpartner(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetFaxNrAndAnsprechpartner(Settlement2RO pRO)
|
|
{
|
|
String fax = null;
|
|
if (pRO.InvoiceBaseOid.HasValue)
|
|
{
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRO.InvoiceBaseOid.Value);
|
|
|
|
if (ib.RecipientOrganisationOid.HasValue)
|
|
{
|
|
var org = DAOFactory.GenericDAO.LoadByID<Organisation>(ib.RecipientOrganisationOid.Value);
|
|
|
|
var contact = org.Contacts.FirstOrDefault(c => c.Type == ContactType.business_Fax);
|
|
if (contact != null)
|
|
{
|
|
fax = contact.Value;
|
|
}
|
|
|
|
if (String.IsNullOrWhiteSpace(pRO.RecipientContactPerson))
|
|
{
|
|
contact = org.Contacts.FirstOrDefault(c => c.Type == ContactType.ContactPerson);
|
|
if (contact != null)
|
|
{
|
|
pRO.RecipientContactPerson = contact.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (fax != null)
|
|
{
|
|
lblFax.Text = String.Format("Fax: {0}", fax);
|
|
}
|
|
else
|
|
{
|
|
lblFax.Text = "";
|
|
}
|
|
}
|
|
}
|
|
}
|