public void Init(WorldsTimeRecordingPrintoutContext recordingContext, DateTime viewDate, bool printPlannedValues, bool hideSums) { _recordingContext = recordingContext; _printPlannedValues = printPlannedValues; _hideSums = hideSums; // Hide SUM colums if needed if (_hideSums) { //tbl_DailyCaption.DeleteColumn(lbCell_ContractWorkingHours); tbl_DailyCaption.DeleteColumn(lbCell_AllreadyPlannedWorkingHours); //tbl_DailyCaption.DeleteColumn(lbCell_SummOfAdditionalCharges); //tbl_DailyCaption.DeleteColumn(lbCell_PlusMinusHours); //tbl_DailyCaption.DeleteColumn(lbCell_EmployeeBalanceHours); //tbl_DailyData.DeleteColumn(fieldCell_ContractWorkingHoursPlanned); tbl_DailyData.DeleteColumn(fieldCell_PlannedWorkingHoursPlanned); //tbl_DailyData.DeleteColumn(fieldCell_SumAdditionalHoursPlanned); //tbl_DailyData.DeleteColumn(fieldCell_PlusMinusHoursPlanned); //tbl_DailyData.DeleteColumn(fieldCell_BalanceHoursPlanned); //tbl_DailyData.DeleteColumn(fieldCell_ContractWorkingHours); tbl_DailyData.DeleteColumn(fieldCell_PlannedHours); //tbl_DailyData.DeleteColumn(fieldCell_PlusMinusHours); //tbl_DailyData.DeleteColumn(fieldCell_PlusMinusHours); //tbl_DailyData.DeleteColumn(fieldCell_BalanceHours); } // // Generate columnss // int segmentWidth = Convert.ToInt32(lbCell_0000.Width / 24); lbCell_Employee.Width = fieldCell_EmployeeName.Width = fieldCell_Employee1.Width = lbCell_0000.Right - (segmentWidth * 24); TimeSpan dayTime = TimeSpan.Zero; TimeSpan timeStep = TimeSpan.FromMinutes(60); XRTableCell baseLabelCell = lbCell_0000; XRTableCell basePlannedCell = fieldCell_0000Planned; XRTableCell baseDataCell = fieldCell_0000; while (dayTime.TotalHours < 23) { DateTime columnTime = viewDate.Add(dayTime); // Caption ReportPainter.ApplyCaptionCellFormat(baseLabelCell, columnTime); tbl_DailyCaption.InsertColumnToRight(baseLabelCell); baseLabelCell.Width = segmentWidth; baseLabelCell = baseLabelCell.NextCell; // Planned values tbl_DailyData.InsertColumnToRight(basePlannedCell); basePlannedCell.Tag = columnTime; basePlannedCell.BeforePrint += PrintPlannedCell; //basePlannedCell.SizeChanged += CellSizeChanged; basePlannedCell.Width = segmentWidth; ReportPainter.Insert15MinuteShapes(basePlannedCell, columnTime, false); basePlannedCell = basePlannedCell.NextCell; // Data baseDataCell.Tag = columnTime; baseDataCell.BeforePrint += PrintTimeCell; baseDataCell.Width = segmentWidth; //baseDataCell.SizeChanged += CellSizeChanged; ReportPainter.Insert15MinuteShapes(baseDataCell, columnTime, false); baseDataCell = baseDataCell.NextCell; dayTime = dayTime.Add(timeStep); } DateTime lastColumnTime = viewDate.Add(dayTime); ReportPainter.ApplyCaptionCellFormat(baseLabelCell, lastColumnTime); basePlannedCell.Tag = baseDataCell.Tag = lastColumnTime; basePlannedCell.BeforePrint += PrintPlannedCell; baseDataCell.BeforePrint += PrintTimeCell; ReportPainter.Insert15MinuteShapes(basePlannedCell, lastColumnTime, false); ReportPainter.Insert15MinuteShapes(baseDataCell, lastColumnTime, false); if (!_printPlannedValues) { tbl_DailyData.Rows.RemoveAt(0); Detail.Height = tbl_DailyData.Height; } }
protected override void OnBeforePrint(PrintEventArgs e) { base.OnBeforePrint(e); // Hide SUM colums if needed if (_hideSums) { //tbl_DailyCaption.DeleteColumn(lbCell_ContractWorkingHours); tbl_DailyCaption.DeleteColumn(lbCell_AllreadyPlannedWorkingHours); //tbl_DailyCaption.DeleteColumn(lbCell_SummOfAdditionalCharges); //tbl_DailyCaption.DeleteColumn(lbCell_PlusMinusHours); //tbl_DailyCaption.DeleteColumn(lbCell_EmployeeBalanceHours); //tbl_DailyData.DeleteColumn(fieldCell_ContractWorkingHours); tbl_DailyData.DeleteColumn(fieldCell_PlannedWorkingHours); //tbl_DailyData.DeleteColumn(fieldCell_SumAdditionalHours); //tbl_DailyData.DeleteColumn(fieldCell_PlusMinusHours); //tbl_DailyData.DeleteColumn(fieldCell_BalanceHours); } // // Generate columnss // int segmentWidth = Convert.ToInt32(lbCell_0000.Width / 24); lbCell_Employee.Width = fieldCell_EmployeeName.Width = lbCell_0000.Right - (segmentWidth * 24); TimeSpan dayTime = TimeSpan.Zero; TimeSpan timeStep = TimeSpan.FromMinutes(60); XRTableCell baseLabelCell = lbCell_0000; XRTableCell baseDataCell = fieldCell_0000; while (dayTime.TotalHours < 23) { DateTime columnTime = _viewDate.Add(dayTime); // Caption ReportPainter.ApplyCaptionCellFormat(baseLabelCell, columnTime); tbl_DailyCaption.InsertColumnToRight(baseLabelCell); baseLabelCell.Width = segmentWidth; baseLabelCell = baseLabelCell.NextCell; // Data baseDataCell.Tag = columnTime; tbl_DailyData.InsertColumnToRight(baseDataCell); baseDataCell.BeforePrint += PrintTimeCell; baseDataCell.Width = segmentWidth; ReportPainter.Insert15MinuteShapes(baseDataCell, columnTime, ManualFillOnly); baseDataCell = baseDataCell.NextCell; dayTime = dayTime.Add(timeStep); } DateTime lastColumnTime = _viewDate.Add(dayTime); ReportPainter.ApplyCaptionCellFormat(baseLabelCell, lastColumnTime); baseDataCell.Tag = lastColumnTime; baseDataCell.BeforePrint += PrintTimeCell; ReportPainter.Insert15MinuteShapes(baseDataCell, lastColumnTime, ManualFillOnly); // // If manuall fill, add new row if (ManualFill && !ManualFillOnly) { XRTableRow dataRow = tbl_DailyData.Rows.FirstRow; tbl_DailyData.InsertRowBelow(dataRow); XRTableRow manualFillRow = tbl_DailyData.Rows[1]; for (int idx = 1; idx < dataRow.Cells.Count; idx++) { if (dataRow.Cells[idx].Tag.GetType() == typeof(DateTime)) { DateTime columnTime = (DateTime)dataRow.Cells[idx].Tag; manualFillRow.Cells[idx].Tag = columnTime; ReportPainter.Insert15MinuteShapes(manualFillRow.Cells[idx], columnTime, true); manualFillRow.Cells[idx].BeforePrint += PrintTimeCell; } } } }