<localView:BeWoView x:Class="BeWo.View.Detail.Accounting.SettlementInvoiceItemEditView"
					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:val="clr-namespace:BeWo.Validation"
					xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 
					Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True">
    <Grid>
        <GroupBox MinHeight="300" Width="800" 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="Rechnung bearbeiten" 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" 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" />
									<RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Label Content="Organisation" />
                                <TextBox Margin="3" Grid.Row="0" Grid.Column="1"
                                        Text="{val:ValidationBinding Path=RecipientOrganisation}" Height="23" />
                                <Label Content="Ansprechpartner" Grid.Row="1" Grid.Column="0" />
                                <TextBox Margin="3" Grid.Row="1" Grid.Column="1"
                                        Text="{Binding RecipientContactPerson}"
                                        Height="23" />
                                <Label Content="Abteilung" Grid.Row="2" Grid.Column="0" />
                                <TextBox Margin="3" Grid.Row="2" Grid.Column="1"
                                        Text="{Binding RecipientDivision}"
                                        Height="23" />
                                <Label Content="Strasse" Grid.Row="0" Grid.Column="2" />
                                <TextBox Margin="3" Grid.Row="0" Grid.Column="3"
                                        Text="{val:ValidationBinding Path=RecipientStreet}" 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 Path=RecipientPostCode}" Height="23" />
                                <Label Content="Ort" Grid.Row="2" Grid.Column="2" />
                                <TextBox Margin="3" Grid.Row="2" Grid.Column="3"
                                        Text="{val:ValidationBinding Path=RecipientTown}" Height="23" />
								<Label Content="Postfach" Grid.Row="3" Grid.Column="2" />
								<TextBox Margin="3" Grid.Row="3" Grid.Column="3"
                                        Text="{Binding Path=RecipientPostBox}" Height="23" />
							</Grid>
                        </GroupBox>
                        <GroupBox Margin="0 0 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 SenderContactPersonFirstName}" Height="23" />
                                <Label Content="Nachname" Grid.Row="0" Grid.Column="2" />
                                <TextBox Margin="3" Grid.Row="0" Grid.Column="3"
                                        Text="{Binding SenderContactPersonLastName}"
                                        Height="23" />
                                <Label Content="Abteilung" Grid.Row="1" Grid.Column="0" />
                                <TextBox Margin="3" Grid.Row="1" Grid.Column="1"
                                        Text="{Binding SenderContactPersonDivision}"
                                        Height="23" />
                                <Label Content="Email" Grid.Row="2" Grid.Column="0" />
                                <TextBox Margin="3" Grid.Row="2" Grid.Column="1"
                                        Text="{Binding SenderContactPersonMail}"
                                        Height="23" />
                                <Label Content="Telefon" Grid.Row="1" Grid.Column="2" />
                                <TextBox Margin="3" Grid.Row="1" Grid.Column="3"
                                        Text="{Binding SenderContactPersonPhone}"
                                        Height="23" />
                                <Label Content="Fax" Grid.Row="2" Grid.Column="2" />
                                <TextBox Margin="3" Grid.Row="2" Grid.Column="3"
                                        Text="{Binding SenderContactPersonFax}"
                                        Height="23" />
                            </Grid>
                        </GroupBox>
                        <GroupBox Margin="0 0 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="{Binding CreatorFirstName}"
                                        Height="23" />
                                <Label Content="Ersteller Nachname" Grid.Row="0" Grid.Column="2" />
                                <TextBox Margin="3" Height="23" Grid.Row="0" Grid.Column="3"
                                        Text="{Binding CreatorLastName}" />
                                <Label Content="Abrechnungszeitraum von" Grid.Row="1" Grid.Column="0" />
                                <dxe:DateEdit MaskType="DateTimeAdvancingCaret" BorderThickness="1" 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" BorderThickness="1" 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" BorderThickness="1" Margin="3"
                                        Height="23"
                                        Grid.Row="2" Grid.Column="1"
                                        EditValue="{Binding 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 Path=InvoiceNumber}" />
                                <Label Content="Rechnungsdatum" Grid.Row="3" Grid.Column="0" />
                                <dxe:DateEdit MaskType="DateTimeAdvancingCaret" BorderThickness="1" Margin="3"
                                        Height="23"
                                        Grid.Row="3" Grid.Column="1"
                                        EditValue="{val:ValidationBinding 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="{Binding CustomerReferenceNumber}" />
                                <Label Grid.Column="0" Grid.Row="4" Content="anz Mahnungen" />
                                <dxe:SpinEdit MinValue="0" IsFloatValue="False" AllowNullInput="True" VerticalAlignment="Top" EditValue="{Binding Path=DunningLetterCount, Converter={StaticResource Int2DecimalConverter}}"
                                        Height="23" Margin="3" Grid.Row="4"
                                        Grid.Column="1"/>
                                <Label Content="Bemerkung" Grid.Row="4" Grid.Column="2" />
                                <TextBox Grid.Row="4" Grid.Column="3"
                                        Grid.ColumnSpan="3" Margin="3" AcceptsReturn="True"
                                        TextWrapping="Wrap" Height="60" Text="{Binding Notice}" 
                                        VerticalScrollBarVisibility="Visible" AutoWordSelection="True" Width="228"
                                />
                                                               
                            </Grid>
                        </GroupBox>
                        <GroupBox Margin="0 0 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 />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Label Grid.Column="0" Content="{Binding ServiceUnitName}"
                                        ContentStringFormat="Bewilligte {0}" />
                                <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{val:ValidationBinding Path=ApprovedFLS}"
                                        Height="23" Margin="3" Grid.Row="0"
                                        Grid.Column="1"
                                        IsReadOnly="True" />
                                <Label Grid.Column="0" Grid.Row="1" Content="{Binding ServiceUnitName}"
                                        ContentStringFormat="Geleistete {0}" />
                                <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{val:ValidationBinding Path=RecordedBillableFLSNetto}"
                                        Height="23" Margin="3" Grid.Row="1"
                                        Grid.Column="1"
                                        IsReadOnly="True" />
                                <Label Grid.Column="0" Grid.Row="2" Content="{Binding ServiceUnitName}"
                                        ContentStringFormat="{}{0} 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"
                                        IsReadOnly="True" />
                                <Label Grid.Column="0" Grid.Row="3" Content="{Binding ServiceUnitName}"
                                        ContentStringFormat="{}{0} 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"
                                        IsReadOnly="True" />

															<TextBlock x:Name="lblHinweise" HorizontalAlignment="Left" Margin="5" Foreground="#FFD20A0A" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding ErrorNotice}"  TextWrapping="Wrap" MaxWidth="370" />
																
															
                                <Label Grid.Column="2" Grid.Row="0" Content="{Binding ServiceUnitName}"
                                        ContentStringFormat="Vergütung für abrechenbare {0}" />
                                <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=AmountBillableTotal}"
                                        Height="23" Margin="3" Grid.Row="0"
                                        Grid.Column="3"
                                        IsReadOnly="True" />
                                <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"
                                        IsReadOnly="True" />
                                <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" IsReadOnly="True" />
                                <Label Grid.Column="2" Grid.Row="3" Content="Eigenanteil" />
                                <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{Binding Path=EquityContribution}"
                                        Height="23" Margin="3" Grid.Row="3"
                                        Grid.Column="3"
                                        Grid.IsSharedSizeScope="True" IsReadOnly="True" />
                                <Label Grid.Column="2" Grid.Row="4" Content="Restforderung" />
                                <dxe:TextEdit MaskType="Numeric" Mask="########0.00" MaskUseAsDisplayFormat="True" EditValue="{val:ValidationBinding Path=Claim}"
                                        Height="23" Margin="3" Grid.Row="4"
                                        Grid.Column="3"
                                        IsReadOnly="True" VerticalAlignment="Top" />
                            </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="Rechnung erstellen" Margin="5" Command="ApplicationCommands.Save"
                            Height="25" />
                    <Button x:Name="btnClose" Content="Abbrechen" Margin="5" Command="ApplicationCommands.Close" Height="25" />
                </StackPanel>
            </Grid>
        </GroupBox>
    </Grid>
</localView:BeWoView>