MainWindow: Add statistics table in Leseabschluss
This commit is contained in:
@ -63,6 +63,7 @@ namespace Elwig.Helpers {
|
|||||||
public DbSet<PaymentDeliveryPart> PaymentDeliveryParts { get; private set; }
|
public DbSet<PaymentDeliveryPart> PaymentDeliveryParts { get; private set; }
|
||||||
public DbSet<PaymentCustom> CustomPayments { get; private set; }
|
public DbSet<PaymentCustom> CustomPayments { get; private set; }
|
||||||
public DbSet<Credit> Credits { get; private set; }
|
public DbSet<Credit> Credits { get; private set; }
|
||||||
|
public DbSet<DeliveryPartBucket> DeliveryPartBuckets { get; private set; }
|
||||||
|
|
||||||
public DbSet<OverUnderDeliveryRow> OverUnderDeliveryRows { get; private set; }
|
public DbSet<OverUnderDeliveryRow> OverUnderDeliveryRows { get; private set; }
|
||||||
public DbSet<AreaComUnderDeliveryRowSingle> AreaComUnderDeliveryRows { get; private set; }
|
public DbSet<AreaComUnderDeliveryRowSingle> AreaComUnderDeliveryRows { get; private set; }
|
||||||
|
@ -105,6 +105,41 @@
|
|||||||
<Button x:Name="PaymentButton" Content="Auszahlung"
|
<Button x:Name="PaymentButton" Content="Auszahlung"
|
||||||
Click="PaymentButton_Click"
|
Click="PaymentButton_Click"
|
||||||
Margin="195,90,0,10" Width="190"/>
|
Margin="195,90,0,10" Width="190"/>
|
||||||
|
|
||||||
|
<Grid VerticalAlignment="Bottom" Margin="50,140,50,10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="20"/>
|
||||||
|
<RowDefinition Height="20"/>
|
||||||
|
<RowDefinition Height="20"/>
|
||||||
|
<RowDefinition Height="20"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" TextAlignment="Right"><Bold>Mitglieder</Bold></TextBlock>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" TextAlignment="Right"><Bold>Gewicht</Bold></TextBlock>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="3" TextAlignment="Right"><Bold>Fläche</Bold></TextBlock>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0">Gesamt:</TextBlock>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0">Gebunden:</TextBlock>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">Ungebunden:</TextBlock>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersTotal">-</TextBlock>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersGeb">-</TextBlock>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="1" TextAlignment="Right">-</TextBlock>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightTotal">-</TextBlock>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightGeb">-</TextBlock>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightUngeb">-</TextBlock>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="3" TextAlignment="Right">-</TextBlock>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="3" TextAlignment="Right" x:Name="SeasonStatArea">-</TextBlock>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="3" TextAlignment="Right">-</TextBlock>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Expander>
|
</Expander>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -251,7 +251,7 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SeasonFinish_Expanded(object sender, RoutedEventArgs evt) {
|
private void SeasonFinish_Expanded(object sender, RoutedEventArgs evt) {
|
||||||
Height = 530;
|
Height = 610;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeasonFinish_Collapsed(object sender, RoutedEventArgs evt) {
|
private void SeasonFinish_Collapsed(object sender, RoutedEventArgs evt) {
|
||||||
@ -260,12 +260,32 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private async void SeasonInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
|
private async void SeasonInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
|
var year = SeasonInput.Value;
|
||||||
|
var s0 = await ctx.Seasons.FindAsync(year);
|
||||||
var valid = (s0 != null);
|
var valid = (s0 != null);
|
||||||
DeliveryConfirmationButton.IsEnabled = valid;
|
DeliveryConfirmationButton.IsEnabled = valid;
|
||||||
OverUnderDeliveryButton.IsEnabled = valid;
|
OverUnderDeliveryButton.IsEnabled = valid;
|
||||||
PaymentButton.IsEnabled = valid;
|
PaymentButton.IsEnabled = valid;
|
||||||
BreakdownButton.IsEnabled = valid;
|
BreakdownButton.IsEnabled = valid;
|
||||||
|
|
||||||
|
if (valid) {
|
||||||
|
var areaComs = Utils.ActiveAreaCommitments(ctx.AreaCommitments, year!.Value);
|
||||||
|
var weightTotal = await ctx.DeliveryParts.Where(p => p.Year == year).SumAsync(p => p.Weight);
|
||||||
|
var gebWeight = await ctx.DeliveryPartBuckets.Where(b => b.Year == year && b.Discr != "_").SumAsync(b => b.Value);
|
||||||
|
SeasonStatMembersTotal.Text = $"{await ctx.Deliveries.Where(d => d.Year == year).Select(d => d.Member).Distinct().CountAsync():N0}";
|
||||||
|
SeasonStatMembersGeb.Text = $"{await areaComs.Select(c => c.Member).Distinct().CountAsync():N0}";
|
||||||
|
SeasonStatWeightTotal.Text = $"{weightTotal:N0} kg";
|
||||||
|
SeasonStatWeightGeb.Text = $"{gebWeight:N0} kg";
|
||||||
|
SeasonStatWeightUngeb.Text = $"{weightTotal - gebWeight:N0} kg";
|
||||||
|
SeasonStatArea.Text = $"{await areaComs.SumAsync(c => c.Area):N0} m²";
|
||||||
|
} else {
|
||||||
|
SeasonStatMembersTotal.Text = "-";
|
||||||
|
SeasonStatMembersGeb.Text = "-";
|
||||||
|
SeasonStatWeightTotal.Text = "-";
|
||||||
|
SeasonStatWeightGeb.Text = "-";
|
||||||
|
SeasonStatWeightUngeb.Text = "-";
|
||||||
|
SeasonStatArea.Text = "-";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
|
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
Reference in New Issue
Block a user