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

namespace BeWo.SeWo
{
    public partial class Leistungsdokumentation : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<FLSReportRO>
    {
        public Leistungsdokumentation()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(FLSReportRO pRO)
        {
            
            foreach (var group in pRO.FLSReportGroups)
            {
                decimal pause = 0;
                foreach (var sr in group.ServiceRecords)
                {
                    if (sr.ServiceDescription == "Pause")
                    {
                        pause += sr.RoundedDuration;
                    }
                }
                group.TotalFLM -= pause;
                pRO.TotalFLM -= pause;
            }
            
            this.bindingSource1.DataSource = pRO;
        }

    }
}
