using System;
using System.Collections;
using System.ComponentModel;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using System.Collections.Generic;

namespace BeWo.LebenshilfeDuisburgReports
{
	[IDSpecificClass(Identifiers = new string[] { "Jugendamt Walsum", "Jugendamt Hamborn", "Jugendamt Meiderich", "Jugendamt Homberg", "Jugendamt Mitte", "Jugendamt Rheinhausen", "Jugendamt Süd", "Jugendamt Marxloh" })]
    public partial class QuittierungsbelegHPFH : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
    {
		public QuittierungsbelegHPFH()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
            if (pRO.Services != null)
            {
                foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
                {
	                s.ServiceCategoryAbbr = "";

	                String firstLine = "";
					if (!String.IsNullOrEmpty(s.Notice))
					{
						if (s.Notice.IndexOf(Environment.NewLine) >= 0)
							firstLine = s.Notice.Substring(0, s.Notice.IndexOf(Environment.NewLine));
						else
							firstLine = s.Notice;
					}
					s.Notice = firstLine;

					if (s.ServiceCategory != null && 
						((s.ServiceCategory.ToLower().IndexOf("face") >= 0) || (s.ServiceCategory.ToLower().IndexOf("atz") >= 0 && s.ServiceCategory.ToLower().IndexOf("mit klient") >= 0)))
						s.ServiceCategoryAbbr = "Ja";
                    else
						s.ServiceCategoryAbbr = "Nein";
                }

            }

            this.bindingSource1.DataSource = pRO;
        }
    }
}
