using System;
using System.Collections.Generic;

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

using DevExpress.XtraReports.UI;

namespace IndroABW
{
    public partial class Stundenzettel : XtraReport, IBeWoReport<ServicesOverviewRO>
    {
        public Stundenzettel()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
			if (pRO.Services != null)
			{
				var servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();

				foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
				{
					if (s.StartDate.Second == 0)
					{
						s.TimeRangeString = String.Format("{0} - {1}", s.StartDate.ToShortTimeString(), s.EndDate.ToShortTimeString());
					}
					if (s.IsBillable)
						servicesBillable.Add(s);
				}

				pRO.Services = servicesBillable;
			}

			

            bindingSource1.DataSource = pRO;
        }
    }
}

