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

using DevExpress.XtraReports.UI;

namespace BeWo.BUGeVReports
{
    public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
    {
        public ServiceInvoiceReport()
        {
            this.InitializeComponent();
        }

        public void SetReportDataSource(ServiceInvoiceRO pRO)
        {
			if (pRO.ServiceInvoicePeriods != null)
			{
				foreach (var sip in pRO.ServiceInvoicePeriods)
				{
					if (sip.ServiceInvoiceItems != null)
					{
						foreach (var ii in sip.ServiceInvoiceItems)
						{
							ii.Notice = string.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2} FLS x {3} x {4}",
							                          ii.AccountingPeriodStart, ii.AccountingPeriodEnd, ii.Hours, ii.RateFactor,
							                          ii.HourlyRate);
						}
					}
				}
			}
	        this.bindingSource1.DataSource = pRO;
        }
    }
}