[#80] Elwig: Add client parameter to switch between simple and red/white business share mode
Test / Run tests (push) Successful in 2m20s
Test / Run tests (push) Successful in 2m20s
This commit is contained in:
@@ -541,6 +541,20 @@
|
||||
</TabItem>
|
||||
<TabItem Header="Parameter">
|
||||
<StackPanel>
|
||||
<GroupBox x:Name="ParameterBusinessShare" Header="Geschäftsanteile" Margin="10,10,10,0" VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<Label Content="Modus:" Margin="10,10,10,10"/>
|
||||
<ComboBox x:Name="ParameterBusinessShareModeInput" Margin="160,10,10,10" Width="100"
|
||||
HorizontalAlignment="Left">
|
||||
<ComboBoxItem IsSelected="True">Normal</ComboBoxItem>
|
||||
<ComboBoxItem>Rot/weiß</ComboBoxItem>
|
||||
</ComboBox>
|
||||
|
||||
<Label Content="Mitgliederbewegungen:" Margin="10,40,10,10"/>
|
||||
<CheckBox x:Name="ParameterBusinessShareHistoryInput" Content="Mit Elwig erfassen" Margin="160,45,10,15"
|
||||
HorizontalAlignment="Left"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox x:Name="ParameterAreaComGroup" Header="Berechnung Flächenbindungen (aktuelle Saison)" Margin="10,10,10,0" VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<CheckBox x:Name="ParameterAllowAttrIntoLowerInput" Content="Erlauben Lieferungen auch auf (konfigurierte) "schlechtere" Flächenbindungen aufzuteilen"
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace Elwig.Windows {
|
||||
SeasonVatFlatrateInput.Text = (s.VatFlatrate * 100).ToString();
|
||||
SeasonStartInput.Text = $"{s.StartDate:dd.MM.yyyy}";
|
||||
SeasonEndInput.Text = $"{s.EndDate:dd.MM.yyyy}";
|
||||
SeasonMinKgPerShareInput.Text = s.MinKgPerShare.ToString();
|
||||
SeasonMaxKgPerShareInput.Text = s.MaxKgPerShare.ToString();
|
||||
SeasonMinKgPerShareInput.Text = s.MinKgPerShare?.ToString() ?? s.MinKgPerShareRed?.ToString() ?? s.MinKgPerShareWhite?.ToString() ?? "0";
|
||||
SeasonMaxKgPerShareInput.Text = s.MaxKgPerShare?.ToString() ?? s.MaxKgPerShareRed?.ToString() ?? s.MaxKgPerShareWhite?.ToString() ?? "0";
|
||||
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
|
||||
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
|
||||
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
|
||||
@@ -96,10 +96,22 @@ namespace Elwig.Windows {
|
||||
s.VatNormal = double.Parse(SeasonVatNormalInput.Text) / 100;
|
||||
if (SeasonVatFlatrateInput.Text.Length > 0)
|
||||
s.VatFlatrate = double.Parse(SeasonVatFlatrateInput.Text) / 100;
|
||||
if (SeasonMinKgPerShareInput.Text.Length > 0)
|
||||
s.MinKgPerShare = int.Parse(SeasonMinKgPerShareInput.Text);
|
||||
if (SeasonMaxKgPerShareInput.Text.Length > 0)
|
||||
s.MaxKgPerShare = int.Parse(SeasonMaxKgPerShareInput.Text);
|
||||
if (ParameterBusinessShareModeInput.SelectedIndex == 0) {
|
||||
s.MinKgPerShare = (SeasonMinKgPerShareInput.Text.Length > 0) ? int.Parse(SeasonMinKgPerShareInput.Text) : null;
|
||||
s.MaxKgPerShare = (SeasonMaxKgPerShareInput.Text.Length > 0) ? int.Parse(SeasonMaxKgPerShareInput.Text) : null;
|
||||
s.MinKgPerShareRed = null;
|
||||
s.MaxKgPerShareRed = null;
|
||||
s.MinKgPerShareWhite = null;
|
||||
s.MaxKgPerShareWhite = null;
|
||||
} else {
|
||||
s.MinKgPerShare = null;
|
||||
s.MaxKgPerShare = null;
|
||||
s.MinKgPerShareRed = (SeasonMinKgPerShareInput.Text.Length > 0) ? int.Parse(SeasonMinKgPerShareInput.Text) : null;
|
||||
s.MaxKgPerShareRed = (SeasonMaxKgPerShareInput.Text.Length > 0) ? int.Parse(SeasonMaxKgPerShareInput.Text) : null;
|
||||
s.MinKgPerShareWhite = s.MinKgPerShareRed;
|
||||
s.MaxKgPerShareWhite = s.MaxKgPerShareRed;
|
||||
}
|
||||
|
||||
s.PenaltyPerKg = (SeasonPenaltyPerKgInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerKgInput.Text) : null;
|
||||
s.PenaltyAmount = (SeasonPenaltyInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyInput.Text) : null;
|
||||
s.PenaltyNone = (SeasonPenaltyNoneInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyNoneInput.Text) : null;
|
||||
@@ -160,8 +172,8 @@ namespace Elwig.Windows {
|
||||
MaxKgPerHa = s?.MaxKgPerHa ?? 10000,
|
||||
VatNormal = s?.VatNormal ?? 0.10,
|
||||
VatFlatrate = s?.VatFlatrate ?? 0.13,
|
||||
MinKgPerShare = s?.MinKgPerShare ?? 500,
|
||||
MaxKgPerShare = s?.MaxKgPerShare ?? 1000,
|
||||
MinKgPerShare = s?.MinKgPerShare,
|
||||
MaxKgPerShare = s?.MaxKgPerShare,
|
||||
PenaltyPerKgValue = s?.PenaltyPerKgValue,
|
||||
PenaltyAmoutValue = s?.PenaltyAmoutValue,
|
||||
PenaltyNoneValue = s?.PenaltyNoneValue,
|
||||
@@ -181,6 +193,7 @@ namespace Elwig.Windows {
|
||||
AbsValue = m.AbsValue * mult / div,
|
||||
RelValue = m.RelValue,
|
||||
IsActive = m.IsActive,
|
||||
IsRedacted = m.IsRedacted,
|
||||
}));
|
||||
}
|
||||
await ctx.SaveChangesAsync();
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Elwig.Windows {
|
||||
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
||||
WineAttributeFillLowerLabel.Visibility = Visibility.Hidden;
|
||||
ParameterAreaComGroup.Header = ParameterAreaComGroup.Header.ToString()!.Split('(')[0] + $"({Utils.CurrentLastSeason})";
|
||||
LockInputs();
|
||||
}
|
||||
|
||||
protected override void ShortcutNew() { }
|
||||
@@ -92,12 +93,6 @@ namespace Elwig.Windows {
|
||||
SeasonModifierNameInput.IsReadOnly = true;
|
||||
SeasonModifierRelInput.IsReadOnly = true;
|
||||
SeasonModifierAbsInput.IsReadOnly = true;
|
||||
|
||||
ParameterAllowAttrIntoLowerInput.IsEnabled = false;
|
||||
ParameterAvoidUnderDeliveriesInput.IsEnabled = false;
|
||||
ParameterHonorGebundenInput.IsEnabled = false;
|
||||
ParameterExportEbicsVersion.IsEnabled = false;
|
||||
ParameterExportEbicsAddress.IsEnabled = false;
|
||||
}
|
||||
|
||||
new protected void UnlockInputs() {
|
||||
@@ -146,12 +141,6 @@ namespace Elwig.Windows {
|
||||
SeasonModifierNameInput.IsReadOnly = false;
|
||||
SeasonModifierRelInput.IsReadOnly = false;
|
||||
SeasonModifierAbsInput.IsReadOnly = false;
|
||||
|
||||
ParameterAllowAttrIntoLowerInput.IsEnabled = true;
|
||||
ParameterAvoidUnderDeliveriesInput.IsEnabled = true;
|
||||
ParameterHonorGebundenInput.IsEnabled = true;
|
||||
ParameterExportEbicsVersion.IsEnabled = true;
|
||||
ParameterExportEbicsAddress.IsEnabled = true;
|
||||
}
|
||||
|
||||
protected override async Task OnRenewContext(AppDbContext ctx) {
|
||||
@@ -359,6 +348,8 @@ namespace Elwig.Windows {
|
||||
TextElementDeliveryConfirmation.Text = p.TextDeliveryConfirmation;
|
||||
TextElementCreditNote.Text = p.TextCreditNote;
|
||||
|
||||
ParameterBusinessShareModeInput.SelectedIndex = p.ModeBusinessShares;
|
||||
ParameterBusinessShareHistoryInput.IsChecked = p.EnableMemberHistory;
|
||||
ParameterAllowAttrIntoLowerInput.IsChecked = s?.Billing_AllowAttrsIntoLower ?? false;
|
||||
ParameterAvoidUnderDeliveriesInput.IsChecked = s?.Billing_AvoidUnderDeliveries ?? false;
|
||||
ParameterHonorGebundenInput.IsChecked = s?.Billing_HonorGebunden ?? false;
|
||||
@@ -387,6 +378,8 @@ namespace Elwig.Windows {
|
||||
p.EmailAddress = string.IsNullOrEmpty(ClientEmailAddressInput.Text) ? null : ClientEmailAddressInput.Text;
|
||||
p.Website = string.IsNullOrEmpty(ClientWebsiteInput.Text) ? null : ClientWebsiteInput.Text;
|
||||
|
||||
p.ModeBusinessShares = ParameterBusinessShareModeInput.SelectedIndex;
|
||||
p.EnableMemberHistory = ParameterBusinessShareHistoryInput.IsChecked ?? false;
|
||||
p.TextDeliveryNote = string.IsNullOrEmpty(TextElementDeliveryNote.Text) ? null : TextElementDeliveryNote.Text;
|
||||
p.ModeDeliveryNoteStats = (ModeDeliveryNoteNone.IsChecked == true) ? 0 : (ModeDeliveryNoteGaOnly.IsChecked == true) ? 1 : (ModeDeliveryNoteShort.IsChecked == true) ? 2 : (ModeDeliveryNoteFull.IsChecked == true) ? 3 : 2;
|
||||
p.TextDeliveryConfirmation = string.IsNullOrEmpty(TextElementDeliveryConfirmation.Text) ? null : TextElementDeliveryConfirmation.Text;
|
||||
|
||||
@@ -460,7 +460,12 @@ namespace Elwig.Windows {
|
||||
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
|
||||
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, year);
|
||||
using var ods = new OdsFile(filename);
|
||||
await ods.AddTable(tbl1);
|
||||
if (App.Client.HasRedWhite) {
|
||||
await ods.AddTable(tbl1.Red);
|
||||
await ods.AddTable(tbl1.White);
|
||||
} else {
|
||||
await ods.AddTable(tbl1.Total);
|
||||
}
|
||||
await ods.AddTable(tbl2);
|
||||
} catch (Exception exc) {
|
||||
InteractionService.ShowException(exc);
|
||||
|
||||
@@ -619,9 +619,16 @@
|
||||
Margin="0,40,10,0" Width="78" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
|
||||
TextChanged="DateInput_TextChanged" LostFocus="DateInput_LostFocus"/>
|
||||
|
||||
<Label Content="Geschäftsanteile:" Margin="10,70,0,0" Grid.Column="0"/>
|
||||
<TextBox x:Name="BusinessSharesInput" Text="{Binding BusinessSharesString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="0,70,10,0" Width="48" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
|
||||
<Label Content="Geschäftsanteile:" Margin="10,65,0,0" Grid.Column="0"/>
|
||||
<Label x:Name="BusinessSharesLabel" Content="(rot/weiß/ruhend)" Margin="10,78,0,0" Grid.Column="0" FontSize="10"/>
|
||||
<TextBox x:Name="BusinessShares1Input" Text="{Binding BusinessShares1String, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="0,70,10,0" Width="32" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
|
||||
TextChanged="IntegerInput_TextChanged"/>
|
||||
<TextBox x:Name="BusinessShares2Input" Text="{Binding BusinessShares2String, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="37,70,10,0" Width="32" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
|
||||
TextChanged="IntegerInput_TextChanged"/>
|
||||
<TextBox x:Name="BusinessShares3Input" Text="{Binding BusinessShares3String, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="74,70,10,0" Width="32" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
|
||||
TextChanged="IntegerInput_TextChanged"/>
|
||||
|
||||
<Label Content="BH-Konto:" Margin="10,100,0,0" Grid.Column="0"/>
|
||||
|
||||
@@ -13,6 +13,7 @@ using Elwig.Dialogs;
|
||||
using Elwig.Services;
|
||||
using Elwig.ViewModels;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Elwig.Windows {
|
||||
public partial class MemberAdminWindow : AdministrationWindow {
|
||||
@@ -43,7 +44,7 @@ namespace Elwig.Windows {
|
||||
RequiredInputs = [
|
||||
MgNrInput, GivenNameInput, NameInput,
|
||||
AddressInput, PlzInput, OrtInput, BillingOrtInput,
|
||||
BusinessSharesInput, BranchInput, DefaultKgInput
|
||||
BusinessShares1Input, BusinessShares2Input, BusinessShares3Input, BranchInput, DefaultKgInput
|
||||
];
|
||||
EmailAddressInputs = [
|
||||
(EmailAddress1Label, EmailAddress1Input),
|
||||
@@ -84,6 +85,24 @@ namespace Elwig.Windows {
|
||||
Menu_Export_UploadAll.IsEnabled = App.Config.SyncUrl != null;
|
||||
ViewModel.ShowOnlyActiveMembers = true;
|
||||
|
||||
if (App.Client.HasRedWhite) {
|
||||
BusinessSharesLabel.Content = "(rot/weiß/ruhend)";
|
||||
//BusinessShares1Input.Background = Brushes.MistyRose;
|
||||
BusinessShares1Input.Foreground = Brushes.DarkRed;
|
||||
BusinessShares1Input.ToolTip = "Geschäftsanteile (rot)";
|
||||
//BusinessShares2Input.Background = Brushes.MintCream;
|
||||
BusinessShares2Input.Foreground = Brushes.DarkGreen;
|
||||
BusinessShares2Input.ToolTip = "Geschäftsanteile (weiß)";
|
||||
BusinessShares3Input.Background = Brushes.WhiteSmoke;
|
||||
BusinessShares3Input.ToolTip = "Geschäftsanteile (ruhend)";
|
||||
} else {
|
||||
BusinessSharesLabel.Content = "(normal/ruhend)";
|
||||
BusinessShares1Input.ToolTip = "Geschäftsanteile (normal)";
|
||||
BusinessShares2Input.Background = Brushes.WhiteSmoke;
|
||||
BusinessShares2Input.ToolTip = "Geschäftsanteile (ruhend)";
|
||||
BusinessShares3Input.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
UpdateContactInfoVisibility();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Elwig.Windows {
|
||||
var season = await ctx.FetchSeasons(Year).SingleAsync();
|
||||
var contracts = await ctx.AreaCommitmentTypes.ToDictionaryAsync(t => t.VtrgId, t => t);
|
||||
|
||||
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, Year);
|
||||
var (tbl1, _, _) = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, Year);
|
||||
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, Year);
|
||||
var weight = tbl1.Rows.ToDictionary(r => r.MgNr, r => r.WeightTotal);
|
||||
var areaComs = tbl2.Rows.ToDictionary(r => r.MgNr, r => r.VtrgIds.Zip(r.UnderDeliveries).ToDictionary(r => r.First, r => r.Second));
|
||||
|
||||
Reference in New Issue
Block a user