Billing: Add possibility to automatically add business shares

This commit is contained in:
2024-01-17 18:59:25 +01:00
parent 668eb9a2d0
commit b52c09a176
13 changed files with 116 additions and 19 deletions

View File

@ -62,12 +62,8 @@ namespace Elwig.Models.Entities {
[NotMapped]
public DateOnly? EntryDate {
get {
return EntryDateString != null ? DateOnly.ParseExact(EntryDateString, "yyyy-MM-dd") : null;
}
set {
EntryDateString = value?.ToString("yyyy-MM-dd");
}
get => EntryDateString != null ? DateOnly.ParseExact(EntryDateString, "yyyy-MM-dd") : null;
set => EntryDateString = value?.ToString("yyyy-MM-dd");
}
[Column("exit_date")]
@ -75,12 +71,8 @@ namespace Elwig.Models.Entities {
[NotMapped]
public DateOnly? ExitDate {
get {
return ExitDateString != null ? DateOnly.ParseExact(ExitDateString, "yyyy-MM-dd") : null;
}
set {
ExitDateString = value?.ToString("yyyy-MM-dd");
}
get => ExitDateString != null ? DateOnly.ParseExact(ExitDateString, "yyyy-MM-dd") : null;
set => ExitDateString = value?.ToString("yyyy-MM-dd");
}
[Column("business_shares")]

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models.Entities {
[Table("member_history"), PrimaryKey("MgNr", "DateString")]
public class MemberHistory {
[Column("mgnr")]
public int MgNr { get; set; }
[Column("date")]
public string DateString { get; set; }
[NotMapped]
public DateOnly Date {
get => DateOnly.ParseExact(DateString, "yyyy-MM-dd");
set => value.ToString("yyyy-MM-dd");
}
[Column("business_shares")]
public int BusinessShares { get; set; }
[Column("type")]
public string Type { get; set; }
[Column("comment")]
public string? Comment { get; set; }
[ForeignKey("MgNr")]
public virtual Member Member { get; private set; }
}
}

View File

@ -55,6 +55,14 @@ namespace Elwig.Models.Entities {
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
}
[Column("bs_value")]
public long? BusinessShareValueValue { get; set; }
[NotMapped]
public decimal? BusinessShareValue {
get => BusinessShareValueValue != null ? DecFromDb(BusinessShareValueValue.Value) : null;
set => BusinessShareValueValue = value != null ? DecToDb(value.Value) : null;
}
[Column("start_date")]
public string? StartDateString { get; set; }