[#48] PaymentVariantsWindow: Add checkbox for custom member modifiers
All checks were successful
Test / Run tests (push) Successful in 2m22s
All checks were successful
Test / Run tests (push) Successful in 2m22s
This commit is contained in:
@ -91,6 +91,7 @@ namespace Elwig.Windows {
|
||||
ConsiderPenaltiesInput.IsChecked = BillingData.ConsiderContractPenalties;
|
||||
ConsiderPenaltyInput.IsChecked = BillingData.ConsiderTotalPenalty;
|
||||
ConsiderAutoInput.IsChecked = BillingData.ConsiderAutoBusinessShares;
|
||||
ConsiderCustomInput.IsChecked = BillingData.ConsiderCustomModifiers;
|
||||
if (BillingData.NetWeightModifier != 0) {
|
||||
WeightModifierInput.Text = $"{Math.Round(BillingData.NetWeightModifier * 100.0, 8)}";
|
||||
} else if (BillingData.GrossWeightModifier != 0) {
|
||||
@ -105,6 +106,7 @@ namespace Elwig.Windows {
|
||||
ConsiderPenaltiesInput.IsChecked = false;
|
||||
ConsiderPenaltyInput.IsChecked = false;
|
||||
ConsiderAutoInput.IsChecked = false;
|
||||
ConsiderCustomInput.IsChecked = false;
|
||||
WeightModifierInput.Text = "";
|
||||
DataInput.Text = v.Data;
|
||||
}
|
||||
@ -113,6 +115,7 @@ namespace Elwig.Windows {
|
||||
ConsiderPenaltiesInput.IsEnabled = !locked;
|
||||
ConsiderPenaltyInput.IsEnabled = !locked;
|
||||
ConsiderAutoInput.IsEnabled = !locked;
|
||||
ConsiderCustomInput.IsEnabled = !locked;
|
||||
DataInput.IsReadOnly = locked;
|
||||
} else {
|
||||
EditButton.Content = "Bearbeiten";
|
||||
@ -153,6 +156,8 @@ namespace Elwig.Windows {
|
||||
ConsiderPenaltyInput.IsEnabled = false;
|
||||
ConsiderAutoInput.IsChecked = false;
|
||||
ConsiderAutoInput.IsEnabled = false;
|
||||
ConsiderCustomInput.IsChecked = false;
|
||||
ConsiderCustomInput.IsEnabled = false;
|
||||
DataInput.Text = "";
|
||||
DataInput.IsReadOnly = true;
|
||||
}
|
||||
@ -168,6 +173,7 @@ namespace Elwig.Windows {
|
||||
(ConsiderPenaltiesInput.IsChecked != BillingData?.ConsiderContractPenalties) ||
|
||||
(ConsiderPenaltyInput.IsChecked != BillingData?.ConsiderTotalPenalty) ||
|
||||
(ConsiderAutoInput.IsChecked != BillingData?.ConsiderAutoBusinessShares) ||
|
||||
(ConsiderCustomInput.IsChecked != BillingData?.ConsiderCustomModifiers) ||
|
||||
WeightModifierChanged);
|
||||
CalculateButton.IsEnabled = !SaveButton.IsEnabled && PaymentVariantList.SelectedItem is PaymentVar { TestVariant: true };
|
||||
CommitButton.IsEnabled = CalculateButton.IsEnabled;
|
||||
@ -295,6 +301,26 @@ namespace Elwig.Windows {
|
||||
App.FocusChartWindow(v.Year, v.AvNr);
|
||||
}
|
||||
|
||||
private async void PaymentAdjustmentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (false && App.Client.IsMatzen) {
|
||||
PaymentAdjustmentButton.IsEnabled = false;
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
|
||||
var b = new Billing(Year);
|
||||
await b.AutoAdjustBusinessShare();
|
||||
|
||||
Mouse.OverrideCursor = null;
|
||||
PaymentAdjustmentButton.IsEnabled = true;
|
||||
} else {
|
||||
MessageBox.Show(
|
||||
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
|
||||
"für diese Genossenschaft eingestellt!\n" +
|
||||
"Bitte wenden Sie sich an die Programmierer!", "Fehler",
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void MailButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (PaymentVariantList.SelectedItem is not PaymentVar pv)
|
||||
return;
|
||||
@ -471,6 +497,7 @@ namespace Elwig.Windows {
|
||||
d.ConsiderContractPenalties = ConsiderPenaltiesInput.IsChecked ?? false;
|
||||
d.ConsiderTotalPenalty = ConsiderPenaltyInput.IsChecked ?? false;
|
||||
d.ConsiderAutoBusinessShares = ConsiderAutoInput.IsChecked ?? false;
|
||||
d.ConsiderCustomModifiers = ConsiderCustomInput.IsChecked ?? false;
|
||||
var modVal = WeightModifierInput.Text.Length > 0 ? double.Parse(WeightModifierInput.Text) : 0;
|
||||
d.NetWeightModifier = modVal > 0 ? modVal / 100.0 : 0;
|
||||
d.GrossWeightModifier = modVal < 0 ? modVal / 100.0 : 0;
|
||||
@ -488,6 +515,7 @@ namespace Elwig.Windows {
|
||||
ConsiderPenaltiesInput_Changed(null, null);
|
||||
ConsiderPenaltyInput_Changed(null, null);
|
||||
ConsiderAutoInput_Changed(null, null);
|
||||
ConsiderCustomInput_Changed(null, null);
|
||||
WeightModifierInput_TextChanged(null, null);
|
||||
} catch (Exception exc) {
|
||||
await HintContextChange();
|
||||
@ -630,6 +658,19 @@ namespace Elwig.Windows {
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void ConsiderCustomInput_Changed(object? sender, RoutedEventArgs? evt) {
|
||||
if (BillingData == null) {
|
||||
ControlUtils.ClearInputState(ConsiderCustomInput);
|
||||
return;
|
||||
}
|
||||
if (BillingData.ConsiderCustomModifiers != ConsiderCustomInput.IsChecked) {
|
||||
ControlUtils.SetInputChanged(ConsiderCustomInput);
|
||||
} else {
|
||||
ControlUtils.ClearInputState(ConsiderCustomInput);
|
||||
}
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
||||
private void WeightModifierInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
|
||||
var res = Validator.CheckDecimal(WeightModifierInput, false, 3, 2, true);
|
||||
if (BillingData == null) {
|
||||
|
Reference in New Issue
Block a user