<localView:BeWoView x:Class="BeWo.View.Detail.Accounting.ServiceInvoiceItemEditView"
                    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:val="clr-namespace:BeWo.Validation"
                    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"
                    VerticalAlignment="Stretch" Focusable="True">
    <GroupBox MinHeight="500" Width="900" Style="{StaticResource PopUpWindowStyle}">
        <GroupBox.Header>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,0">
                <Image Source="..\..\Ressources\Icons\CoinsDisabled.png" Height="28" />
                <TextBox Text="Rechnungen erstellen" Margin="10,4,0,0" Background="{x:Null}"
                        Foreground="{DynamicResource MainGroupBoxForegroundBrush}" FontSize="20" BorderBrush="{x:Null}"
                        VerticalAlignment="Stretch" BorderThickness="0,0,0,0" Padding="0,0,0,0" />
            </StackPanel>
        </GroupBox.Header>
        <Grid Background="{StaticResource ObjectEditBackgroundBrush}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{DynamicResource AccountingContentBrush}" VerticalAlignment="Top" Height="6" />
            <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
                <Grid Grid.IsSharedSizeScope="True" Margin="10,10,0,10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <GroupBox Margin="3 6 3 6" Style="{StaticResource ObjectEditGroupBox}" Grid.ColumnSpan="2" Header="Rechnungsdetails">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Label Content="Rechnungsnummer" />
                            <TextBox Margin="3" Height="23" Grid.Row="0" Grid.Column="1"
                                    Text="{Binding InvoiceBase.InvoiceNumber, UpdateSourceTrigger=PropertyChanged}" />
                            <Label Content="Ersteller Vorname" Grid.Row="0" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="0" Grid.Column="3"
                                    Text="{Binding InvoiceBase.CreatorFirstName}"
                                    Height="23" />
                            <Label Content="Ersteller Nachname" Grid.Row="0" Grid.Column="4" />
                            <TextBox Margin="3" Height="23" Grid.Row="0" Grid.Column="5"
                                    Text="{Binding InvoiceBase.CreatorLastName}" />
                            <Label Content="Rechnungsdatum" Grid.Row="1" Grid.Column="0" />
                            <dxe:DateEdit MaskType="DateTimeAdvancingCaret" BorderThickness="1" Margin="3" Height="23" Grid.Row="1" Grid.Column="1"
                                    EditValue="{val:ValidationBinding Path=InvoiceBase.InvoiceDate, Mode=TwoWay}" />
                            <Label Content="Abrechnungszeitraum von" Grid.Row="1" Grid.Column="2" />
                            <dxe:DateEdit MaskType="DateTimeAdvancingCaret" BorderThickness="1" Height="23" Margin="3" Grid.Row="1" Grid.Column="3"
                                    EditValue="{val:ValidationBinding Path=InvoiceBase.AccountingPeriodStart}" />
                            <Label Content="Abrechnungszeitraum bis" Grid.Row="1" Grid.Column="4" />
                            <dxe:DateEdit MaskType="DateTimeAdvancingCaret" BorderThickness="1" Height="23" Margin="3" Grid.Row="1" Grid.Column="5"
                                    EditValue="{val:ValidationBinding Path=InvoiceBase.AccountingPeriodEnd}" />
                            <Label Grid.Column="0" Grid.Row="2" Content="anz Mahnungen" />
                            <dxe:TextEdit BorderTemplate="{StaticResource dx_textedit_border}"
                                    HorizontalContentAlignment="Right" DisplayFormatString="0:0" Foreground="Black"
                                    Text="{Binding InvoiceBase.DunningLetterCount, Mode=OneWay}" Margin="3" Grid.Column="1"
                                    Grid.Row="2"></dxe:TextEdit>
                            <Label Content="Bemerkung" Grid.Row="2" Grid.Column="2" />
                            <TextBox Grid.Row="2" Grid.Column="3"
                                    Grid.ColumnSpan="3" Margin="3" AcceptsReturn="True"
                                    TextWrapping="Wrap" Height="23" Text="{Binding InvoiceBase.Notice}" />
                        </Grid>
                    </GroupBox>
                    <GroupBox Margin="3 6 6 3" Grid.Row="1" Style="{StaticResource ObjectEditGroupBox}" Header="Empfänger">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="col3" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
								<RowDefinition Height="Auto" />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>
                            <Label Content="Organisation" />
                            <TextBox Margin="3" Grid.Row="0" Grid.Column="1"
                                    Text="{Binding InvoiceBase.RecipientOrganisation}" Height="23" />
                            <Label Content="Abteilung" Grid.Row="0" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="0" Grid.Column="3"
                                    Text="{Binding InvoiceBase.RecipientDivision}"
                                    Height="23" />
                            <Label Content="Vorname" Grid.Row="1" Grid.Column="0" />
                            <TextBox Margin="3" Grid.Row="1" Grid.Column="1"
                                    Text="{Binding InvoiceBase.RecipientPersonFirstName}" Height="23" />
                            <Label Content="Nachname" Grid.Row="1" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="1" Grid.Column="3"
                                    Text="{Binding InvoiceBase.RecipientPersonLastName}" Height="23" />
                            <Label Content="Aktenzeichen" Grid.Row="2" Grid.Column="0" />
                            <TextBox Margin="3" Height="23" Grid.Row="2" Grid.Column="1"
                                    Text="{Binding InvoiceBase.CustomerReferenceNumber}" />
                            <Label Content="Strasse" Grid.Row="2" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="2" Grid.Column="3"
                                    Text="{val:ValidationBinding Path=InvoiceBase.RecipientStreet}" Height="23" />
                            <Label Content="Postleitzahl" Grid.Row="3" Grid.Column="0" />
                            <TextBox Margin="3,3,3,0" Grid.Row="3" Grid.Column="1"
                                    Text="{val:ValidationBinding Path=InvoiceBase.RecipientPostCode}" Height="23" />
                            <Label Content="Ort" Grid.Row="3" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="3" Grid.Column="3"
                                    Text="{val:ValidationBinding Path=InvoiceBase.RecipientTown}" Height="23" />
							<Label Content="Postfach" Grid.Row="4" Grid.Column="2" />
							<TextBox Margin="3" Grid.Row="4" Grid.Column="3"
                                     Text="{Binding Path=RecipientPostBox}" Height="23" />
						</Grid>
                    </GroupBox>
                    <GroupBox Margin="6 6 3 3" Style="{StaticResource ObjectEditGroupBox}" Grid.Row="1" Grid.Column="2"
                            Header="Absender">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="col3" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Label Content="Vorname" />
                            <TextBox Margin="3" Grid.Row="0" Grid.Column="1"
                                    Text="{Binding InvoiceBase.SenderFirstName}"
                                    Height="23" />
                            <Label Content="Nachname" Grid.Row="0" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="0" Grid.Column="3"
                                    Text="{Binding InvoiceBase.SenderLastName}"
                                    Height="23" />
                            <Label Content="Organisation" Grid.Row="1" />
                            <TextBox Margin="3" Grid.Row="1" Grid.Column="1"
                                    Text="{Binding InvoiceBase.SenderOrganisation}"
                                    Height="23" />
                            <Label Content="Abteilung" Grid.Row="1" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="1" Grid.Column="3"
                                    Text="{Binding InvoiceBase.SenderDivision}"
                                    Height="23" />
                            <Label Content="Fax" Grid.Row="2" Grid.Column="0" />
                            <TextBox Margin="3" Grid.Row="2" Grid.Column="1"
                                    Text="{Binding InvoiceBase.SenderFax}"
                                    Height="23" />
                            <Label Content="Telefon" Grid.Row="2" Grid.Column="2" />
                            <TextBox Margin="3" Grid.Row="2" Grid.Column="3"
                                    Text="{Binding InvoiceBase.SenderPhone}"
                                    Height="23" />
                        </Grid>
                    </GroupBox>
                    <GroupBox Margin="3 6 3 3" Style="{StaticResource ObjectEditGroupBox}" Grid.ColumnSpan="2"
                            Grid.Row="3"
                            Header="Leistungen in Bewilligungszeiträumen - Details">
                        <Grid>
                            <Border Background="#FF838383" BorderBrush="#FF484848" BorderThickness="1" Margin="-3,-4,-3,-10">

                                <dx:DXTabControl Name="tab_periods" Loaded="TabControl_Loaded" Height="300" Margin="10"
                                        ItemsSource="{Binding ServiceInvoicePeriodTabItemSource}">
                                    <dx:DXTabControl.View>
                                        <dx:TabControlScrollView HeaderLocation="Top" HeaderOrientation="Horizontal" ShowHeaderMenu="True" ScrollButtonsShowMode="WhenNeeded" />
                                    </dx:DXTabControl.View>
                                    <dx:DXTabControl.Resources>
                                        <DataTemplate x:Key="summary_content" DataType="{x:Type localViewModel:ServiceInvoiceVM}">
                                            <ScrollViewer>
                                                <Grid Margin="5" Name="summary_grid" >
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <dxg:GridControl Background="Transparent" Margin="3 3 3 0" HorizontalAlignment="Left"
                                                            DataSource="{Binding ServiceInvoicePeriods.VMList}">
                                                        <!--<dxg:GridControl.Resources>
                                                <ControlTemplate x:Key="{dxg:TableViewThemeKey ResourceKey=ControlTemplate}">
                                                    <dxg:GridViewScrollViewer x:Name="scr" CanContentScroll="true"
                                                            VerticalScrollBarVisibility="Hidden"
                                                            HorizontalScrollBarVisibility="Auto" Focusable="False"
                                                            Template="{DynamicResource {dxg:TableViewThemeKey ResourceKey=ScrollViewerTemplate}}"></dxg:GridViewScrollViewer>
                                                </ControlTemplate>
                                            </dxg:GridControl.Resources>-->
                                                        <dxg:GridControl.Columns>
                                                            <dxg:GridColumn Header="Klient/in" Width="200" AllowResizing="False"
                                                                    FieldName="CustomerString" />
                                                            <dxg:GridColumn Header="Bewilligungszeitraum" Width="200" AllowResizing="False"
                                                                    FieldName="PeriodString" />
                                                            <!--<dxg:GridColumn Header="Bewilligt" FieldName="ApprovedAmount" Width="120">
                                                    <dxg:GridColumn.EditSettings>
                                                        <dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric"></dxe:TextEditSettings>
                                                    </dxg:GridColumn.EditSettings>
                                                </dxg:GridColumn>-->
                                                            <dxg:GridColumn Header="Forderung" Width="120" FieldName="Claim" AllowResizing="False">
                                                                <dxg:GridColumn.EditSettings>
                                                                    <dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric"></dxe:TextEditSettings>
                                                                </dxg:GridColumn.EditSettings>
                                                            </dxg:GridColumn>
                                                        </dxg:GridControl.Columns>
                                                        <dxg:GridControl.View>
                                                            <dxg:TableView NavigationStyle="None" ShowIndicator="False"
                                                                    AllowSorting="False" AllowColumnFiltering="False"
                                                                    ShowHorizontalLines="False" ShowVerticalLines="False" AllowResizing="False"
                                                                    ShowGroupPanel="False"
                                                        />
                                                        </dxg:GridControl.View>
                                                    </dxg:GridControl>
                                                    <Grid Grid.Row="1" Margin="3 0 3 3">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="280" />
                                                            <ColumnDefinition Width="120" />
                                                            <ColumnDefinition Width="122" />
                                                        </Grid.ColumnDefinitions>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="Auto" />
                                                            <RowDefinition Height="Auto" />
                                                            <RowDefinition Height="Auto" />
                                                            <RowDefinition Height="Auto" />
                                                        </Grid.RowDefinitions>
                                                        <Label Margin="3"
                                                                Content="Gesamtforderung:" VerticalAlignment="Center"
                                                                Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right" />
                                                        <Label Margin="3"
                                                                Content="Vorauszahlungen:" VerticalAlignment="Center"
                                                                Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" />
                                                        <Label Margin="3"
                                                                Content="Eigenanteil:" VerticalAlignment="Center"
                                                                Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" />
                                                        <Label Margin="3"
                                                                Content="Restforderung:" VerticalAlignment="Center"
                                                                FontWeight="Bold" Grid.Column="1" Grid.Row="3"
                                                                HorizontalAlignment="Right" />
                                                        <dxe:TextEdit IsReadOnly="True"
                                                                MaskUseAsDisplayFormat="True"
                                                                HorizontalContentAlignment="Right"
                                                                Mask="c"
                                                                MaskType="Numeric"
                                                                Foreground="Black"
                                                                Text="{Binding ClaimSum, Mode=OneWay}" Margin="0"
                                                                Grid.Column="2"
                                                                Grid.Row="0">
                                                            <dxe:TextEdit.BorderTemplate>
                                                                <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                    <Border Background="White" BorderBrush="#6f7074"
                                                                            BorderThickness="1 0 1 1">
                                                                        <ContentPresenter />
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </dxe:TextEdit.BorderTemplate>
                                                        </dxe:TextEdit>
                                                        <dxe:TextEdit IsReadOnly="True"
                                                                MaskUseAsDisplayFormat="True"
                                                                HorizontalContentAlignment="Right"
                                                                Mask="c"
                                                                MaskType="Numeric"
                                                                Foreground="Black"
                                                                Text="{Binding AmountAdvancePayments, Mode=OneWay}" Margin="0"
                                                                Grid.Column="2"
                                                                Grid.Row="1">
                                                            <dxe:TextEdit.BorderTemplate>
                                                                <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                    <Border Background="White" BorderBrush="#6f7074"
                                                                            BorderThickness="1 0 1 0">
                                                                        <ContentPresenter />
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </dxe:TextEdit.BorderTemplate>
                                                        </dxe:TextEdit>
                                                        <dxe:TextEdit IsReadOnly="True"
                                                                MaskUseAsDisplayFormat="True"
                                                                HorizontalContentAlignment="Right"
                                                                Mask="c"
                                                                MaskType="Numeric"
                                                                Foreground="Black"
                                                                Text="{Binding AmountEquityContribution, Mode=OneWay}" Margin="0"
                                                                Grid.Column="2"
                                                                Grid.Row="2">
                                                            <dxe:TextEdit.BorderTemplate>
                                                                <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                    <Border Background="White" BorderBrush="#6f7074"
                                                                            BorderThickness="1 0 1 1">
                                                                        <ContentPresenter />
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </dxe:TextEdit.BorderTemplate>
                                                        </dxe:TextEdit>
                                                        <dxe:TextEdit IsReadOnly="True"
                                                                FontWeight="Bold" MaskUseAsDisplayFormat="True"
                                                                HorizontalContentAlignment="Right"
                                                                Mask="c"
                                                                MaskType="Numeric"
                                                                Foreground="Black"
                                                                Text="{Binding EndClaim, Mode=OneWay}" Margin="0"
                                                                Grid.Column="2"
                                                                Grid.Row="3">
                                                            <dxe:TextEdit.BorderTemplate>
                                                                <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                    <Border Background="White" BorderBrush="#6f7074"
                                                                            BorderThickness="1 0 1 1">
                                                                        <ContentPresenter />
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </dxe:TextEdit.BorderTemplate>
                                                        </dxe:TextEdit>
                                                    </Grid>
                                                </Grid>
                                            </ScrollViewer>
                                        </DataTemplate>
                                        <DataTemplate x:Key="item_header" DataType="{x:Type localViewModel:ServiceInvoicePeriodVM}">
                                            <StackPanel Orientation="Horizontal">
                                                <Label x:Name="ItemHeaderLabel" Content="{Binding ShortDescription, Mode=OneWay}" Foreground="Black" ToolTip="{Binding PeriodString, Mode=OneWay}"/>
                                            </StackPanel>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type dx:DXTabItem}, Mode=FindAncestor}}" Value="False">
                                                    <Setter Property="Foreground" TargetName="ItemHeaderLabel" Value="{StaticResource GridPrintMenuLightBrush}"/>
                                                </DataTrigger>

                                            </DataTemplate.Triggers>
                                        </DataTemplate>
                                        <DataTemplate x:Key="summary_header"
                                                DataType="{x:Type localViewModel:ServiceInvoicePeriodVM}">
                                            <StackPanel Orientation="Horizontal">
                                                <Label x:Name="SummaryHeaderLabel" FontWeight="Bold" Content="Zusammenfassung" Foreground="Black" />
                                            </StackPanel>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type dx:DXTabItem}, Mode=FindAncestor}}" Value="False">
                                                    <Setter Property="Foreground" TargetName="SummaryHeaderLabel" Value="{StaticResource GridPrintMenuLightBrush}"/>
                                                </DataTrigger>

                                            </DataTemplate.Triggers>
                                        </DataTemplate>
                                        <DataTemplate x:Key="item_content" DataType="{x:Type localViewModel:ServiceInvoicePeriodVM}">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="*" />
                                                </Grid.RowDefinitions>
                                                <!--<Grid Margin="3" x:Name="grid_approvedAmount"
                                                Visibility="{Binding ApprovedFixedAmount, Converter={StaticResource ObjectVisibilityConverter}}">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Label Content="Bewilligter Pauschalbetrag im Zeitraum" VerticalAlignment="Center"
                                                    />
                                            
                                            
                                            <dxe:TextEdit IsReadOnly="True"
                                                    BorderTemplate="{StaticResource dx_textedit_border}"
                                                    MaskUseAsDisplayFormat="True"
                                                    HorizontalContentAlignment="Right"
                                                    Mask="c"
                                                    MaskType="Numeric"
                                                    Foreground="Black"
                                                    MinWidth="150"
                                                    Text="{Binding ApprovedFixedAmount, Mode=OneWay}" Margin="3"
                                                    Grid.Column="1"
                                                    Grid.Row="0"></dxe:TextEdit>
                                            <Label Grid.Row="2" Content="Forderung im Zeitraum" VerticalAlignment="Center"
                                                    />
                                            <dxe:TextEdit IsReadOnly="True"
                                                    BorderTemplate="{StaticResource dx_textedit_border}"
                                                    MaskUseAsDisplayFormat="True"
                                                    HorizontalContentAlignment="Right"
                                                    Mask="c"
                                                    MaskType="Numeric"
                                                    Foreground="Black"
                                                    MinWidth="150"
                                                    Text="{Binding Claim, Mode=OneWay}" Margin="3"
                                                    Grid.Column="1"
                                                    Grid.Row="2"></dxe:TextEdit>
                                        </Grid>-->
                                                <!--<Grid Margin="3" x:Name="grid_approvedHours"
                                                Visibility="{Binding ApprovedHours, Converter={StaticResource ObjectVisibilityConverter}}">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Label Content="Bewilligte Stunden im Zeitraum" VerticalAlignment="Center"
                                                    />
                                            <dxe:TextEdit IsReadOnly="True"
                                                    BorderTemplate="{StaticResource dx_textedit_border}"
                                                    Mask="########0.00"
                                                    MaskType="Numeric"
                                                    MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right"
                                                    Foreground="Black"
                                                    MinWidth="150"
                                                    Text="{Binding ApprovedHours, Mode=OneWay}" Margin="3"
                                                    Grid.Column="1"
                                                    Grid.Row="0"></dxe:TextEdit>
                                            <Label Content="{Binding BEString, Mode=OneWay}" VerticalAlignment="Center"
                                                    Grid.Column="2" />
                                            <Label Grid.Row="1" Content="Bewilligter Betrag im Zeitraum"
                                                    VerticalAlignment="Center"
                                                    />
                                            <dxe:TextEdit IsReadOnly="True"
                                                    BorderTemplate="{StaticResource dx_textedit_border}"
                                                    MaskUseAsDisplayFormat="True"
                                                    HorizontalContentAlignment="Right"
                                                    Mask="c"
                                                    MaskType="Numeric"
                                                    Foreground="Black"
                                                    MinWidth="150"
                                                    Text="{Binding ApprovedAmountDefaultHourlyRate, Mode=OneWay}" Margin="3"
                                                    Grid.Column="1"
                                                    Grid.Row="1"></dxe:TextEdit>
                                            <Label Grid.Row="2" Content="Forderung im Zeitraum" VerticalAlignment="Center"
                                                    />
                                            <dxe:TextEdit IsReadOnly="True"
                                                    BorderTemplate="{StaticResource dx_textedit_border}"
                                                    MaskUseAsDisplayFormat="True"
                                                    HorizontalContentAlignment="Right"
                                                    Mask="c"
                                                    MaskType="Numeric"
                                                    Foreground="Black"
                                                    MinWidth="150"
                                                    Text="{Binding Claim, Mode=OneWay}" Margin="3"
                                                    Grid.Column="1"
                                                    Grid.Row="2"></dxe:TextEdit>
                                            <Label Grid.Row="3"
                                                    Grid.ColumnSpan="2" VerticalAlignment="Center"
                                                    Margin="3"
                                                    Foreground="Red" Content="{Binding NotBillableString}" />
                                        </Grid>-->

                                                <dxg:GridControl Grid.Row="2" Margin="3"
                                                        x:Name="datagrid_invoiceItems" DataSource="{Binding InvoiceItemList.VMList}"
                                                        Loaded="GridControl_Loaded" VerticalAlignment="Stretch"
                                                        HorizontalAlignment="Stretch">
                                                    <dxg:GridControl.Columns>
                                                        <dxg:GridColumn FieldName="ItemPeriodStart" Header="Von" Width="60"
                                                                EditSettings="{dxe:DateSettings DisplayFormat=dd.MM.yy}"></dxg:GridColumn>
                                                        <dxg:GridColumn FieldName="ItemPeriodEnd" Header="Bis" Width="60"
                                                                EditSettings="{dxe:DateSettings DisplayFormat=dd.MM.yy}" />
                                                        <dxg:GridColumn FieldName="ItemDescription" Header="Posten" Width="200"/>
                                                        <dxg:GridColumn FieldName="AmountPerUnit" Header="Stundensatz" Width="80">
                                                            <dxg:GridColumn.EditSettings>
                                                                <dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric"></dxe:TextEditSettings>
                                                            </dxg:GridColumn.EditSettings>
                                                        </dxg:GridColumn>
                                                        <dxg:GridColumn FieldName="UnitCount" Header="Stunden" Width="60">
                                                            <dxg:GridColumn.EditSettings>
                                                                <dxe:TextEditSettings DisplayFormat="0.00"></dxe:TextEditSettings>
                                                            </dxg:GridColumn.EditSettings>
                                                        </dxg:GridColumn>
                                                        <dxg:GridColumn FieldName="AmountTotal" Header="Betrag" Width="80">
                                                            <dxg:GridColumn.EditSettings>
                                                                <dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric"></dxe:TextEditSettings>
                                                            </dxg:GridColumn.EditSettings>
                                                        </dxg:GridColumn>
                                                        <dxg:GridColumn FieldName="RateFactor" Header="pausch. Faktor" Width="100">
                                                            <dxg:GridColumn.EditSettings>
                                                                <dxe:TextEditSettings MaskUseAsDisplayFormat="True" Mask="P"
                                                                        MaskType="Numeric"></dxe:TextEditSettings>
                                                            </dxg:GridColumn.EditSettings>
                                                        </dxg:GridColumn>
                                                        <dxg:GridColumn FieldName="GrossAmountTotal" Header="Gesamtbetrag" Width="100">
                                                            <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:GridControl.Columns>
                                                    <dxg:GridControl.View>
                                                        <dxg:TableView NewItemRowPosition="None" Loaded="gridView_Loaded" AutoWidth="False"
                                                                x:Name="gridView" ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                                                NavigationStyle="Cell" ShowGroupPanel="False"
                                                                SnapsToDevicePixels="True" Margin="3" />
                                                    </dxg:GridControl.View>
                                                </dxg:GridControl>
                                            </Grid>
                                        </DataTemplate>
                                    </dx:DXTabControl.Resources>
                                    <dx:DXTabControl.ItemContainerStyle>
                                        <Style TargetType="dx:DXTabItem">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding Type}"
                                                        Value="{x:Type Type={x:Type localViewModel:ServiceInvoicePeriodVM}}">
                                                    <Setter Property="HeaderTemplate" Value="{StaticResource item_header}" />
                                                    <Setter Property="ContentTemplate" Value="{StaticResource item_content}" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding Type}"
                                                        Value="{x:Type Type={x:Type localViewModel:ServiceInvoiceVM}}">
                                                    <Setter Property="HeaderTemplate" Value="{StaticResource summary_header}" />
                                                    <Setter Property="ContentTemplate" Value="{StaticResource summary_content}" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </dx:DXTabControl.ItemContainerStyle>
                                </dx:DXTabControl>
                            </Border>
                        </Grid>
                    </GroupBox>
                </Grid>
            </ScrollViewer>
            <StackPanel Grid.ColumnSpan="2" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto"
                    Margin="5 0 5 5" HorizontalAlignment="Right">
                <Button x:Name="btnSave" Content="Speichern" Margin="5" Command="ApplicationCommands.Save" Height="25" />
                <Button x:Name="btnClose" Content="Abbrechen" Margin="5" Command="ApplicationCommands.Close" Height="25" />
            </StackPanel>
        </Grid>
    </GroupBox>
</localView:BeWoView>