109 lines
3.3 KiB
C#
109 lines
3.3 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
|
|
namespace BeWo.Report.DefaultReports
|
|
{
|
|
public partial class InvoiceCustomerReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<InvoiceCustomerRO>
|
|
{
|
|
public InvoiceCustomerReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(InvoiceCustomerRO pRO)
|
|
{
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if ((!String.IsNullOrEmpty(pRO.RecipientFirstName) && !String.IsNullOrEmpty(pRO.RecipientFirstName.Trim()))
|
|
|| (!String.IsNullOrEmpty(pRO.RecipientLastName) && !String.IsNullOrEmpty(pRO.RecipientLastName.Trim())))
|
|
{
|
|
sb.AppendLine(String.Format("{0} {1}", pRO.RecipientFirstName, pRO.RecipientLastName).Trim());
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCode) && !String.IsNullOrEmpty(pRO.RecipientPostCode.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientPostCode);
|
|
sb.Append(" ");
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientTown) && !String.IsNullOrEmpty(pRO.RecipientTown.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
ortDatum.Text = string.Format("Ahlen, den {0}", pRO.InvoiceDate);
|
|
|
|
|
|
decimal stunden = 0;
|
|
decimal stundenSatz = 0;
|
|
|
|
|
|
if (pRO.InvoiceItems != null)
|
|
{
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
|
|
if (ii.AmountPerUnit.HasValue)
|
|
{
|
|
stundenSatz = ii.AmountPerUnit.Value;
|
|
}
|
|
|
|
stunden += ii.UnitCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
cellGeleisteteFls.Text = String.Format("{0:0.00}", stunden);
|
|
cellStundensatz.Text = String.Format("{0:c}", stundenSatz);
|
|
cellGesamt.Text = String.Format("{0}", pRO.TotalClaim);
|
|
|
|
SetBewilligungInfos(pRO);
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetBewilligungInfos(InvoiceCustomerRO pRO)
|
|
{
|
|
cellDebNumber.Text = pRO.RecipientDebitorNumber;
|
|
|
|
String sal = pRO.CustomerSalutation;
|
|
|
|
if (sal == "Herr")
|
|
{
|
|
sal = "Herrn";
|
|
}
|
|
|
|
String name = String.Format("{0} {1}", pRO.CustomerFirstName, pRO.CustomerLastName);
|
|
|
|
if (!String.IsNullOrEmpty(pRO.CustomerReferenceNumber))
|
|
{
|
|
name += ", AZ: " + pRO.CustomerReferenceNumber;
|
|
}
|
|
|
|
lblAnrede.Text =
|
|
String.Format(
|
|
"Sehr geehrte Damen und Herren,\n\nhiermit stellen wir Ihnen die geleisteten Fachleistungsstunden für {0} {1} in Rechnung.",
|
|
sal, name);
|
|
}
|
|
}
|
|
}
|