<localView:BeWoView x:Class="BeWo.View.Detail.Accounting.InvoiceOverview" 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:localViewModel="clr-namespace:BeWo.ViewModel" xmlns:localViewDetail="clr-namespace:BeWo.View.Detail.Accounting" xmlns:val="clr-namespace:BeWo.Validation" xmlns:proxy="clr-namespace:BeWo.ServiceProxy" 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" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:r="clr-namespace:BeWo.Security" VerticalAlignment="Stretch" Focusable="True" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic">

	<Grid>
		<GroupBox x:Name="groupbox_editArea" Grid.Row="0" Header="Alle Rechnungen" Style="{DynamicResource ObjectEditGroupBox}">

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

				<localView:YearMonthFilter Margin="3 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" x:Name="yearMonthFilter" FilterSpanChanged="YearMonthFilter_FilterSpanChanged" />
				<Button x:Name="button_reload" Grid.Column="1" Content="Aktualisieren" Margin="0,0,0,8" Click="ReloadButton_OnClick" Height="24" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="80" />
				
				<dxg:GridControl Margin="3" Grid.ColumnSpan="2" Grid.Row="1" DataSource="{Binding VMList}" x:Name="datagrid_invoices" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
					<dxg:GridControl.Columns>

						<dxg:GridColumn AllowEditing="False" MinWidth="67" FieldName="ReportLink" Header=" ">
							<dxg:GridColumn.DisplayTemplate>
								<ControlTemplate>
									<StackPanel Orientation="Horizontal">
										<Button Margin="1" ToolTip="Formular anzeigen" x:Name="btn_report" Height="20" Width="20" VerticalAlignment="Center">
											<TextBlock Padding="0">
												<Hyperlink TextDecorations="None" TargetName="_NewWindow" NavigateUri="{Binding DisplayText, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" RequestNavigate="Hyperlink_OnRequestNavigate">
													<TextBlock Padding="0" Text="¥" Foreground="#FFFFFF" FontSize="15" FontFamily="Webdings" Height="17" Width="16" VerticalAlignment="Center" HorizontalAlignment="Left" />
												</Hyperlink>
											</TextBlock>
										</Button>
                                        <Button Click="btn_edit_Click" Content="@" Padding="0" Margin="1" ToolTip="Editieren" Foreground="#FFFFFF" FontSize="13" FontFamily="Webdings" x:Name="btn_edit" Height="20" Width="20" VerticalAlignment="Center" />
                                        <Button Click="btn_delete_Click" Content="r" Padding="0" Margin="1" ToolTip="Löschen" Foreground="#FFFFFF" FontSize="13" FontFamily="Webdings" x:Name="btn_delete" Height="20" Width="20" VerticalAlignment="Center" />
									</StackPanel>
								</ControlTemplate>
							</dxg:GridColumn.DisplayTemplate>
						</dxg:GridColumn>
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="TypeString" Header="Art der Rechnung" Width="150" />
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="CustomerName" Header="Klient/in" Width="100" />
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="InvoiceNumber" Header="Nummer" />
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="InvoiceDate" Header="Datum" EditSettings="{dxe:DateSettings DisplayFormat=d}" MinWidth="70" />
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="RecipientString" Header="Empfänger" />
						<!--<dxg:GridColumn FieldName="AccountingPeriodString" Header="Abrechnungszeitraum" />-->
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="TotalAmount" Header="Betrag" MinWidth="70">
							<!--<dxg:GridColumn.CellStyle>
                                <Style  TargetType="dxg:CellContentPresenter">
                                    <Setter Property="FontWeight" Value="Bold"/>
                                </Style>
                            </dxg:GridColumn.CellStyle>-->
							<dxg:GridColumn.EditSettings>
								<dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric"></dxe:TextEditSettings>
							</dxg:GridColumn.EditSettings>
						</dxg:GridColumn>
						<dxg:GridColumn ReadOnly="True" AllowEditing="False" FieldName="Notice" Header="Notiz" MinWidth="200" >
							<dxg:GridColumn.EditSettings>
								<dxe:TextEditSettings TextWrapping="Wrap" />
							</dxg:GridColumn.EditSettings>
						</dxg:GridColumn>

						<dxg:GridColumn FieldName="IsPaid" Header="Bezahlt"></dxg:GridColumn>
					</dxg:GridControl.Columns>
					<dxg:GridControl.View>
						<dxg:TableView NavigationStyle="Cell" Loaded="gridView_Loaded" x:Name="gridView" BestFitMode="Smart" AllowBestFit="True" ShowGroupPanel="False" ScrollingMode="Smart" SnapsToDevicePixels="True" Margin="3,22,3,3" />
					</dxg:GridControl.View>
				</dxg:GridControl>

				<Grid Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="5,2,5,0">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*" />
						<ColumnDefinition Width="Auto" />
					</Grid.ColumnDefinitions>
					<Label FontSize="14" Foreground="{StaticResource GridPrintMenuLightBrush}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Content="{Binding FilterResultAmountSum, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}Summe der angezeigten Rechnungen: {0:c}'}" />
					<TextBlock Grid.Column="1" x:Name="textblock_link" VerticalAlignment="Bottom" Margin="5,0,5,3" HorizontalAlignment="Right" FontSize="14">
						<Hyperlink x:Name="linkExcelExport" TargetName="newWindow" Foreground="{StaticResource GridPrintMenuLightBrush}" RequestNavigate="linkExcelExport_RequestNavigate">
							<Run Text="Excel Export" />
						</Hyperlink>
					</TextBlock>


				</Grid>
			</Grid>
		</GroupBox>
	</Grid>

</localView:BeWoView>