using System;
using BS.Shared;
using BeWo.Report.ReportObjects;

namespace BeWo.Report.DefaultReports
{
    public partial class AdditionalServiceBookingReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<AdditionalServiceBookingRO>
    {
        public AdditionalServiceBookingReport()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(AdditionalServiceBookingRO pRO)
        {
            bindingSource1.DataSource = pRO;
            Monat monat;
            Enum.TryParse(pRO.Month, out monat);
            var monatInt = (int) monat;
            var daysInMonth = DateTime.DaysInMonth(pRO.Year, monatInt);

            xrTableCell30.Visible = daysInMonth >= 29;
            xrTableCell31.Visible = daysInMonth >= 30;
            xrTableCell32.Visible = daysInMonth == 31;

            xrTableCell62.Visible = xrTableCell30.Visible;
            xrTableCell63.Visible = xrTableCell31.Visible;
            xrTableCell64.Visible = xrTableCell32.Visible;
        }
    }
}
