Display lengths in feet and inches

This commit is contained in:
AJ
2021-10-05 09:25:39 -04:00
parent 28d53e6d38
commit 63fa51c5cd
3 changed files with 8 additions and 8 deletions

View File

@@ -79,7 +79,7 @@ namespace CutList.Forms
var writer = new StreamWriter(file); var writer = new StreamWriter(file);
writer.AutoFlush = true; writer.AutoFlush = true;
var max = Bins.Max(b => b.Items.Max(i => i.Length.ToString().Length)); var max = Bins.Max(b => b.Items.Max(i => ArchUnits.FormatFromInches(i.Length).Length));
var id = 1; var id = 1;
foreach (var bin in Bins) foreach (var bin in Bins)
@@ -92,16 +92,16 @@ namespace CutList.Forms
{ {
var first = group.First(); var first = group.First();
var count = group.Count(); var count = group.Count();
var length = first.Length.ToString().PadLeft(max); var length = ArchUnits.FormatFromInches(first.Length).ToString().PadLeft(max);
var name = first.Name; var name = first.Name;
var pcsSingularOrPlural = count == 1 ? "pc " : "pcs"; var pcsSingularOrPlural = count == 1 ? "pc " : "pcs";
writer.WriteLine($" {count}{pcsSingularOrPlural} @ {length}\" LG Tag:{name}"); writer.WriteLine($" {count}{pcsSingularOrPlural} @ {length} LG Tag: {name}");
} }
writer.WriteLine("---------------------------------------------------------------------"); writer.WriteLine("---------------------------------------------------------------------");
writer.WriteLine(); //writer.WriteLine();
} }
writer.Close(); writer.Close();

View File

@@ -65,7 +65,7 @@ namespace SawCut
if (feet > 0) if (feet > 0)
{ {
return $"{feet}' {inches}\""; return $"{feet}'-{inches}\"";
} }
else else
{ {

View File

@@ -38,11 +38,11 @@ namespace SawCut
public override string ToString() public override string ToString()
{ {
var totalLength = Math.Round(Length, 4); var totalLength = ArchUnits.FormatFromInches(Math.Round(Length, 4));
var remainingLength = Math.Round(RemainingLength, 4); var remainingLength = ArchUnits.FormatFromInches(Math.Round(RemainingLength, 4));
var utilitation = Math.Round(Utilization * 100, 2); var utilitation = Math.Round(Utilization * 100, 2);
return $"Length: {totalLength}\", {remainingLength}\" remaining, {Items.Count} items, {utilitation}% utilization"; return $"Length: {totalLength}, {remainingLength} remaining, {Items.Count} items, {utilitation}% utilization";
} }
} }
} }