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

namespace BeWo.BeWoAuxilio
{
    public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
    {
        public Stundenzettel()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
	        if (!String.IsNullOrEmpty(pRO.AbsenceTimes))
	        {
		        lblAbwesenheiten.Text = pRO.AbsenceTimes;
	        }
			if (pRO.Services != null)
			{
				List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();

				foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
				{
					if (s.IsBillable)
					{
						s.FLSUnqualifiedString = ""; //"Gruppe";
						s.FLSQualifiedString = ""; // Einzel
						s.Notice = ""; //"Telefon";

						if (s.IsGroup)
						{
							s.FLSUnqualifiedString = String.Format("{0} Teilnehmer", s.CustomerCount);
						}
						else
						{
							if (s.ServiceDescription.ToLower().Contains("telefon"))
							{
								s.Notice = "X";
							}
							else
							{
								s.FLSQualifiedString = "X";
							}
						}
						
						
						

						servicesBillable.Add(s);
					}
				}

				pRO.Services = servicesBillable;
			}

			this.bindingSource1.DataSource = pRO;
        }
    }
}

