private void CreateArticleListForDocket(Section section, Order.Order order)
        {
            // Create the article table
            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = TableBorder;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Article list columns
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote)
            {
                var column = table.AddColumn(Unit.FromCentimeter(ArticleColumn.ColumnWidth));
                column.Format.Alignment = ArticleColumn.Alignment;
            }

            if (ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote.Count < 2)
            {
                Biller.UI.ViewModel.MainWindowViewModel.GetCurrentMainWindowViewModel().NotificationManager.ShowNotification("Zu wenig Artikelspalten", "Es werden mindestens zwei Artikelspalten benötigt!");
                return;
            }
            var row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.SpaceBefore = "0,1cm";
            row.Format.SpaceAfter = "0,25cm";

            var index = 0;
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote)
            {
                row.Cells[index].AddParagraph(ArticleColumn.Header);
                index += 1;
            }

            logger.Trace("FillContent - AddArticle " + order.DocumentType + ":" + order.DocumentID);

            foreach (var article in order.OrderedArticles)
            {
                logger.Trace("AddArticle - " + article.ArticleID);

                Row row1 = table.AddRow();
                index = 0;
                foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote)
                {
                    row1.Cells[index].AddParagraph(ReplaceArticlePlaceHolder(ArticleColumn.Content, article));
                    index += 1;
                }

                row1.Format.SpaceBefore = "0,1cm";
                row1.Format.SpaceAfter = "0,4cm";
            }

            logger.Trace("Setting Borders");
            Border BlackThickBorder = new Border();
            BlackThickBorder.Visible = true;
            BlackThickBorder.Color = Colors.Black;
            BlackThickBorder.Width = 1.5;

            var lastcolumn = ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote.Count - 1;

            logger.Trace("Adding total weight");
            row = table.AddRow();
            row.Cells[0].Borders.Bottom = BlackThickBorder.Clone();
            row.Cells[0].AddParagraph("Gesamtgewicht");
            row.Cells[0].Format.Font.Bold = true;
            row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[0].MergeRight = lastcolumn - 1;
            row.Cells[lastcolumn].AddParagraph(kgUnit.ValueToString(order.OrderCalculation.OrderedWeight));
            row.Cells[lastcolumn].Borders.Bottom = BlackThickBorder.Clone();
            row.Format.SpaceBefore = "0,25cm";
            row.Format.SpaceAfter = "0,05cm";
        }
        private void CreateArticleListForInvoice(Section section, Order.Order order)
        {
            // Create the article table
            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = TableBorder;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Article list columns
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumns)
            {
                var column = table.AddColumn(Unit.FromCentimeter(ArticleColumn.ColumnWidth));
                column.Format.Alignment = ArticleColumn.Alignment;
            }


            if (ParentViewModel.SettingsController.ArticleListColumns.Count < 2)
            {
                Biller.UI.ViewModel.MainWindowViewModel.GetCurrentMainWindowViewModel().NotificationManager.ShowNotification("Zu wenig Artikelspalten", "Es werden mindestens zwei Artikelspalten benötigt!");
                return;
            }
            var row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.SpaceBefore = "0,1cm";
            row.Format.SpaceAfter = "0,25cm";

            var index = 0;
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumns)
            {
                row.Cells[index].AddParagraph(ArticleColumn.Header);
                index += 1;
            }

            logger.Trace("FillContent - AddArticle " + order.DocumentType + ":" + order.DocumentID);

            foreach (var article in order.OrderedArticles)
            {
                logger.Trace("AddArticle - " + article.ArticleID);

                Row row1 = table.AddRow();
                index = 0;
                foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumns)
                {
                    row1.Cells[index].AddParagraph(ReplaceArticlePlaceHolder(ArticleColumn.Content, article));
                    index += 1;
                }

                row1.Format.SpaceBefore = "0,1cm";
                row1.Format.SpaceAfter = "0,4cm";
            }

            logger.Trace("Setting Borders");
            Border BlackBorder = new Border();
            BlackBorder.Visible = true;
            BlackBorder.Color = Colors.Black;
            BlackBorder.Width = 0.75;

            Border BlackThickBorder = new Border();
            BlackThickBorder.Visible = true;
            BlackThickBorder.Color = Colors.Black;
            BlackThickBorder.Width = 1.5;

            Border NoBorder = new Border();
            NoBorder.Visible = false;

            logger.Trace("Adding subtotal net");
            var lastcolumn = ParentViewModel.SettingsController.ArticleListColumns.Count - 1;

            dynamic sb = Biller.UI.ViewModel.MainWindowViewModel.GetCurrentMainWindowViewModel().SettingsTabViewModel.KeyValueStore;
            if (sb.IsSmallBusiness == null)
                sb.IsSmallBusiness = false;

            if (sb.IsSmallBusiness)
            {
                // Add the total price row
                row = table.AddRow();
                row.Format.PageBreakBefore = true;
                row.Cells[0].AddParagraph("Zwischensumme");
                row.Cells[0].Format.Font.Bold = true;
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.ArticleSummary.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }
            else
            {
                // Add the total price row
                row = table.AddRow();
                row.Format.PageBreakBefore = true;
                row.Cells[0].AddParagraph("Zwischensumme Netto");
                row.Cells[0].Format.Font.Bold = true;
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetArticleSummary.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }

            if (order.OrderCalculation.OrderRebate.Amount > 0)
            {
                logger.Trace("Adding OrderRebate");
                row = table.AddRow();
                row.Cells[0].AddParagraph("Abzgl. " + order.OrderRebate.PercentageString + " Gesamtrabatt");
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                if (sb.IsSmallBusiness)
                    row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.OrderRebate.AmountString);
                else
                    row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetOrderRebate.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }

            if (!String.IsNullOrEmpty(order.OrderShipment.Name))
            {
                logger.Trace("Adding Shipment");
                row = table.AddRow();
                row.Cells[0].AddParagraph("Zzgl. " + order.OrderShipment.Name);
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetShipment.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = BlackBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = BlackBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }

            if (!sb.IsSmallBusiness)
            {
                if (order.OrderCalculation.OrderRebate.Amount > 0 || !String.IsNullOrEmpty(order.OrderShipment.Name))
                {
                    logger.Trace("Adding Subtotal");
                    row = table.AddRow();
                    row.Cells[0].AddParagraph("Zwischensumme Netto");
                    row.Cells[0].Format.Font.Bold = true;
                    row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                    row.Cells[0].MergeRight = lastcolumn - 1;
                    row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetOrderSummary.AmountString);
                    row.Format.SpaceBefore = "0,1cm";
                    row.Cells[0].Borders.Bottom = NoBorder.Clone();
                    row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                    row.Cells[0].Borders.Top = BlackBorder.Clone();
                    row.Cells[lastcolumn].Borders.Top = BlackBorder.Clone();
                }

                // Add the VAT row
                foreach (var tax in order.OrderCalculation.TaxValues)
                {
                    logger.Trace("Adding Tax - " + tax.TaxClass.Name);
                    row = table.AddRow();
                    row.Cells[0].AddParagraph("Zzgl. " + tax.TaxClass.Name + " " + tax.TaxClassAddition);
                    row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                    row.Cells[0].MergeRight = lastcolumn - 1;
                    row.Cells[lastcolumn].AddParagraph(tax.Value.AmountString);
                    row.Cells[0].Borders.Bottom = NoBorder.Clone();
                    row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                    row.Cells[0].Borders.Top = NoBorder.Clone();
                    row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
                }
            }

            logger.Trace("Adding subtotal gross");
            row = table.AddRow();
            row.Cells[0].Borders.Bottom = BlackThickBorder.Clone();
            row.Cells[0].AddParagraph("Gesamtbetrag");
            row.Cells[0].Format.Font.Bold = true;
            row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[0].MergeRight = lastcolumn - 1;
            row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.OrderSummary.AmountString);
            row.Cells[lastcolumn].Borders.Bottom = BlackThickBorder.Clone();
            row.Format.SpaceBefore = "0,25cm";
            row.Format.SpaceAfter = "0,05cm";
        }