- Data from entry forms copied to test results as well

- Printed results layout change (subtitles in bold)
This commit is contained in:
Milan Hanajik
2014-07-29 08:42:19 +02:00
parent 7261d44728
commit 019e85066f
3 changed files with 40 additions and 20 deletions
@@ -149,7 +149,11 @@ namespace TBF.BenchControl.DataEntry.Munich
{ {
if (test.MetersKind != Entities.MetersKind.Combined) continue; 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;
} }
} }
} }
@@ -141,7 +141,12 @@ namespace TBF.BenchControl.DataEntry.Munich3
{ {
if (test.MetersKind != Entities.MetersKind.Single) continue; 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;
}
} }
} }
} }
@@ -8,10 +8,12 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
{ {
public class MunichPrintDocument : PrintDocument 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 SpacingOneAndHalf = (3 * SpacingOne) / 2;
const int TitleX = 240; 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 FirstLineNr = 14; /// Depends on the size of the header
const int Tab1 = 80; /// Positions of columns above the table const int Tab1 = 80; /// Positions of columns above the table
const int Tab2 = 240; const int Tab2 = 240;
@@ -31,12 +33,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
/// <summary> /// <summary>
/// Property variable for the Font the user wishes to use /// Property variable for the Font the user wishes to use
/// </summary> /// </summary>
public Font Font
{
get { return font; }
set { font = value; }
}
Font font; Font font;
Font boldFont;
Font fontTitle; Font fontTitle;
/// <summary> /// <summary>
@@ -58,8 +56,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e) protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
{ {
base.OnBeginPrint(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); }
} }
/// <summary> /// <summary>
@@ -101,10 +101,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
int lineNr = FirstLineNr; int lineNr = FirstLineNr;
PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version); PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version);
lineNr++; lineNr++;
PrintAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :"); PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
PrintAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchNr.ToString() : ""); PrintBoldAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchNr.ToString() : "");
PrintAt(e, Tab3, lineNr * SpacingOne, "Datum :"); PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :");
PrintAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d")); PrintBoldAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d"));
lineNr++; lineNr++;
PrintAt(e, Tab1, lineNr * SpacingOne, "Zahlertyp :"); PrintAt(e, Tab1, lineNr * SpacingOne, "Zahlertyp :");
PrintAt(e, Tab2, lineNr * SpacingOne, prn.Zaehlertyp); PrintAt(e, Tab2, lineNr * SpacingOne, prn.Zaehlertyp);
@@ -117,8 +117,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
if (combined) if (combined)
{ {
PrintAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler"); PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler");
PrintAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler"); PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler");
lineNr++; lineNr++;
} }
@@ -309,6 +309,17 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea); e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
} }
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) Point FromTest(int testNr, int parNr)
{ {
const int NrParamsInOneTableRow = 6; const int NrParamsInOneTableRow = 6;