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

namespace BeWo.VisionReports
{
    public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
    {
        private int page = 0;

        public Stundenzettel()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
            if (pRO.Services != null)
            {
                List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();

                foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
                {
                    if (s.IsBillable)
                        servicesBillable.Add(s);
                }

                pRO.Services = servicesBillable;
            }
            this.bindingSource1.DataSource = pRO;
        }



        private void PageHeader_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            if (page == 0)
                PageHeader.Visible = false;
            else
                PageHeader.Visible = true;
            page++;
        }

        
    }
}
