using System.Collections.Generic;
using BeWo.Report;
using BeWo.Report.ReportObjects;

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

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
	        if (pRO.Month == "Januar")
	        {
		        pRO.Month = "01";
	        }
			else if (pRO.Month == "Februar")
			{
				pRO.Month = "02";
			}
			else if (pRO.Month == "März")
			{
				pRO.Month = "03";
			}
			else if (pRO.Month == "April")
			{
				pRO.Month = "04";
			}
			else if (pRO.Month == "Mai")
			{
				pRO.Month = "05";
			}
			else if (pRO.Month == "Juni")
			{
				pRO.Month = "06";
			}
			else if (pRO.Month == "Juli")
			{
				pRO.Month = "07";
			}
			else if (pRO.Month == "August")
			{
				pRO.Month = "08";
			}
			else if (pRO.Month == "September")
			{
				pRO.Month = "09";
			}
			else if (pRO.Month == "Oktober")
			{
				pRO.Month = "10";
			}
			else if (pRO.Month == "November")
			{
				pRO.Month = "11";
			}
			else if (pRO.Month == "Dezember")
			{
				pRO.Month = "12";
			}

            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);
                }

                pRO.Services = servicesBillable;
            }
            this.bindingSource1.DataSource = pRO;
        }

    }
}
