DataTable: Add units for columns
This commit is contained in:
@ -7,19 +7,19 @@ using System.Threading.Tasks;
|
||||
namespace Elwig.Models.Dtos {
|
||||
public class OverUnderDeliveryData : DataTable<OverUnderDeliveryRow> {
|
||||
|
||||
private static readonly (string, string, int)[] FieldNames = new[] {
|
||||
("MgNr", "MgNr.", 12),
|
||||
("Name", "Name", 40),
|
||||
("GivenName", "Vorname", 40),
|
||||
("Address", "Adresse", 60),
|
||||
("Plz", "PLZ", 10),
|
||||
("Locality", "Ort", 60),
|
||||
("BusinessShares", "GA", 10),
|
||||
("DeliveryObligation", "Lieferpflicht", 22),
|
||||
("DeliveryRight", "Lieferrecht", 22),
|
||||
("Weight", "Geliefert", 22),
|
||||
("OverUnderDelivery", "Über-/Unterliefert", 35),
|
||||
("Percent", "Prozent", 16),
|
||||
private static readonly (string, string, string?, int)[] FieldNames = new[] {
|
||||
("MgNr", "MgNr.", null, 12),
|
||||
("Name", "Name", null, 40),
|
||||
("GivenName", "Vorname", null, 40),
|
||||
("Address", "Adresse", null, 60),
|
||||
("Plz", "PLZ", null, 10),
|
||||
("Locality", "Ort", null, 60),
|
||||
("BusinessShares", "GA", null, 10),
|
||||
("DeliveryObligation", "Lieferpflicht", "kg", 22),
|
||||
("DeliveryRight", "Lieferrecht", "kg", 22),
|
||||
("Weight", "Geliefert", "kg", 22),
|
||||
("OverUnderDelivery", "Über-/Unterliefert", "kg", 35),
|
||||
("Percent", "Prozent", "%", 16),
|
||||
};
|
||||
|
||||
public OverUnderDeliveryData(IEnumerable<OverUnderDeliveryRow> rows, int year) :
|
||||
@ -75,7 +75,7 @@ namespace Elwig.Models.Dtos {
|
||||
Weight > DeliveryRight ? Weight - DeliveryRight : null;
|
||||
[NotMapped]
|
||||
public double? Percent =>
|
||||
Weight < DeliveryObligation ? Math.Round(Weight * 100.0 / DeliveryObligation - 100.0, 1) :
|
||||
Weight > DeliveryRight ? Math.Round(Weight * 100.0 / DeliveryRight - 100, 1) : null;
|
||||
Weight < DeliveryObligation ? Weight * 100.0 / DeliveryObligation - 100.0 :
|
||||
Weight > DeliveryRight ? Weight * 100.0 / DeliveryRight - 100 : null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user