MH: Änderungen des Dienstplaner-Drucks

This commit is contained in:
Marcel Hirschle
2021-05-06 09:47:00 +02:00
parent 1e7c4a8e12
commit 9dc3cda2ce
7 changed files with 114 additions and 40 deletions

View File

@@ -43,14 +43,6 @@ namespace BeWo.View.Detail.Report
{
private DienstplanerRootDC _DienstplanerRootObj;
//private List<CompactWohnheimDC> _Wohnheime;
//private List<DienstBlockDC> _DienstDCListe;
//private List<DienstZeileDC> _DienstEintragListe;
//private List<DienstInfoDC> _AlleDienste;
//private List<DienstEintragDC> _AlleDienstEintraege;
//private List<DienstvertretungDC> _AlleDienstvertretungen;
//private List<FeiertagDC> _Feiertage;
private GridColumn _ColumnEmp;
private List<GridColumn> _ColumnDays;
private GridColumn _ColumnMonth;
@@ -1419,7 +1411,19 @@ namespace BeWo.View.Detail.Report
+ "/ReportView.aspx"
+ "?type=" + Utils.EnumName(ReportTypes.RosterReport)
+ "&wid=" + wOid
+ "&dt=" + date.ToString("MM.yyyy");
+ "&dt=" + date.ToString("MM.yyyy")
+ "&ft=";
List<int> tage = new List<int>();
foreach (var feiertag in _DienstplanerRootObj.Feiertage)
{
if (feiertag.Datum.Month == date.Month)
tage.Add(feiertag.Datum.Day);
}
url += string.Join(";", tage);
linkPdfExport.NavigateUri = new Uri(url);
}

View File

@@ -699,8 +699,12 @@ namespace Host
{
DateTime dt = DateTime.ParseExact(Request.Params["dt"], "MM.yyyy", CultureInfo.InvariantCulture);
long wOid = int.Parse(Request.Params["wid"]);
List<int> feiertage = new List<int>();
return reportCreator.CreateRosterReport(wOid, dt);
if (Request.Params["ft"] != null)
feiertage = Request.Params["ft"].Split(';').Select(int.Parse).ToList();
return reportCreator.CreateRosterReport(wOid, dt, feiertage);
}
private XtraReport CreateVorlagenReport()

View File

@@ -81,7 +81,7 @@ namespace BeWo.Report
public abstract XtraReport CreateAbsenceReport(DateTime dt, List<long> abs, List<long> empTypes, List<long> teams, List<int> feiertage);
public abstract XtraReport CreateRosterReport(long wOid, DateTime dt);
public abstract XtraReport CreateRosterReport(long wOid, DateTime dt, List<int> feiertage);
public abstract XtraReport CreateKilometerauswertung(long customerOid, DateTime rangeDate);

View File

@@ -959,7 +959,7 @@ namespace BeWo.Report
return report as XtraReport;
}
public override XtraReport CreateRosterReport(long wOid, DateTime dt)
public override XtraReport CreateRosterReport(long wOid, DateTime dt, List<int> feiertage)
{
var service = new OperationsServiceImp();
var service2 = new CustomerServiceImp();
@@ -984,7 +984,7 @@ namespace BeWo.Report
//report.SetReportDataSource(RosterRO.Create(service.GetDienstEintraege(wOid, dt.Year, dt.Month), service.GetAllDienste(), service2.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month));
report.SetReportDataSource(RosterRO.CreateNew(dienstEintraege, vertretungen, employee,
service.GetAllDienste(), service2.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month));
service.GetAllDienste(), service2.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month, feiertage));
return report as XtraReport;
}

View File

@@ -23,9 +23,15 @@ namespace BeWo.Report.DefaultReports
public Tuple<XRTableCell, XRTableCell> Month { get; set; }
public DateTime monthAndYear { get; set; }
public int Modifier { get; set; }
public int LastIndex { get; set; }
public bool LastCellWasWo { get; set; }
public List<int> Feiertage { get; set; }
public RosterReport()
{
Modifier = 0;
LastCellWasWo = false;
InitializeComponent();
InitializeComponent2();
}
@@ -34,6 +40,7 @@ namespace BeWo.Report.DefaultReports
{
int days = DateTime.DaysInMonth(pRO.ReportDateTime.Year, pRO.ReportDateTime.Month);
monthAndYear = new DateTime(pRO.ReportDateTime.Year, pRO.ReportDateTime.Month, 1);
Feiertage = pRO.Feiertage;
Table1.BeginInit();
Table2.BeginInit();
@@ -69,7 +76,6 @@ namespace BeWo.Report.DefaultReports
SetWeekDayNames(monthAndYear.Year, monthAndYear.Month, DateTime.DaysInMonth(monthAndYear.Year, monthAndYear.Month));
bindingSource1.DataSource = pRO;
List<DienstInfoDC> dienste = new List<DienstInfoDC>();
@@ -131,17 +137,7 @@ namespace BeWo.Report.DefaultReports
}
}
private void SetWeekDayNames(int year, int month, int numberOfDays)
{
for (int i = 1; i <= numberOfDays; i++)
{
DateTime date = new DateTime(year, month, i);
CultureInfo c = new CultureInfo("de-DE");
string weekday = c.DateTimeFormat.GetAbbreviatedDayName(date.DayOfWeek);
Table1.Rows[0].Cells[i].Text += "\n" + weekday;
}
}
private string AdaptTime(TimeSpan start, TimeSpan ende)
{
@@ -201,7 +197,7 @@ namespace BeWo.Report.DefaultReports
var empColumn = CreateColumn(0x0D, "Mitarbeiter", 0.5, false);
var empColumn = CreateColumn(0x0D, "Mitarbeiter", 0.33, false);
empColumn.Item2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "RosterReportRows.Title")});
@@ -210,7 +206,7 @@ namespace BeWo.Report.DefaultReports
Days = new Tuple<XRTableCell, XRTableCell>[31];
for (int i = 0; i < Days.Length; i++)
{
var dayColumn = CreateColumn(0x0C, $"{i + 1}.", 0.08, false);
var dayColumn = CreateColumn(0x0C, $"{i + 1}.", 0.10, false);
monthAndYear = new DateTime(monthAndYear.Year, monthAndYear.Month, i + 1);
dayColumn.Item2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, $"RosterReportRows.Day{ i + 1 }") });
dayColumn.Item2.EvaluateBinding += new DevExpress.XtraReports.UI.BindingEventHandler(this.Cell_EvaluateBinding);
@@ -220,7 +216,7 @@ namespace BeWo.Report.DefaultReports
Weeks = new Tuple<XRTableCell, XRTableCell>[6];
for (int i = 0; i < Weeks.Length; i++)
{
var weekColumns = CreateColumn(0x0C, "Wo.", 0.16, false);
var weekColumns = CreateColumn(0x0C, "Wo.", 0.10, false);
weekColumns.Item2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, $"RosterReportRows.Week{ i + 1 }", "{0:F2}")});
weekColumns.Item2.EvaluateBinding += new DevExpress.XtraReports.UI.BindingEventHandler(this.Cell_EvaluateBinding);
@@ -279,18 +275,87 @@ namespace BeWo.Report.DefaultReports
{
cell.BackColor = Color.Transparent;
cell.ForeColor = Color.Black;
if (cell.Index <= DateTime.DaysInMonth(monthAndYear.Year, monthAndYear.Month))
var index = cell.Index;
if (Table1.Rows[0].Cells[index].Text.Contains("Wo")) // Damit mal versuchen..int index = cell.Index;
{
DateTime date = new DateTime(monthAndYear.Year, monthAndYear.Month, cell.Index);
if (date.DayOfWeek == DayOfWeek.Sunday)
cell.BackColor = Color.LightPink;
//else if (Feiertage != null)
//{
// if (Feiertage.Contains(date.Day))
// cell.BackColor = Color.LightPink;
//}
LastCellWasWo = true;
return;
}
if (LastCellWasWo)
{
cell.Row.Cells[index].BackColor = Color.LightPink;
LastCellWasWo = false;
}
else if (Feiertage != null)
{
if (Feiertage.Count > 0)
{
var header = Table1.Rows[0].Cells[index].Text;
int tag = 0;
if (header.Length == 4)
{
tag = int.Parse(header.Remove(2, 2));
}
else
{
tag = int.Parse(header.Remove(1, 2));
}
foreach (var feiertag in Feiertage)
{
if (tag == feiertag)
cell.Row.Cells[index].BackColor = Color.LightPink;
}
}
}
//if (index > LastIndex)
// Modifier = 0;
//if (index <= DateTime.DaysInMonth(monthAndYear.Year, monthAndYear.Month))
//{
// DateTime date = new DateTime(monthAndYear.Year, monthAndYear.Month, index);
// if (date.DayOfWeek == DayOfWeek.Sunday)
// {
// cell.Row.Cells[index].BackColor = Color.LightPink;
// Modifier++;
// }
// LastIndex = index;
//else if (Feiertage != null)
//{
// if (Feiertage.Contains(date.Day))
// cell.BackColor = Color.LightPink;
//}
//}
}
}
private void SetWeekDayNames(int year, int month, int numberOfDays)
{
int skipper = 0;
for (int i = 1; i <= numberOfDays; i++)
{
if (!Table1.Rows[0].Cells[i + skipper].Text.Contains("Wo"))
{
DateTime date = new DateTime(year, month, i);
CultureInfo c = new CultureInfo("de-DE");
string weekday = c.DateTimeFormat.GetAbbreviatedDayName(date.DayOfWeek);
weekday = weekday.Remove(weekday.Length - 1, 1);
Table1.Rows[0].Cells[i + skipper].Text += weekday;
}
else
{
skipper++;
i--;
}
}
}
private System.Windows.Media.Color TransformStringToColor(string colorString)

View File

@@ -431,7 +431,6 @@
<DependentUpon>ServicesOverviewReport.cs</DependentUpon>
</Compile>
<Compile Include="DefaultReportCreator.cs" />
<Compile Include="ReportObjects\FlsAuslastungsauswertungRO.cs" />
<Compile Include="ReportObjects\RosterRO.cs" />
<Compile Include="ReportObjects\AdditionalServiceBookingRO.cs" />
<Compile Include="ReportObjects\AbsenceRO.cs" />

View File

@@ -14,6 +14,7 @@ namespace BeWo.Report.ReportObjects
public string WohnheimName { get; set; }
public List<RosterReportRow> RosterReportRows { get; set; }
public int FirstWeekDay { get; set; }
public List<int> Feiertage { get; set; }
public RosterRO()
{
@@ -82,7 +83,7 @@ namespace BeWo.Report.ReportObjects
return res;
}
public static RosterRO CreateNew(List<DienstEintragDC> dienstEintragDCs, List<DienstvertretungDC> dienstvertretungDCs, List<EmployeeDC> employee, List<DienstInfoDC> dienstInfoDCs, BS.Shared.DataContracts.Compact.CompactWohnheimDC compactWohnheimDC, int year, int month)
public static RosterRO CreateNew(List<DienstEintragDC> dienstEintragDCs, List<DienstvertretungDC> dienstvertretungDCs, List<EmployeeDC> employee, List<DienstInfoDC> dienstInfoDCs, BS.Shared.DataContracts.Compact.CompactWohnheimDC compactWohnheimDC, int year, int month, List<int> feiertage)
{
var dt = new DateTime(year, month, 1);
// Result
@@ -90,7 +91,8 @@ namespace BeWo.Report.ReportObjects
{
WohnheimName = compactWohnheimDC.WohnheimName,
ReportDateTime = dt,
FirstWeekDay = ((int)dt.DayOfWeek - 1) % 7
FirstWeekDay = ((int)dt.DayOfWeek - 1) % 7,
Feiertage = feiertage
};
// WD V F Formel
// Mo 1 0 (tag - 1) / 7