Billing: fix calculation
This commit is contained in:
@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("area_commitment_type"), PrimaryKey("VtrgId"), Index("SortId", "AttrId", "Discriminator")]
|
||||
[Table("area_commitment_type"), PrimaryKey("VtrgId"), Index("SortId", "AttrId", "Discriminator", IsUnique = true)]
|
||||
public class AreaComType {
|
||||
[Column("vtrgid")]
|
||||
public string VtrgId { get; set; }
|
||||
@ -21,18 +21,30 @@ namespace Elwig.Models {
|
||||
[Column("min_kg_per_ha")]
|
||||
public int? MinKgPerHa { get; set; }
|
||||
|
||||
[Column("max_kg_per_ha")]
|
||||
public int? MaxKgPerHa { get; set; }
|
||||
[Column("penalty_per_kg")]
|
||||
public long? PenaltyPerKgValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyPerKg {
|
||||
get => PenaltyPerKgValue != null ? Utils.DecFromDb(PenaltyPerKgValue.Value, 4) : null;
|
||||
set => PenaltyPerKgValue = value != null ? Utils.DecToDb(value.Value, 4) : null;
|
||||
}
|
||||
|
||||
[Column("penalty_amount")]
|
||||
public long? PenaltyAmoutValue { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public decimal? PenaltyAmount {
|
||||
get => PenaltyAmoutValue != null ? Utils.DecFromDb(PenaltyAmoutValue.Value, 4) : null;
|
||||
set => PenaltyAmoutValue = value != null ? Utils.DecToDb(value.Value, 4) : null;
|
||||
}
|
||||
|
||||
[Column("penalty_none")]
|
||||
public long? PenaltyNoneValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyNone {
|
||||
get => PenaltyNoneValue != null ? Utils.DecFromDb(PenaltyNoneValue.Value, 4) : null;
|
||||
set => PenaltyNoneValue = value != null ? Utils.DecToDb(value.Value, 4) : null;
|
||||
}
|
||||
|
||||
[ForeignKey("SortId")]
|
||||
public virtual WineVar WineVar { get; private set; }
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("branch"), PrimaryKey("ZwstId")]
|
||||
[Table("branch"), PrimaryKey("ZwstId"), Index("Name", IsUnique = true)]
|
||||
public class Branch {
|
||||
[Column("zwstid")]
|
||||
public string ZwstId { get; set; }
|
||||
|
@ -115,6 +115,6 @@ namespace Elwig.Models {
|
||||
public string OriginString => Origin.OriginString + "\n" + (Kg?.Gl != null ? $" / {Kg.Gl.Name}" : "") + (Kg != null ? $" / {Kg.AtKg.Gem.Name} / KG {Kg.AtKg.Name}" : "") + (Rd != null ? $" / Ried {Rd.Name}" : "");
|
||||
|
||||
[InverseProperty("Part")]
|
||||
public virtual ISet<DeliveryPartBin> Bins { get; private set; }
|
||||
public virtual ISet<DeliveryPartBucket> Bins { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("delivery_part_bin"), PrimaryKey("Year", "DId", "DPNr", "BinNr")]
|
||||
public class DeliveryPartBin {
|
||||
[Table("delivery_part_bucket"), PrimaryKey("Year", "DId", "DPNr", "BktNr")]
|
||||
public class DeliveryPartBucket {
|
||||
[Column("year")]
|
||||
public int Year { get; set; }
|
||||
|
||||
@ -13,8 +13,8 @@ namespace Elwig.Models {
|
||||
[Column("dpnr")]
|
||||
public int DPNr { get; set; }
|
||||
|
||||
[Column("binnr")]
|
||||
public int BinNr { get; set; }
|
||||
[Column("bktnr")]
|
||||
public int BktNr { get; set; }
|
||||
|
||||
[Column("discr")]
|
||||
public string Discr { get; set; }
|
@ -104,6 +104,9 @@ namespace Elwig.Models {
|
||||
[Column("buchführend")]
|
||||
public bool IsBuchführend { get; set; }
|
||||
|
||||
[Column("organic")]
|
||||
public bool IsOrganic { get; set; }
|
||||
|
||||
[Column("funktionär")]
|
||||
public bool IsFunktionär { get; set; }
|
||||
|
||||
@ -176,9 +179,6 @@ namespace Elwig.Models {
|
||||
|
||||
public string FullAddress => $"{Address}, {PostalDest.AtPlz.Plz} {PostalDest.AtPlz.Ort.Name}";
|
||||
|
||||
public int DeliveryRight => BusinessShares * App.Client.DeliveryRight;
|
||||
public int DeliveryObligation => BusinessShares * App.Client.DeliveryObligation;
|
||||
|
||||
public int SearchScore(IEnumerable<string> keywords) {
|
||||
return Utils.GetSearchScore(new string?[] {
|
||||
MgNr.ToString(),
|
||||
|
@ -2,8 +2,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("payment_delivery_part_bin"), PrimaryKey("Year", "DId", "DPNr", "BinNr", "AvNr")]
|
||||
public class PaymentDeliveryPartBin {
|
||||
[Table("payment_delivery_part_bucket"), PrimaryKey("Year", "DId", "DPNr", "BktNr", "AvNr")]
|
||||
public class PaymentDeliveryPartBucket {
|
||||
[Column("year")]
|
||||
public int Year { get; set; }
|
||||
|
||||
@ -13,8 +13,8 @@ namespace Elwig.Models {
|
||||
[Column("dpnr")]
|
||||
public int DPNr { get; set; }
|
||||
|
||||
[Column("binnr")]
|
||||
public int BinNr { get; set; }
|
||||
[Column("bktnr")]
|
||||
public int BktNr { get; set; }
|
||||
|
||||
[Column("avnr")]
|
||||
public int AvNr { get; set; }
|
@ -16,17 +16,52 @@ namespace Elwig.Models {
|
||||
[Column("precision")]
|
||||
public byte Precision { get; set; }
|
||||
|
||||
[Column("max_kg_per_ha")]
|
||||
public int MaxKgPerHa { get; set; }
|
||||
|
||||
[Column("vat_normal")]
|
||||
public double VatNormal { get; set; }
|
||||
|
||||
[Column("vat_flatrate")]
|
||||
public double VatFlatrate { get; set; }
|
||||
|
||||
[Column("min_kg_per_bs")]
|
||||
public int MinKgPerBusinessShare { get; set; }
|
||||
|
||||
[Column("max_kg_per_bs")]
|
||||
public int MaxKgPerBusinessShare { get; set; }
|
||||
|
||||
[Column("penalty_per_kg")]
|
||||
public long? PenaltyPerKgValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyPerKg {
|
||||
get => PenaltyPerKgValue != null ? DecFromDb(PenaltyPerKgValue.Value) : null;
|
||||
set => PenaltyPerKgValue = value != null ? DecToDb(value.Value) : null;
|
||||
}
|
||||
|
||||
[Column("penalty_amount")]
|
||||
public long? PenaltyAmoutValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyAmount {
|
||||
get => PenaltyAmoutValue != null ? DecFromDb(PenaltyAmoutValue.Value) : null;
|
||||
set => PenaltyAmoutValue = value != null ? DecToDb(value.Value) : null;
|
||||
}
|
||||
|
||||
[Column("penalty_none")]
|
||||
public long? PenaltyNoneValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyNone {
|
||||
get => PenaltyNoneValue != null ? DecFromDb(PenaltyNoneValue.Value) : null;
|
||||
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||
}
|
||||
|
||||
[Column("start_date")]
|
||||
public string? StartDateString { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateOnly? StartDate {
|
||||
get {
|
||||
return StartDateString != null ? DateOnly.ParseExact(StartDateString, "yyyy-MM-dd") : null;
|
||||
}
|
||||
set {
|
||||
StartDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
get => StartDateString != null ? DateOnly.ParseExact(StartDateString, "yyyy-MM-dd") : null;
|
||||
set => StartDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
[Column("end_date")]
|
||||
@ -34,12 +69,8 @@ namespace Elwig.Models {
|
||||
|
||||
[NotMapped]
|
||||
public DateOnly? EndDate {
|
||||
get {
|
||||
return EndDateString != null ? DateOnly.ParseExact(EndDateString, "yyyy-MM-dd") : null;
|
||||
}
|
||||
set {
|
||||
EndDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
get => EndDateString != null ? DateOnly.ParseExact(EndDateString, "yyyy-MM-dd") : null;
|
||||
set => EndDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
[ForeignKey("CurrencyCode")]
|
||||
|
@ -1,8 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("wine_attribute"), PrimaryKey("AttrId")]
|
||||
[Table("wine_attribute"), PrimaryKey("AttrId"), Index("Name", IsUnique = true)]
|
||||
public class WineAttr {
|
||||
[Column("attrid")]
|
||||
public string AttrId { get; set; }
|
||||
@ -10,14 +11,18 @@ namespace Elwig.Models {
|
||||
[Column("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column("active")]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[Column("max_kg_per_ha")]
|
||||
public int? MaxKgPerHa { get; set; }
|
||||
|
||||
[Column("fill_lower_bins")]
|
||||
public int FillLowerBins { get; set; }
|
||||
[Column("strict")]
|
||||
public bool IsStrict { get; set; }
|
||||
|
||||
[Column("fill_lower")]
|
||||
public int FillLower { get; set; }
|
||||
|
||||
[Column("active")]
|
||||
public bool IsActive { get; set; }
|
||||
public override string ToString() {
|
||||
return Name;
|
||||
}
|
||||
|
@ -1,13 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("wine_cultivation"), PrimaryKey("CultId")]
|
||||
[Table("wine_cultivation"), PrimaryKey("CultId"), Index("Name", IsUnique = true)]
|
||||
public class WineCult {
|
||||
[Column("cultid")]
|
||||
public string CultId { get; set; }
|
||||
|
||||
[Column("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column("description")]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user