Dtos: merge under/over delivery with percent column
This commit is contained in:
@ -18,8 +18,7 @@ namespace Elwig.Models.Dtos {
|
||||
("DeliveryObligation", "Lieferpflicht", "kg", 22),
|
||||
("DeliveryRight", "Lieferrecht", "kg", 22),
|
||||
("Weight", "Geliefert", "kg", 22),
|
||||
("OverUnderDelivery", "Über-/Unterliefert", "kg", 35),
|
||||
("Percent", "Prozent", "%", 16),
|
||||
("OverUnderDelivery", "Über-/Unterliefert", "kg|%", 34),
|
||||
};
|
||||
|
||||
public OverUnderDeliveryData(IEnumerable<OverUnderDeliveryRow> rows, int year) :
|
||||
@ -70,12 +69,8 @@ namespace Elwig.Models.Dtos {
|
||||
[Column("sum")]
|
||||
public int Weight { get; set; }
|
||||
[NotMapped]
|
||||
public int? OverUnderDelivery =>
|
||||
Weight < DeliveryObligation ? Weight - DeliveryObligation :
|
||||
Weight > DeliveryRight ? Weight - DeliveryRight : null;
|
||||
[NotMapped]
|
||||
public double? Percent =>
|
||||
Weight < DeliveryObligation ? Weight * 100.0 / DeliveryObligation - 100.0 :
|
||||
Weight > DeliveryRight ? Weight * 100.0 / DeliveryRight - 100 : null;
|
||||
public (int? Kg, double? Percent) OverUnderDelivery =>
|
||||
Weight < DeliveryObligation ? (Weight - DeliveryObligation, Weight * 100.0 / DeliveryObligation - 100.0) :
|
||||
Weight > DeliveryRight ? (Weight - DeliveryRight, Weight * 100.0 / DeliveryRight - 100) : (null, null);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user