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.LebenshilfeDuisburgReports
{
    public partial class StundenzettelHPFH : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
    {
		public StundenzettelHPFH()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
			double minTotal = 0;
	        String category = null;

			//String empName = String.Empty;
			//Dictionary<String, bool> empCountDict = new Dictionary<String, bool>();

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

                foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
                {
	                if (s.IsBillable)
	                {
						
						
		                servicesBillable.Add(s);
		                minTotal += s.Minutes;

		                if (String.IsNullOrEmpty(category))
		                {
			                category = s.ServiceCategory;
		                }
	                }
	                
                }

                pRO.Services = servicesBillable;
            }
			
			lblHeader.Text = String.Format("Quittierungsbeleg über {0}", category);
	        lblFLSTotal.Text = String.Format("{0:0.00}", minTotal / 60);

			bindingSource1.DataSource = pRO;
			
        }
    }
}
