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

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

        public void SetReportDataSource(SettlementRO pRO)
        {
            //if (pRO.ClaimWithEigenbeteiligung < 0)
            //{
            //    lblClaimText1.Text = "Rückzahlungsanspruch LWL:";
            //    lblClaimText2.Text = "Rückzahlungsanspruch LWL:";
            //}
            //else
            //{
            //    lblClaimText1.Text = "Betrag:";
            //    lblClaimText2.Text = "Betrag:";
            //}

            xrPanel1Amount.Location = xrPanel2Amounts.Location;
			xrPanel3Amounts.Location = xrPanel2Amounts.Location;

            if (pRO.DifferentHourlyRateCount == 1)
            {
                xrPanel2Amounts.Visible = false;
				xrPanel3Amounts.Visible = false;
                xrPanel1Amount.Visible = true;

                cellStart1.Text = pRO.AccountingStartDateString;
                cellEnde1.Text = pRO.AccountingEndDateString;
                cellStundensatz1.Text = pRO.HourlyRateNewString;
                cellFLS1.Text = pRO.RecordedFLSWithNewHourlyRateString;
                
            }

            else if (pRO.DifferentHourlyRateCount == 2)
            {
                xrPanel2Amounts.Visible = true;
				xrPanel3Amounts.Visible = false;
                xrPanel1Amount.Visible = false;

                cellStart1.Text = pRO.AccountingStartDateString;
                cellEnde1.Text = pRO.HourlyRateOldEndDateString;
                cellStundensatz1.Text = pRO.HourlyRateOldString;
                cellFLS1.Text = pRO.RecordedFLSWithOldHourlyRateString;

                cellStart2.Text = pRO.HourlyRateNewStartDateString;
                cellEnde2.Text = pRO.AccountingEndDateString;
                cellStundensatz2.Text = pRO.HourlyRateNewString;
                cellFLS2.Text = pRO.RecordedFLSWithNewHourlyRateString;
            }
            else if (pRO.DifferentHourlyRateCount == 3)
            {
				xrPanel3Amounts.Visible = true;
                xrPanel2Amounts.Visible = false;
                xrPanel1Amount.Visible = false;

                cellStart1.Text = pRO.AccountingStartDateString;
                cellEnde1.Text = pRO.HourlyRate3EndDateString;
                cellStundensatz1.Text = pRO.HourlyRate3String;
                cellFLS1.Text = pRO.RecordedFLSWithHourlyRate3String;

                cellStart2.Text = pRO.HourlyRateOldStartDateString;
                cellEnde2.Text = pRO.HourlyRateOldEndDateString;
                cellStundensatz2.Text = pRO.HourlyRateOldString;
                cellFLS2.Text = pRO.RecordedFLSWithOldHourlyRateString;
                
                cellStart3.Text = pRO.HourlyRateNewStartDateString;
                cellEnde3.Text = pRO.AccountingEndDateString;
                cellStundensatz3.Text = pRO.HourlyRateNewString;
                cellFLS3.Text = pRO.RecordedFLSWithNewHourlyRateString;
            }

            this.bindingSource1.DataSource = pRO;
        }
    }
}
