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

using DevExpress.XtraReports.UI;
using BS.Shared.Core;
namespace BeWo.SeWo
{
    [IDSpecificClass(Identifier = "FLSAuswertung")]
    public partial class FLSAuswertung : XtraReport, IBeWoReport<FLSReportRO>
    {
        public FLSAuswertung()
        {
            InitializeComponent();
        }

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

                    detail.TotalFLM -= pause;
                    group.TotalFLM -= pause;
                    pRO.TotalFLM -= pause;
                }

            }
            
            

            this.bindingSource1.DataSource = pRO;
        }

    }
}
