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

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

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {

           // lblBewilligteLeistung.Text = String.Format("{0:0.00} h / {1:0} min. mtl. // {3:0.##} h ges.", pRO.ApprovedFLSPerWeek, Math.Round(pRO.ApprovedFLSPerWeek * 4.333333333m, 0, MidpointRounding.AwayFromZero), pRO.ApprovedFLSTotal);
           
            if (pRO.Services != null)
            {
                List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
                

                foreach (var item in pRO.Services)
                {
                    if (item.IsBillable) 
                    {
						ServicesOverviewRO.CreateGoalList(item);
                        servicesBillable.Add(item);
                    }
                }

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

    }
}
