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

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

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
            double gesamt = 0;
            double abrechenbar = 0;

            if (pRO.Services != null)
            {
                foreach (var sd in pRO.Services)
                {
                    if (sd.IsBillable)
                    {
                        abrechenbar += sd.Minutes;
                    }
                    gesamt += sd.Minutes;
                }
            }

            lblSummeFLM.Text = String.Format("{0:0.##}", gesamt);
            lblFlmAbrechenbar.Text = String.Format("{0:0.##}", abrechenbar);
            lblFlsAbrechenbar.Text = String.Format("{0:0.00}", abrechenbar / 60);
            lblFlsFactor.Text = String.Format("{0:0.00}", (abrechenbar / 60) * 1.2);

            this.bindingSource1.DataSource = pRO;
        }

    }
}
