Exemplo n.º 1
0
        private static Table CreateClassificationTable(SkuPdfModel model)
        {
            return(TableBuilder.Create(builder =>
            {
                builder.SetCellPaddings(5f);
                builder.SetColumnWidths(2, "200 300");
                builder.SetDefaultTextStyle();
                //builder.AddBorders();

                builder.AddSingleCellRow(cellBuilder =>
                {
                    cellBuilder.Cell.Margin = new MarginInfo(0, 12, 0, 15);
                    cellBuilder.AddHtml(fragmentBuilder => fragmentBuilder.AppendHeader("Классификация"));
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.Row.BackgroundColor = Color.FromRgb(231 / 255f, 239 / 255f, 247 / 255f);

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Справочник");
                    }));

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Код");
                    }));
                });

                foreach (var classification in model.Classifications)
                {
                    builder.AddRow(rowBuilder =>
                    {
                        rowBuilder.Row.Border = new BorderInfo(BorderSide.Top,
                                                               new GraphInfo {
                            Color = Color.Gray, LineWidth = 0.5f
                        });

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder.AppendText(classification.Dictionary);
                        }));

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder.AppendText(classification.Code);
                        }));
                    });
                }
            }));
        }
Exemplo n.º 2
0
        private static Table CreateHeaderTable(SkuPdfModel model, ImageStore imageStore)
        {
            var table = TableBuilder.Create(builder =>
            {
                builder.SetCellPaddings(5f);
                builder.SetColumnWidths(3, "150 150 150");
                builder.SetDefaultTextStyle();
                //builder.AddBorders();

                builder.AddRow(rowBuilder =>
                {
                    var image = imageStore.GetImage("D:\\WorkAsposeFiles\\2.png", image => image.ImageScale = 0.6);

                    rowBuilder.AddCell(3, cellBuilder =>
                    {
                        cellBuilder.AddImage(image);
                    });
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.AddCell(2, cellBuilder =>
                    {
                        cellBuilder.Cell.VerticalAlignment = VerticalAlignment.Center;
                        cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder.AppendHighlighted(model.Name).Build();
                        });
                    });

                    rowBuilder.AddCell(cellBuilder =>
                    {
                        var qr = imageStore.GetImage(
                            "D:\\WorkAsposeFiles\\3.gif",
                            image =>
                        {
                            image.FixHeight           = 80;
                            image.FixWidth            = 80;
                            image.VerticalAlignment   = VerticalAlignment.Top;
                            image.HorizontalAlignment = HorizontalAlignment.Right;
                        });

                        cellBuilder.AddImage(qr);
                    });
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.AddCell(cellBuilder =>
                    {
                        var sku = imageStore.GetImage("D:\\WorkAsposeFiles\\1.jpg", image =>
                        {
                            image.FixHeight = 150;
                            image.FixWidth  = 150;
                        });

                        cellBuilder.Cell.RowSpan = 3;
                        cellBuilder.AddImage(sku);
                    });

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder
                        .AppendText("Референтная цена")
                        .AppendHighlighted(model.ReferencePrice)
                        .AppendText("штука");
                    }));

                    rowBuilder.AddCell(cellBuilder =>
                    {
                        cellBuilder.Cell.Alignment         = HorizontalAlignment.Right;
                        cellBuilder.Cell.VerticalAlignment = VerticalAlignment.Top;

                        cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder
                            .AppendText("Контрактов")
                            .AppendHighlighted(model.ContractsCount);
                        });
                    });
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.AddCell(2, cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder
                        .AppendHighlighted($"от {model.MinPrice} до {model.MaxPrice}")
                        .AppendText("на основе 24 предложений поставщиков");
                    }));
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.AddCell(2, cellBuilder =>
                    {
                        cellBuilder.Cell.VerticalAlignment = VerticalAlignment.Top;

                        cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder
                            .AppendText("Востребованная продукция");
                        });
                    });
                });
            });

            return(table);
        }
Exemplo n.º 3
0
        private static Table CreateCharacteristicTable(SkuPdfModel model)
        {
            return(TableBuilder.Create(builder =>
            {
                builder.SetCellPaddings(5f);
                builder.SetColumnWidths(2, "200 300");
                builder.SetDefaultTextStyle();
                //builder.AddBorders();

                builder.AddSingleCellRow(cellBuilder =>
                {
                    cellBuilder.Cell.Margin = new MarginInfo(0, 0, 0, 10);
                    cellBuilder.AddHtml(fragmentBuilder => fragmentBuilder.AppendHeader("Характеристики"));
                });

                builder.AddSingleCellRow(cellBuilder =>
                {
                    cellBuilder.AddHtml(fragmentBuilder =>
                    {
                        fragmentBuilder
                        .AppendText("Модель: " + model.SkuModel)
                        .AppendText("Производитель: " + model.Producer);
                    });
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.Row.BackgroundColor = Color.FromRgb(231 / 255f, 239 / 255f, 247 / 255f);

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Наименование характеристики");
                    }));

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Значение");
                    }));
                });

                foreach (var characteristic in model.Characteristics)
                {
                    builder.AddRow(rowBuilder =>
                    {
                        rowBuilder.Row.Border = new BorderInfo(BorderSide.Top,
                                                               new GraphInfo {
                            Color = Color.Gray, LineWidth = 0.5f
                        });

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder.AppendText(characteristic.Name);
                        }));

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder.AppendText(characteristic.Value);
                        }));
                    });
                }
            }));
        }
Exemplo n.º 4
0
        private static Table CreateSupplierOffersTable(SkuPdfModel model)
        {
            return(TableBuilder.Create(builder =>
            {
                builder.SetCellPaddings(5f);
                builder.SetColumnWidths(3, "150 200 100");
                builder.SetDefaultTextStyle();

                builder.AddSingleCellRow(cellBuilder =>
                {
                    cellBuilder.Cell.Margin = new MarginInfo(0, 12, 0, 15);
                    cellBuilder.AddHtml(fragmentBuilder => fragmentBuilder.AppendHeader("Предложения поставщиков"));
                });

                builder.AddRow(rowBuilder =>
                {
                    rowBuilder.Row.BackgroundColor = Color.FromRgb(231 / 255f, 239 / 255f, 247 / 255f);

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Поставщик");
                    }));

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Условия поставки");
                    }));

                    rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                    {
                        htmlBuilder.AppendText("Стоимость с НДС");
                    }));
                });

                foreach (var supplierOffer in model.SupplierOffers)
                {
                    builder.AddRow(rowBuilder =>
                    {
                        rowBuilder.Row.Border = new BorderInfo(BorderSide.Top,
                                                               new GraphInfo {
                            Color = Color.Gray, LineWidth = 0.5f
                        });

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder
                            .AppendBoldText(supplierOffer.Name)
                            .AppendText($"ИНН: {supplierOffer.Inn}")
                            .AppendText($"Оферта: №: {supplierOffer.Offer}");
                        }));

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder
                            .AppendText($"Срок поставки: {supplierOffer.DeliveryTime}")
                            .AppendText($"Регион поставки: {supplierOffer.DeliveryRegion}");
                        }));

                        rowBuilder.AddCell(cellBuilder => cellBuilder.AddHtml(htmlBuilder =>
                        {
                            htmlBuilder
                            .AppendHighlighted($"{supplierOffer.Price} ₽")
                            .AppendText($"НДС: {supplierOffer.Vat}%");
                        }));
                    });
                }
            }));
        }