<localView:BeWoView x:Class="BeWo.View.Detail.Report.SettlementView" 
                    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:localsearch="clr-namespace:BeWo.View.Search" 
                    xmlns:localcore="clr-namespace:BeWo.Core" 
                    xmlns:val="clr-namespace:BeWo.Validation" 
                    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
                    xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:s="clr-namespace:System;assembly=mscorlib" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True" xmlns:BeWo_ServiceProxy="clr-namespace:BeWo.ServiceProxy">
    <Grid>
        <GroupBox Header="Spitzabrechnung" Style="{StaticResource ObjectEditGroupBox}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="300" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="0" />
                </Grid.RowDefinitions>
                <Label Content="Hilfeplan" VerticalAlignment="Center" Width="Auto" HorizontalAlignment="Left" />
                <uc:PopUpEdit x:Name="popupedit_CostBeaerer" Height="23" Margin="3" Grid.Column="1" IsReadOnly="True" DeleteButtonVisibility="Collapsed" PopUpClick="popupedit_CostBeaerer_PopUpClick" MaxWidth="300" />
                <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:SupportConceptSearchView ItemSelected="SupportConceptSearchView_ItemSelected" SearchMode="ActiveApprovedLVRSupportConcepts" />
                </Popup>
                <Image Margin="10" x:Name="image" Grid.Row="1" Grid.ColumnSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />

                <TabControl Visibility="Collapsed" x:Name="tabcontrol" Margin="10" Grid.Row="1" Grid.ColumnSpan="3">
                    <TabItem Header="Daten" x:Name="tabitem_data">
                        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                            <Grid Grid.IsSharedSizeScope="True" Margin="10,10,10,10">

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <GroupBox Margin="0,0,0,0" Style="{StaticResource ObjectEditGroupBox}" Header="Empfänger Adresse">
                                    <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" />
                                        </Grid.RowDefinitions>

                                        <Label Content="Organisation" />
                                        <TextBox Margin="3" Grid.Row="0" Grid.Column="1" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=RecipientOrganisation, Mode=Default}" Height="23" />

                                        <Label Content="Ansprechpartner" Grid.Row="1" />
                                        <TextBox Margin="3" Grid.Row="1" Grid.Column="1" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=RecipientContactPerson, Mode=Default}" Height="23" />

                                        <Label Content="Abteilung" Grid.Row="2" />
                                        <TextBox Margin="3" Grid.Row="2" Grid.Column="1" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=RecipientDivision, Mode=Default}" Height="23" />

                                        <Label Content="Strasse" Grid.Row="0" Grid.Column="2" />
                                        <TextBox Margin="3" Grid.Row="0" Grid.Column="3" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=RecipientStreet, Mode=Default}" Height="23" />

                                        <Label Content="Postleitzahl" Grid.Row="1" Grid.Column="2" />
                                        <TextBox Margin="3,3,3,0" Grid.Row="1" Grid.Column="3" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=RecipientPostCode, Mode=Default}" Height="23" />

                                        <Label Content="Ort" Grid.Row="2" Grid.Column="2" />
                                        <TextBox Margin="3" Grid.Row="2" Grid.Column="3" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=RecipientTown, Mode=Default}" Height="23" />

                                    </Grid>
                                </GroupBox>

                                <GroupBox Margin="0 20 0 0" Style="{StaticResource ObjectEditGroupBox}" Grid.Row="1" Header="Absender Ansprechpartner">
                                    <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" />
                                        </Grid.RowDefinitions>

                                        <Label Content="Vorname" />
                                        <TextBox Margin="3" Grid.Row="0" Grid.Column="1" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=SenderContactPersonFirstName, Mode=Default}" Height="23" />

                                        <Label Content="Nachname" Grid.Row="0" Grid.Column="2" />
                                        <TextBox Margin="3" Grid.Row="0" Grid.Column="3" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=SenderContactPersonLastName, Mode=Default}" Height="23" />

                                        <Label Content="Abteilung" Grid.Row="1" />
                                        <TextBox Margin="3" Grid.Row="1" Grid.Column="1" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=SenderContactPersonDivision, Mode=Default}" Height="23" />

                                        <Label Content="Email" Grid.Row="2" Grid.Column="0" />
                                        <TextBox Margin="3" Grid.Row="2" Grid.Column="1" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=SenderContactPersonMail, Mode=Default}" Height="23" />

                                        <Label Content="Telefon" Grid.Row="1" Grid.Column="2" />
                                        <TextBox Margin="3" Grid.Row="1" Grid.Column="3" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=SenderContactPersonPhone, Mode=Default}" Height="23" />

                                        <Label Content="Fax" Grid.Row="2" Grid.Column="2" />
                                        <TextBox Margin="3" Grid.Row="2" Grid.Column="3" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=SenderContactPersonFax, Mode=Default}" Height="23" />

                                    </Grid>
                                </GroupBox>

                                <GroupBox Margin="0 20 0 0" Style="{StaticResource ObjectEditGroupBox}" Grid.Row="2" Header="Details">
                                    <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" />
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>


                                        <Label Content="Ersteller Vorname" Grid.Row="0" />
                                        <TextBox Margin="3" Grid.Row="0" Grid.Column="1" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=CreatorFirstName, Mode=Default}" Height="23" />

                                        <Label Content="Ersteller Nachname" Grid.Row="0" Grid.Column="2" />
                                        <TextBox Margin="3" Height="23" Grid.Row="0" Grid.Column="3" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=CreatorLastName, Mode=Default}" />

                                        <Label Content="Abrechnungszeitraum von" Grid.Row="1" Grid.Column="0" />
                                        <dxe:DateEdit MaskType="DateTimeAdvancingCaret" Height="23" Margin="3" Grid.Row="1" Grid.Column="1" EditValue="{val:ValidationBinding Path=AccountingPeriodStart, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

                                        <Label Content="Abrechnungszeitraum bis" Grid.Row="1" Grid.Column="2" />
                                        <dxe:DateEdit MaskType="DateTimeAdvancingCaret" Height="23" Margin="3" Grid.Row="1" Grid.Column="3" EditValue="{val:ValidationBinding Path=AccountingPeriodEnd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

                                        <Label Content="Bewilligungsbescheid vom" Grid.Row="2" Grid.Column="0" />
                                        <dxe:DateEdit MaskType="DateTimeAdvancingCaret" Margin="3" Height="23" Grid.Row="2" Grid.Column="1" EditValue="{val:ValidationBinding Path=ApprovalNoticeDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

                                        <Label Content="Rechnungsnummer" Grid.Row="2" Grid.Column="2" />
                                        <TextBox Margin="3" Height="23" Grid.Row="2" Grid.Column="3" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=InvoiceNumber, Mode=Default}" />


                                        <Label Content="Rechnungsdatum" Grid.Row="3" Grid.Column="0" />
                                        <dxe:DateEdit MaskType="DateTimeAdvancingCaret" Margin="3" Height="23" Grid.Row="3" Grid.Column="1" EditValue="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=InvoiceDate, Mode=TwoWay}" />

                                        <Label Content="Aktenzeichen" Grid.Row="3" Grid.Column="2" />
                                        <TextBox Margin="3" Height="23" Grid.Row="3" Grid.Column="3" Text="{val:ValidationBinding UpdateSourceTrigger=PropertyChanged , Path=CustomerReferenceNumber, Mode=Default}" />

                                        <Label Content="Bemerkung" Grid.Row="4" />
                                        <TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="3" AcceptsReturn="True" TextWrapping="Wrap" Height="80" Text="{Binding UpdateSourceTrigger=PropertyChanged , Path=Notice, Mode=Default}" />

                                    </Grid>
                                </GroupBox>
                                <GroupBox Margin="0 20 0 0" Style="{StaticResource ObjectEditGroupBox}" Grid.Row="3" Header="Bilanz">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" SharedSizeGroup="col3" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition />
                                            <RowDefinition />
                                            <RowDefinition />
                                            <RowDefinition />
                                            <RowDefinition />
                                        </Grid.RowDefinitions>

                                        <Label Grid.Column="0" Content="Bewilligte FLS" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=ApprovedFLS}" Height="23" Margin="3" Grid.Row="0" Grid.Column="1" />

                                        <Label Grid.Column="0" Grid.Row="1" Content="Geleistete FLS" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=RecordedBillableFLSNetto}" Height="23" Margin="3" Grid.Row="1" Grid.Column="1" />


                                        <Label Grid.Column="0" Grid.Row="2" Content="FLS außerhalb Bewilligungszeitraum" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=RecordedBillableFLSNotBillableOutOfApprovedSpan}" Height="23" Margin="3" Grid.Row="2" Grid.Column="1" />

                                        <Label Grid.Column="0" Grid.Row="3" Content="FLS während Abwesenheiten" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=RecordedBillableFLSNotBillableCustomerAbsent}" Height="23" Margin="3" Grid.Row="3" Grid.Column="1" />

                                        <Label Grid.Column="2" Grid.Row="0" Content="Vergütung für abrechenbare FLS" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="######,##0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=AmountBillableTotal}" Height="23" Margin="3" Grid.Row="0" Grid.Column="3" />

                                        <Label Grid.Column="2" Grid.Row="1" Content="Inkl. pauschaler Faktor" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="######,##0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=AmountRateFactor}" Height="23" Margin="3" Grid.Row="1" Grid.Column="3" />

                                        <Label Grid.Column="2" Grid.Row="2" Content="Summe der Vorauszahlungen" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="######,##0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=AmountAdvancedPayments}" Height="23" Margin="3" Grid.Row="2" Grid.Column="3" Grid.IsSharedSizeScope="True" />


                                        <Label Grid.Column="2" Grid.Row="3" Content="Restforderung" />
                                        <dxe:TextEdit MaskType="Numeric" Mask="######,##0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=Claim}" Height="23" Margin="3" Grid.Row="3" Grid.Column="3" />

                                    </Grid>
                                </GroupBox>
                            </Grid>
                        </ScrollViewer>
                    </TabItem>
                    <TabItem Header="Formular" x:Name="tabItem_report" Selector.Selected="tabItem_report_Selected">
                        <Frame Margin="10" x:Name="frame" />
                    </TabItem>
                </TabControl>

            </Grid>
        </GroupBox>
    </Grid>
</localView:BeWoView>