using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Text;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;

namespace BeWo.DiakonieLennepReports
{
    public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
    {
        public Spitzabrechnung()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(Settlement2RO pRO)
        {
            
	        if (pRO.Claim >= 0)
	        {
		        //lblEndText.Text =
				//	"Wir bitten um Erstattung des Differenzbetrages auf das Konto des Ev. Kirchenkreises Lennep, IBAN: DE02 3506 0190 1010 2080 21, BIC: GENODED1DKD";
	        }
	        else
	        {
				lblEndText.Text =
					"Wir bitten um Mitteilung, in welcher Form oben genannter Betrag ausgeglichen werden soll.";
	        }

			StringBuilder sb = new StringBuilder();

			if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
			{
				if (pRO.RecipientOrganisation.Trim().ToLower() == "lvr" && String.IsNullOrEmpty(pRO.RecipientDivision))
				{
					pRO.RecipientDivision = "Dezernat 7";
				}
				sb.AppendLine(pRO.RecipientOrganisation);
			}
			if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && !String.IsNullOrEmpty(pRO.RecipientContactPerson.Trim()))
			{
				sb.AppendLine(pRO.RecipientContactPerson);
			}
			if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
			{
				sb.AppendLine(pRO.RecipientDivision);
			}
			if (!String.IsNullOrEmpty(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
			{
				sb.AppendLine(pRO.RecipientStreet);
			}
			if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
			{
				sb.AppendLine(pRO.RecipientPostCodeAndTown);
			}
			lblAnschrift.Text = sb.ToString();

            this.bindingSource1.DataSource = pRO;
        }
    }
}
