private string FormatCost(TagPrintable line)
        {
            if (priceTagSettings.PrintEmpty)
            {
                return("");
            }

            var format = (NumberFormatInfo)CultureInfo.CurrentCulture.NumberFormat.Clone();

            format.NumberDecimalSeparator = "-";
            return(String.Format(format, "{0:0.00}", line.RetailCost));
        }
示例#2
0
        private Grid Map(TagPrintable line)
        {
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition {
                Height = defaultHeight
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = labelColumnWidth
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = valueColumnWidth
            });
            var header = new Label {
                Padding = new Thickness(0),
                HorizontalContentAlignment = HorizontalAlignment.Center,
                FontSize        = 11,
                Content         = "Стеллажная карта",
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 0, 2.5, 2.5),
                FontFamily      = new FontFamily("Arial"),
            };

            header.SetValue(Grid.RowProperty, 0);
            header.SetValue(Grid.ColumnSpanProperty, 2);
            grid.Children.Add(header);

            var row = 1;

            Line(grid, "PrintProduct", "Наименование ЛС", line.Product, bigHeight, ref row);
            Line(grid, "PrintProducer", "Производитель", line.Producer, defaultHeight, ref row);
            Line(grid, "PrintSerialNumber", "Серия", line.SerialNumber, defaultHeight, ref row);
            Line(grid, "PrintPeriod", "Срок годности", line.Period, defaultHeight, ref row);
            Line(grid, "PrintQuantity", "Количество", line.Quantity.ToString(), defaultHeight, ref row);
            Line(grid, "PrintSupplier", "Поставщик", line.SupplierName, defaultHeight, ref row);
            Line(grid, "PrintCertificates", "Номер сертификата", line.Certificates, defaultHeight, ref row);
            Line(grid, "PrintDocumentDate", "Дата поступления", line.DocumentDate.ToString(), defaultHeight, ref row);
            Line(grid, "PrintRetailCost", "Цена", Util.FormatCost(line.RetailCost), defaultHeight, ref row);

            return(grid);
        }
        private FrameworkElement Normal(TagPrintable line)
        {
            var panel = new StackPanel {
                Width  = 162,
                Margin = new Thickness(2)
            };

            if (!priceTagSettings.HideNotPrinted || priceTagSettings.PrintFullName)
            {
                var uri = new Uri(String.Format(@"pack://application:,,,/{0};component/assets/images/price-tag-log.png",
                                                typeof(PriceTagDocument).Assembly.GetName().Name));
                panel.Children.Add(new Border {
                    BorderThickness = new Thickness(0, 0, 0, 0.5),
                    BorderBrush     = Brushes.Black,
                    Child           = new DockPanel {
                        Width    = 162,
                        Children =
                        {
                            new Image     {
                                Height = 20,
                                Width  = 18,
                                Source = new BitmapImage(uri)
                            },
                            new TextBlock {
                                Height            = 20,
                                Text              = priceTagSettings.PrintFullName ? $"{line.ClientName}, {line.AddressName}" : "",
                                FontSize          = 8,
                                TextAlignment     = TextAlignment.Center,
                                VerticalAlignment = VerticalAlignment.Center,
                                TextWrapping      = TextWrapping.Wrap
                            }
                        }
                    }
                });
            }
            GetValue(panel, "", line.Product, "Product");
            GetValue(panel, "Цена", FormatCost(line), "Cost");
            GetValue(panel, "Произв.", line.Country, "Country");
            GetValue(panel, "", line.Producer, "Producer");
            GetValue(panel, "Срок годности", line.Period, "Period");
            GetValue(panel, "Серия товара", line.SerialNumber, "SerialNumber");
            GetValue(panel, "№ накладной", line.ProviderDocumentId, "ProviderDocumentId");

            var haveValue = priceTagSettings.PrintSupplier || priceTagSettings.PrintDocumentDate;

            if (haveValue || !priceTagSettings.HideNotPrinted)
            {
                var value = String.Format("{0:d}{1}",
                                          priceTagSettings.PrintDocumentDate ? (DateTime?)line.DocumentDate : null,
                                          priceTagSettings.PrintSupplier ? line.SupplierName : "");

                var label = new Label {
                    FontSize = 8,
                    Content  = value,
                    HorizontalContentAlignment = HorizontalAlignment.Right,
                    Margin  = new Thickness(0),
                    Padding = new Thickness(0)
                };
                var dockPanel = new DockPanel {
                    Width    = 162,
                    Children =
                    {
                        new Label {
                            VerticalAlignment = VerticalAlignment.Center,
                            Content           = "Подпись",
                            FontSize          = 8,
                            Margin            = new Thickness(0),
                            Padding           = new Thickness(0),
                        },
                        label
                    }
                };
                label.SetValue(DockPanel.DockProperty, Dock.Right);
                panel.Children.Add(new Border {
                    BorderThickness = new Thickness(0, 0.5, 0, 0),
                    BorderBrush     = Brushes.Black,
                    Child           = dockPanel
                });
            }

            ApplyDefaults(panel);

            return(panel);
        }
        public FrameworkElement Big2(TagPrintable line)
        {
            var canvas = new Canvas {
                Width  = 162,
                Height = 106,
            };

            var nameAndAddressLabel = new TextBlock {
                Text          = $"{line.ClientName}, {line.AddressName}",
                TextAlignment = TextAlignment.Center,
                FontSize      = 6,
                Width         = 162,
                Height        = 10
            };

            nameAndAddressLabel.SetValue(Canvas.LeftProperty, 0d);
            nameAndAddressLabel.SetValue(Canvas.TopProperty, 0d);
            canvas.Children.Add(new Border {
                BorderThickness = new Thickness(0, 0, 0, 1),
                BorderBrush     = Brushes.Black,
                Child           = nameAndAddressLabel
            });

            var serialNumberLabel = new TextBlock {
                Text          = line.SerialNumber,
                TextAlignment = TextAlignment.Center,
                FontSize      = 6,
                Width         = 81,
                Height        = 10
            };
            var serialNumberBorder = new Border {
                BorderThickness = new Thickness(0, 0, 1, 1),
                BorderBrush     = Brushes.Black,
                Child           = serialNumberLabel
            };

            serialNumberBorder.SetValue(Canvas.LeftProperty, 0d);
            serialNumberBorder.SetValue(Canvas.TopProperty, 10d);
            canvas.Children.Add(serialNumberBorder);

            var supplierNameLabel = new TextBlock {
                Text          = line.SupplierName,
                TextAlignment = TextAlignment.Center,
                FontSize      = 6,
                Width         = 81,
                Height        = 10
            };
            var supplierNameBorder = new Border {
                BorderThickness = new Thickness(0, 0, 0, 1),
                BorderBrush     = Brushes.Black,
                Child           = supplierNameLabel
            };

            supplierNameBorder.SetValue(Canvas.LeftProperty, 81d);
            supplierNameBorder.SetValue(Canvas.TopProperty, 10d);
            canvas.Children.Add(supplierNameBorder);

            var product = new TextBlock {
                Text            = $"{line.Product}\n{line.Producer}",
                FontSize        = 11,
                FontWeight      = FontWeights.Bold,
                TextDecorations = TextDecorations.Underline,
                TextWrapping    = TextWrapping.Wrap,
                TextAlignment   = TextAlignment.Center,
                Height          = 54,
                Width           = 160
            };

            product.SetValue(Canvas.LeftProperty, 0d);
            product.SetValue(Canvas.TopProperty, 20d);
            canvas.Children.Add(product);

            var cost = new TextBlock {
                Text              = FormatCost(line),
                Width             = 112,
                FontSize          = 26,
                FontWeight        = FontWeights.Bold,
                TextAlignment     = TextAlignment.Right,
                VerticalAlignment = VerticalAlignment.Bottom,
            };

            cost.SetValue(Canvas.LeftProperty, 49d);
            cost.SetValue(Canvas.TopProperty, 78d);
            canvas.Children.Add(cost);

            var periodLabel = new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 8,
                Text          = "Годен до",
                Width         = 49,
            };

            periodLabel.SetValue(Canvas.LeftProperty, 0d);
            periodLabel.SetValue(Canvas.TopProperty, 78d);
            canvas.Children.Add(periodLabel);
            var period = new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 9,
                Text          = line.Period,
                Width         = 49,
            };

            period.SetValue(Canvas.LeftProperty, 0d);
            period.SetValue(Canvas.TopProperty, 86d);
            canvas.Children.Add(period);

            var singLabel = new TextBlock {
                FontSize = 8,
                Text     = "Подпись",
                Width    = 49,
            };

            singLabel.SetValue(Canvas.LeftProperty, 0d);
            singLabel.SetValue(Canvas.TopProperty, 96d);
            canvas.Children.Add(singLabel);

            ApplyDefaults(canvas);
            return(canvas);
        }
        public FrameworkElement Big(TagPrintable line)
        {
            var canvas = new Canvas {
                Width  = 162,
                Height = 106,
            };
            var nameAndAddressLabel = new TextBlock {
                Text          = $"{line.ClientName}, {line.AddressName}",
                TextAlignment = TextAlignment.Center,
                TextWrapping  = TextWrapping.Wrap,
                FontSize      = 8,
                Width         = 162,
                Height        = 20
            };

            nameAndAddressLabel.SetValue(Canvas.LeftProperty, 0d);
            nameAndAddressLabel.SetValue(Canvas.TopProperty, 0d);
            canvas.Children.Add(new Border {
                BorderThickness = new Thickness(0, 0, 0, 1),
                BorderBrush     = Brushes.Black,
                Child           = nameAndAddressLabel
            });

            var product = new TextBlock {
                Text            = $"{line.Product}\n{line.Producer}",
                FontSize        = 11,
                FontWeight      = FontWeights.Bold,
                TextDecorations = TextDecorations.Underline,
                TextWrapping    = TextWrapping.Wrap,
                TextAlignment   = TextAlignment.Center,
                Height          = 37,
                Width           = 160
            };

            product.SetValue(Canvas.LeftProperty, 0d);
            product.SetValue(Canvas.TopProperty, 21d);
            canvas.Children.Add(product);

            var cost = new TextBlock {
                Text              = FormatCost(line),
                Width             = 112,
                FontSize          = 26,
                FontWeight        = FontWeights.Bold,
                TextAlignment     = TextAlignment.Right,
                VerticalAlignment = VerticalAlignment.Bottom,
            };

            cost.SetValue(Canvas.LeftProperty, 49d);
            cost.SetValue(Canvas.TopProperty, 78d);
            canvas.Children.Add(cost);

            canvas.Add(0, 68, new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 8,
                Text          = "Годен до",
                Width         = 49,
            });

            canvas.Add(0, 76, new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 9,
                Text          = line.Period,
                Width         = 49,
            });

            canvas.Add(0, 86, new TextBlock {
                FontSize = 8,
                Text     = "Подпись",
                Width    = 49,
            });

            canvas.Add(0, 94, new TextBlock {
                FontSize = 9,
                Text     = DateTime.Now.ToShortDateString(),
                Width    = 49,
            });

            ApplyDefaults(canvas);

            return(canvas);
        }
        private FrameworkElement Small(TagPrintable line)
        {
            var canvas = new Canvas {
                Height = 106,
                Width  = 162,
            };
            var product = new TextBlock {
                Text            = line.Product,
                FontSize        = 11,
                FontWeight      = FontWeights.Bold,
                TextDecorations = TextDecorations.Underline,
                TextWrapping    = TextWrapping.Wrap,
                TextAlignment   = TextAlignment.Center,
                Height          = 37,
                Width           = 160
            };

            product.SetValue(Canvas.LeftProperty, 0d);
            product.SetValue(Canvas.TopProperty, 0d);
            canvas.Children.Add(product);

            var costLabel = new TextBlock {
                Text     = "Цена",
                Width    = 26,
                FontSize = 9
            };

            costLabel.SetValue(Canvas.LeftProperty, 0d);
            costLabel.SetValue(Canvas.TopProperty, 38d);
            canvas.Children.Add(costLabel);

            var cost = new TextBlock {
                Text            = FormatCost(line),
                Width           = 133,
                FontSize        = 11,
                FontWeight      = FontWeights.Bold,
                TextDecorations = TextDecorations.Underline,
                TextAlignment   = TextAlignment.Right,
            };

            cost.SetValue(Canvas.LeftProperty, 28d);
            cost.SetValue(Canvas.TopProperty, 38d);
            canvas.Children.Add(cost);

            var producerLabel = new TextBlock {
                Text     = "Произв.",
                Width    = 37,
                FontSize = 9
            };

            producerLabel.SetValue(Canvas.LeftProperty, 0d);
            producerLabel.SetValue(Canvas.TopProperty, 50d);
            canvas.Children.Add(producerLabel);
            var country = new TextBlock {
                Text          = line.Country,
                Width         = 122,
                FontSize      = 9,
                TextAlignment = TextAlignment.Right,
            };

            country.SetValue(Canvas.LeftProperty, 39d);
            country.SetValue(Canvas.TopProperty, 50d);
            canvas.Children.Add(country);

            var producer = new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 9,
                Text          = line.Producer,
                Width         = 160,
            };

            producer.SetValue(Canvas.LeftProperty, 0d);
            producer.SetValue(Canvas.TopProperty, 62d);
            canvas.Children.Add(producer);

            var periodLabel = new TextBlock {
                Text     = "Срок годности",
                Width    = 65,
                FontSize = 9
            };

            periodLabel.SetValue(Canvas.LeftProperty, 0d);
            periodLabel.SetValue(Canvas.TopProperty, 73d);
            canvas.Children.Add(periodLabel);
            var period = new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 9,
                Text          = line.Period,
                Width         = 93,
            };

            period.SetValue(Canvas.LeftProperty, 67d);
            period.SetValue(Canvas.TopProperty, 73d);
            canvas.Children.Add(period);

            var singLabel = new TextBlock {
                Text     = "Подпись",
                Width    = 160,
                FontSize = 8
            };

            singLabel.SetValue(Canvas.LeftProperty, 0d);
            singLabel.SetValue(Canvas.TopProperty, 84d);
            canvas.Children.Add(singLabel);

            var waybillDate = new TextBlock {
                TextAlignment = TextAlignment.Right,
                FontSize      = 9,
                Text          = line.DocumentDate.ToShortDateString(),
                Width         = 100,
            };

            waybillDate.SetValue(Canvas.LeftProperty, 46d);
            waybillDate.SetValue(Canvas.TopProperty, 84d);
            canvas.Children.Add(waybillDate);

            ApplyDefaults(canvas);

            return(canvas);
        }
        private FrameworkElement Normal(TagPrintable line)
        {
            var panel = new Grid
            {
                Width             = 100,
                Height            = 66,
                Margin            = new Thickness(1),
                ColumnDefinitions =
                {
                    new ColumnDefinition(),
                    new ColumnDefinition()
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(16, GridUnitType.Pixel)
                    },
                    new RowDefinition {
                        Height = new GridLength(26, GridUnitType.Pixel)
                    },
                    new RowDefinition {
                        Height = new GridLength(8, GridUnitType.Pixel)
                    },
                    new RowDefinition {
                        Height = new GridLength(8, GridUnitType.Pixel)
                    },
                    new RowDefinition {
                        Height = new GridLength(8, GridUnitType.Pixel)
                    },
                }
            };

            var barcode = MakeBarcode(line.Barcode, 100, 16);

            if (barcode != null)
            {
                var img = new Image()
                {
                    Source = barcode,
                };
                img.SetValue(Grid.ColumnSpanProperty, 2);
                panel.Children.Add(img);
            }

            var label1 = new TextBlock
            {
                TextAlignment        = TextAlignment.Center,
                TextWrapping         = TextWrapping.Wrap,
                FontSize             = 8,
                Text                 = line.Product,
                Margin               = new Thickness(0, 2, 0, 0),
                Padding              = new Thickness(0),
                LineHeight           = 8,
                LineStackingStrategy = LineStackingStrategy.BlockLineHeight,
                Height               = 24,
            };

            label1.SetValue(Grid.RowProperty, 1);
            label1.SetValue(Grid.ColumnSpanProperty, 2);
            panel.Children.Add(label1);

            var label2 = new TextBlock
            {
                FontSize = 7,
                Text     = line.Barcode,
                Margin   = new Thickness(0),
                Padding  = new Thickness(0),
            };

            label2.SetValue(Grid.RowProperty, 2);
            panel.Children.Add(label2);

            var label3 = new Label
            {
                FontSize            = 12,
                FontWeight          = FontWeights.Bold,
                Content             = line.RetailCost?.ToString("0.00"),
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin  = new Thickness(0),
                Padding = new Thickness(0),
            };

            label3.SetValue(Grid.RowProperty, 2);
            label3.SetValue(Grid.ColumnProperty, 1);
            label3.SetValue(Grid.RowSpanProperty, 2);
            panel.Children.Add(label3);

            var label4 = new TextBlock
            {
                FontSize = 7,
                Text     = line.SerialNumber,
                Margin   = new Thickness(0),
                Padding  = new Thickness(0),
            };

            label4.SetValue(Grid.RowProperty, 3);
            panel.Children.Add(label4);

            var label5 = new TextBlock
            {
                Text     = line.ProviderDocumentId,
                FontSize = 7,
                Margin   = new Thickness(0),
                Padding  = new Thickness(0),
            };

            label5.SetValue(Grid.RowProperty, 4);
            panel.Children.Add(label5);

            var label6 = new TextBlock
            {
                FontSize            = 7,
                Text                = line.DocumentDate.ToShortDateString(),
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin              = new Thickness(0),
                Padding             = new Thickness(0),
            };

            label6.SetValue(Grid.RowProperty, 4);
            label6.SetValue(Grid.ColumnProperty, 1);
            panel.Children.Add(label6);

            return(panel);
        }
示例#8
0
        private FrameworkElement Map2(TagPrintable line)
        {
            var body = new Grid {
                Height = 206,
                Width  = 340,
                Margin = new Thickness(4, 0, 2, 4)
            };

            body.RowDefinitions.Add(new RowDefinition());
            body.RowDefinitions.Add(new RowDefinition());
            body.RowDefinitions.Add(new RowDefinition());
            body.RowDefinitions.Add(new RowDefinition());

            var header = new Grid();

            header.RowDefinitions.Add(new RowDefinition());
            header.RowDefinitions.Add(new RowDefinition());
            header.RowDefinitions.Add(new RowDefinition());
            header.RowDefinitions.Add(new RowDefinition());
            header.ColumnDefinitions.Add(new ColumnDefinition());
            header.ColumnDefinitions.Add(new ColumnDefinition());
            header.ColumnDefinitions.Add(new ColumnDefinition());

            var textBlock = new TextBlock {
                Text       = "Поставка №:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };

            header.Cell(0, 0, textBlock);

            textBlock = new TextBlock {
                Text       = "Накладная №:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };
            header.Cell(1, 0, textBlock);

            textBlock = new TextBlock {
                Text       = line.ProviderDocumentId,
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };
            header.Cell(1, 1, textBlock);

            textBlock = new TextBlock {
                Text       = "Поставщик:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };
            header.Cell(2, 0, textBlock);

            textBlock = new TextBlock {
                Text       = line.SupplierName,
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };
            header.Children.Add(textBlock);
            textBlock.SetValue(Grid.RowProperty, 2);
            textBlock.SetValue(Grid.ColumnProperty, 1);
            textBlock.SetValue(Grid.ColumnSpanProperty, 2);

            textBlock = new TextBlock {
                Text       = "Производитель:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };
            header.Cell(3, 0, textBlock);
            textBlock = new TextBlock {
                Text       = line.Producer,
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            };
            header.Children.Add(textBlock);
            textBlock.SetValue(Grid.RowProperty, 3);
            textBlock.SetValue(Grid.ColumnProperty, 1);
            textBlock.SetValue(Grid.ColumnSpanProperty, 2);

            textBlock = new TextBlock {
                Text                = line.DocumentDate.ToShortDateString(),
                FontSize            = 10,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontFamily          = new FontFamily("Arial"),
            };
            header.Cell(0, 2, textBlock);
            textBlock = new TextBlock {
                Text                = "(дата накладной)",
                FontSize            = 9,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontFamily          = new FontFamily("Arial"),
            };
            header.Cell(1, 2, textBlock);

            body.Children.Add(header);
            header.SetValue(Grid.RowProperty, 0);

            textBlock = new TextBlock {
                Text = line.Product,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                TextAlignment       = TextAlignment.Center,
                FontSize            = 13,
                FontFamily          = new FontFamily("Arial"),
                FontWeight          = FontWeights.Bold,
                Height = 46,
                Width  = 332
            };
            body.Children.Add(textBlock);
            textBlock.SetValue(Grid.RowProperty, 1);

            var subBody = new Grid();

            subBody.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            subBody.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            subBody.ColumnDefinitions.Add(new ColumnDefinition());
            subBody.ColumnDefinitions.Add(new ColumnDefinition());
            subBody.ColumnDefinitions.Add(new ColumnDefinition());
            subBody.ColumnDefinitions.Add(new ColumnDefinition());

            subBody.Cell(0, 0, new TextBlock {
                Text       = "Серия:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            });
            subBody.Cell(0, 1, new TextBlock {
                Text       = line.SerialNumber,
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            });
            subBody.Cell(0, 2, new TextBlock {
                Text       = "Количество:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            });
            subBody.Cell(0, 3, new TextBlock {
                Text       = line.Quantity.ToString(),
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            });
            subBody.Cell(1, 0, new TextBlock {
                Text       = "Штрих-код:",
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            });
            subBody.Cell(1, 1, new TextBlock {
                Text       = line.Barcode,
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
            });
            body.Children.Add(subBody);
            subBody.SetValue(Grid.RowProperty, 2);

            var markup = new Grid();

            markup.Margin = new Thickness(0, 0, 2, 0);
            markup.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            markup.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            markup.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            markup.ColumnDefinitions.Add(new ColumnDefinition());
            markup.ColumnDefinitions.Add(new ColumnDefinition());
            markup.ColumnDefinitions.Add(new ColumnDefinition());
            markup.Cell(0, 1, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = "Нац. %",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(1)
            });
            markup.Cell(0, 2, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = "Цена",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 1, 1, 1)
            });
            markup.Cell(1, 0, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = "Поставщик",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(1)
            });
            markup.Cell(2, 0, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = "Аптека",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(1, 0, 1, 1)
            });
            markup.Cell(1, 1, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = line.SupplierPriceMarkup != null ? line.SupplierPriceMarkup.Value.ToString("0.00") : "",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 0, 1, 1),
            });
            markup.Cell(1, 2, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = line.SupplierCost != null ? line.SupplierCost.Value.ToString("0.00") : "",
                HorizontalContentAlignment = HorizontalAlignment.Right,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 0, 1, 1),
            });
            markup.Cell(2, 1, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = line.RetailMarkup != null ? line.RetailMarkup.Value.ToString("0.00") : "",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 0, 1, 1),
            });
            markup.Cell(2, 2, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = line.RetailCost != null ? line.RetailCost.Value.ToString("0.00") : "",
                HorizontalContentAlignment = HorizontalAlignment.Right,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 0, 1, 1),
            });

            var tax = new Grid();

            tax.Margin = new Thickness(2, 0, 0, 0);
            tax.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            tax.ColumnDefinitions.Add(new ColumnDefinition());
            tax.ColumnDefinitions.Add(new ColumnDefinition());
            tax.Cell(0, 0, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = String.Format("НДС {0:0.00} %", line.Nds),
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(1, 1, 1, 1),
            });
            tax.Cell(0, 1, new Label {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Content    = "НП __ %",
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(0),
                BorderBrush     = Brushes.Black,
                BorderThickness = new Thickness(0, 1, 1, 1),
            });

            var period = new Grid();

            period.Margin = new Thickness(2, 0, 0, 0);
            tax.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            period.ColumnDefinitions.Add(new ColumnDefinition());
            period.ColumnDefinitions.Add(new ColumnDefinition());
            period.Cell(0, 0, new TextBlock {
                FontSize            = 10,
                FontFamily          = new FontFamily("Arial"),
                HorizontalAlignment = HorizontalAlignment.Center,
                Text = "Срок годности:"
            });
            period.Cell(0, 1, new TextBlock {
                FontSize   = 10,
                FontFamily = new FontFamily("Arial"),
                Text       = line.Period
            });

            var footer = new Grid();

            footer.RowDefinitions.Add(new RowDefinition());
            footer.RowDefinitions.Add(new RowDefinition());
            footer.ColumnDefinitions.Add(new ColumnDefinition());
            footer.ColumnDefinitions.Add(new ColumnDefinition());
            footer.Children.Add(markup);
            markup.SetValue(Grid.RowProperty, 0);
            markup.SetValue(Grid.ColumnProperty, 0);
            markup.SetValue(Grid.RowSpanProperty, 2);
            footer.Cell(0, 1, tax);
            footer.Cell(1, 1, period);

            body.Children.Add(footer);
            footer.SetValue(Grid.RowProperty, 3);

            var border = new Border {
                BorderThickness = new Thickness(0, 0, 1, 1),
                BorderBrush     = Brushes.Black,
            };

            border.Child = body;
            return(border);
        }