protected override void GenerateReportFooter() { int extraWidth = 30; Panel footDivisionLine = new Panel(); footDivisionLine.Top = PageHeight - FooterHeight; footDivisionLine.Left = PageHorizonalPadding - extraWidth; footDivisionLine.Width = DefaultSectionWidth + extraWidth * 2; footDivisionLine.Height = 1; footDivisionLine.BorderStyle = BorderStyle.None; footDivisionLine.BackColor = Color.Silver; this.AddSection(footDivisionLine, true); SectionControl footerSection = new SectionControl(false); //string defaultFileName = string.Format("File name: {0}_{1}.pdf", this.device.SerialNumber, this.device.TripNumber); //string pageNumber = string.Format("{0} / ", this.pageCount.ToString()); int footerRowHeight = 12; int heightBetweenLineAndContent = 10; footerSection.Width = DefaultSectionWidth; footerSection.Top = footDivisionLine.Bottom + heightBetweenLineAndContent; footerSection.IsBorderShown = false; footerSection.DefaultRowHeight = footerRowHeight; footerSection.IsFootSection = true; //footerSection.AddRow(new string[] { defaultFileName, ReportConstString.CreatedTime, ReportConstString.PoweredBy }); //footerSection.AddRow(new string[] { pageNumber, string.Empty, ReportConstString.Site }); //footerSection.InitializeLayout(new float[] { 0.35f, 0.25f, 0.40f }); footerSections.Add(new FooterSection() { FooterSectionControl = footerSection, PageNumber = pageCount }); this.AddSection(footerSection, true); }
protected override void GenerateSignatures() { if (this.isSignatureShown) { float signatureRowHeight = 25f; this.GenerateReportFooter(); this.AddNewPage(); SectionControl sectionSignature = new SectionControl(false); sectionSignature.IsCellBorderShown = true; sectionSignature.IsBorderShown = false; sectionSignature.IsAllowNewLine = true; sectionSignature.Width = DefaultSectionWidth; sectionSignature.DefaultRowHeight = signatureRowHeight; sectionSignature.SetSectionTitle("Electronic Signatures"); for (int i = 0; i < this.signatureList.Count; i++) { sectionSignature.AddRow(new string[] { (i + 1).ToString(), this.signatureList[i].ToString(Common.GlobalProfile.DateTimeFormator) }); } sectionSignature.InitializeLayout(new float[] { 0.05f, 0.95f }); sectionSignature.PaintByUser(); this.rowsInfectedBySignature = (int)Math.Ceiling(((sectionSignature.Height + sectionMargin * 3) / this.dataListContentCellHeight)); this.AddSection(sectionSignature); } }
protected override void GenerateLoggingSummary() { SectionControl sectionLoggingSummary = new SectionControl(); sectionLoggingSummary.Width = DefaultSectionWidth; sectionLoggingSummary.SetSectionTitle("Logging Summary"); IDictionary <string, string[]> loggingSummaryContents = this.reportdataGenerator.GetLoggingSummaryColumsContents(this.device, this.deviceDataFrom); string[] column1Contents = loggingSummaryContents["column1Contents"]; string[] column2Contents = loggingSummaryContents["column2Contents"]; sectionLoggingSummary.AddRow(new string[] { column1Contents[0], column2Contents[0] }); sectionLoggingSummary.AddRow(new string[] { column1Contents[1], column2Contents[1] }); sectionLoggingSummary.AddRow(new string[] { column1Contents[2], column2Contents[2] }); sectionLoggingSummary.AddRow(new string[] { column1Contents[3], column2Contents[3] }); sectionLoggingSummary.AddRow(new string[] { column1Contents[4], column2Contents[4] }); sectionLoggingSummary.InitializeLayout(new float[] { 0.5f, 0.5f }); this.AddSection(sectionLoggingSummary); }
protected override void GenerateDeviceConfigurationAndTripInfomation() { int widthBetweenTwoSection = 20; SectionControl sectionDeviceConfig = new SectionControl(); sectionDeviceConfig.Width = (PageWidth - PageHorizonalPadding * 2) / 2 - widthBetweenTwoSection / 2; sectionDeviceConfig.SetSectionTitle("Device Configuration"); IDictionary <string, string[]> deviceConfigurationContents = this.reportdataGenerator.GetDeviceConfigurationTripInfoRowsContents(this.device); string[] row1Contents = deviceConfigurationContents["row1Contents"]; string[] row2Contents = deviceConfigurationContents["row2Contents"]; string[] row3Contents = deviceConfigurationContents["row3Contents"]; string[] tripInfoContents = deviceConfigurationContents["tripInfoContents"]; sectionDeviceConfig.AddRow(row1Contents); sectionDeviceConfig.AddRow(row2Contents); sectionDeviceConfig.AddRow(row3Contents); sectionDeviceConfig.InitializeLayout(new float[] { 0.42f, 0.58f }); this.AddSection(sectionDeviceConfig); SectionControl sectionTripInfo = new SectionControl(); sectionTripInfo.Top = sectionDeviceConfig.Top; sectionTripInfo.Width = sectionDeviceConfig.Width; sectionTripInfo.Left = sectionDeviceConfig.Right + widthBetweenTwoSection; sectionTripInfo.IsAllowNewLine = true; sectionTripInfo.IsTripInfoSection = true; sectionTripInfo.SetSectionTitle(string.Format("Trip Information_{0}", reportdataGenerator.GetLocalTimeZoneString())); sectionTripInfo.AddRow(new string[] { "Trip Number:", tripInfoContents[0] }); sectionTripInfo.AddRow(new string[] { tripInfoContents[1].Trim(), tripInfoContents[2] }); sectionTripInfo.AddRow(new string[] { string.Empty, string.Empty }); sectionTripInfo.InitializeLayout(new float[] { 0.203f, 0.797f }); this.AddSection(sectionTripInfo); }
protected override void GenerateDataList() { IList <PointKeyValue> dataList = this.device.tempList; TableLayoutPanel dataListTable = null; int columnIndex = 0; int cellContentSectionWidth = (DefaultSectionWidth - 4) / 3; int cellDataCount = 100; int columnPerPage = 4; int dataPerPage = cellDataCount * columnPerPage; SectionControl cellContentSection = null; SectionControl tableHearderSection = null; dataListTable = this.CreateDataListTableLayoutPanel(true); dataListTable.Top = this.currentSectionTop + sectionMargin * 2; for (int i = 0; i < Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count); i++) { if (i % (cellDataCount - this.rowsInfectedBySignature) == 0) { if (cellContentSection != null) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); } tableHearderSection = new SectionControl(false); cellContentSection = new SectionControl(false); cellContentSection.IsDataListContentSection = true; dataListTable.Controls.Add(cellContentSection); dataListTable.Controls.Add(tableHearderSection); tableHearderSection.Width = cellContentSectionWidth; cellContentSection.Width = cellContentSectionWidth; cellContentSection.IsContentWithSmallFont = true; tableHearderSection.IsContentWithSmallFont = true; tableHearderSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.IsBorderShown = false; tableHearderSection.IsBorderShown = false; tableHearderSection.DefaultRowHeight = 16; cellContentSection.DefaultRowHeight = 11.2f; tableHearderSection.SetHeader(new string[] { "Date", "Time", unit }); columnIndex = (i / (cellDataCount - this.rowsInfectedBySignature)) % columnPerPage; } cellContentSection.AddRow(new string[] { TempsenFormatHelper.GetFormattedDate(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTime(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTemperature(dataList[i].PointTemp), dataList[i].IsMark.ToString() }); if (i == Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count) - 1) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); this.AddSection(dataListTable); this.GenerateReportFooter(); cellContentSection = null; dataListTable = null; } } for (int i = (cellDataCount - this.rowsInfectedBySignature) * columnPerPage; i < device.tempList.Count; i++) { int j = i - ((cellDataCount - this.rowsInfectedBySignature) * columnPerPage); if (j % dataPerPage == 0) { if (dataListTable != null) { this.AddSection(dataListTable); } dataListTable = this.CreateDataListTableLayoutPanel(); } if (j % cellDataCount == 0) { if (cellContentSection != null) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); } tableHearderSection = new SectionControl(false); cellContentSection = new SectionControl(false); cellContentSection.IsDataListContentSection = true; dataListTable.Controls.Add(cellContentSection); dataListTable.Controls.Add(tableHearderSection); tableHearderSection.Width = cellContentSectionWidth; cellContentSection.Width = cellContentSectionWidth; cellContentSection.IsContentWithSmallFont = true; tableHearderSection.IsContentWithSmallFont = true; tableHearderSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.IsBorderShown = false; tableHearderSection.IsBorderShown = false; tableHearderSection.DefaultRowHeight = 16; cellContentSection.DefaultRowHeight = 11.2f; tableHearderSection.SetHeader(new string[] { "Date", "Time", unit }); columnIndex = (j / cellDataCount) % 4; } cellContentSection.AddRow(new string[] { TempsenFormatHelper.GetFormattedDate(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTime(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTemperature(dataList[i].PointTemp), dataList[i].IsMark.ToString() }); if (i == device.tempList.Count - 1) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); this.AddSection(dataListTable); this.GenerateReportFooter(); } } }
protected override void GenerateAlarms() { SectionControl sectionAlarm = new SectionControl(); sectionAlarm.HorizonalTextAlignment = ContentAlignment.MiddleCenter; sectionAlarm.Width = DefaultSectionWidth; sectionAlarm.SetSectionTitle(this.reportdataGenerator.GetAlarmSectionTitle(this.device)); IDictionary <string, string[]> alarmDataContents = this.reportdataGenerator.GetAlarmRowContents(this.device); string[] highRowContents = alarmDataContents["highRowContents"]; string[] lowRowContents = alarmDataContents["lowRowContents"]; string[] a1RowContents = alarmDataContents["a1RowContents"]; string[] a2RowContents = alarmDataContents["a2RowContents"]; string[] a3RowContents = alarmDataContents["a3RowContents"]; string[] a4RowContents = alarmDataContents["a4RowContents"]; string[] a5RowContents = alarmDataContents["a5RowContents"]; string[] a6RowContents = alarmDataContents["a6RowContents"]; int totalRows = 6; if (this.device.AlarmMode == 0) { // nothing to do } else if (device.AlarmMode == 1) { sectionAlarm.SetHeader(new string[] { "Alarm Zones", "Alarm Delay", "Total Time", "Events", "First Triggered", "Alarm Status" }); if (reportdataGenerator.IsStringArrayNotEmpty(highRowContents)) { sectionAlarm.AddRow(highRowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(lowRowContents)) { sectionAlarm.AddRow(lowRowContents); totalRows--; } } else if (device.AlarmMode == 2) { sectionAlarm.SetHeader(new string[] { "Alarm Zones", "Alarm Delay", "Total Time", "Events", "First Triggered", "Alarm Status" }); if (reportdataGenerator.IsStringArrayNotEmpty(a1RowContents)) { sectionAlarm.AddRow(a1RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a2RowContents)) { sectionAlarm.AddRow(a2RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a3RowContents)) { sectionAlarm.AddRow(a3RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a4RowContents)) { sectionAlarm.AddRow(a4RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a5RowContents)) { sectionAlarm.AddRow(a5RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a6RowContents)) { sectionAlarm.AddRow(a6RowContents); totalRows--; } } for (int i = 0; i < totalRows; i++) { sectionAlarm.AddRow(new string[6]); } sectionAlarm.InitializeLayout(new float[] { 0.18f, 0.19f, 0.17f, 0.10f, 0.23f, 0.13f }, new ContentAlignment[] { ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleRight }); this.AddSection(sectionAlarm); }