46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Globalization;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
namespace BeWo.Report.DefaultReports
|
|
{
|
|
public partial class AbsenceReport : XtraReport, IBeWoReport<AbsenceRO>
|
|
{
|
|
public AbsenceReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(AbsenceRO pRO)
|
|
{
|
|
int i = DateTime.DaysInMonth(pRO.ReportFilter.Year, pRO.ReportFilter.Month);
|
|
|
|
cellHeader29.Visible = cellDetail29.Visible = i >= 29;
|
|
cellHeader30.Visible = cellDetail30.Visible = i >= 30;
|
|
cellHeader31.Visible = cellDetail31.Visible = i >= 31;
|
|
|
|
bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void Cell_EvaluateBinding(object sender, BindingEventArgs e)
|
|
{
|
|
var cell = sender as XRTableCell;
|
|
|
|
var sv = e.Value as CellValue;
|
|
if (sv != null && !string.IsNullOrEmpty(sv.Color))
|
|
{
|
|
int argb = Int32.Parse(sv.Color.Replace("#", ""), NumberStyles.HexNumber);
|
|
Color clr = Color.FromArgb(argb);
|
|
|
|
cell.BackColor = clr;
|
|
}
|
|
else
|
|
{
|
|
cell.BackColor = Color.Transparent;
|
|
}
|
|
}
|
|
}
|
|
}
|