MainWindow: Add 'Flächenbindungen' and 'Liefermenge/Ertrag' button
This commit is contained in:
@ -90,23 +90,59 @@
|
||||
Margin="0,13,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
|
||||
TextChanged="SeasonInput_TextChanged"/>
|
||||
|
||||
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
|
||||
Click="OverUnderDeliveryButton_Click"
|
||||
Margin="0,50,195,10" Width="190"/>
|
||||
|
||||
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
|
||||
Click="DeliveryConfirmationButton_Click"
|
||||
Margin="195,50,0,10" Width="190"/>
|
||||
|
||||
<Button x:Name="BreakdownButton" Content="Sorten-/Qual.aufteilung"
|
||||
Click="BreakdownButton_Click"
|
||||
Margin="0,90,195,10" Width="190"/>
|
||||
Margin="0,50,195,10" Width="190"/>
|
||||
|
||||
<Button x:Name="PaymentButton" Content="Auszahlung"
|
||||
Click="PaymentButton_Click"
|
||||
Margin="195,90,0,10" Width="190"/>
|
||||
Margin="195,50,0,10" Width="190"/>
|
||||
|
||||
<Grid VerticalAlignment="Bottom" Margin="50,140,50,10">
|
||||
<Button x:Name="OverUnderDeliveryButton"
|
||||
Click="OverUnderDeliveryButton_Click"
|
||||
Margin="0,90,195,10" Width="190" Padding="3,5,5,5"
|
||||
ToolTip="Über-/Unterlieferungen laut gezeichneten Geschäftsanteilen und Unterlieferungen nach Flächenbindungen">
|
||||
<Grid Width="172">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
||||
TextAlignment="Left" HorizontalAlignment="Left" Padding="1.5,0.5,0,0"/>
|
||||
<TextBlock FontSize="12" Margin="18,1,0,0" TextAlignment="Center">Über-/Unterlieferungen</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="BreakdownButton"
|
||||
Click="BreakdownButton_Click"
|
||||
Margin="195,90,0,10" Width="190" Padding="3,5,5,5"
|
||||
ToolTip="Aufschlüsselung des Gewichts nach Zweigstelle, Mitglied, Sorte, Attribut/Bewirt., Qualitätsstufe, gebunden/ungebunden">
|
||||
<Grid Width="170">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
||||
TextAlignment="Left" HorizontalAlignment="Left" Padding="1.5,0.5,0,0"/>
|
||||
<TextBlock FontSize="12" Margin="18,1,0,0" TextAlignment="Center">Sorten-/Qual.aufschlüssel.</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="AreaCommitmentsButton"
|
||||
Click="AreaCommitmentsButton_Click"
|
||||
Margin="0,130,195,10" Width="190" Padding="3,5,5,5"
|
||||
ToolTip="Aktive Flächenbindungen der Saison pro Mitglied und Sorte/Attribut">
|
||||
<Grid Width="172">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
||||
TextAlignment="Left" HorizontalAlignment="Left" Padding="1.5,1.5,0,0"/>
|
||||
<TextBlock Margin="18,0,0,0" TextAlignment="Center">Flächenbindungen</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="BreakdownMemberVarietyButton"
|
||||
Click="BreakdownMemberVarietyButton_Click"
|
||||
Margin="195,130,0,10" Width="190" Padding="3,5,5,5"
|
||||
ToolTip="Liefermengen und Ertrag (kg/ha) pro Mitglied">
|
||||
<Grid Width="170">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
||||
TextAlignment="Left" HorizontalAlignment="Left" Padding="1.5,1.5,0,0"/>
|
||||
<TextBlock Margin="18,0,0,0" TextAlignment="Center">Liefermengen/Ertrag</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
<Grid VerticalAlignment="Bottom" Margin="50,175,50,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
|
@ -251,7 +251,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void SeasonFinish_Expanded(object sender, RoutedEventArgs evt) {
|
||||
Height = 610;
|
||||
Height = 660;
|
||||
}
|
||||
|
||||
private void SeasonFinish_Collapsed(object sender, RoutedEventArgs evt) {
|
||||
@ -264,9 +264,11 @@ namespace Elwig.Windows {
|
||||
var s0 = await ctx.Seasons.FindAsync(year);
|
||||
var valid = (s0 != null);
|
||||
DeliveryConfirmationButton.IsEnabled = valid;
|
||||
OverUnderDeliveryButton.IsEnabled = valid;
|
||||
PaymentButton.IsEnabled = valid;
|
||||
OverUnderDeliveryButton.IsEnabled = valid;
|
||||
BreakdownButton.IsEnabled = valid;
|
||||
AreaCommitmentsButton.IsEnabled = valid;
|
||||
BreakdownMemberVarietyButton.IsEnabled = valid;
|
||||
|
||||
if (valid) {
|
||||
var areaComs = Utils.ActiveAreaCommitments(ctx.AreaCommitments, year!.Value);
|
||||
@ -295,6 +297,12 @@ namespace Elwig.Windows {
|
||||
w.AddDeliveryConfirmation();
|
||||
}
|
||||
|
||||
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (SeasonInput.Value is not int year)
|
||||
return;
|
||||
App.FocusPaymentVariants(year);
|
||||
}
|
||||
|
||||
private async void OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (SeasonInput.Value is not int year)
|
||||
return;
|
||||
@ -317,23 +325,15 @@ namespace Elwig.Windows {
|
||||
using var ctx = new AppDbContext();
|
||||
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
|
||||
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, year);
|
||||
var tbl3 = await MemberDeliveryPerVariantData.ForSeason(ctx.MemberDeliveryPerVariantRows, year);
|
||||
using var ods = new OdsFile(d.FileName);
|
||||
await ods.AddTable(tbl1);
|
||||
await ods.AddTable(tbl2);
|
||||
await ods.AddTable(tbl3);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (SeasonInput.Value is not int year)
|
||||
return;
|
||||
App.FocusPaymentVariants(year);
|
||||
}
|
||||
|
||||
private async void BreakdownButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (SeasonInput.Value is not int year)
|
||||
return;
|
||||
@ -366,5 +366,63 @@ namespace Elwig.Windows {
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
private async void AreaCommitmentsButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (SeasonInput.Value is not int year)
|
||||
return;
|
||||
var d = new SaveFileDialog() {
|
||||
FileName = $"Flächenbindungen-{year}.ods",
|
||||
DefaultExt = "ods",
|
||||
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
|
||||
Title = $"Flächenbindungen {year} speichern unter - Elwig"
|
||||
};
|
||||
if (d.ShowDialog() == false)
|
||||
return;
|
||||
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
try {
|
||||
var b = new Billing(year);
|
||||
await b.FinishSeason();
|
||||
await b.CalculateBuckets();
|
||||
App.HintContextChange();
|
||||
|
||||
using var ctx = new AppDbContext();
|
||||
var tbl = await MemberAreaComsData.ForSeason(ctx.MemberAreaComsRows, year);
|
||||
using var ods = new OdsFile(d.FileName);
|
||||
await ods.AddTable(tbl);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
private async void BreakdownMemberVarietyButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (SeasonInput.Value is not int year)
|
||||
return;
|
||||
var d = new SaveFileDialog() {
|
||||
FileName = $"Liefermengen-Ertrag-{year}.ods",
|
||||
DefaultExt = "ods",
|
||||
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
|
||||
Title = $"Liefermengen/Ertrag {year} speichern unter - Elwig"
|
||||
};
|
||||
if (d.ShowDialog() == false)
|
||||
return;
|
||||
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
try {
|
||||
var b = new Billing(year);
|
||||
await b.FinishSeason();
|
||||
await b.CalculateBuckets();
|
||||
App.HintContextChange();
|
||||
|
||||
using var ctx = new AppDbContext();
|
||||
var tbl = await MemberDeliveryPerVarietyData.ForSeason(ctx.MemberDeliveryPerVariantRows, year);
|
||||
using var ods = new OdsFile(d.FileName);
|
||||
await ods.AddTable(tbl);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user