diff --git a/ReportImp/AlphaEv/AlphaEv.csproj b/ReportImp/AlphaEv/AlphaEv.csproj index 00553f08f..a3bc09432 100644 --- a/ReportImp/AlphaEv/AlphaEv.csproj +++ b/ReportImp/AlphaEv/AlphaEv.csproj @@ -108,6 +108,12 @@ AuswertungSozialdienstAlt.cs + + Component + + + RosterReport.cs + Component @@ -182,6 +188,10 @@ AuswertungSozialdienstAlt.cs + + RosterReport.cs + Designer + ServiceInvoiceReport.cs Designer diff --git a/ReportImp/AlphaEv/RosterReport.Designer.cs b/ReportImp/AlphaEv/RosterReport.Designer.cs new file mode 100644 index 000000000..7754673e1 --- /dev/null +++ b/ReportImp/AlphaEv/RosterReport.Designer.cs @@ -0,0 +1,320 @@ +using BeWo.Report.ReportObjects; +namespace BeWo.Report.DefaultReports +{ + partial class RosterReport + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.Detail = new DevExpress.XtraReports.UI.DetailBand(); + this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); + this.xrPageInfo1 = new DevExpress.XtraReports.UI.XRPageInfo(); + this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); + this.DetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); + this.Detail1 = new DevExpress.XtraReports.UI.DetailBand(); + this.ReportFooter = new DevExpress.XtraReports.UI.ReportFooterBand(); + this.xrLabel_Image = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel_Time = new DevExpress.XtraReports.UI.XRLabel(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); + this.ruleNotApprovedAndExpiringNext4Months = new DevExpress.XtraReports.UI.FormattingRule(); + this.ruleNotApprovedAndExpiringNext8Months = new DevExpress.XtraReports.UI.FormattingRule(); + this.PageHeader = new DevExpress.XtraReports.UI.PageHeaderBand(); + this.PageFooter = new DevExpress.XtraReports.UI.PageFooterBand(); + this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); + this.lblErsteller = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrPageInfo2 = new DevExpress.XtraReports.UI.XRPageInfo(); + this.approvedText = new DevExpress.XtraReports.UI.CalculatedField(); + this.topMarginBand1 = new DevExpress.XtraReports.UI.TopMarginBand(); + this.bottomMarginBand1 = new DevExpress.XtraReports.UI.BottomMarginBand(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); + // + // Detail + // + this.Detail.HeightF = 0F; + this.Detail.Name = "Detail"; + this.Detail.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); + this.Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; + // + // ReportHeader + // + this.ReportHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrPageInfo1, + this.xrLabel1}); + this.ReportHeader.HeightF = 48.95833F; + this.ReportHeader.Name = "ReportHeader"; + // + // xrPageInfo1 + // + this.xrPageInfo1.Font = new System.Drawing.Font("Arial", 8F); + this.xrPageInfo1.LocationFloat = new DevExpress.Utils.PointFloat(835.1252F, 0F); + this.xrPageInfo1.Name = "xrPageInfo1"; + this.xrPageInfo1.PageInfo = DevExpress.XtraPrinting.PageInfo.DateTime; + this.xrPageInfo1.SizeF = new System.Drawing.SizeF(273.8748F, 23F); + this.xrPageInfo1.StylePriority.UseFont = false; + this.xrPageInfo1.StylePriority.UseTextAlignment = false; + this.xrPageInfo1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomRight; + // + // xrLabel1 + // + this.xrLabel1.Font = new System.Drawing.Font("Arial", 14F); + this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); + this.xrLabel1.Multiline = true; + this.xrLabel1.Name = "xrLabel1"; + this.xrLabel1.SizeF = new System.Drawing.SizeF(835.125F, 25F); + this.xrLabel1.StylePriority.UseFont = false; + this.xrLabel1.StylePriority.UseTextAlignment = false; + this.xrLabel1.Text = "Dienstplan für \"[WohnheimName]\" ([ReportDateTime!MMMM yyyy])"; + this.xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomLeft; + // + // DetailReport + // + this.DetailReport.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { + this.Detail1, + this.ReportFooter}); + this.DetailReport.DataMember = "RosterReportRows"; + this.DetailReport.DataSource = this.bindingSource1; + this.DetailReport.Level = 0; + this.DetailReport.Name = "DetailReport"; + // + // Detail1 + // + this.Detail1.HeightF = 20.00001F; + this.Detail1.Name = "Detail1"; + this.Detail1.StylePriority.UseBackColor = false; + // + // ReportFooter + // + this.ReportFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel_Image, + this.xrLabel_Time}); + this.ReportFooter.HeightF = 80.20834F; + this.ReportFooter.Name = "ReportFooter"; + // + // xrLabel_Image + // + this.xrLabel_Image.BorderColor = System.Drawing.Color.Transparent; + this.xrLabel_Image.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) + | DevExpress.XtraPrinting.BorderSide.Right) + | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.xrLabel_Image.BorderWidth = 0.25F; + this.xrLabel_Image.Font = new System.Drawing.Font("Arial", 8F); + this.xrLabel_Image.LocationFloat = new DevExpress.Utils.PointFloat(55F, 32.92F); + this.xrLabel_Image.Multiline = true; + this.xrLabel_Image.Name = "xrLabel_Image"; + this.xrLabel_Image.SizeF = new System.Drawing.SizeF(20F, 20F); + this.xrLabel_Image.StylePriority.UseBorderColor = false; + this.xrLabel_Image.StylePriority.UseBorders = false; + this.xrLabel_Image.StylePriority.UseBorderWidth = false; + this.xrLabel_Image.StylePriority.UseFont = false; + this.xrLabel_Image.StylePriority.UseTextAlignment = false; + this.xrLabel_Image.Text = "\r\n"; + this.xrLabel_Image.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + // + // xrLabel_Time + // + this.xrLabel_Time.Font = new System.Drawing.Font("Arial", 8F); + this.xrLabel_Time.LocationFloat = new DevExpress.Utils.PointFloat(85F, 32.92F); + this.xrLabel_Time.Multiline = true; + this.xrLabel_Time.Name = "xrLabel_Time"; + this.xrLabel_Time.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 0, 0, 0, 100F); + this.xrLabel_Time.SizeF = new System.Drawing.SizeF(124.36F, 19.99581F); + this.xrLabel_Time.StylePriority.UseFont = false; + this.xrLabel_Time.StylePriority.UsePadding = false; + this.xrLabel_Time.StylePriority.UseTextAlignment = false; + this.xrLabel_Time.Text = "\r\n"; + this.xrLabel_Time.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.RosterRO); + // + // ruleNotApprovedAndExpiringNext4Months + // + this.ruleNotApprovedAndExpiringNext4Months.Condition = "[IsApproved] == False And [OpenMonths] < 4"; + this.ruleNotApprovedAndExpiringNext4Months.DataMember = "SupportConceptDetailList"; + this.ruleNotApprovedAndExpiringNext4Months.Formatting.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); + this.ruleNotApprovedAndExpiringNext4Months.Name = "ruleNotApprovedAndExpiringNext4Months"; + // + // ruleNotApprovedAndExpiringNext8Months + // + this.ruleNotApprovedAndExpiringNext8Months.Condition = "[IsApproved] == False And [OpenMonths] < 8 And [OpenMonths] >= 4"; + this.ruleNotApprovedAndExpiringNext8Months.DataMember = "SupportConceptDetailList"; + this.ruleNotApprovedAndExpiringNext8Months.Formatting.BackColor = System.Drawing.Color.LightBlue; + this.ruleNotApprovedAndExpiringNext8Months.Name = "ruleNotApprovedAndExpiringNext8Months"; + // + // PageHeader + // + this.PageHeader.HeightF = 20F; + this.PageHeader.Name = "PageHeader"; + this.PageHeader.StylePriority.UseBorderColor = false; + this.PageHeader.StylePriority.UseTextAlignment = false; + this.PageHeader.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopCenter; + // + // PageFooter + // + this.PageFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel4, + this.xrLabel3, + this.lblErsteller, + this.xrLabel2, + this.xrPageInfo2}); + this.PageFooter.HeightF = 76.87505F; + this.PageFooter.Name = "PageFooter"; + // + // xrLabel4 + // + this.xrLabel4.Borders = DevExpress.XtraPrinting.BorderSide.Bottom; + this.xrLabel4.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.xrLabel4.LocationFloat = new DevExpress.Utils.PointFloat(393.9375F, 33.87502F); + this.xrLabel4.Multiline = true; + this.xrLabel4.Name = "xrLabel4"; + this.xrLabel4.SizeF = new System.Drawing.SizeF(157F, 25F); + this.xrLabel4.StylePriority.UseBorders = false; + this.xrLabel4.StylePriority.UseFont = false; + this.xrLabel4.StylePriority.UseTextAlignment = false; + this.xrLabel4.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomLeft; + // + // xrLabel3 + // + this.xrLabel3.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.xrLabel3.LocationFloat = new DevExpress.Utils.PointFloat(302.5625F, 33.87502F); + this.xrLabel3.Multiline = true; + this.xrLabel3.Name = "xrLabel3"; + this.xrLabel3.SizeF = new System.Drawing.SizeF(91.37497F, 25F); + this.xrLabel3.StylePriority.UseFont = false; + this.xrLabel3.StylePriority.UseTextAlignment = false; + this.xrLabel3.Text = "Unterschrift:"; + this.xrLabel3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomLeft; + // + // lblErsteller + // + this.lblErsteller.Borders = DevExpress.XtraPrinting.BorderSide.Bottom; + this.lblErsteller.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblErsteller.LocationFloat = new DevExpress.Utils.PointFloat(91.37497F, 33.87502F); + this.lblErsteller.Multiline = true; + this.lblErsteller.Name = "lblErsteller"; + this.lblErsteller.SizeF = new System.Drawing.SizeF(157F, 25F); + this.lblErsteller.StylePriority.UseBorders = false; + this.lblErsteller.StylePriority.UseFont = false; + this.lblErsteller.StylePriority.UseTextAlignment = false; + this.lblErsteller.Text = "Antijana Luburic"; + this.lblErsteller.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomLeft; + // + // xrLabel2 + // + this.xrLabel2.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.xrLabel2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 33.87502F); + this.xrLabel2.Multiline = true; + this.xrLabel2.Name = "xrLabel2"; + this.xrLabel2.SizeF = new System.Drawing.SizeF(91.37497F, 25F); + this.xrLabel2.StylePriority.UseFont = false; + this.xrLabel2.StylePriority.UseTextAlignment = false; + this.xrLabel2.Text = "Ersteller*in:"; + this.xrLabel2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomLeft; + // + // xrPageInfo2 + // + this.xrPageInfo2.Font = new System.Drawing.Font("Arial", 8F); + this.xrPageInfo2.Format = "Seite {0} von {1}"; + this.xrPageInfo2.LocationFloat = new DevExpress.Utils.PointFloat(1024.917F, 33.87502F); + this.xrPageInfo2.Name = "xrPageInfo2"; + this.xrPageInfo2.SizeF = new System.Drawing.SizeF(74.08325F, 18F); + this.xrPageInfo2.StylePriority.UseFont = false; + this.xrPageInfo2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; + // + // approvedText + // + this.approvedText.DataMember = "SupportConceptDetailList"; + this.approvedText.Expression = "Iif([IsApproved], \'bewilligt\' , \'nicht bewilligt\')"; + this.approvedText.Name = "approvedText"; + // + // topMarginBand1 + // + this.topMarginBand1.HeightF = 50F; + this.topMarginBand1.Name = "topMarginBand1"; + // + // bottomMarginBand1 + // + this.bottomMarginBand1.HeightF = 20F; + this.bottomMarginBand1.Name = "bottomMarginBand1"; + // + // RosterReport + // + this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { + this.Detail, + this.ReportHeader, + this.DetailReport, + this.PageHeader, + this.PageFooter, + this.topMarginBand1, + this.bottomMarginBand1}); + this.CalculatedFields.AddRange(new DevExpress.XtraReports.UI.CalculatedField[] { + this.approvedText}); + this.DataSource = this.bindingSource1; + this.FormattingRuleSheet.AddRange(new DevExpress.XtraReports.UI.FormattingRule[] { + this.ruleNotApprovedAndExpiringNext8Months, + this.ruleNotApprovedAndExpiringNext4Months}); + this.Landscape = true; + this.Margins = new System.Drawing.Printing.Margins(30, 30, 50, 20); + this.PageHeight = 827; + this.PageWidth = 1169; + this.PaperKind = System.Drawing.Printing.PaperKind.A4; + this.Version = "17.1"; + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); + + } + + #endregion + + private DevExpress.XtraReports.UI.DetailBand Detail; + private System.Windows.Forms.BindingSource bindingSource1; + private DevExpress.XtraReports.UI.ReportHeaderBand ReportHeader; + private DevExpress.XtraReports.UI.DetailReportBand DetailReport; + private DevExpress.XtraReports.UI.DetailBand Detail1; + private DevExpress.XtraReports.UI.PageHeaderBand PageHeader; + private DevExpress.XtraReports.UI.PageFooterBand PageFooter; + private DevExpress.XtraReports.UI.XRPageInfo xrPageInfo2; + private DevExpress.XtraReports.UI.CalculatedField approvedText; + private DevExpress.XtraReports.UI.FormattingRule ruleNotApprovedAndExpiringNext8Months; + private DevExpress.XtraReports.UI.FormattingRule ruleNotApprovedAndExpiringNext4Months; + private DevExpress.XtraReports.UI.TopMarginBand topMarginBand1; + private DevExpress.XtraReports.UI.BottomMarginBand bottomMarginBand1; + private DevExpress.XtraReports.UI.ReportFooterBand ReportFooter; + private DevExpress.XtraReports.UI.XRLabel xrLabel_Image; + private DevExpress.XtraReports.UI.XRLabel xrLabel_Time; + private DevExpress.XtraReports.UI.XRPageInfo xrPageInfo1; + private DevExpress.XtraReports.UI.XRLabel xrLabel1; + private DevExpress.XtraReports.UI.XRLabel xrLabel2; + private DevExpress.XtraReports.UI.XRLabel lblErsteller; + private DevExpress.XtraReports.UI.XRLabel xrLabel3; + private DevExpress.XtraReports.UI.XRLabel xrLabel4; + } +} diff --git a/ReportImp/AlphaEv/RosterReport.cs b/ReportImp/AlphaEv/RosterReport.cs new file mode 100644 index 000000000..96d955d2c --- /dev/null +++ b/ReportImp/AlphaEv/RosterReport.cs @@ -0,0 +1,383 @@ +using System; +using System.Drawing; +using System.Globalization; +using DevExpress.XtraReports.UI; +using BeWo.Report.ReportObjects; +using BS.Shared.DataContracts; +using BS.Shared.Extensions; +using System.Collections.Generic; +using System.Linq; + +namespace BeWo.Report.DefaultReports +{ + public partial class RosterReport : XtraReport, IBeWoReport + { + public XRTable Table1 { get; set; } + public XRTable Table2 { get; set; } + + public XRTableRow Row1 { get; set; } + public XRTableRow Row2 { get; set; } + + public Tuple Title { get; set; } + public Tuple[] Days { get; set; } + public Tuple[] Weeks { get; set; } + public Tuple Month { get; set; } + + public DateTime monthAndYear { get; set; } + public int Modifier { get; set; } + public int LastIndex { get; set; } + public List Feiertage { get; set; } + public List WoIndexes { get; set; } + + public RosterReport() + { + Modifier = 0; + WoIndexes = new List(); + InitializeComponent(); + InitializeComponent2(); + } + + public void SetReportDataSource(RosterRO pRO) + { + 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(); + + Row1.Cells.Clear(); + Row2.Cells.Clear(); + + Row1.Cells.Add(Title.Item1); + Row2.Cells.Add(Title.Item2); + + int w = 0; + + for (int i = 0; i < days; i++) + { + var tmp = Days[i]; + + Row1.Cells.Add(tmp.Item1); + Row2.Cells.Add(tmp.Item2); + + if (pRO.ReportDateTime.AddDays(i).DayOfWeek == DayOfWeek.Sunday) + { + var week = Weeks[w++]; + Row1.Cells.Add(week.Item1); + Row2.Cells.Add(week.Item2); + } + + } + Row1.Cells.Add(Month.Item1); + Row2.Cells.Add(Month.Item2); + + Table1.EndInit(); + Table2.EndInit(); + + SetWeekDayNames(monthAndYear.Year, monthAndYear.Month, DateTime.DaysInMonth(monthAndYear.Year, monthAndYear.Month)); + + bindingSource1.DataSource = pRO; + + List dienste = new List(); + if (pRO.RosterReportRows.Count > 0) + { + if (pRO.RosterReportRows[0].AlleDienste.Count > 0) + { + foreach (var dienst in pRO.RosterReportRows[0].AlleDienste) + dienste.Add(dienst.Value); + } + } + + if (dienste.Count > 0) + { + xrLabel_Image.Text = dienste[0].Kurz; + xrLabel_Image.BackColor = ColorTranslator.FromHtml(dienste[0].Farbe); + xrLabel_Image.BorderColor = Color.Black; + xrLabel_Time.Text = AdaptTime(dienste[0].Start.TimeOfDay, dienste[0].Ende.TimeOfDay); + dienste.RemoveAt(0); + int zeile = 0; + int elem = 1; + int counter = 1; + int schwellwert = 7; + foreach (var d in dienste) + { + var foreColor = Color.Black; + + this.ReportFooter.Controls.Add( + new XRLabel() + { + LocationF = new PointF(xrLabel_Image.WidthF * elem + xrLabel_Time.WidthF * elem + 55f, xrLabel_Time.LocationF.Y + zeile * (xrLabel_Image.HeightF + 10)), + Font = xrLabel_Image.Font, + TextAlignment = xrLabel_Image.TextAlignment, + WidthF = xrLabel_Image.WidthF, + HeightF = xrLabel_Image.HeightF, + Borders = xrLabel_Image.Borders, + BorderColor = Color.Black, + BorderWidth = xrLabel_Image.BorderWidth, + BackColor = ColorTranslator.FromHtml(d.Farbe), + ForeColor = foreColor, + Text = d.Kurz + }); + this.ReportFooter.Controls.Add( + new XRLabel() + { + LocationF = new PointF(xrLabel_Image.WidthF * (elem + 1) + xrLabel_Time.WidthF * elem + 67f, xrLabel_Time.LocationF.Y + zeile * (xrLabel_Time.HeightF + 10)), + Font = xrLabel_Time.Font, + TextAlignment = xrLabel_Time.TextAlignment, + WidthF = xrLabel_Time.WidthF, + HeightF = xrLabel_Time.HeightF, + Text = AdaptTime(d.Start.TimeOfDay, d.Ende.TimeOfDay), + Padding = xrLabel_Time.Padding + }); + + elem++; + counter++; + + if (counter % schwellwert == 0) //Hier muss Wert für x wieder resettet werden + { + zeile++; + elem = 0; + if (schwellwert == 7) + schwellwert++; + counter = 1; + } + + } + } + + } + + + + private string AdaptTime(TimeSpan start, TimeSpan ende) + { + string[] startArray = start.ToString().Split(':'); + string[] endeArray = ende.ToString().Split(':'); + + return startArray[0] + ":" + startArray[1] + " - " + endeArray[0] + ":" + endeArray[1]; + } + + private void InitializeComponent2() + { + Table1 = new XRTable(); + Table2 = new XRTable(); + Row1 = new XRTableRow(); + Row2 = new XRTableRow(); + + Table1.BeginInit(); + Table2.BeginInit(); + + + Table1.BackColor = System.Drawing.Color.LightBlue; + Table1.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) | DevExpress.XtraPrinting.BorderSide.Bottom))); + Table1.Font = new System.Drawing.Font("Arial", 7F, System.Drawing.FontStyle.Bold); + Table1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); + Table1.Name = "xrTable1"; + Table1.Rows.Add(Row1); + Table1.SizeF = new System.Drawing.SizeF(1109F, 20F); + Table1.StylePriority.UseBackColor = false; + Table1.StylePriority.UseBorders = false; + Table1.StylePriority.UseFont = false; + Table1.StylePriority.UseTextAlignment = false; + Table1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + + Table2.BackColor = System.Drawing.Color.Transparent; + Table2.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom))); + Table2.Font = new System.Drawing.Font("Arial", 7F); + Table2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); + Table2.Name = "xrTable2"; + Table2.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); + Table2.Rows.Add(Row2); + Table2.SizeF = new System.Drawing.SizeF(1109F, 20F); + Table2.StylePriority.UseBackColor = false; + Table2.StylePriority.UseBorders = false; + Table2.StylePriority.UseFont = false; + Table2.StylePriority.UsePadding = false; + Table2.StylePriority.UseTextAlignment = false; + Table2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + Table2.CanGrow = false; + + Row1.Name = "xrTableRow1"; + Row1.Weight = 0.47; + + Row2.Name = "xrTableRow2"; + Row2.Weight = 0.47; + Row2.FormattingRules.Add(ruleNotApprovedAndExpiringNext4Months); + Row2.FormattingRules.Add(ruleNotApprovedAndExpiringNext8Months); + + + + 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")}); + + Title = empColumn; + + Days = new Tuple[31]; + for (int i = 0; i < Days.Length; i++) + { + 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); + Days[i] = dayColumn; + } + + Weeks = new Tuple[6]; + for (int i = 0; i < Weeks.Length; i++) + { + 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); + + Weeks[i] = weekColumns; + } + var monthColumn = CreateColumn(0x0D, "Monat", 0.16, false); + monthColumn.Item2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "RosterReportRows.MonthSum", "{0:F2}" )}); + Month = monthColumn; + + PageHeader.Controls.Add(Table1); + + Detail1.Controls.Add(Table2); + Detail1.HeightF = 20; + + + + Table1.EndInit(); + Table2.EndInit(); + } + + private Tuple CreateColumn(byte border, string text, double weight, bool canGrow) + { + var res = new Tuple(new XRTableCell(), new XRTableCell()); + + res.Item1.Borders = DevExpress.XtraPrinting.BorderSide.All; + res.Item1.CanGrow = canGrow; + res.Item1.Text = text; + res.Item1.Weight = weight; + + res.Item2.Borders = (DevExpress.XtraPrinting.BorderSide)border; + res.Item2.CanGrow = canGrow; + res.Item2.Weight = weight; + + return res; + } + + + public int EvalCount { get; set; } + private void Cell_EvaluateBinding(object sender, BindingEventArgs e) + { + EvalCount++; + + var cell = sender as XRTableCell; + var sv = e.Value as DienstInfoDC; + if (sv != null && !string.IsNullOrEmpty(sv.Farbe)) + { + int argb = Int32.Parse(sv.Farbe.Replace("#", ""), NumberStyles.HexNumber); + var clr = Color.FromArgb(argb); + var clr2 = Color.FromArgb(clr.R, clr.G, clr.B); + + cell.BackColor = clr; + cell.ForeColor = /*clr2.IsBrighter(70) ? Color.Black :*/ Color.White; + } + else + { + cell.BackColor = Color.Transparent; + cell.ForeColor = Color.Black; + + var index = cell.Index; + + if (Table1.Rows[0].Cells[index].Text.Contains("Wo")) + { + if (!WoIndexes.Contains(index)) + WoIndexes.Add(index); + return; + } + if (WoIndexes.Any(i => i - 1 == index)) + cell.Row.Cells[index].BackColor = Color.LightGray; + 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 Color TransformStringToColor(string colorString) + { + //Hier bei keiner Farbe String weiß machen(Übergangslösung) + if (colorString == null) + colorString = "#FF7B68EE"; + + + int argb = Int32.Parse(colorString.Replace("#", ""), NumberStyles.HexNumber); + var clr = Color.FromArgb(argb); + + return Color.FromArgb(clr.R, clr.G, clr.B); + } + } +} diff --git a/ReportImp/AlphaEv/RosterReport.resx b/ReportImp/AlphaEv/RosterReport.resx new file mode 100644 index 000000000..d25f3eba2 --- /dev/null +++ b/ReportImp/AlphaEv/RosterReport.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file