Elwig: Rename AreaCom to AreaCmt

This commit is contained in:
2026-09-30 12:14:30 +02:00
parent a18d687f18
commit 3d96c31a70
42 changed files with 387 additions and 387 deletions
+7 -7
View File
@@ -16,9 +16,9 @@ namespace Elwig.Helpers.Billing {
protected BillingVariant(int year, int avnr, Season season,
Dictionary<string, string> attributes,
Dictionary<string, (decimal?, decimal?)> modifiers,
Dictionary<string, (string, string?, string?, int?, decimal?)> areaComTypes,
Dictionary<string, (string, string?, string?, int?, decimal?)> areaCmtTypes,
PaymentVar paymentVar, PaymentBillingData data) :
base(year, season, attributes, modifiers, areaComTypes) {
base(year, season, attributes, modifiers, areaCmtTypes) {
AvNr = avnr;
PaymentVariant = paymentVar;
Data = data;
@@ -32,9 +32,9 @@ namespace Elwig.Helpers.Billing {
public static async Task<BillingVariant> Create(int year, int avnr) {
using var ctx = new AppDbContext();
var (season, attributes, modifiers, areaComTypes) = await LoadData(ctx, year);
var (season, attributes, modifiers, areaCmtTypes) = await LoadData(ctx, year);
var (paymentVar, data) = await LoadData(ctx, year, avnr);
return new BillingVariant(year, avnr, season, attributes, modifiers, areaComTypes, paymentVar, data);
return new BillingVariant(year, avnr, season, attributes, modifiers, areaCmtTypes, paymentVar, data);
}
public async Task Calculate(bool strictPrices = true, bool? honorContracted = null, bool? allowAttrsIntoLower = null, bool? avoidUnderDeliveries = null) {
@@ -170,7 +170,7 @@ namespace Elwig.Helpers.Billing {
protected async Task CalculatePrices(SqliteConnection cnx, bool strict = true) {
var invalid = new HashSet<string>();
var parts = new List<(int Year, int DId, int DPNr, int BktNr, string SortId, string? AttrId, string? CultId, string Discr, int Value, double Oe, double Kmw, string QualId, bool AttrAreaCom)>();
var parts = new List<(int Year, int DId, int DPNr, int BktNr, string SortId, string? AttrId, string? CultId, string Discr, int Value, double Oe, double Kmw, string QualId, bool AttrAreaCmt)>();
using (var cmd = cnx.CreateCommand()) {
cmd.CommandText = $"""
SELECT d.year, d.did, d.dpnr, b.bktnr, d.sortid, d.attrid, d.cultid, b.discr, b.value, d.oe, d.kmw, d.qualid, COALESCE(a.area_com, TRUE)
@@ -197,8 +197,8 @@ namespace Elwig.Helpers.Billing {
continue;
var unctrd = part.Discr == "_";
var payAttrId = (part.Discr is "" or "_") ? null : part.Discr;
var attrId = part.AttrAreaCom ? payAttrId : part.AttrId;
var ctrd = !unctrd && (payAttrId == attrId || !part.AttrAreaCom);
var attrId = part.AttrAreaCmt ? payAttrId : part.AttrId;
var ctrd = !unctrd && (payAttrId == attrId || !part.AttrAreaCmt);
decimal price = 0;
try {
price = Data.CalculatePrice(part.SortId, attrId, part.CultId, part.QualId, ctrd, part.Oe, part.Kmw);