update document
This commit is contained in:
parent
9af88075ac
commit
1592002820
@ -11,11 +11,11 @@ namespace BenchtopPDF
|
|||||||
{
|
{
|
||||||
public static Image LogoImage { get; } = Image.FromFile("BenchTopLogo.jpg");
|
public static Image LogoImage { get; } = Image.FromFile("BenchTopLogo.jpg");
|
||||||
|
|
||||||
public Sheet Model { get; }
|
public Sheet Sheet { get; }
|
||||||
|
|
||||||
public SheetDocument(Sheet model)
|
public SheetDocument(Sheet model)
|
||||||
{
|
{
|
||||||
Model = model;
|
Sheet = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocumentMetadata GetMetadata() => DocumentMetadata.Default;
|
public DocumentMetadata GetMetadata() => DocumentMetadata.Default;
|
||||||
@ -56,7 +56,7 @@ namespace BenchtopPDF
|
|||||||
column.Item().Text(text =>
|
column.Item().Text(text =>
|
||||||
{
|
{
|
||||||
text.Span("Issue date: ").SemiBold();
|
text.Span("Issue date: ").SemiBold();
|
||||||
text.Span($"{Model.IssueDate:d}");
|
// text.Span($"{Sheet.IssueDate:d}");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,18 +72,20 @@ namespace BenchtopPDF
|
|||||||
|
|
||||||
column.Item().Row(row =>
|
column.Item().Row(row =>
|
||||||
{
|
{
|
||||||
row.RelativeItem().Component(new AddressComponent("From", Model.SellerAddress));
|
row.RelativeItem().Component(new AddressComponent("From"));
|
||||||
row.ConstantItem(50);
|
row.ConstantItem(50);
|
||||||
row.RelativeItem().Component(new AddressComponent("For", Model.CustomerAddress));
|
row.RelativeItem().Component(new AddressComponent("For"));
|
||||||
});
|
});
|
||||||
|
|
||||||
column.Item().Element(ComposeTable);
|
foreach (var item in Sheet.Transducers) {
|
||||||
|
column.Item().Element(ComposeTable);
|
||||||
|
}
|
||||||
|
|
||||||
var totalPrice = Model.Items.Sum(x => x.Price * x.Quantity);
|
// var totalPrice = Sheet.Items.Sum(x => x.Price * x.Quantity);
|
||||||
column.Item().PaddingRight(5).AlignRight().Text($"Grand total: {totalPrice:C}").SemiBold();
|
// column.Item().PaddingRight(5).AlignRight().Text($"Grand total: {totalPrice:C}").SemiBold();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Model.Comments))
|
// if (!string.IsNullOrWhiteSpace(Sheet.Comments))
|
||||||
column.Item().PaddingTop(25).Element(ComposeComments);
|
// column.Item().PaddingTop(25).Element(ComposeComments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +97,9 @@ namespace BenchtopPDF
|
|||||||
{
|
{
|
||||||
table.ColumnsDefinition(columns =>
|
table.ColumnsDefinition(columns =>
|
||||||
{
|
{
|
||||||
columns.ConstantColumn(25);
|
columns.RelativeColumn();
|
||||||
columns.RelativeColumn(3);
|
columns.RelativeColumn();
|
||||||
|
columns.RelativeColumn();
|
||||||
columns.RelativeColumn();
|
columns.RelativeColumn();
|
||||||
columns.RelativeColumn();
|
columns.RelativeColumn();
|
||||||
columns.RelativeColumn();
|
columns.RelativeColumn();
|
||||||
@ -104,24 +107,26 @@ namespace BenchtopPDF
|
|||||||
|
|
||||||
table.Header(header =>
|
table.Header(header =>
|
||||||
{
|
{
|
||||||
header.Cell().Text("#");
|
header.Cell().Text("Point #").Style(headerStyle);
|
||||||
header.Cell().Text("Product").Style(headerStyle);
|
header.Cell().AlignRight().Text("Master Value").Style(headerStyle);
|
||||||
header.Cell().AlignRight().Text("Unit price").Style(headerStyle);
|
header.Cell().AlignRight().Text("Low Limit").Style(headerStyle);
|
||||||
header.Cell().AlignRight().Text("Quantity").Style(headerStyle);
|
header.Cell().AlignRight().Text("High Limit").Style(headerStyle);
|
||||||
header.Cell().AlignRight().Text("Total").Style(headerStyle);
|
header.Cell().AlignRight().Text("DUT").Style(headerStyle);
|
||||||
|
header.Cell().AlignRight().Text("Delta").Style(headerStyle);
|
||||||
|
|
||||||
header.Cell().ColumnSpan(5).PaddingTop(5).BorderBottom(1).BorderColor(Colors.Black);
|
header.Cell().ColumnSpan(6).PaddingTop(5).BorderBottom(1).BorderColor(Colors.Black);
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var item in Model.Items)
|
foreach (var item in Sheet.Transducers)
|
||||||
{
|
{
|
||||||
var index = Model.Items.IndexOf(item) + 1;
|
var index = Sheet.Transducers.IndexOf(item) + 1;
|
||||||
|
|
||||||
table.Cell().Element(CellStyle).Text($"{index}");
|
table.Cell().Element(CellStyle).Text($"{index}");
|
||||||
table.Cell().Element(CellStyle).Text(item.Name);
|
table.Cell().Element(CellStyle).Text(item.PartNumber);
|
||||||
table.Cell().Element(CellStyle).AlignRight().Text($"{item.Price:C}");
|
table.Cell().Element(CellStyle).AlignRight().Text($"{item.Accuracy}");
|
||||||
table.Cell().Element(CellStyle).AlignRight().Text($"{item.Quantity}");
|
table.Cell().Element(CellStyle).AlignRight().Text($"{item.TransducerName}");
|
||||||
table.Cell().Element(CellStyle).AlignRight().Text($"{item.Price * item.Quantity:C}");
|
table.Cell().Element(CellStyle).AlignRight().Text($"{item.VerifyDate}");
|
||||||
|
table.Cell().Element(CellStyle).AlignRight().Text($"{item.VerifyDate}");
|
||||||
|
|
||||||
static IContainer CellStyle(IContainer container) => container.BorderBottom(1).BorderColor(Colors.Grey.Lighten2).PaddingVertical(5);
|
static IContainer CellStyle(IContainer container) => container.BorderBottom(1).BorderColor(Colors.Grey.Lighten2).PaddingVertical(5);
|
||||||
}
|
}
|
||||||
@ -134,7 +139,7 @@ namespace BenchtopPDF
|
|||||||
{
|
{
|
||||||
column.Spacing(5);
|
column.Spacing(5);
|
||||||
column.Item().Text("Comments").FontSize(14).SemiBold();
|
column.Item().Text("Comments").FontSize(14).SemiBold();
|
||||||
column.Item().Text(Model.Comments);
|
// column.Item().Text(Sheet.Comments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,12 +147,10 @@ namespace BenchtopPDF
|
|||||||
public class AddressComponent : IComponent
|
public class AddressComponent : IComponent
|
||||||
{
|
{
|
||||||
private string Title { get; }
|
private string Title { get; }
|
||||||
private Address Address { get; }
|
|
||||||
|
|
||||||
public AddressComponent(string title, Address address)
|
public AddressComponent(string title)
|
||||||
{
|
{
|
||||||
Title = title;
|
Title = title;
|
||||||
Address = address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Compose(IContainer container)
|
public void Compose(IContainer container)
|
||||||
@ -158,12 +161,6 @@ namespace BenchtopPDF
|
|||||||
|
|
||||||
column.Item().Text(Title).SemiBold();
|
column.Item().Text(Title).SemiBold();
|
||||||
column.Item().PaddingBottom(5).LineHorizontal(1);
|
column.Item().PaddingBottom(5).LineHorizontal(1);
|
||||||
|
|
||||||
column.Item().Text(Address.CompanyName);
|
|
||||||
column.Item().Text(Address.Street);
|
|
||||||
column.Item().Text($"{Address.City}, {Address.State}");
|
|
||||||
column.Item().Text(Address.Email);
|
|
||||||
column.Item().Text(Address.Phone);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user