<localView:BeWoView x:Class="BeWo.View.Detail.AccountingTransactionView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:conv="clr-namespace:BeWo.Converter" xmlns:val="clr-namespace:BeWo.Validation" xmlns:s="clr-namespace:System;assembly=mscorlib" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True">
	<Grid>
		<Grid.Resources>
			<conv:NumberSmaller0ColorConverter x:Key="NumberSmaller0ColorConverter" />
			<!--xcdg:DataGridCollectionViewSource x:Key="dataSource" Source="{Binding Path=FilterResult}" /-->
		</Grid.Resources>

		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<GroupBox x:Name="groupbox_editArea" Grid.Row="0" Header="Alle Buchungen" Style="{DynamicResource ObjectEditGroupBox}">
			<Grid Grid.IsSharedSizeScope="True">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="270" />
					<ColumnDefinition Width="*" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="*" />
					<RowDefinition Height="Auto" />
				</Grid.RowDefinitions>

				<GroupBox Margin="0 0 10 0">
					<GroupBox.Header>

						<Grid Margin="0 0 4 0">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" SharedSizeGroup="a" />
								<ColumnDefinition Width="Auto" SharedSizeGroup="b" />
							</Grid.ColumnDefinitions>
							<CheckBox Name="checkbox_yearfilter" IsChecked="True" Content="Nach Jahr filtern" />
							<CheckBox Name="checkbox_monthfilter" IsEnabled="{Binding Path=IsChecked, ElementName=checkbox_yearfilter}" Grid.Column="1" IsChecked="True" Content="Nach Monat filtern" Margin="5,0,0,0" />
						</Grid>
					</GroupBox.Header>
					<Grid Margin="0 0 4 0">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*" SharedSizeGroup="a" />
							<ColumnDefinition Width="Auto" SharedSizeGroup="b" />
						</Grid.ColumnDefinitions>
						<ComboBox x:Name="combobox_year" IsEnabled="{Binding Path=IsChecked, ElementName=checkbox_yearfilter}" Margin="3" Height="20" MinWidth="80" Padding="5 0" VerticalContentAlignment="Center" Background="White" />
						<ComboBox x:Name="combobox_month" IsEnabled="{Binding Path=IsChecked, ElementName=checkbox_monthfilter}" Grid.Column="1" Margin="8,0,0,0" Height="20" MinWidth="120" Padding="5 0" VerticalContentAlignment="Center" Background="White" Grid.Row="1" />
					</Grid>
				</GroupBox>

				<GroupBox Grid.Row="1" Grid.RowSpan="2" Grid.Column="0" Margin="0 0 10 0">
					<GroupBox.Header>
						<CheckBox Name="checkbox_supportconceptfilter" Unchecked="checkbox_supportconceptfilter_CheckedChanged" IsChecked="False" Checked="checkbox_supportconceptfilter_CheckedChanged" Content="Nach Hilfeplan filtern" />
					</GroupBox.Header>
					<localSearchView:SupportConceptTreeSearchView ResultListBackground="{StaticResource AccountingContentBrush}" x:Name="treesearchview_filter" IsEnabled="{Binding Path=IsChecked, ElementName=checkbox_supportconceptfilter}" Grid.Row="2" />
				</GroupBox>

				<GridSplitter Grid.Column="0" HorizontalAlignment="Right" Grid.Row="0" Grid.RowSpan="3" Width="4" />

				<dxg:GridControl x:Name="datagrid_transactions" VerticalAlignment="Stretch" DataSource="{Binding FilterResult}"
				                 Grid.Row="0" Grid.RowSpan="3" Grid.Column="1" HorizontalAlignment="Stretch">
					<dxg:GridControl.Columns>

						<dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True">
							<dxg:GridColumn.CellTemplate>
								<DataTemplate>
									<Button Content="r" FontFamily="Webdings" Click="DeleteButton_Click" Width="18" Height="18" VerticalAlignment="Center" />
								</DataTemplate>
							</dxg:GridColumn.CellTemplate>
						</dxg:GridColumn>

						<dxg:GridColumn x:Name="column_bookingdate" FieldName="BookingDate" EditSettings="{dxe:DateSettings DisplayFormat=d}" Header="Buchungsdatum" />
            <dxg:GridColumn x:Name="column_validitydate" FieldName="ValidityDate" Header="Gültigkeitsdatum" />
						<dxg:GridColumn FieldName="Amount" Header="Betrag">
							<dxg:GridColumn.EditSettings>
								<dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric"></dxe:TextEditSettings>
							</dxg:GridColumn.EditSettings>
							<!--<dxg:GridColumn.DisplayTemplate>
                                <ControlTemplate>
                                    <TextBlock Text="{Binding EditValue, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:0.00}'}" Foreground="{Binding EditValue, Converter={StaticResource NumberSmaller0ColorConverter}}"></TextBlock>
                                </ControlTemplate>
                            </dxg:GridColumn.DisplayTemplate>-->
						</dxg:GridColumn>
						<dxg:GridColumn x:Name="column_category" FieldName="Category" Header="Kategorie" />
						<dxg:GridColumn AllowEditing="False" FieldName="SupportConceptName" Header="Hilfeplan" />
						<dxg:GridColumn AllowEditing="False" FieldName="CostBearer" Header="Kostenträger" />
						<dxg:GridColumn FieldName="Notice" Header="Bemerkung" />
					</dxg:GridControl.Columns>
					<dxg:GridControl.View>
						<dxg:TableView x:Name="gridView" NavigationStyle="Cell" ShowGroupPanel="False" ScrollingMode="Smart" SnapsToDevicePixels="True" Margin="3,22,3,3" />
					</dxg:GridControl.View>
				</dxg:GridControl>

				<Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="5,0,5,0">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*" />
						<ColumnDefinition Width="Auto" />
					</Grid.ColumnDefinitions>

					<TextBlock Grid.Column="1" x:Name="textblock_link" VerticalAlignment="Center" Margin="0 0 10 0" HorizontalAlignment="Left" FontSize="14">
						<Hyperlink x:Name="linkExcelExport" TargetName="newWindow" Foreground="{StaticResource GridPrintMenuLightBrush}" RequestNavigate="linkExcelExport_RequestNavigate">Excel Export</Hyperlink>
					</TextBlock>
					<Label Grid.Column="0" FontSize="14" Foreground="{StaticResource GridPrintMenuLightBrush}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Content="{Binding FilterResultAmountSum, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}Summe der angezeigten Buchungen: {0:n} €'}" />

				</Grid>


			</Grid>
		</GroupBox>

	</Grid>
</localView:BeWoView>