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

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

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

	            double minuten = 0;
                foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
                {
	                if (s.IsBillable)
	                {
		                if (s.ServiceCategory.IndexOf("Freizeitassistenz") < 0)
		                {
			                servicesBillable.Add(s);
			                minuten += s.Minutes;
		                }
	                }
                }

				pRO.TotalFLMBillable = minuten;
                pRO.Services = servicesBillable;
            }

            this.bindingSource1.DataSource = pRO;
        }
    }
}
