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

namespace SPZRatingen
{
    public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
    {
        public Spitzabrechnung()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(Settlement2RO pRO)
        {
	        if (pRO.InvoiceItems != null)
	        {
		        foreach (var ii in pRO.InvoiceItems)
		        {
			        decimal hours = ii.UnitCount ?? 0;
			        decimal mittelbarHours = 0;
			        if (ii.RateFactor.HasValue)
				        mittelbarHours = (hours* ii.RateFactor.Value) / 100m;

			        ii.ItemDescription = String.Format("{0:0.00}", mittelbarHours);
			        ii.UnitDescription = String.Format("{0:0.00}", hours + mittelbarHours);
		        }
	        }
            this.bindingSource1.DataSource = pRO;
        }
    }
}
