private XRTable CreateTasksTable(ShiftPlanTask_Report task, float tableWidth) { XRTable table = new XRTable(); table.BeginInit(); table.BorderWidth = 1; table.WidthF = tableWidth; table.Borders = BorderSide.All; table.BorderColor = Color.FromArgb(195, 197, 197); table.TextAlignment = TextAlignment.MiddleLeft; table.Font = new Font("Arial", 8, FontStyle.Regular); table.KeepTogether = true; XRTableRow row; XRTableCell cell; string workOrder = " [" + task.WorkOrder + "]"; var locationsstr = String.Join(",", task.Locations.Select(x => x.Location).ToList()); string description = !String.IsNullOrEmpty(task.WorkOrder) ? task.Description + workOrder : task.Description; description = description + " " + locationsstr; string compperccolor = "#ebf3fb"; string completionPercentagestr = task.CompletionPercentage == null ? "" : task.CompletionPercentage.ToString(); var completionPercentage = task.CompletionPercentage == null ? null : task.CompletionPercentage; if (completionPercentage != null) { if (completionPercentage >= 100) {// green compperccolor = "#7eff70"; } if (completionPercentage < 100 && completionPercentage >= 80) {// yelow compperccolor = "#ffe561"; } if (completionPercentage < 80 && completionPercentage >= 0) {// red compperccolor = "#ff5d47"; } } var compcolor = completionPercentage != null?ColorTranslator.FromHtml(compperccolor) : _LightBlue; if (String.IsNullOrEmpty(task.TypeColor)) { row = new XRTableRow { HeightF = 25F, Padding = new PaddingInfo(5, 5, 5, 5), KeepTogether = true }; row.Cells.Add(new XRTableCell { Text = task.Priority, WidthF = 45F, TextAlignment = TextAlignment.MiddleCenter, BackColor = Color.FromArgb(238, 235, 235), Font = new Font("Arial", 8, FontStyle.Bold), KeepTogether = true }); cell = new XRTableCell() { KeepTogether = true }; var icons = new List <string>(); // Tags icons.AddRange(TagUtil.GetTagsForPrinting(task.Tags, new List <Tag>())); var descHtml = "<div style=\"padding: 0; margin: 0; font-size: 10pt; font-family: Calibri; font-weight: bold\">" + description + " " + string.Join(" ", icons) + "</div>"; var descRt = new XRRichText { Padding = new PaddingInfo(2, 2, 2, 2), TopF = 2, LeftF = 2, WidthF = tableWidth - 135F - 4, HeightF = 21, Html = descHtml, Borders = BorderSide.None, CanGrow = true, AnchorVertical = VerticalAnchorStyles.None, KeepTogether = true }; cell.Controls.Add(descRt); cell.WidthF = tableWidth - 135f; row.Cells.Add(cell); cell.BackColor = Color.FromArgb(248, 248, 248); //row.Cells.Add(new XRTableCell { Text = description, WidthF = tableWidth - 45F, BackColor = Color.FromArgb(248, 248, 248) }); row.Cells.Add(new XRTableCell { Text = task.TargetAndUnitShortCode, WidthF = 45F, TextAlignment = TextAlignment.MiddleCenter, BackColor = Color.FromArgb(238, 235, 235), Font = new Font("Arial", 8, FontStyle.Bold), KeepTogether = true }); row.Cells.Add(new XRTableCell { Text = completionPercentagestr, BackColor = compcolor, WidthF = 45F, TextAlignment = TextAlignment.MiddleCenter, Font = new Font("Arial", 8, FontStyle.Bold), KeepTogether = true }); table.Rows.Add(row); } else { BorderSide topBorders = BorderSide.All; row = new XRTableRow { HeightF = 25F, Padding = new PaddingInfo(5, 5, 5, 5), KeepTogether = true }; row.Cells.Add(new XRTableCell { WidthF = 10F, BackColor = ColorTranslator.FromHtml("#" + task.TypeColor), Borders = topBorders, KeepTogether = true }); row.Cells.Add(new XRTableCell { Text = task.Priority, WidthF = 35F, TextAlignment = TextAlignment.MiddleCenter, BackColor = Color.FromArgb(238, 235, 235), Font = new Font("Arial", 8, FontStyle.Bold), KeepTogether = true }); cell = new XRTableCell() { KeepTogether = true }; var icons = new List <string>(); if (task.Shadow) { icons.Add("<img src=\"/content/images/shared/shadow-task.png\" style=\"width: 16px; height: 12px; vertical-align: middle\">"); } //if (task.Priority.IndexOf("S", StringComparison.OrdinalIgnoreCase) > -1) // icons.Add("<img src=\"" + Settings.GetSettings().Host.TrimEnd('/') + "/workspace/build/production/Fewzion/resources/images/shared/statutory-red.png\" style=\"width: 12px; height: 12px; vertical-align: middle\">"); //if (task.Source == "Mainstay") // icons.Add("<img src=\"" + Settings.GetSettings().Host.TrimEnd('/') + "/workspace/build/production/Fewzion/resources/images/shared/mainstay.png\" style=\"width: 12px; height: 12px; vertical-align: middle\">"); // Tags icons.AddRange(TagUtil.GetTagsForPrinting(task.Tags, new List <Tag>())); var descHtml = "<div style=\"padding: 0; margin: 0; font-size: 10pt; font-family: Calibri; font-weight: bold\">" + description + " " + string.Join(" ", icons) + "</div>"; var descRt = new XRRichText { Padding = new PaddingInfo(2, 2, 2, 2), TopF = 2, LeftF = 2, WidthF = tableWidth - 135F - 4, HeightF = 21, Html = descHtml, Borders = BorderSide.None, CanGrow = true, AnchorVertical = VerticalAnchorStyles.None, KeepTogether = true }; cell.Controls.Add(descRt); cell.WidthF = tableWidth - 135f; cell.BackColor = Color.FromArgb(248, 248, 248); row.Cells.Add(cell); //row.Cells.Add(new XRTableCell { Text = description, WidthF = tableWidth - 45F, BackColor = Color.FromArgb(248, 248, 248) }); row.Cells.Add(new XRTableCell { Text = task.TargetAndUnitShortCode, WidthF = 45F, TextAlignment = TextAlignment.MiddleCenter, BackColor = Color.FromArgb(238, 235, 235), Font = new Font("Arial", 8, FontStyle.Bold), KeepTogether = true }); row.Cells.Add(new XRTableCell { Text = completionPercentagestr, WidthF = 45F, TextAlignment = TextAlignment.MiddleCenter, BackColor = compcolor, Font = new Font("Arial", 8, FontStyle.Bold), KeepTogether = true }); table.Rows.Add(row); } table.EndInit(); return(table); }