From 019e85066fc345301621013077f045ee609943ff Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 29 Jul 2014 08:42:09 +0200 Subject: [PATCH] - Data from entry forms copied to test results as well - Printed results layout change (subtitles in bold) --- .../DataEntry/Munich/EntryForm.cs | 6 ++- .../DataEntry/Munich3/EntryForm.cs | 7 ++- .../Munich/MunichPrintDocument.cs | 47 ++++++++++++------- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs index 4bf247163..a47b5cb4d 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs @@ -149,7 +149,11 @@ namespace TBF.BenchControl.DataEntry.Munich { if (test.MetersKind != Entities.MetersKind.Combined) continue; - //TODO + /// Todo: Generalize !!! Now implemented for Munich = one combined meter. + test.Meters[0].SerialNr = waterMeters[0].SerialNr; + test.Meters[0].EndState = waterMeters[0].EndState; + test.Meters[1].SerialNr = waterMeters[1].SerialNr; + test.Meters[1].EndState = waterMeters[1].EndState; } } } diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs index 9e43684b5..2f600fc17 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs @@ -141,7 +141,12 @@ namespace TBF.BenchControl.DataEntry.Munich3 { if (test.MetersKind != Entities.MetersKind.Single) continue; - //TODO + int count = Math.Max(waterMeters.Count, test.Meters.Count); + for (int i = 0; i < count; i++) + { + test.Meters[i].SerialNr = waterMeters[i].SerialNr; + test.Meters[i].EndState = waterMeters[i].EndState; + } } } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/MunichPrintDocument.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/MunichPrintDocument.cs index d0fa68096..19b323fe7 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/MunichPrintDocument.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/MunichPrintDocument.cs @@ -8,10 +8,12 @@ namespace TBF.BenchControl.ResultsPrinters.Munich { public class MunichPrintDocument : PrintDocument { - const int SpacingOne = 20; + const string FontFamilyName = "Arial"; //"Times New Roman"; + + const int SpacingOne = 18; const int SpacingOneAndHalf = (3 * SpacingOne) / 2; const int TitleX = 240; - const int TitleY = 200; /// Depends on the size of the header + const int TitleY = 180; /// Depends on the size of the header const int FirstLineNr = 14; /// Depends on the size of the header const int Tab1 = 80; /// Positions of columns above the table const int Tab2 = 240; @@ -31,13 +33,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich /// /// Property variable for the Font the user wishes to use /// - public Font Font - { - get { return font; } - set { font = value; } - } Font font; - Font fontTitle; + Font boldFont; + Font fontTitle; /// /// Constructor @@ -58,9 +56,11 @@ namespace TBF.BenchControl.ResultsPrinters.Munich protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e) { base.OnBeginPrint(e); - if (font == null) { font = new Font("Times New Roman", 10); } - if (fontTitle == null) { fontTitle = new Font("Times New Roman", 24); } - } + + if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); } + if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); } + if (fontTitle == null) { fontTitle = new Font(FontFamilyName, 24, FontStyle.Bold); } + } /// /// Override the default OnPrintPage method of the PrintDocument. @@ -101,10 +101,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich int lineNr = FirstLineNr; PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version); lineNr++; - PrintAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :"); - PrintAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchNr.ToString() : ""); - PrintAt(e, Tab3, lineNr * SpacingOne, "Datum :"); - PrintAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d")); + PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :"); + PrintBoldAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchNr.ToString() : ""); + PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :"); + PrintBoldAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d")); lineNr++; PrintAt(e, Tab1, lineNr * SpacingOne, "Zahlertyp :"); PrintAt(e, Tab2, lineNr * SpacingOne, prn.Zaehlertyp); @@ -117,8 +117,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich if (combined) { - PrintAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler"); - PrintAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler"); + PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler"); + PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler"); lineNr++; } @@ -309,7 +309,18 @@ namespace TBF.BenchControl.ResultsPrinters.Munich e.Graphics.DrawString(text, this.font, Brushes.Black, printArea); } - Point FromTest(int testNr, int parNr) + void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text) + { + PrintBoldAt(e, p.X, p.Y, text); + } + + void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text) + { + RectangleF printArea = new RectangleF(x, y, 667, SpacingOne); + e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea); + } + + Point FromTest(int testNr, int parNr) { const int NrParamsInOneTableRow = 6;