Billing: Always call CalculateBuckets() when Calculate() is called to avoid user confusion

This commit is contained in:
2024-01-31 11:14:56 +01:00
parent 50ac757067
commit b9287f8260
7 changed files with 83 additions and 21 deletions

View File

@ -65,7 +65,6 @@ namespace Elwig.Models.Entities {
[Column("start_date")]
public string? StartDateString { get; set; }
[NotMapped]
public DateOnly? StartDate {
get => StartDateString != null ? DateOnly.ParseExact(StartDateString, "yyyy-MM-dd") : null;
@ -74,13 +73,30 @@ namespace Elwig.Models.Entities {
[Column("end_date")]
public string? EndDateString { get; set; }
[NotMapped]
public DateOnly? EndDate {
get => EndDateString != null ? DateOnly.ParseExact(EndDateString, "yyyy-MM-dd") : null;
set => EndDateString = value?.ToString("yyyy-MM-dd");
}
[Column("calc_mode")]
public int CalcMode { get; set; }
[NotMapped]
public bool Billing_HonorGebunden {
get => (CalcMode & 0x1) != 0;
set => CalcMode = value ? CalcMode | 0x1 : CalcMode & ~0x1;
}
[NotMapped]
public bool Billing_AllowAttrsIntoLower {
get => (CalcMode & 0x4) != 0;
set => CalcMode = value ? CalcMode | 0x4 : CalcMode & ~0x4;
}
[NotMapped]
public bool Billing_AvoidUnderDeliveries {
get => (CalcMode & 0x2) != 0;
set => CalcMode = value ? CalcMode | 0x2 : CalcMode & ~0x2;
}
[ForeignKey("CurrencyCode")]
public virtual Currency Currency { get; private set; }