[#47] Billing: Add penalty per business share
All checks were successful
Test / Run tests (push) Successful in 2m2s
All checks were successful
Test / Run tests (push) Successful in 2m2s
This commit is contained in:
@ -5,7 +5,8 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ctrl:UnitTextBox">
|
<ControlTemplate TargetType="ctrl:UnitTextBox">
|
||||||
<Border BorderThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
<Border x:Name="Border"
|
||||||
|
BorderThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
||||||
BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
||||||
SnapsToDevicePixels="True">
|
SnapsToDevicePixels="True">
|
||||||
<Grid>
|
<Grid>
|
||||||
@ -22,9 +23,19 @@
|
|||||||
FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3"/>
|
FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter TargetName="Border" Property="BorderBrush" Value="LightGray"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="TextAlignment" Value="Right"/>
|
<Setter Property="TextAlignment" Value="Right"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="Gray"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
@ -354,6 +354,27 @@ namespace Elwig.Helpers {
|
|||||||
_memberUnderDelivery[year] = buckets;
|
_memberUnderDelivery[year] = buckets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Dictionary<int, long>> GetBusinessSharePenalties(int year) {
|
||||||
|
using var cnx = await ConnectAsync();
|
||||||
|
var dict = new Dictionary<int, long>();
|
||||||
|
using var cmd = cnx.CreateCommand();
|
||||||
|
cmd.CommandText = $"""
|
||||||
|
SELECT mgnr, ROUND((
|
||||||
|
COALESCE(-s.penalty_amount, 0) +
|
||||||
|
COALESCE(-s.penalty_per_bs_amount * CEIL(CAST(-u.diff AS REAL) / s.min_kg_per_bs), 0) +
|
||||||
|
COALESCE(u.diff * s.penalty_per_kg, 0)
|
||||||
|
) / POW(10, s.precision - 2))
|
||||||
|
FROM v_total_under_delivery u
|
||||||
|
JOIN season s ON s.year = u.year
|
||||||
|
WHERE s.year = {year} AND u.diff < 0
|
||||||
|
""";
|
||||||
|
using var reader = await cmd.ExecuteReaderAsync();
|
||||||
|
while (await reader.ReadAsync()) {
|
||||||
|
dict[reader.GetInt32(0)] = reader.GetInt64(1);
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<Dictionary<string, AreaComBucket>> GetMemberAreaCommitmentBuckets(int year, int mgnr, SqliteConnection? cnx = null) {
|
public async Task<Dictionary<string, AreaComBucket>> GetMemberAreaCommitmentBuckets(int year, int mgnr, SqliteConnection? cnx = null) {
|
||||||
if (!_memberAreaCommitmentBuckets.ContainsKey(year))
|
if (!_memberAreaCommitmentBuckets.ContainsKey(year))
|
||||||
await FetchMemberAreaCommitmentBuckets(year, cnx);
|
await FetchMemberAreaCommitmentBuckets(year, cnx);
|
||||||
|
@ -9,7 +9,7 @@ namespace Elwig.Helpers {
|
|||||||
public static class AppDbUpdater {
|
public static class AppDbUpdater {
|
||||||
|
|
||||||
// Don't forget to update value in Tests/fetch-resources.bat!
|
// Don't forget to update value in Tests/fetch-resources.bat!
|
||||||
public static readonly int RequiredSchemaVersion = 19;
|
public static readonly int RequiredSchemaVersion = 20;
|
||||||
|
|
||||||
private static int VersionOffset = 0;
|
private static int VersionOffset = 0;
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ namespace Elwig.Helpers.Billing {
|
|||||||
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
|
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
|
||||||
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
|
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
|
||||||
ROUND(IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0), 0) / POW(10, 4 - 2)) +
|
ROUND(IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0), 0) / POW(10, 4 - 2)) +
|
||||||
ROUND(IIF({Data.ConsiderTotalPenalty}, COALESCE(b.total_penalty, 0), 0) / POW(10, s.precision - 2)) +
|
|
||||||
ROUND(IIF({Data.ConsiderAutoBusinessShares}, -COALESCE(a.total_amount, 0), 0) / POW(10, s.precision - 2))
|
ROUND(IIF({Data.ConsiderAutoBusinessShares}, -COALESCE(a.total_amount, 0), 0) / POW(10, s.precision - 2))
|
||||||
AS modifiers,
|
AS modifiers,
|
||||||
lc.modifiers AS prev_modifiers
|
lc.modifiers AS prev_modifiers
|
||||||
@ -66,10 +65,28 @@ namespace Elwig.Helpers.Billing {
|
|||||||
LEFT JOIN payment_member p ON (p.year, p.avnr, p.mgnr) = (v.year, v.avnr, m.mgnr)
|
LEFT JOIN payment_member p ON (p.year, p.avnr, p.mgnr) = (v.year, v.avnr, m.mgnr)
|
||||||
LEFT JOIN credit lc ON (lc.year, lc.avnr, lc.mgnr) = (l.year, l.avnr, m.mgnr)
|
LEFT JOIN credit lc ON (lc.year, lc.avnr, lc.mgnr) = (l.year, l.avnr, m.mgnr)
|
||||||
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
||||||
LEFT JOIN v_penalty_business_shares b ON (b.year, b.mgnr) = (s.year, m.mgnr)
|
|
||||||
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
||||||
WHERE s.year = {Year} AND v.avnr = {AvNr};
|
WHERE s.year = {Year} AND v.avnr = {AvNr};
|
||||||
|
""");
|
||||||
|
if (Data.ConsiderTotalPenalty) {
|
||||||
|
if (App.Client.IsWinzerkeller) {
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
await AppDbContext.ExecuteBatch(cnx, $"""
|
||||||
|
UPDATE credit AS c
|
||||||
|
SET modifiers = modifiers + ROUND((
|
||||||
|
COALESCE(-s.penalty_amount, 0) +
|
||||||
|
COALESCE(-s.penalty_per_bs_amount * CEIL(CAST(-u.diff AS REAL) / s.min_kg_per_bs), 0) +
|
||||||
|
COALESCE(u.diff * s.penalty_per_kg, 0)
|
||||||
|
) / POW(10, s.precision - 2))
|
||||||
|
FROM v_total_under_delivery u
|
||||||
|
JOIN season s ON s.year = u.year
|
||||||
|
WHERE c.year = {Year} AND c.avnr = {AvNr} AND (u.year, u.mgnr) = (c.year, c.mgnr) AND
|
||||||
|
u.diff < 0
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await AppDbContext.ExecuteBatch(cnx, $"""
|
||||||
UPDATE payment_variant SET test_variant = FALSE WHERE (year, avnr) = ({Year}, {AvNr});
|
UPDATE payment_variant SET test_variant = FALSE WHERE (year, avnr) = ({Year}, {AvNr});
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,9 @@ namespace Elwig.Models.Dtos {
|
|||||||
public static async Task<CreditNoteData> ForPaymentVariant(AppDbContext ctx, int year, int avnr) {
|
public static async Task<CreditNoteData> ForPaymentVariant(AppDbContext ctx, int year, int avnr) {
|
||||||
var variant = await ctx.PaymentVariants.FindAsync(year, avnr);
|
var variant = await ctx.PaymentVariants.FindAsync(year, avnr);
|
||||||
var name = variant!.Name;
|
var name = variant!.Name;
|
||||||
|
var bsPenalty = await ctx.GetBusinessSharePenalties(year);
|
||||||
var data = BillingData.FromJson(variant!.Data);
|
var data = BillingData.FromJson(variant!.Data);
|
||||||
var rows = (await FromDbSet(ctx.CreditNoteRows, year, avnr)).Select(r => new CreditNoteRow(r, data)).ToList();
|
var rows = (await FromDbSet(ctx.CreditNoteRows, year, avnr)).Select(r => new CreditNoteRow(r, data, bsPenalty)).ToList();
|
||||||
return new CreditNoteData(rows, year, name);
|
return new CreditNoteData(rows, year, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +57,6 @@ namespace Elwig.Models.Dtos {
|
|||||||
p.amount - p.net_amount AS surcharge,
|
p.amount - p.net_amount AS surcharge,
|
||||||
c.net_amount, c.prev_net_amount, c.vat, c.vat_amount, c.gross_amount, c.modifiers, c.prev_modifiers, c.amount,
|
c.net_amount, c.prev_net_amount, c.vat, c.vat_amount, c.gross_amount, c.modifiers, c.prev_modifiers, c.amount,
|
||||||
ROUND(COALESCE(u.total_penalty, 0) / POW(10, 4 - 2)) AS fb_penalty,
|
ROUND(COALESCE(u.total_penalty, 0) / POW(10, 4 - 2)) AS fb_penalty,
|
||||||
ROUND(COALESCE(b.total_penalty, 0) / POW(10, s.precision - 2)) AS bs_penalty,
|
|
||||||
ROUND(COALESCE(a.total_amount, 0) / POW(10, s.precision - 2)) AS auto_bs
|
ROUND(COALESCE(a.total_amount, 0) / POW(10, s.precision - 2)) AS auto_bs
|
||||||
FROM credit c
|
FROM credit c
|
||||||
LEFT JOIN member m ON m.mgnr = c.mgnr
|
LEFT JOIN member m ON m.mgnr = c.mgnr
|
||||||
@ -65,7 +65,6 @@ namespace Elwig.Models.Dtos {
|
|||||||
LEFT JOIN AT_ort o ON o.okz = p.okz
|
LEFT JOIN AT_ort o ON o.okz = p.okz
|
||||||
LEFT JOIN season s ON s.year = c.year
|
LEFT JOIN season s ON s.year = c.year
|
||||||
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
||||||
LEFT JOIN v_penalty_business_shares b ON (b.year, b.mgnr) = (s.year, m.mgnr)
|
|
||||||
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
||||||
WHERE c.year = {year} AND c.avnr = {avnr}
|
WHERE c.year = {year} AND c.avnr = {avnr}
|
||||||
ORDER BY m.mgnr
|
ORDER BY m.mgnr
|
||||||
@ -96,7 +95,7 @@ namespace Elwig.Models.Dtos {
|
|||||||
public decimal? Considered;
|
public decimal? Considered;
|
||||||
public decimal Amount;
|
public decimal Amount;
|
||||||
|
|
||||||
public CreditNoteRow(CreditNoteRowSingle row, BillingData data) {
|
public CreditNoteRow(CreditNoteRowSingle row, BillingData data, Dictionary<int, long> bsPenalty) {
|
||||||
byte prec1 = 2, prec2 = row.Precision;
|
byte prec1 = 2, prec2 = row.Precision;
|
||||||
MgNr = row.MgNr;
|
MgNr = row.MgNr;
|
||||||
Name1 = row.Name1;
|
Name1 = row.Name1;
|
||||||
@ -120,7 +119,7 @@ namespace Elwig.Models.Dtos {
|
|||||||
if (data.ConsiderContractPenalties)
|
if (data.ConsiderContractPenalties)
|
||||||
Penalties = (row.FbPenalty == null || row.FbPenalty == 0) ? null : Utils.DecFromDb((long)row.FbPenalty, prec1);
|
Penalties = (row.FbPenalty == null || row.FbPenalty == 0) ? null : Utils.DecFromDb((long)row.FbPenalty, prec1);
|
||||||
if (data.ConsiderTotalPenalty)
|
if (data.ConsiderTotalPenalty)
|
||||||
Penalty = (row.BsPealty == null || row.BsPealty == 0) ? null : Utils.DecFromDb((long)row.BsPealty, prec1);
|
Penalty = (!bsPenalty.TryGetValue(row.MgNr, out var val) || val == 0) ? null : Utils.DecFromDb(val, prec1);
|
||||||
if (data.ConsiderAutoBusinessShares)
|
if (data.ConsiderAutoBusinessShares)
|
||||||
AutoBs = (row.AutoBs == null || row.AutoBs == 0) ? null : -Utils.DecFromDb((long)row.AutoBs, prec1);
|
AutoBs = (row.AutoBs == null || row.AutoBs == 0) ? null : -Utils.DecFromDb((long)row.AutoBs, prec1);
|
||||||
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoBs ?? 0);
|
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoBs ?? 0);
|
||||||
@ -175,8 +174,6 @@ namespace Elwig.Models.Dtos {
|
|||||||
public long Amount { get; set; }
|
public long Amount { get; set; }
|
||||||
[Column("fb_penalty")]
|
[Column("fb_penalty")]
|
||||||
public long? FbPenalty { get; set; }
|
public long? FbPenalty { get; set; }
|
||||||
[Column("bs_penalty")]
|
|
||||||
public long? BsPealty { get; set; }
|
|
||||||
[Column("auto_bs")]
|
[Column("auto_bs")]
|
||||||
public long? AutoBs { get; set; }
|
public long? AutoBs { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,22 @@ namespace Elwig.Models.Entities {
|
|||||||
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
|
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Column("penalty_per_bs_amount")]
|
||||||
|
public long? PenaltyPerBsAmountValue { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public decimal? PenaltyPerBsAmount {
|
||||||
|
get => PenaltyPerBsAmountValue != null ? DecFromDb(PenaltyPerBsAmountValue.Value) : null;
|
||||||
|
set => PenaltyPerBsAmountValue = value != null ? DecToDb(value.Value) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Column("penalty_per_bs_none")]
|
||||||
|
public long? PenaltyPerBsNoneValue { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public decimal? PenaltyPerBsNone {
|
||||||
|
get => PenaltyPerBsNoneValue != null ? DecFromDb(PenaltyPerBsNoneValue.Value) : null;
|
||||||
|
set => PenaltyPerBsNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||||
|
}
|
||||||
|
|
||||||
[Column("bs_value")]
|
[Column("bs_value")]
|
||||||
public long? BusinessShareValueValue { get; set; }
|
public long? BusinessShareValueValue { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
7
Elwig/Resources/Sql/19-20.sql
Normal file
7
Elwig/Resources/Sql/19-20.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-- schema version 19 to 20
|
||||||
|
|
||||||
|
ALTER TABLE season ADD COLUMN penalty_per_bs_amount INTEGER DEFAULT NULL;
|
||||||
|
ALTER TABLE season ADD COLUMN penalty_per_bs_none INTEGER DEFAULT NULL;
|
||||||
|
DROP VIEW v_penalty_business_shares;
|
||||||
|
|
||||||
|
UPDATE season SET penalty_none = NULL;
|
@ -395,7 +395,7 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="205"/>
|
<RowDefinition Height="180"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
@ -415,7 +415,7 @@
|
|||||||
<Grid Grid.Column="1" Margin="0,10,0,0">
|
<Grid Grid.Column="1" Margin="0,10,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="130"/>
|
<ColumnDefinition Width="130"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="120"/>
|
||||||
<ColumnDefinition Width="150"/>
|
<ColumnDefinition Width="150"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
@ -440,29 +440,32 @@
|
|||||||
<TextBox x:Name="SeasonEndInput" Grid.Column="1" Margin="0,130,10,10" Width="78" IsEnabled="False"
|
<TextBox x:Name="SeasonEndInput" Grid.Column="1" Margin="0,130,10,10" Width="78" IsEnabled="False"
|
||||||
HorizontalAlignment="Left"/>
|
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"
|
<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"/>
|
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"
|
<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"/>
|
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"/>
|
<Label Content="Strafe (Unterlieferung):" 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"/>
|
|
||||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
|
<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"/>
|
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"
|
<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>
|
</Grid>
|
||||||
|
|
||||||
<GroupBox Grid.Column="1" Grid.Row="1" Header="Zu-/Abschläge" Margin="0,0,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
<GroupBox Grid.Column="1" Grid.Row="1" Header="Zu-/Abschläge" Margin="0,0,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||||
|
@ -49,13 +49,17 @@ namespace Elwig.Windows {
|
|||||||
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
|
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
|
||||||
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
|
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
|
||||||
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
|
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
|
||||||
|
SeasonPenaltyPerBsInput.Text = s.PenaltyPerBsAmount?.ToString() ?? "";
|
||||||
|
SeasonPenaltyPerBsNoneInput.Text = s.PenaltyPerBsNone?.ToString() ?? "";
|
||||||
SeasonBsValueInput.Text = s.BusinessShareValue?.ToString() ?? "";
|
SeasonBsValueInput.Text = s.BusinessShareValue?.ToString() ?? "";
|
||||||
|
|
||||||
var sym = s.Currency.Symbol ?? "";
|
var sym = s.Currency.Symbol ?? s.Currency.Code;
|
||||||
SeasonModifierAbsInput.Unit = $"{sym}/kg";
|
SeasonModifierAbsInput.Unit = $"{sym}/kg";
|
||||||
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
|
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
|
||||||
SeasonPenaltyInput.Unit = sym;
|
SeasonPenaltyInput.Unit = sym;
|
||||||
SeasonPenaltyNoneInput.Unit = sym;
|
SeasonPenaltyNoneInput.Unit = sym;
|
||||||
|
SeasonPenaltyPerBsInput.Unit = $"{sym}/GA";
|
||||||
|
SeasonPenaltyPerBsNoneInput.Unit = $"{sym}/GA";
|
||||||
SeasonBsValueInput.Unit = $"{sym}/GA";
|
SeasonBsValueInput.Unit = $"{sym}/GA";
|
||||||
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
|
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
|
||||||
AreaCommitmentTypePenaltyInput.Unit = sym;
|
AreaCommitmentTypePenaltyInput.Unit = sym;
|
||||||
@ -72,6 +76,8 @@ namespace Elwig.Windows {
|
|||||||
SeasonPenaltyPerKgInput.Text = "";
|
SeasonPenaltyPerKgInput.Text = "";
|
||||||
SeasonPenaltyInput.Text = "";
|
SeasonPenaltyInput.Text = "";
|
||||||
SeasonPenaltyNoneInput.Text = "";
|
SeasonPenaltyNoneInput.Text = "";
|
||||||
|
SeasonPenaltyPerBsInput.Text = "";
|
||||||
|
SeasonPenaltyPerBsNoneInput.Text = "";
|
||||||
SeasonBsValueInput.Text = "";
|
SeasonBsValueInput.Text = "";
|
||||||
}
|
}
|
||||||
_seasonUpdate = false;
|
_seasonUpdate = false;
|
||||||
@ -94,6 +100,8 @@ namespace Elwig.Windows {
|
|||||||
s.PenaltyPerKg = (SeasonPenaltyPerKgInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerKgInput.Text) : null;
|
s.PenaltyPerKg = (SeasonPenaltyPerKgInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerKgInput.Text) : null;
|
||||||
s.PenaltyAmount = (SeasonPenaltyInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyInput.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.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;
|
s.BusinessShareValue = (SeasonBsValueInput.Text.Length > 0) ? decimal.Parse(SeasonBsValueInput.Text) : null;
|
||||||
|
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
@ -119,5 +127,11 @@ namespace Elwig.Windows {
|
|||||||
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
|
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
|
||||||
Season_Changed(sender, evt);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ namespace Elwig.Windows {
|
|||||||
SeasonMaxKgPerHaInput, SeasonVatNormalInput, SeasonVatFlatrateInput, SeasonStartInput, SeasonEndInput,
|
SeasonMaxKgPerHaInput, SeasonVatNormalInput, SeasonVatFlatrateInput, SeasonStartInput, SeasonEndInput,
|
||||||
SeasonMinKgPerBsInput, SeasonMaxKgPerBsInput, SeasonBsValueInput,
|
SeasonMinKgPerBsInput, SeasonMaxKgPerBsInput, SeasonBsValueInput,
|
||||||
SeasonPenaltyPerKgInput, SeasonPenaltyInput, SeasonPenaltyNoneInput,
|
SeasonPenaltyPerKgInput, SeasonPenaltyInput, SeasonPenaltyNoneInput,
|
||||||
|
SeasonPenaltyPerBsInput, SeasonPenaltyPerBsNoneInput,
|
||||||
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput, SeasonModifierAbsInput,
|
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput, SeasonModifierAbsInput,
|
||||||
];
|
];
|
||||||
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
||||||
|
@ -1 +1 @@
|
|||||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=19" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
curl --fail -s -L "https://elwig.at/files/create.sql?v=20" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||||
|
Reference in New Issue
Block a user