using BeWo.Report;
using BeWo.Report.ReportObjects;

using DevExpress.XtraReports.UI;
using BS.Shared.Core;

namespace BeWo.FibMarburg
{
    [IDSpecificClass(Identifier = "Sammelrechnung")]
    public partial class Sammelrechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
    {
        public Sammelrechnung()
        {
            this.InitializeComponent();
        }

        public void SetReportDataSource(ServiceInvoiceRO pRO)
        {

	        if (!string.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.Contains("206"))
	        {
		        txtKoerperlich.Visible = false;
		        txtGeistig.Visible = true;
	        }
	        else
	        {
				txtKoerperlich.Location = txtGeistig.Location;
				txtGeistig.Visible = false;
				txtKoerperlich.Visible = true;
	        }
			pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
            this.bindingSource1.DataSource = pRO;
        }
    }
}