[#47] Billing: Add penalty per business share
All checks were successful
Test / Run tests (push) Successful in 2m2s

This commit is contained in:
2024-06-08 16:01:28 +02:00
parent f756220d75
commit 302870fb58
11 changed files with 117 additions and 30 deletions

View File

@ -395,7 +395,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="205"/>
<RowDefinition Height="180"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
@ -415,7 +415,7 @@
<Grid Grid.Column="1" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
@ -440,29 +440,32 @@
<TextBox x:Name="SeasonEndInput" Grid.Column="1" Margin="0,130,10,10" Width="78" IsEnabled="False"
HorizontalAlignment="Left"/>
<Label Content="Lieferpflicht:" Margin="10,10,0,10" Grid.Column="2"/>
<Label Content="Lieferpflicht/-recht:" Margin="10,10,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonMinKgPerBsInput" Unit="kg/GA" TextChanged="SeasonMinMaxKgInput_TextChanged"
Grid.Column="3" Width="80" Margin="0,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Lieferrecht:" Margin="10,40,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonMaxKgPerBsInput" Unit="kg/GA" TextChanged="SeasonMinMaxKgInput_TextChanged"
Grid.Column="3" Width="80" Margin="85,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Strafe (pro unterl. kg):" Margin="10,40,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerKgInput" Unit="€/kg" TextChanged="SeasonPenaltyPerKgInput_TextChanged"
Grid.Column="3" Width="80" Margin="0,40,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Strafe (pro unterl. kg):" Margin="10,70,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerKgInput" Unit="€/kg" TextChanged="SeasonPenaltyPerKgInput_TextChanged"
Grid.Column="3" Width="80" Margin="0,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Strafe (Unterlieferung):" Margin="10,100,0,10" Grid.Column="2"/>
<Label Content="Strafe (Unterlieferung):" Margin="10,70,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
Grid.Column="3" Width="68" Margin="0,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerBsInput" Unit="€/GA" TextChanged="SeasonPenaltyPerBsInput_TextChanged"
Grid.Column="3" Width="100" Margin="72,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Strafe (Nicht-Lieferung):" Margin="10,100,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyNoneInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged" IsEnabled="False"
Grid.Column="3" Width="68" Margin="0,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerBsNoneInput" Unit="€/GA" TextChanged="SeasonPenaltyPerBsInput_TextChanged" IsEnabled="False"
Grid.Column="3" Width="100" Margin="72,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Strafe (Nicht-Lieferung):" Margin="10,130,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonPenaltyNoneInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
Grid.Column="3" Width="68" Margin="0,130,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="GA-Wert:" Margin="10,160,0,10" Grid.Column="2"/>
<Label Content="GA-Wert:" Margin="10,130,0,10" Grid.Column="2"/>
<ctrl:UnitTextBox x:Name="SeasonBsValueInput" Unit="€/GA" TextChanged="SeasonPenaltyInput_TextChanged"
Grid.Column="3" Width="85" Margin="0,160,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
Grid.Column="3" Width="85" Margin="0,130,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>
<GroupBox Grid.Column="1" Grid.Row="1" Header="Zu-/Abschläge" Margin="0,0,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">

View File

@ -49,13 +49,17 @@ namespace Elwig.Windows {
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
SeasonPenaltyPerBsInput.Text = s.PenaltyPerBsAmount?.ToString() ?? "";
SeasonPenaltyPerBsNoneInput.Text = s.PenaltyPerBsNone?.ToString() ?? "";
SeasonBsValueInput.Text = s.BusinessShareValue?.ToString() ?? "";
var sym = s.Currency.Symbol ?? "";
var sym = s.Currency.Symbol ?? s.Currency.Code;
SeasonModifierAbsInput.Unit = $"{sym}/kg";
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
SeasonPenaltyInput.Unit = sym;
SeasonPenaltyNoneInput.Unit = sym;
SeasonPenaltyPerBsInput.Unit = $"{sym}/GA";
SeasonPenaltyPerBsNoneInput.Unit = $"{sym}/GA";
SeasonBsValueInput.Unit = $"{sym}/GA";
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
AreaCommitmentTypePenaltyInput.Unit = sym;
@ -72,6 +76,8 @@ namespace Elwig.Windows {
SeasonPenaltyPerKgInput.Text = "";
SeasonPenaltyInput.Text = "";
SeasonPenaltyNoneInput.Text = "";
SeasonPenaltyPerBsInput.Text = "";
SeasonPenaltyPerBsNoneInput.Text = "";
SeasonBsValueInput.Text = "";
}
_seasonUpdate = false;
@ -94,6 +100,8 @@ namespace Elwig.Windows {
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;
s.PenaltyPerBsAmount = (SeasonPenaltyPerBsInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerBsInput.Text) : null;
s.PenaltyPerBsNone = (SeasonPenaltyPerBsNoneInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerBsNoneInput.Text) : null;
s.BusinessShareValue = (SeasonBsValueInput.Text.Length > 0) ? decimal.Parse(SeasonBsValueInput.Text) : null;
UpdateButtons();
@ -119,5 +127,11 @@ namespace Elwig.Windows {
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
Season_Changed(sender, evt);
}
private void SeasonPenaltyPerBsInput_TextChanged(object sender, TextChangedEventArgs evt) {
if (SeasonList.SelectedItem is not Season s) return;
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, s.Precision));
Season_Changed(sender, evt);
}
}
}

View File

@ -31,6 +31,7 @@ namespace Elwig.Windows {
SeasonMaxKgPerHaInput, SeasonVatNormalInput, SeasonVatFlatrateInput, SeasonStartInput, SeasonEndInput,
SeasonMinKgPerBsInput, SeasonMaxKgPerBsInput, SeasonBsValueInput,
SeasonPenaltyPerKgInput, SeasonPenaltyInput, SeasonPenaltyNoneInput,
SeasonPenaltyPerBsInput, SeasonPenaltyPerBsNoneInput,
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput, SeasonModifierAbsInput,
];
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;