- 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:09 +02:00
parent 7261d44728
commit 019e85066f
3 changed files with 40 additions and 20 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}
}

View File

@ -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
/// <summary>
/// Property variable for the Font the user wishes to use
/// </summary>
public Font Font
{
get { return font; }
set { font = value; }
}
Font font;
Font fontTitle;
Font boldFont;
Font fontTitle;
/// <summary>
/// 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); }
}
/// <summary>
/// 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;