<localView:BeWoView 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: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:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:s="clr-namespace:System;assembly=mscorlib"
        xmlns:r="clr-namespace:BeWo.Security" xmlns:localsearch="clr-namespace:BeWo.View.Search"
        xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        x:Class="BeWo.View.Detail.Accounting.ServiceInvoiceView" Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
        VerticalAlignment="Stretch" Focusable="True" mc:Ignorable="d">
    <Grid>
        <GroupBox Style="{StaticResource ObjectEditGroupBox}" Header="Sammelrechnung an Kostenträger">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Label VerticalAlignment="Center" Content="Kostenträger:" />
                    <uc:PopUpEdit x:Name="popupedit_CostBeaerer" PopUpClick="popupedit_CostBeaerer_PopUpClick" Width="250"
                            Height="23" Margin="3" Text="{Binding SelectedCostBearer.Name, Mode=OneWay}" Grid.Column="1"
                            IsReadOnly="True" DeleteButtonVisibility="Collapsed" MaxWidth="300" Cursor="Arrow"
                                  PreviewMouseDoubleClick="Popupedit_CostBeaerer_OnPreviewMouseDoubleClick"/>
                    <Popup Margin="10" x:Name="popup_costBearer" StaysOpen="False" Placement="MousePoint" Width="400"
                            Grid.Row="2" Height="400" Closed="popup_Closed" Opened="popup_Opened">
                        <localsearch:OrganisationSearchView x:Name="organisationSearchView"
                                ItemSelected="organisationSearchView_ItemSelected" SearchMode="CostBearer" />
                    </Popup>
                    <StackPanel Grid.Column="2"
                            Visibility="{Binding Text, Converter={StaticResource ObjectVisibilityConverter}, ElementName=popupedit_CostBeaerer}"
                            Orientation="Horizontal">
                        <dxe:CheckEdit Margin="3" Grid.Column="2" Content="Alle Hilfepläne"
                                IsChecked="{Binding IsAllSupportConcepts}" x:Name="ce_all_hp" />
                        <uc:PopUpEdit x:Name="popupedit_supportConcept" PopUpClick="popupedit_supportConcept_PopUpClick"
                                Width="250"
                                Visibility="{Binding IsChecked, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=false, ElementName=ce_all_hp}"
                                Height="23" Text="{Binding SelectedSupportConcept.DetailDescription, Mode=OneWay}" Margin="3"
                                Grid.Column="3" IsReadOnly="True" DeleteButtonVisibility="Collapsed" MaxWidth="300" 
                                      Cursor="Arrow" PreviewMouseDoubleClick="Popupedit_supportConcept_OnPreviewMouseDoubleClick"/>
                    </StackPanel>
                    <Popup Margin="10" x:Name="popup_supportConcept" StaysOpen="False" Placement="MousePoint" Width="400"
                            Grid.Row="2" Height="400" Closed="popup_Closed" Opened="popup_Opened">
                        <localsearch:SupportConceptSearchView CostBearerFilter="{Binding SelectedCostBearer, PresentationTraceSources.TraceLevel=High}"
                                x:Name="supportConcept_search" Grid.Column="3" SearchMode="ActiveCostbearer2SupportConcepts"
                                ItemSelected="SupportConceptSearchView_ItemSelected" />
                    </Popup>
                    <dxe:CheckEdit x:Name="ce_invoice_sc_duration" Margin="3 5 3 3" Foreground="Black" FontSize="12"
                            Grid.ColumnSpan="4" Grid.Row="1" VerticalAlignment="Center"
                            Content="Über gesamten Bewilligungszeitraum"
                            IsChecked="{Binding IsUseApprovalPeriod}" />
                    <Label Grid.Row="2" Content="von:" HorizontalAlignment="Right"
                            Visibility="{Binding Visibility, ElementName=grid_period}" />
                    <Grid Grid.Row="2" x:Name="grid_period" Grid.Column="1"
                            Visibility="{Binding IsChecked, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=false, ElementName=ce_invoice_sc_duration}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <dxe:DateEdit MaskType="DateTimeAdvancingCaret" x:Name="dp_start" Grid.Column="0" Margin="3" Height="23" 
                                EditValue="{Binding InvoicePeriodStart}" />
                        <Label Content="bis:" Grid.Column="1" />
                        <dxe:DateEdit MaskType="DateTimeAdvancingCaret" x:Name="dp_end" Grid.Column="2" Margin="3" Height="23" 
                                EditValue="{Binding InvoicePeriodEnd}" />
                    </Grid>
                    <Button Height="23" VerticalAlignment="Center" Margin="3" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left"
                            Grid.Row="3" IsEnabled="{Binding IsSelectionValid}" ToolTip="Hinzufügen"
                            x:Name="button_createInvoice" Click="button_createInvoice_Click" Content="Rechnungen erstellen" />
                </Grid>
                <ListView HorizontalContentAlignment="Stretch" x:Name="lb_invoivces" Background="{x:Null}"
                        BorderBrush="{x:Null}" ItemsSource="{Binding ServiceInvoiceListVM.VMList, Mode=OneWay}" Grid.Row="1"
                        ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="False">
                    <ListView.Resources>
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
                    </ListView.Resources>
                    <ListView.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Focusable" Value="false" />
                        </Style>
                    </ListView.ItemContainerStyle>
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel />
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <Border MinHeight="85" CornerRadius="5" Background="White" Margin="3" BorderThickness="1"
                                    BorderBrush="Black">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <TextBlock Margin="5 5 5 3" FontWeight="Bold"
                                            >
										<TextBlock.Text>
											<MultiBinding Converter="{StaticResource StringFormatMulitConverter}"
                                                    ConverterParameter="{}{0} vom {1:dd.MM.yyyy} an {2} {3} {4}">
												<Binding Path="InvoiceBase.InvoiceNumber" />
												<Binding Path="InvoiceBase.InvoiceDate" />
												<Binding Path="InvoiceBase.RecipientOrganisation" />
												<Binding Path="InvoiceBase.RecipientPersonFirstName" />
												<Binding Path="InvoiceBase.RecipientPersonLastName" />
											</MultiBinding>
										</TextBlock.Text></TextBlock>
                                    <TextBlock Margin="5 0 0 0" Grid.Row="1" Grid.ColumnSpan="2"
                                            Text="{Binding InvoiceBase.InvoiceTitle}" />
                                    <TextBlock Margin="5,0,0,4" Grid.Row="2" Grid.ColumnSpan="2"
                                            >
										<TextBlock.Text>
											<MultiBinding StringFormat="Abrechnungszeitraum: {0:dd.MM.yyyy} - {1:dd.MM.yyyy}">
												<Binding Path="InvoiceBase.AccountingPeriodStart" />
												<Binding Path="InvoiceBase.AccountingPeriodEnd" />
											</MultiBinding>
										</TextBlock.Text></TextBlock>
                                    <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" FontWeight="Bold"
                                            Margin="0 5 5 0" Height="50" FontSize="14"
                                            Text="{Binding EndClaim, Mode=OneWay, StringFormat=\{0:0.00\} €}" Grid.Column="2"
                                            Grid.RowSpan="3" />
                                    <Border VerticalAlignment="Stretch" CornerRadius="0 0 5 5" HorizontalAlignment="Stretch"
                                            BorderBrush="{x:Null}" BorderThickness="0 1 0 0" Grid.Row="3" Grid.ColumnSpan="3"
                                            Background="#43A7C6CD" />
                                    <dxe:CheckEdit Grid.ColumnSpan="3" IsChecked="{Binding IsPrinting}" Tag="{Binding}"
                                            VerticalAlignment="Center" Margin="5 0 0 0" Grid.Row="3" />
                                    <Label Grid.ColumnSpan="3" VerticalAlignment="Center" Margin="20 0 0 0" Grid.Row="3"
                                            Content="Sammeldruck" />
                                    <Button Grid.Column="2" Grid.Row="3" Width="32"
                                            Height="22" HorizontalAlignment="Right"
                                            Margin="0,5,75,5" Style="{DynamicResource GlassButton}"
                                            >
                                        <TextBlock>
											<Hyperlink TargetName="_NewWindow" Foreground="#FFFFFFFF" RequestNavigate="Hyperlink_OnRequestNavigate"
                                                    NavigateUri="{Binding Converter={StaticResource SettlementDCPrintURLConverter}}">
												<InlineUIContainer>
													<Grid Width="32" Margin="-3 0" Height="22">
														<Rectangle Fill="White" Opacity=".01" />
														<TextBlock Text="¥" Foreground="#2d4d82" Margin="6 1 0 0"
                                                                FontSize="18" FontFamily="Webdings" />
													</Grid>
												</InlineUIContainer>
											</Hyperlink>
										</TextBlock>
                                    </Button>
                                    <Button x:Name="btnEdit" Click="btnEdit_Click" Grid.Column="2" Grid.Row="3" Width="32"
                                            Height="22" HorizontalAlignment="Right"
                                            Margin="0,5,40,5"
                                            BorderThickness="1,1,1,1" Padding="1,1,1,1" Style="{DynamicResource GlassButton}"
                                            Tag="{Binding}"
                                            Visibility="{Binding EditAllowed, Converter={StaticResource BoolVisibilityConverter}}">
                                        <Image Source="..\..\..\Ressources\Icons\Symbol Edit.png" Stretch="Uniform"
                                                Margin="1,1,1,1" />
                                    </Button>
                                    <Button x:Name="btnDelete" Grid.Column="2" Grid.Row="3" Click="btnDelete_Click"
                                            Width="32"
                                            Height="22" HorizontalAlignment="Right"
                                            Margin="0,5,5,5"
                                            Padding="1,1,1,1" BorderThickness="1,1,1,1" Style="{DynamicResource GlassButton}"
                                            Tag="{Binding}"
                                            Visibility="{Binding EditAllowed, Converter={StaticResource BoolVisibilityConverter}}">
                                        <Image Source="..\..\..\Ressources\Icons\Symbol Delete.png" Stretch="Uniform"
                                                Margin="1,1,1,1" />
                                    </Button>
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
                <Grid Grid.Row="2" Margin="13 3 3 3" x:Name="grid_printselect" Visibility="Hidden">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <dxe:CheckEdit dx:ThemeManager.ThemeName="Azure" x:Name="ce_selectAll" Checked="ce_selectAll_Checked"
                            Unchecked="ce_selectAll_Unchecked" />
                    <Label VerticalAlignment="Center" Margin="3" Grid.Column="1" Content="Alle" Foreground="White" />
                    <Label VerticalAlignment="Center" Margin="3" Content="|" Foreground="LightGray" Grid.Column="2" />
                    <dxe:DateEdit MaskType="DateTimeAdvancingCaret" Grid.Column="3" DateTime="{x:Static s:DateTime.Now}" Margin="3" Name="dt_selectAll" />
                    <Button Grid.Column="4" x:Name="bt_selectAllDate" Content="a"
                            ToolTip="Rechnungen des gewählten Datums für Sammeldruck selektieren" FontFamily="webdings"
                            Height="20" VerticalAlignment="Center" Width="20" FontSize="16" Click="bt_selectAllDate_Click" />
                    <TextBlock HorizontalAlignment="Right" x:Name="tb_printAll" Margin="3" Grid.Column="5"
                            Visibility="Hidden">
						<Hyperlink TargetName="_NewWindow" Foreground="Blue" RequestNavigate="Hyperlink_OnRequestNavigate">
							<InlineUIContainer>
								<TextBlock Text="Selektierte Rechnungen drucken" />
							</InlineUIContainer>
						</Hyperlink>
					</TextBlock>
                </Grid>
            </Grid>
        </GroupBox>
    </Grid>
</localView:BeWoView>