64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace MuenchenerAidsHilfeEV
|
|
{
|
|
public class CustomReportCreator : DefaultReportCreator
|
|
{
|
|
public override XtraReport CreateQueryReport(long queryOid, string queryReportId)
|
|
{
|
|
if (queryOid == 100)
|
|
{
|
|
return CreateUeberUnterbringungReport(queryOid, queryReportId);
|
|
}
|
|
|
|
return base.CreateQueryReport(queryOid, queryReportId);
|
|
}
|
|
|
|
private XtraReport CreateUeberUnterbringungReport(long queryOid, string queryReportId)
|
|
{
|
|
var query = DAOFactory.GenericDAO.LoadByID<Query>(queryOid);
|
|
|
|
if (query == null)
|
|
return new XtraReport();
|
|
|
|
var path = Path.Combine(TempPath, queryReportId + ".xml");
|
|
var table = Utils.XMLDeserialize<DataTable>(path);
|
|
var qro = QueryRO.Create(query, table);
|
|
|
|
if (qro.Rows.Count > 0)
|
|
{
|
|
DateTime monat = DateTime.Parse(qro.Rows[0].Field1.ToString());
|
|
DateTimeSpan span = new DateTimeSpan();
|
|
span.StartDateTime = monat;
|
|
span.EndDateTime = monat.AddMonths(1).AddTicks(-1);
|
|
|
|
MitarbeiterauslastungRO ro = MitarbeiterauslastungRO.Create(null, null, monat, monat.AddMonths(1));
|
|
UeberUnterbelegungReport report = new UeberUnterbelegungReport();
|
|
report.SetReportDataSource(ro);
|
|
|
|
if (report != null)
|
|
{
|
|
return report;
|
|
}
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
|
|
}
|
|
}
|