DeliveryAdminWindow: Only show active modifiers in receipt mode
All checks were successful
Test / Run tests (push) Successful in 1m53s
All checks were successful
Test / Run tests (push) Successful in 1m53s
This commit is contained in:
@ -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 = 23;
|
public static readonly int RequiredSchemaVersion = 24;
|
||||||
|
|
||||||
private static int VersionOffset = 0;
|
private static int VersionOffset = 0;
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ namespace Elwig.Models.Entities {
|
|||||||
[Column("modid")]
|
[Column("modid")]
|
||||||
public required string ModId { get; set; }
|
public required string ModId { get; set; }
|
||||||
|
|
||||||
|
[Column("active")]
|
||||||
|
public bool IsActive { get; set; }
|
||||||
|
|
||||||
[Column("ordering")]
|
[Column("ordering")]
|
||||||
public int Ordering { get; set; }
|
public int Ordering { get; set; }
|
||||||
|
|
||||||
@ -21,7 +24,6 @@ namespace Elwig.Models.Entities {
|
|||||||
|
|
||||||
[Column("abs")]
|
[Column("abs")]
|
||||||
public long? AbsValue { get; set; }
|
public long? AbsValue { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public decimal? Abs {
|
public decimal? Abs {
|
||||||
get => AbsValue != null ? Season.DecFromDb(AbsValue.Value) : null;
|
get => AbsValue != null ? Season.DecFromDb(AbsValue.Value) : null;
|
||||||
@ -30,19 +32,12 @@ namespace Elwig.Models.Entities {
|
|||||||
|
|
||||||
[Column("rel")]
|
[Column("rel")]
|
||||||
public double? RelValue { get; set; }
|
public double? RelValue { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public decimal? Rel {
|
public decimal? Rel {
|
||||||
get => (decimal?)RelValue;
|
get => (decimal?)RelValue;
|
||||||
set => RelValue = (double?)value;
|
set => RelValue = (double?)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Column("standard")]
|
|
||||||
public bool IsStandard { get; set; }
|
|
||||||
|
|
||||||
[Column("quick_select")]
|
|
||||||
public bool IsQuickSelect { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("Year")]
|
[ForeignKey("Year")]
|
||||||
public virtual Season Season { get; private set; } = null!;
|
public virtual Season Season { get; private set; } = null!;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- schema version 20 to 21
|
-- schema version 21 to 22
|
||||||
|
|
||||||
CREATE VIEW v_penalty_business_shares AS
|
CREATE VIEW v_penalty_business_shares AS
|
||||||
SELECT u.year, u.mgnr,
|
SELECT u.year, u.mgnr,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- schema version 20 to 21
|
-- schema version 22 to 23
|
||||||
|
|
||||||
CREATE VIEW v_stat_modifier AS
|
CREATE VIEW v_stat_modifier AS
|
||||||
SELECT v.year, v.avnr, m.modid, m.name, m.abs, m.rel,
|
SELECT v.year, v.avnr, m.modid, m.name, m.abs, m.rel,
|
||||||
|
5
Elwig/Resources/Sql/23-24.sql
Normal file
5
Elwig/Resources/Sql/23-24.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-- schema version 23 to 24
|
||||||
|
|
||||||
|
ALTER TABLE modifier DROP COLUMN standard;
|
||||||
|
ALTER TABLE modifier DROP COLUMN quick_select;
|
||||||
|
ALTER TABLE modifier ADD COLUMN active INTEGER NOT NULL CHECK (active IN (TRUE, FALSE)) DEFAULT TRUE;
|
@ -521,6 +521,10 @@
|
|||||||
<Label Content="Absolut:" Grid.Column="1" Margin="10,100,10,10"/>
|
<Label Content="Absolut:" Grid.Column="1" Margin="10,100,10,10"/>
|
||||||
<ctrl:UnitTextBox x:Name="SeasonModifierAbsInput" Unit="€/kg" TextChanged="SeasonModifierAbsInput_TextChanged"
|
<ctrl:UnitTextBox x:Name="SeasonModifierAbsInput" Unit="€/kg" TextChanged="SeasonModifierAbsInput_TextChanged"
|
||||||
Grid.Column="2" Width="86" Margin="0,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
Grid.Column="2" Width="86" Margin="0,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
|
<CheckBox x:Name="SeasonModifierActiveInput" Content="In Übernahme-Fenster anzeigen"
|
||||||
|
Grid.Column="1" Grid.ColumnSpan="2" Margin="10,134,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Checked="SeasonModifier_Changed" Unchecked="SeasonModifier_Changed"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -134,11 +134,13 @@ namespace Elwig.Windows {
|
|||||||
SeasonModifierNameInput.Text = "";
|
SeasonModifierNameInput.Text = "";
|
||||||
SeasonModifierRelInput.Text = "";
|
SeasonModifierRelInput.Text = "";
|
||||||
SeasonModifierAbsInput.Text = "";
|
SeasonModifierAbsInput.Text = "";
|
||||||
|
SeasonModifierActiveInput.IsChecked = false;
|
||||||
} else {
|
} else {
|
||||||
SeasonModifierIdInput.Text = mod.ModId;
|
SeasonModifierIdInput.Text = mod.ModId;
|
||||||
SeasonModifierNameInput.Text = mod.Name;
|
SeasonModifierNameInput.Text = mod.Name;
|
||||||
SeasonModifierRelInput.Text = (mod.Rel * 100)?.ToString() ?? "";
|
SeasonModifierRelInput.Text = (mod.Rel * 100)?.ToString() ?? "";
|
||||||
SeasonModifierAbsInput.Text = mod.Abs?.ToString() ?? "";
|
SeasonModifierAbsInput.Text = mod.Abs?.ToString() ?? "";
|
||||||
|
SeasonModifierActiveInput.IsChecked = mod.IsActive;
|
||||||
}
|
}
|
||||||
_modUpdate = false;
|
_modUpdate = false;
|
||||||
}
|
}
|
||||||
@ -154,6 +156,7 @@ namespace Elwig.Windows {
|
|||||||
mod.Name = SeasonModifierNameInput.Text;
|
mod.Name = SeasonModifierNameInput.Text;
|
||||||
mod.Rel = decimal.TryParse(SeasonModifierRelInput.Text, out var vRel) ? vRel / 100 : null;
|
mod.Rel = decimal.TryParse(SeasonModifierRelInput.Text, out var vRel) ? vRel / 100 : null;
|
||||||
mod.AbsValue = decimal.TryParse(SeasonModifierAbsInput.Text, out var vAbs) ? Utils.DecToDb(vAbs, s.Precision) : null;
|
mod.AbsValue = decimal.TryParse(SeasonModifierAbsInput.Text, out var vAbs) ? Utils.DecToDb(vAbs, s.Precision) : null;
|
||||||
|
mod.IsActive = SeasonModifierActiveInput.IsChecked ?? false;
|
||||||
|
|
||||||
CollectionViewSource.GetDefaultView(_modList).Refresh();
|
CollectionViewSource.GetDefaultView(_modList).Refresh();
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
|
@ -187,8 +187,7 @@ namespace Elwig.Windows {
|
|||||||
Name = m.Name,
|
Name = m.Name,
|
||||||
AbsValue = m.AbsValue * mult / div,
|
AbsValue = m.AbsValue * mult / div,
|
||||||
RelValue = m.RelValue,
|
RelValue = m.RelValue,
|
||||||
IsStandard = m.IsStandard,
|
IsActive = m.IsActive,
|
||||||
IsQuickSelect = m.IsQuickSelect,
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync();
|
||||||
|
@ -1084,7 +1084,7 @@ namespace Elwig.Windows {
|
|||||||
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
|
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
|
||||||
ControlUtils.RenewItemsSource(WineQualityLevelInput, await ctx.WineQualityLevels.ToListAsync());
|
ControlUtils.RenewItemsSource(WineQualityLevelInput, await ctx.WineQualityLevels.ToListAsync());
|
||||||
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
.Where(m => m.Year == y)
|
.Where(m => m.Year == y && (!IsCreating || m.IsActive))
|
||||||
.OrderBy(m => m.Ordering)
|
.OrderBy(m => m.Ordering)
|
||||||
.Include(m => m.Season.Currency)
|
.Include(m => m.Season.Currency)
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
@ -1116,14 +1116,14 @@ namespace Elwig.Windows {
|
|||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
if (DeliveryList.SelectedItem is Delivery d) {
|
if (DeliveryList.SelectedItem is Delivery d) {
|
||||||
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
.Where(m => m.Year == d.Year)
|
.Where(m => m.Year == d.Year && (!IsCreating || m.IsActive))
|
||||||
.OrderBy(m => m.Ordering)
|
.OrderBy(m => m.Ordering)
|
||||||
.Include(m => m.Season.Currency)
|
.Include(m => m.Season.Currency)
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
ControlUtils.RenewItemsSource(DeliveryPartList, d.FilteredParts.OrderBy(p => p.DPNr).ToList(), DeliveryPartList_SelectionChanged, ControlUtils.RenewSourceDefault.First);
|
ControlUtils.RenewItemsSource(DeliveryPartList, d.FilteredParts.OrderBy(p => p.DPNr).ToList(), DeliveryPartList_SelectionChanged, ControlUtils.RenewSourceDefault.First);
|
||||||
} else {
|
} else {
|
||||||
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
.Where(m => m.Year == SeasonInput.Value)
|
.Where(m => m.Year == SeasonInput.Value && (!IsCreating || m.IsActive))
|
||||||
.OrderBy(m => m.Ordering)
|
.OrderBy(m => m.Ordering)
|
||||||
.Include(m => m.Season.Currency)
|
.Include(m => m.Season.Currency)
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
@ -1555,6 +1555,11 @@ namespace Elwig.Windows {
|
|||||||
var attrList = await ctx.WineAttributes.Where(a => a.IsActive).OrderBy(a => a.Name).Cast<object>().ToListAsync();
|
var attrList = await ctx.WineAttributes.Where(a => a.IsActive).OrderBy(a => a.Name).Cast<object>().ToListAsync();
|
||||||
attrList.Insert(0, new NullItem(""));
|
attrList.Insert(0, new NullItem(""));
|
||||||
ControlUtils.RenewItemsSource(AttributeInput, attrList, null, ControlUtils.RenewSourceDefault.First);
|
ControlUtils.RenewItemsSource(AttributeInput, attrList, null, ControlUtils.RenewSourceDefault.First);
|
||||||
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
|
.Where(m => m.Year == SeasonInput.Value && m.IsActive)
|
||||||
|
.OrderBy(m => m.Ordering)
|
||||||
|
.Include(m => m.Season.Currency)
|
||||||
|
.ToListAsync());
|
||||||
ControlUtils.RenewItemsSource(MemberInput, await ctx.Members
|
ControlUtils.RenewItemsSource(MemberInput, await ctx.Members
|
||||||
.Where(m => m.IsActive || !IsReceipt)
|
.Where(m => m.IsActive || !IsReceipt)
|
||||||
.Include(m => m.PostalDest.AtPlz!.Ort)
|
.Include(m => m.PostalDest.AtPlz!.Ort)
|
||||||
|
@ -31,9 +31,9 @@ INSERT INTO season (year, currency, min_kg_per_bs, max_kg_per_bs, penalty_per_kg
|
|||||||
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL),
|
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL),
|
||||||
(2021, 'EUR', 2000, 4000, NULL, NULL, NULL, NULL, NULL);
|
(2021, 'EUR', 2000, 4000, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO modifier (year, modid, ordering, name, abs, rel, standard, quick_select) VALUES
|
INSERT INTO modifier (year, modid, ordering, name, abs, rel, active) VALUES
|
||||||
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, FALSE, FALSE),
|
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, TRUE),
|
||||||
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, FALSE, FALSE);
|
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, TRUE);
|
||||||
|
|
||||||
-- Test 01
|
-- Test 01
|
||||||
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
||||||
|
@ -9,9 +9,9 @@ INSERT INTO wine_attribute (attrid, name, active, max_kg_per_ha, strict, fill_lo
|
|||||||
INSERT INTO season (year, currency, min_kg_per_bs, max_kg_per_bs, penalty_per_kg, penalty_amount, penalty_none, start_date, end_date) VALUES
|
INSERT INTO season (year, currency, min_kg_per_bs, max_kg_per_bs, penalty_per_kg, penalty_amount, penalty_none, start_date, end_date) VALUES
|
||||||
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL);
|
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO modifier (year, modid, ordering, name, abs, rel, standard, quick_select) VALUES
|
INSERT INTO modifier (year, modid, ordering, name, abs, rel, active) VALUES
|
||||||
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, FALSE, FALSE),
|
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, TRUE),
|
||||||
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, FALSE, FALSE);
|
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, TRUE);
|
||||||
|
|
||||||
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
||||||
(101, 2020, 1, '2020-10-01', '09:03:12', 'X', 1),
|
(101, 2020, 1, '2020-10-01', '09:03:12', 'X', 1),
|
||||||
|
@ -1 +1 @@
|
|||||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=23" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
curl --fail -s -L "https://elwig.at/files/create.sql?v=24" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||||
|
Reference in New Issue
Block a user