PaymentVariantsWindow: Add possibility to switch options on/off
This commit is contained in:
@ -17,6 +17,7 @@ namespace Elwig.Documents {
|
||||
public int Precision;
|
||||
public string MemberModifier;
|
||||
public IEnumerable<(string Name, int Kg, decimal Amount)>? MemberUnderDeliveries;
|
||||
public decimal MemberTotalUnderDelivery;
|
||||
|
||||
public CreditNote(AppDbContext ctx, PaymentMember p, CreditNoteData data, Dictionary<string, UnderDelivery>? underDeliveries = null) :
|
||||
base($"{Name} {(p.Credit != null ? $"Nr. {p.Credit.Year}/{p.Credit.TgNr:000}" : p.Member.Name)} – {p.Variant.Name}", p.Member) {
|
||||
@ -32,6 +33,10 @@ namespace Elwig.Documents {
|
||||
} else {
|
||||
MemberModifier = "Sonstige Zu-/Abschläge";
|
||||
}
|
||||
var total = data.Rows.SelectMany(r => r.Buckets).Sum(b => b.Value);
|
||||
var totalUnderDelivery = total - p.Member.BusinessShares * season.MinKgPerBusinessShare;
|
||||
MemberTotalUnderDelivery = totalUnderDelivery < 0 ? totalUnderDelivery * (season.PenaltyPerKg ?? 0) - (season.PenaltyAmount ?? 0) : 0;
|
||||
if (total == 0) MemberTotalUnderDelivery -= (season.PenaltyNone ?? 0);
|
||||
Aside = Aside.Replace("</table>", "") +
|
||||
$"<thead><tr><th colspan='2'>Gutschrift</th></tr></thead><tbody>" +
|
||||
$"<tr><th>TG-Nr.</th><td>{(p.Credit != null ? $"{p.Credit.Year}/{p.Credit.TgNr:000}" : "-")}</td></tr>" +
|
||||
|
@ -136,6 +136,10 @@
|
||||
}
|
||||
penalty = Math.Round(penalty, 2, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
@if (Model.MemberTotalUnderDelivery != 0) {
|
||||
@Raw(FormatRow("Unterlieferung (GA)", Model.MemberTotalUnderDelivery, add: true));
|
||||
penalty += Math.Round(Model.MemberTotalUnderDelivery, 2, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
@if (Model.Credit == null) {
|
||||
@Raw(FormatRow("Auszahlungsbetrag", (Model.Payment?.Amount + penalty) ?? (sum + penalty), bold: true))
|
||||
|
@ -9,7 +9,7 @@ namespace Elwig.Helpers {
|
||||
public static class AppDbUpdater {
|
||||
|
||||
// Don't forget to update value in Tests/fetch-resources.bat!
|
||||
public static readonly int RequiredSchemaVersion = 12;
|
||||
public static readonly int RequiredSchemaVersion = 13;
|
||||
|
||||
private static int VersionOffset = 0;
|
||||
|
||||
|
@ -23,12 +23,44 @@ namespace Elwig.Helpers.Billing {
|
||||
Schema = await JsonSchema.FromJsonAsync(stream ?? throw new ArgumentException("JSON schema not found"));
|
||||
}
|
||||
|
||||
public readonly JsonObject Data;
|
||||
|
||||
private readonly CalculationMode Mode;
|
||||
private readonly JsonObject Data;
|
||||
private readonly Dictionary<int, Curve> Curves;
|
||||
private readonly Dictionary<string, Curve> PaymentData;
|
||||
private readonly Dictionary<string, Curve> QualityData;
|
||||
|
||||
public bool ConsiderDelieryModifiers {
|
||||
get => GetConsider("consider_delivery_modifiers");
|
||||
set => SetConsider(value, "consider_delivery_modifiers");
|
||||
}
|
||||
public bool ConsiderContractPenalties {
|
||||
get => GetConsider("consider_contract_penalties");
|
||||
set => SetConsider(value, "consider_contract_penalties");
|
||||
}
|
||||
public bool ConsiderTotalPenalty {
|
||||
get => GetConsider("consider_total_penalty");
|
||||
set => SetConsider(value, "consider_total_penalty");
|
||||
}
|
||||
public bool ConsiderAutoBusinessShares {
|
||||
get => GetConsider("consider_auto_business_shares");
|
||||
set => SetConsider(value, "consider_total_penalty");
|
||||
}
|
||||
|
||||
private bool GetConsider(string name, string? wgMasterName = null) {
|
||||
return ((Mode == CalculationMode.Elwig) ? Data[name] : Data[wgMasterName ?? ""])?.AsValue().GetValue<bool>() ?? false;
|
||||
}
|
||||
|
||||
private void SetConsider(bool value, string name, string? wgMasterName = null) {
|
||||
if (Mode == CalculationMode.WgMaster && wgMasterName == null) {
|
||||
return;
|
||||
} else if (value) {
|
||||
Data[(Mode == CalculationMode.Elwig) ? name : wgMasterName ?? ""] = value;
|
||||
} else {
|
||||
Data.Remove((Mode == CalculationMode.Elwig) ? name : wgMasterName ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
public BillingData(JsonObject data, IEnumerable<string> attributeVariants) {
|
||||
if (attributeVariants.Any(e => e.Any(c => c < 'A' || c > 'Z')))
|
||||
throw new ArgumentException("Invalid attributeVariants");
|
||||
@ -51,6 +83,10 @@ namespace Elwig.Helpers.Billing {
|
||||
}
|
||||
}
|
||||
|
||||
public static BillingData FromJson(string json) {
|
||||
return FromJson(json, []);
|
||||
}
|
||||
|
||||
public static BillingData FromJson(string json, IEnumerable<string> attributeVariants) {
|
||||
return new(ParseJson(json), attributeVariants);
|
||||
}
|
||||
|
@ -10,10 +10,19 @@ namespace Elwig.Helpers.Billing {
|
||||
|
||||
protected readonly int AvNr;
|
||||
protected readonly PaymentVar PaymentVariant;
|
||||
protected readonly BillingData Data;
|
||||
|
||||
public BillingVariant(int year, int avnr) : base(year) {
|
||||
AvNr = avnr;
|
||||
PaymentVariant = Context.PaymentVariants.Find(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found");
|
||||
var attrVariants = Context.DeliveryParts
|
||||
.Where(d => d.Year == Year)
|
||||
.Select(d => $"{d.SortId}{d.AttrId}")
|
||||
.Distinct()
|
||||
.ToList()
|
||||
.Union(Context.WineVarieties.Select(v => v.SortId))
|
||||
.ToList();
|
||||
Data = BillingData.FromJson(PaymentVariant.Data, attrVariants);
|
||||
}
|
||||
|
||||
public async Task Calculate() {
|
||||
@ -22,7 +31,8 @@ namespace Elwig.Helpers.Billing {
|
||||
await DeleteInDb(cnx);
|
||||
await SetCalcTime(cnx);
|
||||
await CalculatePrices(cnx);
|
||||
await CalculateModifiers(cnx);
|
||||
if (Data.ConsiderDelieryModifiers)
|
||||
await CalculateDeliveryModifiers(cnx);
|
||||
await CalculateMemberModifiers(cnx);
|
||||
await tx.CommitAsync();
|
||||
}
|
||||
@ -39,7 +49,11 @@ namespace Elwig.Helpers.Billing {
|
||||
ROUND(p.amount / POW(10, s.precision - 2)) AS net_amount,
|
||||
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
|
||||
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
|
||||
ROUND(COALESCE(u.total_penalty, 0) / POW(10, 4 - 2)) AS modifiers,
|
||||
ROUND(
|
||||
IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0) / POW(10, 4 - 2), 0) +
|
||||
IIF({Data.ConsiderTotalPenalty}, COALESCE(b.total_penalty, 0), 0) +
|
||||
IIF({Data.ConsiderAutoBusinessShares}, 0, 0)
|
||||
) AS modifiers,
|
||||
lc.modifiers AS prev_modifiers
|
||||
FROM season s
|
||||
JOIN payment_variant v ON v.year = s.year
|
||||
@ -62,6 +76,14 @@ namespace Elwig.Helpers.Billing {
|
||||
FROM v_under_delivery u
|
||||
JOIN area_commitment_type t ON t.vtrgid = u.bucket
|
||||
GROUP BY year, mgnr) u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
||||
LEFT JOIN (SELECT s.year, u.mgnr,
|
||||
(COALESCE(IIF(u.weight = 0, -s.penalty_none, 0), 0) +
|
||||
COALESCE(IIF(u.diff < 0, -s.penalty_amount, 0), 0) +
|
||||
COALESCE(u.diff * s.penalty_per_kg, 0)
|
||||
) / POW(10, s.precision - 2) AS total_penalty
|
||||
FROM v_total_under_delivery u
|
||||
JOIN season s ON s.year = u.year
|
||||
WHERE u.diff < 0) b ON (b.year, b.mgnr) = (s.year, m.mgnr)
|
||||
WHERE s.year = {Year} AND v.avnr = {AvNr};
|
||||
|
||||
UPDATE payment_variant SET test_variant = FALSE WHERE (year, avnr) = ({Year}, {AvNr});
|
||||
@ -119,17 +141,6 @@ namespace Elwig.Helpers.Billing {
|
||||
}
|
||||
|
||||
protected async Task CalculatePrices(SqliteConnection cnx) {
|
||||
var jsonData = PaymentVariant.Data;
|
||||
var attrVariants = Context.DeliveryParts
|
||||
.Where(d => d.Year == Year)
|
||||
.Select(d => $"{d.SortId}{d.AttrId}")
|
||||
.Distinct()
|
||||
.ToList()
|
||||
.Union(Context.WineVarieties.Select(v => v.SortId))
|
||||
.ToList();
|
||||
|
||||
var data = BillingData.FromJson(jsonData, attrVariants);
|
||||
|
||||
var parts = new List<(int Year, int DId, int DPNr, int BktNr, string SortId, string Discr, int Value, double Oe, double Kmw, string QualId)>();
|
||||
using (var cmd = cnx.CreateCommand()) {
|
||||
cmd.CommandText = $"""
|
||||
@ -151,7 +162,7 @@ namespace Elwig.Helpers.Billing {
|
||||
var inserts = new List<(int Year, int DId, int DPNr, int BktNr, long Price, long Amount)>();
|
||||
foreach (var part in parts) {
|
||||
var attrId = (part.Discr == "_" || part.Discr == "") ? null : part.Discr;
|
||||
var price = data.CalculatePrice(part.SortId, attrId, part.QualId, part.Discr != "_", part.Oe, part.Kmw);
|
||||
var price = Data.CalculatePrice(part.SortId, attrId, part.QualId, part.Discr != "_", part.Oe, part.Kmw);
|
||||
var priceL = PaymentVariant.Season.DecToDb(price);
|
||||
inserts.Add((part.Year, part.DId, part.DPNr, part.BktNr, priceL, priceL * part.Value));
|
||||
}
|
||||
@ -162,7 +173,7 @@ namespace Elwig.Helpers.Billing {
|
||||
""");
|
||||
}
|
||||
|
||||
protected async Task CalculateModifiers(SqliteConnection cnx) {
|
||||
protected async Task CalculateDeliveryModifiers(SqliteConnection cnx) {
|
||||
await AppDbContext.ExecuteBatch(cnx, $"""
|
||||
INSERT INTO payment_delivery_part (year, did, dpnr, avnr, net_amount, mod_abs, mod_rel)
|
||||
SELECT d.year, d.did, d.dpnr, {AvNr}, 0, COALESCE(m.abs, 0), COALESCE(m.rel, 0)
|
||||
|
@ -8,6 +8,10 @@
|
||||
"properties": {
|
||||
"mode": {"enum": ["elwig"]},
|
||||
"version": {"enum": [1]},
|
||||
"consider_delivery_modifiers": {"type": "boolean"},
|
||||
"consider_contract_penalties": {"type": "boolean"},
|
||||
"consider_total_penalty": {"type": "boolean"},
|
||||
"consider_auto_business_shares": {"type": "boolean"},
|
||||
"payment": {"$ref": "#/definitions/payment_1"},
|
||||
"quality": {"$ref": "#/definitions/quality_1"},
|
||||
"curves": {
|
||||
|
31
Elwig/Resources/Sql/12-13.sql
Normal file
31
Elwig/Resources/Sql/12-13.sql
Normal file
@ -0,0 +1,31 @@
|
||||
-- schema version 11 to 12
|
||||
|
||||
ALTER TABLE season ADD COLUMN bs_value INTEGER;
|
||||
|
||||
CREATE TABLE member_history (
|
||||
mgnr INTEGER NOT NULL,
|
||||
date TEXT NOT NULL CHECK (date REGEXP '^[1-9][0-9]{3}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$') DEFAULT CURRENT_DATE,
|
||||
|
||||
business_shares INTEGER NOT NULL,
|
||||
type TEXT NOT NULL CHECK (type REGEXP '^[a-z_]+$'),
|
||||
comment TEXT DEFAULT NULL,
|
||||
|
||||
CONSTRAINT pk_member_history PRIMARY KEY (mgnr, date),
|
||||
CONSTRAINT fk_member_history_member FOREIGN KEY (mgnr) REFERENCES member (mgnr)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
) STRICT;
|
||||
|
||||
CREATE VIEW v_total_under_delivery AS
|
||||
SELECT s.year, m.mgnr, m.business_shares,
|
||||
m.business_shares * s.min_kg_per_bs AS min_kg,
|
||||
m.business_shares * s.max_kg_per_bs AS max_kg,
|
||||
COALESCE(d.sum, 0) AS weight,
|
||||
IIF(COALESCE(d.sum, 0) < m.business_shares * s.min_kg_per_bs,
|
||||
COALESCE(d.sum, 0) - m.business_shares * s.min_kg_per_bs,
|
||||
IIF(COALESCE(d.sum, 0) > m.business_shares * s.max_kg_per_bs,
|
||||
COALESCE(d.sum, 0) - m.business_shares * s.max_kg_per_bs,
|
||||
0)) AS diff
|
||||
FROM member m, season s
|
||||
LEFT JOIN v_stat_member d ON (d.year, d.mgnr) = (s.year, m.mgnr)
|
||||
ORDER BY s.year, m.mgnr;
|
@ -65,6 +65,12 @@
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,60,5,0" Grid.RowSpan="2"
|
||||
Click="DeleteButton_Click"/>
|
||||
|
||||
<TextBox x:Name="DataInput" Margin="10,200,35,10" Grid.Column="0" Grid.RowSpan="2"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="auto"
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto"
|
||||
FontFamily="Cascadia Code Light" FontSize="13"
|
||||
TextChanged="DataInput_TextChanged"/>
|
||||
|
||||
<Label Content="Name:" Margin="10,10,0,0" Grid.Column="1"/>
|
||||
<TextBox x:Name="NameInput" Width="200" Grid.Column="2" HorizontalAlignment="Left" Margin="0,10,0,0"
|
||||
TextChanged="NameInput_TextChanged"/>
|
||||
@ -80,11 +86,20 @@
|
||||
<TextBox x:Name="TransferDateInput" Grid.Column="2" Width="77" HorizontalAlignment="Left" Margin="0,100,10,0"
|
||||
TextChanged="TransferDateInput_TextChanged"/>
|
||||
|
||||
<TextBox x:Name="DataInput" Margin="82,70,10,74" Grid.Column="2"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="auto"
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto"
|
||||
FontFamily="Cascadia Code Light" FontSize="13"
|
||||
TextChanged="DataInput_TextChanged"/>
|
||||
<Label Content="Berücksichtigen:" Margin="90,70,10,10" Grid.Column="2"/>
|
||||
<CheckBox x:Name="ConsiderModifiersInput" Content="Zu-/Abschläge bei Lieferungen"
|
||||
Margin="110,95,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Checked="ConsiderModifiersInput_Changed" Unchecked="ConsiderModifiersInput_Changed"/>
|
||||
<CheckBox x:Name="ConsiderPenaltiesInput" Content="Pönalen bei Unterlieferungen (FB)"
|
||||
Margin="110,115,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Checked="ConsiderPenaltiesInput_Changed" Unchecked="ConsiderPenaltiesInput_Changed"/>
|
||||
<CheckBox x:Name="ConsiderPenaltyInput" Content="Strafen bei Unterlieferungen (GA)"
|
||||
Margin="110,135,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Checked="ConsiderPenaltyInput_Changed" Unchecked="ConsiderPenaltyInput_Changed"/>
|
||||
<CheckBox x:Name="ConsiderAutoInput" Content="Automatische Nachzeichnungen der GA"
|
||||
Margin="110,155,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Checked="ConsiderAutoInput_Changed" Unchecked="ConsiderAutoInput_Changed"/>
|
||||
<Label Content="" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="0" Grid.Column="2" Margin="108,175,10,10"/>
|
||||
|
||||
<Grid Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="10,10,10,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -21,6 +21,7 @@ namespace Elwig.Windows {
|
||||
public readonly int Year;
|
||||
public readonly bool SeasonLocked;
|
||||
private bool DataValid, DataChanged, NameChanged, CommentChanged, TransferDateValid, TransferDateChanged;
|
||||
private BillingData? BillingData;
|
||||
|
||||
private static readonly JsonSerializerOptions JsonOpt = new() { WriteIndented = true };
|
||||
|
||||
@ -56,16 +57,37 @@ namespace Elwig.Windows {
|
||||
ExportButton.IsEnabled = locked;
|
||||
|
||||
NameInput.Text = v.Name;
|
||||
NameInput.IsReadOnly = false;
|
||||
CommentInput.Text = v.Comment;
|
||||
CommentInput.IsReadOnly = false;
|
||||
DateInput.Text = $"{v.Date:dd.MM.yyyy}";
|
||||
DateInput.IsReadOnly = false;
|
||||
TransferDateInput.Text = $"{v.TransferDate:dd.MM.yyyy}";
|
||||
if (App.Config.Debug) {
|
||||
try {
|
||||
var json = BillingData.ParseJson(v.Data);
|
||||
DataInput.Text = JsonSerializer.Serialize(json, JsonOpt);
|
||||
} catch {
|
||||
DataInput.Text = v.Data;
|
||||
}
|
||||
TransferDateInput.IsReadOnly = false;
|
||||
try {
|
||||
BillingData = BillingData.FromJson(v.Data);
|
||||
ConsiderModifiersInput.IsChecked = BillingData.ConsiderDelieryModifiers;
|
||||
ConsiderModifiersInput.IsEnabled = !locked;
|
||||
ConsiderPenaltiesInput.IsChecked = BillingData.ConsiderContractPenalties;
|
||||
ConsiderPenaltiesInput.IsEnabled = !locked;
|
||||
ConsiderPenaltyInput.IsChecked = BillingData.ConsiderTotalPenalty;
|
||||
ConsiderPenaltyInput.IsEnabled = !locked;
|
||||
ConsiderAutoInput.IsChecked = BillingData.ConsiderAutoBusinessShares;
|
||||
ConsiderAutoInput.IsEnabled = !locked;
|
||||
DataInput.Text = JsonSerializer.Serialize(BillingData.Data, JsonOpt);
|
||||
DataInput.IsReadOnly = locked;
|
||||
} catch {
|
||||
BillingData = null;
|
||||
ConsiderModifiersInput.IsChecked = false;
|
||||
ConsiderModifiersInput.IsEnabled = false;
|
||||
ConsiderPenaltiesInput.IsChecked = false;
|
||||
ConsiderPenaltiesInput.IsEnabled = false;
|
||||
ConsiderPenaltyInput.IsChecked = false;
|
||||
ConsiderPenaltyInput.IsEnabled = false;
|
||||
ConsiderAutoInput.IsChecked = false;
|
||||
ConsiderAutoInput.IsEnabled = false;
|
||||
DataInput.Text = v.Data;
|
||||
DataInput.IsEnabled = false;
|
||||
}
|
||||
} else {
|
||||
EditButton.Content = "Bearbeiten";
|
||||
@ -81,11 +103,25 @@ namespace Elwig.Windows {
|
||||
PrintButton.IsEnabled = false;
|
||||
ExportButton.IsEnabled = false;
|
||||
|
||||
BillingData = null;
|
||||
NameInput.Text = "";
|
||||
NameInput.IsReadOnly = true;
|
||||
CommentInput.Text = "";
|
||||
CommentInput.IsReadOnly = true;
|
||||
DateInput.Text = "";
|
||||
DateInput.IsReadOnly = true;
|
||||
TransferDateInput.Text = "";
|
||||
TransferDateInput.IsReadOnly = true;
|
||||
ConsiderModifiersInput.IsChecked = false;
|
||||
ConsiderModifiersInput.IsEnabled = false;
|
||||
ConsiderPenaltiesInput.IsChecked = false;
|
||||
ConsiderPenaltiesInput.IsEnabled = false;
|
||||
ConsiderPenaltyInput.IsChecked = false;
|
||||
ConsiderPenaltyInput.IsEnabled = false;
|
||||
ConsiderAutoInput.IsChecked = false;
|
||||
ConsiderAutoInput.IsEnabled = false;
|
||||
DataInput.Text = "";
|
||||
DataInput.IsReadOnly = true;
|
||||
}
|
||||
UpdateSums();
|
||||
UpdateSaveButton();
|
||||
@ -94,7 +130,11 @@ namespace Elwig.Windows {
|
||||
private void UpdateSaveButton() {
|
||||
SaveButton.IsEnabled = PaymentVariantList.SelectedItem != null &&
|
||||
((DataChanged && DataValid) || NameChanged || CommentChanged ||
|
||||
(TransferDateChanged && TransferDateValid));
|
||||
(TransferDateChanged && TransferDateValid)) ||
|
||||
(ConsiderModifiersInput.IsChecked != BillingData?.ConsiderDelieryModifiers) ||
|
||||
(ConsiderPenaltiesInput.IsChecked != BillingData?.ConsiderContractPenalties) ||
|
||||
(ConsiderPenaltyInput.IsChecked != BillingData?.ConsiderTotalPenalty) ||
|
||||
(ConsiderAutoInput.IsChecked != BillingData?.ConsiderAutoBusinessShares);
|
||||
}
|
||||
|
||||
private void UpdateSums() {
|
||||
@ -268,15 +308,25 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void SaveButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (PaymentVariantList.SelectedItem is not PaymentVar v) return;
|
||||
if (PaymentVariantList.SelectedItem is not PaymentVar v || BillingData == null) return;
|
||||
try {
|
||||
v.Name = NameInput.Text;
|
||||
v.Comment = (CommentInput.Text != "") ? CommentInput.Text : null;
|
||||
v.TransferDateString = (TransferDateInput.Text != "") ? string.Join("-", TransferDateInput.Text.Split(".").Reverse()) : null;
|
||||
if (App.Config.Debug) v.Data = JsonSerializer.Serialize(BillingData.ParseJson(DataInput.Text));
|
||||
var d = App.Config.Debug ? BillingData.FromJson(DataInput.Text) : BillingData;
|
||||
d.ConsiderDelieryModifiers = ConsiderModifiersInput.IsChecked ?? false;
|
||||
d.ConsiderContractPenalties = ConsiderPenaltiesInput.IsChecked ?? false;
|
||||
d.ConsiderTotalPenalty = ConsiderPenaltyInput.IsChecked ?? false;
|
||||
d.ConsiderAutoBusinessShares = ConsiderAutoInput.IsChecked ?? false;
|
||||
v.Data = JsonSerializer.Serialize(d.Data);
|
||||
Context.Update(v);
|
||||
await Context.SaveChangesAsync();
|
||||
await App.HintContextChange();
|
||||
CommentInput_TextChanged(null, null);
|
||||
ConsiderModifiersInput_Changed(null, null);
|
||||
ConsiderPenaltiesInput_Changed(null, null);
|
||||
ConsiderPenaltyInput_Changed(null, null);
|
||||
ConsiderAutoInput_Changed(null, null);
|
||||
} catch (Exception exc) {
|
||||
await HintContextChange();
|
||||
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||
@ -304,7 +354,7 @@ namespace Elwig.Windows {
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void CommentInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
private void CommentInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
|
||||
if (PaymentVariantList.SelectedItem is not PaymentVar v) {
|
||||
ControlUtils.ClearInputState(CommentInput);
|
||||
return;
|
||||
@ -366,6 +416,58 @@ namespace Elwig.Windows {
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void ConsiderModifiersInput_Changed(object? sender, RoutedEventArgs? evt) {
|
||||
if (BillingData == null) {
|
||||
ControlUtils.ClearInputState(ConsiderModifiersInput);
|
||||
return;
|
||||
}
|
||||
if (BillingData.ConsiderDelieryModifiers != ConsiderModifiersInput.IsChecked) {
|
||||
ControlUtils.SetInputChanged(ConsiderModifiersInput);
|
||||
} else {
|
||||
ControlUtils.ClearInputState(ConsiderModifiersInput);
|
||||
}
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void ConsiderPenaltiesInput_Changed(object? sender, RoutedEventArgs? evt) {
|
||||
if (BillingData == null) {
|
||||
ControlUtils.ClearInputState(ConsiderPenaltiesInput);
|
||||
return;
|
||||
}
|
||||
if (BillingData.ConsiderContractPenalties != ConsiderPenaltiesInput.IsChecked) {
|
||||
ControlUtils.SetInputChanged(ConsiderPenaltiesInput);
|
||||
} else {
|
||||
ControlUtils.ClearInputState(ConsiderPenaltiesInput);
|
||||
}
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void ConsiderPenaltyInput_Changed(object? sender, RoutedEventArgs? evt) {
|
||||
if (BillingData == null) {
|
||||
ControlUtils.ClearInputState(ConsiderPenaltyInput);
|
||||
return;
|
||||
}
|
||||
if (BillingData.ConsiderTotalPenalty != ConsiderPenaltyInput.IsChecked) {
|
||||
ControlUtils.SetInputChanged(ConsiderPenaltyInput);
|
||||
} else {
|
||||
ControlUtils.ClearInputState(ConsiderPenaltyInput);
|
||||
}
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void ConsiderAutoInput_Changed(object? sender, RoutedEventArgs? evt) {
|
||||
if (BillingData == null) {
|
||||
ControlUtils.ClearInputState(ConsiderAutoInput);
|
||||
return;
|
||||
}
|
||||
if (BillingData.ConsiderAutoBusinessShares != ConsiderAutoInput.IsChecked) {
|
||||
ControlUtils.SetInputChanged(ConsiderAutoInput);
|
||||
} else {
|
||||
ControlUtils.ClearInputState(ConsiderAutoInput);
|
||||
}
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private async Task Generate(int mode) {
|
||||
if (PaymentVariantList.SelectedItem is not PaymentVar v)
|
||||
return;
|
||||
|
@ -1 +1 @@
|
||||
curl -s "https://www.necronda.net/elwig/files/create.sql?v=12" -u "elwig:ganzGeheim123!" -o "Resources\Create.sql"
|
||||
curl -s "https://www.necronda.net/elwig/files/create.sql?v=13" -u "elwig:ganzGeheim123!" -o "Resources\Create.sql"
|
||||
|
Reference in New Issue
Block a user