(1) Output.Printers.OnePerMeter : Table{s} centered horizontally on pages, (2) Indicators for PL: "brak"
This commit is contained in:
@@ -137,7 +137,12 @@ namespace Results.Entities
|
|||||||
public virtual string ErrorFlagsStr()
|
public virtual string ErrorFlagsStr()
|
||||||
{
|
{
|
||||||
ErrorFlagsMode errorFlagsMode;
|
ErrorFlagsMode errorFlagsMode;
|
||||||
return Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||||
|
#if LANG_PL
|
||||||
|
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
|
||||||
|
#else
|
||||||
|
return eFlags;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace Results.Output.Printers.OnePerMeter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float bodyTop = cfg.TopMargin;
|
float tableTop = cfg.TopMargin;
|
||||||
|
|
||||||
if (pageNr == 1)
|
if (pageNr == 1)
|
||||||
{
|
{
|
||||||
@@ -192,43 +192,44 @@ namespace Results.Output.Printers.OnePerMeter
|
|||||||
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
||||||
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
||||||
|
|
||||||
Table table = new Table(2) { Style = commonTableStyle };
|
Table table1 = new Table(2) { Style = commonTableStyle };
|
||||||
foreach (var v in commonItems1)
|
foreach (var v in commonItems1)
|
||||||
{
|
{
|
||||||
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
||||||
table.AddRow(row, horizAlgn, vertAlgn);
|
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||||
}
|
}
|
||||||
float bodyTop1 = table.Draw(e, leftMarginCommon1, commonTop);
|
float bodyTop1 = table1.Draw(e, leftMarginCommon1, commonTop);
|
||||||
|
|
||||||
|
|
||||||
table = new Table(2) { Style = commonTableStyle };
|
table1 = new Table(2) { Style = commonTableStyle };
|
||||||
foreach (var v in commonItems2)
|
foreach (var v in commonItems2)
|
||||||
{
|
{
|
||||||
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
||||||
table.AddRow(row, horizAlgn, vertAlgn);
|
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||||
}
|
}
|
||||||
float bodyTop2 = table.Draw(e, leftMarginCommon2, commonTop);
|
float bodyTop2 = table1.Draw(e, leftMarginCommon2, commonTop);
|
||||||
|
|
||||||
|
|
||||||
table = new Table(2) { Style = commonTableStyle };
|
table1 = new Table(2) { Style = commonTableStyle };
|
||||||
foreach (var v in commonItems3)
|
foreach (var v in commonItems3)
|
||||||
{
|
{
|
||||||
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
||||||
table.AddRow(row, horizAlgn, vertAlgn);
|
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||||
}
|
}
|
||||||
float bodyTop3 = table.Draw(e, leftMarginCommon3, commonTop);
|
float bodyTop3 = table1.Draw(e, leftMarginCommon3, commonTop);
|
||||||
|
|
||||||
float bodyTop12 = (bodyTop1 > bodyTop2) ? bodyTop1 : bodyTop2;
|
float bodyTop12 = (bodyTop1 > bodyTop2) ? bodyTop1 : bodyTop2;
|
||||||
bodyTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s
|
tableTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s
|
||||||
bodyTop += spacingOne4Header; /// Space between the common part and the table
|
tableTop += spacingOne4Header; /// Space between the common part and the table
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw table
|
/// Draw table (on the 1st, as well as on the 2nd page)
|
||||||
///
|
///
|
||||||
float belowTop;
|
float belowTop;
|
||||||
TableStyle style;
|
TableStyle style;
|
||||||
|
Table table;
|
||||||
switch (cfg.Form)
|
switch (cfg.Form)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -245,7 +246,7 @@ namespace Results.Output.Printers.OnePerMeter
|
|||||||
HorizLines = TableLines.All,
|
HorizLines = TableLines.All,
|
||||||
VertLines = TableLines.FirstSecondAndLast
|
VertLines = TableLines.FirstSecondAndLast
|
||||||
};
|
};
|
||||||
belowTop = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style).Draw(e, (float)leftMargin, bodyTop);
|
table = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TableForm.Columns:
|
case TableForm.Columns:
|
||||||
@@ -261,7 +262,7 @@ namespace Results.Output.Printers.OnePerMeter
|
|||||||
HorizLines = TableLines.FirstSecondAndLast,
|
HorizLines = TableLines.FirstSecondAndLast,
|
||||||
VertLines = TableLines.All
|
VertLines = TableLines.All
|
||||||
};
|
};
|
||||||
belowTop = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style).Draw(e, (float)leftMargin, bodyTop);
|
table = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TableForm.ColumnsPL:
|
case TableForm.ColumnsPL:
|
||||||
@@ -277,10 +278,13 @@ namespace Results.Output.Printers.OnePerMeter
|
|||||||
HorizLines = TableLines.FirstSecondAndLast,
|
HorizLines = TableLines.FirstSecondAndLast,
|
||||||
VertLines = TableLines.All
|
VertLines = TableLines.All
|
||||||
};
|
};
|
||||||
belowTop = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style).Draw(e, (float)leftMargin, bodyTop);
|
table = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SizeF size = table.Measure(e);
|
||||||
|
float tableLeft = (float)leftMargin + ((float)printWidth - size.Width) / 2;
|
||||||
|
belowTop = table.Draw(e, tableLeft, tableTop);
|
||||||
|
|
||||||
if (pageNr == nrPages)
|
if (pageNr == nrPages)
|
||||||
{
|
{
|
||||||
@@ -296,31 +300,31 @@ namespace Results.Output.Printers.OnePerMeter
|
|||||||
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
||||||
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
||||||
|
|
||||||
Table table = new Table(2) { Style = commonTableStyle };
|
Table table2 = new Table(2) { Style = commonTableStyle };
|
||||||
foreach (var v in belowItems1)
|
foreach (var v in belowItems1)
|
||||||
{
|
{
|
||||||
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
||||||
table.AddRow(row, horizAlgn, vertAlgn);
|
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||||
}
|
}
|
||||||
table.Draw(e, leftMarginBelow1, belowTop);
|
table2.Draw(e, leftMarginBelow1, belowTop);
|
||||||
|
|
||||||
|
|
||||||
table = new Table(2) { Style = commonTableStyle };
|
table2 = new Table(2) { Style = commonTableStyle };
|
||||||
foreach (var v in belowItems2)
|
foreach (var v in belowItems2)
|
||||||
{
|
{
|
||||||
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
||||||
table.AddRow(row, horizAlgn, vertAlgn);
|
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||||
}
|
}
|
||||||
table.Draw(e, leftMarginBelow2, belowTop);
|
table2.Draw(e, leftMarginBelow2, belowTop);
|
||||||
|
|
||||||
|
|
||||||
table = new Table(2) { Style = commonTableStyle };
|
table2 = new Table(2) { Style = commonTableStyle };
|
||||||
foreach (var v in belowItems3)
|
foreach (var v in belowItems3)
|
||||||
{
|
{
|
||||||
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
|
||||||
table.AddRow(row, horizAlgn, vertAlgn);
|
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||||
}
|
}
|
||||||
table.Draw(e, leftMarginBelow3, belowTop);
|
table2.Draw(e, leftMarginBelow3, belowTop);
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user