комплит, но какой ценой

This commit is contained in:
ValAnn 2024-04-08 00:10:47 +04:00
parent becaed34c7
commit 061c030460
25 changed files with 597 additions and 442 deletions

View File

@ -13,7 +13,6 @@ namespace SushiBarBusinessLogic.OfficePackage
public void CreateReport(ExcelInfo info) public void CreateReport(ExcelInfo info)
{ {
CreateExcel(info); CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
@ -21,46 +20,40 @@ namespace SushiBarBusinessLogic.OfficePackage
Text = info.Title, Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title StyleInfo = ExcelStyleInfoType.Title
}); });
MergeCells(new ExcelMergeParameters MergeCells(new ExcelMergeParameters
{ {
CellFromName = "A1", CellFromName = "A1",
CellToName = "C1" CellToName = "C1"
}); });
uint rowIndex = 2; uint rowIndex = 2;
foreach (var pc in info.SushiComponents) foreach (var sc in info.SushiComponents)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.SushiName, Text = sc.SushiName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var component in sc.Components)
foreach (var (Component, Count) in pc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = Component, Text = component.Item1,
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = Count.ToString(), Text = component.Item2.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });
rowIndex++; rowIndex++;
} }
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
@ -72,18 +65,33 @@ namespace SushiBarBusinessLogic.OfficePackage
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.TotalCount.ToString(), Text = sc.TotalCount.ToString(),
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
} }
SaveExcel(info); SaveExcel(info);
} }
/// <summary>
/// Создание excel-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateExcel(ExcelInfo info); protected abstract void CreateExcel(ExcelInfo info);
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams); /// <summary>
/// Добавляем новую ячейку в лист
/// </summary>
/// <param name="cellParameters"></param>
protected abstract void InsertCellInWorksheet(ExcelCellParameters
excelParams);
/// <summary>
/// Объединение ячеек
/// </summary>
/// <param name="mergeParameters"></param>
protected abstract void MergeCells(ExcelMergeParameters excelParams); protected abstract void MergeCells(ExcelMergeParameters excelParams);
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="info"></param>
protected abstract void SaveExcel(ExcelInfo info); protected abstract void SaveExcel(ExcelInfo info);
}
}
} }

View File

@ -1,10 +1,10 @@
using System; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels;
namespace SushiBarBusinessLogic.OfficePackage namespace SushiBarBusinessLogic.OfficePackage
{ {
@ -13,35 +13,67 @@ namespace SushiBarBusinessLogic.OfficePackage
public void CreateDoc(PdfInfo info) public void CreateDoc(PdfInfo info)
{ {
CreatePdf(info); CreatePdf(info);
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер", "Дата заказа", "Пицца", "Статус", "Сумма" }, Text = info.Title,
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "1cm", "3cm", "4cm", "6cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Статус", "Изделие", "Сумма" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
foreach (var order in info.Orders) foreach (var order in info.Orders)
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SushiName, order.Status.ToString(), order.Sum.ToString() }, Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.Status.ToString(), order.SushiName, order.Sum.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });
} }
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth }); CreateParagraph(new PdfParagraph
{
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
});
SavePdf(info); SavePdf(info);
} }
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreatePdf(PdfInfo info); protected abstract void CreatePdf(PdfInfo info);
/// <summary>
/// Создание параграфа с текстом
/// </summary>
/// <param name="title"></param>
/// <param name="style"></param>
protected abstract void CreateParagraph(PdfParagraph paragraph); protected abstract void CreateParagraph(PdfParagraph paragraph);
/// <summary>
/// Создание таблицы
/// </summary>
/// <param name="title"></param>
/// <param name="style"></param>
protected abstract void CreateTable(List<string> columns); protected abstract void CreateTable(List<string> columns);
/// <summary>
/// Создание и заполнение строки
/// </summary>
/// <param name="rowParameters"></param>
protected abstract void CreateRow(PdfRowParameters rowParameters); protected abstract void CreateRow(PdfRowParameters rowParameters);
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="info"></param>
protected abstract void SavePdf(PdfInfo info); protected abstract void SavePdf(PdfInfo info);
} }
} }

View File

@ -1,10 +1,5 @@
using SushiBarBusinessLogic.OfficePackage.HelperEnums; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels; using SushiBarBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage namespace SushiBarBusinessLogic.OfficePackage
{ {
@ -13,25 +8,27 @@ namespace SushiBarBusinessLogic.OfficePackage
public void CreateDoc(WordInfo info) public void CreateDoc(WordInfo info)
{ {
CreateWord(info); CreateWord(info);
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) }, Texts = new List<(string, WordTextProperties)>
{
(info.Title, new WordTextProperties { Bold = true, Size = "24", })
},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
foreach (var sushi in info.Sushis) foreach (var sushi in info.Sushis)
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { Texts = new List<(string, WordTextProperties)> {
(sushi.SushiName, new WordTextProperties { Size = "24", Bold = true}), (sushi.SushiName, new WordTextProperties { Bold = true, Size = "24", }),
("\t"+sushi.Price.ToString(), new WordTextProperties{Size = "24"}) (" цена: " + sushi.Price.ToString() + " рублей", new WordTextProperties { Size = "24", })
}, },
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",
@ -39,11 +36,23 @@ namespace SushiBarBusinessLogic.OfficePackage
} }
}); });
} }
SaveWord(info); SaveWord(info);
} }
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateWord(WordInfo info); protected abstract void CreateWord(WordInfo info);
/// <summary>
/// Создание абзаца с текстом
/// </summary>
/// <param name="paragraph"></param>
/// <returns></returns>
protected abstract void CreateParagraph(WordParagraph paragraph); protected abstract void CreateParagraph(WordParagraph paragraph);
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="info"></param>
protected abstract void SaveWord(WordInfo info); protected abstract void SaveWord(WordInfo info);
} }
} }

View File

@ -1,10 +1,4 @@
using System; namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
{ {
public enum ExcelStyleInfoType public enum ExcelStyleInfoType
{ {

View File

@ -1,10 +1,4 @@
using System; namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
{ {
public enum WordJustificationType public enum WordJustificationType
{ {

View File

@ -9,5 +9,6 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
public string Text { get; set; } = string.Empty; public string Text { get; set; } = string.Empty;
public string CellReference => $"{ColumnName}{RowIndex}"; public string CellReference => $"{ColumnName}{RowIndex}";
public ExcelStyleInfoType StyleInfo { get; set; } public ExcelStyleInfoType StyleInfo { get; set; }
} }
} }

View File

@ -6,6 +6,11 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ReportSushiComponentViewModel> SushiComponents { get; set; } = new(); public List<ReportSushiComponentViewModel> SushiComponents
{
get;
set;
} = new();
} }
} }

View File

@ -1,9 +1,16 @@
namespace SushiBarBusinessLogic.OfficePackage.HelperModels using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
{ {
public class ExcelMergeParameters public class ExcelMergeParameters
{ {
public string CellFromName { get; set; } = string.Empty; public string CellFromName { get; set; } = string.Empty;
public string CellToName { get; set; } = string.Empty; public string CellToName { get; set; } = string.Empty;
public string Merge => $"{CellFromName}:{CellToName}"; public string Merge => $"{CellFromName}:{CellToName}";
} }
} }

View File

@ -1,4 +1,10 @@
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperModels namespace SushiBarBusinessLogic.OfficePackage.HelperModels
{ {
@ -8,6 +14,8 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public DateTime DateFrom { get; set; } public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; } public DateTime DateTo { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public List<ReportOrdersViewModel> Orders { get; set; } = new(); public List<ReportOrdersViewModel> Orders { get; set; } = new();
} }
} }

View File

@ -1,4 +1,9 @@
using SushiBarBusinessLogic.OfficePackage.HelperEnums; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperModels namespace SushiBarBusinessLogic.OfficePackage.HelperModels
{ {
@ -7,5 +12,6 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
public string Text { get; set; } = string.Empty; public string Text { get; set; } = string.Empty;
public string Style { get; set; } = string.Empty; public string Style { get; set; } = string.Empty;
public PdfParagraphAlignmentType ParagraphAlignment { get; set; } public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
} }
} }

View File

@ -1,4 +1,9 @@
using SushiBarBusinessLogic.OfficePackage.HelperEnums; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperModels namespace SushiBarBusinessLogic.OfficePackage.HelperModels
{ {

View File

@ -7,5 +7,6 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<SushiViewModel> Sushis { get; set; } = new(); public List<SushiViewModel> Sushis { get; set; } = new();
} }
} }

View File

@ -1,4 +1,10 @@
namespace SushiBarBusinessLogic.OfficePackage.HelperModels using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
{ {
public class WordParagraph public class WordParagraph
{ {

View File

@ -7,5 +7,6 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
public string Size { get; set; } = string.Empty; public string Size { get; set; } = string.Empty;
public bool Bold { get; set; } public bool Bold { get; set; }
public WordJustificationType JustificationType { get; set; } public WordJustificationType JustificationType { get; set; }
} }
} }

View File

@ -1,11 +1,11 @@
using DocumentFormat.OpenXml.Office2010.Excel; using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Office2013.Excel; using DocumentFormat.OpenXml.Office2013.Excel;
using DocumentFormat.OpenXml.Office2016.Excel;
using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml;
using SushiBarBusinessLogic.OfficePackage.HelperEnums; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels; using SushiBarBusinessLogic.OfficePackage.HelperModels;
using SushiBarBusinessLogic.OfficePackage;
namespace SushiBarBusinessLogic.OfficePackage.Implements namespace SushiBarBusinessLogic.OfficePackage.Implements
{ {
@ -14,110 +14,167 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
private SpreadsheetDocument? _spreadsheetDocument; private SpreadsheetDocument? _spreadsheetDocument;
private SharedStringTablePart? _shareStringPart; private SharedStringTablePart? _shareStringPart;
private Worksheet? _worksheet; private Worksheet? _worksheet;
/// <summary>
/// Настройка стилей для файла
/// </summary>
/// <param name="workbookpart"></param>
private static void CreateStyles(WorkbookPart workbookpart) private static void CreateStyles(WorkbookPart workbookpart)
{ {
var sp = workbookpart.AddNewPart<WorkbookStylesPart>(); var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
sp.Stylesheet = new Stylesheet(); sp.Stylesheet = new Stylesheet();
var fonts = new Fonts() { Count = 2U, KnownFonts = true }; var fonts = new Fonts() { Count = 2U, KnownFonts = true };
var fontUsual = new Font(); var fontUsual = new Font();
fontUsual.Append(new FontSize() { Val = 12D }); fontUsual.Append(new FontSize() { Val = 12D });
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U }); fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Theme = 1U });
fontUsual.Append(new FontName() { Val = "Times New Roman" }); fontUsual.Append(new FontName() { Val = "Times New Roman" });
fontUsual.Append(new FontFamilyNumbering() { Val = 2 }); fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor }); fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
var fontTitle = new Font(); var fontTitle = new Font();
fontTitle.Append(new Bold()); fontTitle.Append(new Bold());
fontTitle.Append(new FontSize() { Val = 14D }); fontTitle.Append(new FontSize() { Val = 14D });
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U }); fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Theme = 1U });
fontTitle.Append(new FontName() { Val = "Times New Roman" }); fontTitle.Append(new FontName() { Val = "Times New Roman" });
fontTitle.Append(new FontFamilyNumbering() { Val = 2 }); fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor }); fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
fonts.Append(fontUsual); fonts.Append(fontUsual);
fonts.Append(fontTitle); fonts.Append(fontTitle);
var fills = new Fills() { Count = 2U }; var fills = new Fills() { Count = 2U };
var fill1 = new Fill(); var fill1 = new Fill();
fill1.Append(new PatternFill() { PatternType = PatternValues.None }); fill1.Append(new PatternFill() { PatternType = PatternValues.None });
var fill2 = new Fill(); var fill2 = new Fill();
fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 }); fill2.Append(new PatternFill()
{
PatternType = PatternValues.Gray125
});
fills.Append(fill1); fills.Append(fill1);
fills.Append(fill2); fills.Append(fill2);
var borders = new Borders() { Count = 2U }; var borders = new Borders() { Count = 2U };
var borderNoBorder = new Border(); var borderNoBorder = new Border();
borderNoBorder.Append(new LeftBorder()); borderNoBorder.Append(new LeftBorder());
borderNoBorder.Append(new RightBorder()); borderNoBorder.Append(new RightBorder());
borderNoBorder.Append(new TopBorder()); borderNoBorder.Append(new TopBorder());
borderNoBorder.Append(new BottomBorder()); borderNoBorder.Append(new BottomBorder());
borderNoBorder.Append(new DiagonalBorder()); borderNoBorder.Append(new DiagonalBorder());
var borderThin = new Border(); var borderThin = new Border();
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin }; var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin }; var rightBorder = new RightBorder()
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); {
Style = BorderStyleValues.Thin
};
rightBorder.Append(new
DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin }; var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin }; var bottomBorder = new BottomBorder()
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); {
Style =
BorderStyleValues.Thin
};
bottomBorder.Append(new
DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
borderThin.Append(leftBorder); borderThin.Append(leftBorder);
borderThin.Append(rightBorder); borderThin.Append(rightBorder);
borderThin.Append(topBorder); borderThin.Append(topBorder);
borderThin.Append(bottomBorder); borderThin.Append(bottomBorder);
borderThin.Append(new DiagonalBorder()); borderThin.Append(new DiagonalBorder());
borders.Append(borderNoBorder); borders.Append(borderNoBorder);
borders.Append(borderThin); borders.Append(borderThin);
var cellStyleFormats = new CellStyleFormats() { Count = 1U }; var cellStyleFormats = new CellStyleFormats() { Count = 1U };
var cellFormatStyle = new CellFormat() { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U }; var cellFormatStyle = new CellFormat()
{
NumberFormatId = 0U,
FontId
= 0U,
FillId = 0U,
BorderId = 0U
};
cellStyleFormats.Append(cellFormatStyle); cellStyleFormats.Append(cellFormatStyle);
var cellFormats = new CellFormats() { Count = 3U }; var cellFormats = new CellFormats() { Count = 3U };
var cellFormatFont = new CellFormat() { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyFont = true }; var cellFormatFont = new CellFormat()
var cellFormatFontAndBorder = new CellFormat() { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 1U, FormatId = 0U, ApplyFont = true, ApplyBorder = true }; {
var cellFormatTitle = new CellFormat() { NumberFormatId = 0U, FontId = 1U, FillId = 0U, BorderId = 0U, FormatId = 0U, Alignment = new Alignment() { Vertical = VerticalAlignmentValues.Center, WrapText = true, Horizontal = HorizontalAlignmentValues.Center }, ApplyFont = true }; NumberFormatId = 0U,
FontId =
0U,
FillId = 0U,
BorderId = 0U,
FormatId = 0U,
ApplyFont = true
};
var cellFormatFontAndBorder = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 1U,
FormatId = 0U,
ApplyFont = true,
ApplyBorder = true
};
var cellFormatTitle = new CellFormat()
{
NumberFormatId = 0U,
FontId
= 1U,
FillId = 0U,
BorderId = 0U,
FormatId = 0U,
Alignment = new Alignment()
{
Vertical = VerticalAlignmentValues.Center,
WrapText = true,
Horizontal =
HorizontalAlignmentValues.Center
},
ApplyFont = true
};
cellFormats.Append(cellFormatFont); cellFormats.Append(cellFormatFont);
cellFormats.Append(cellFormatFontAndBorder); cellFormats.Append(cellFormatFontAndBorder);
cellFormats.Append(cellFormatTitle); cellFormats.Append(cellFormatTitle);
var cellStyles = new CellStyles() { Count = 1U }; var cellStyles = new CellStyles() { Count = 1U };
cellStyles.Append(new CellStyle()
{
Name = "Normal",
FormatId = 0U,
BuiltinId = 0U
});
var differentialFormats = new
DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
{ Count = 0U };
cellStyles.Append(new CellStyle() { Name = "Normal", FormatId = 0U, BuiltinId = 0U }); var tableStyles = new TableStyles()
{
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats() { Count = 0U }; Count = 0U,
DefaultTableStyle = "TableStyleMedium2",
var tableStyles = new TableStyles() { Count = 0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; DefaultPivotStyle = "PivotStyleLight16"
};
var stylesheetExtensionList = new StylesheetExtensionList(); var stylesheetExtensionList = new StylesheetExtensionList();
var stylesheetExtension1 = new StylesheetExtension()
var stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; {
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
};
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
stylesheetExtension1.Append(new SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }); stylesheetExtension1.Append(new SlicerStyles()
{
var stylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; DefaultSlicerStyle = "SlicerStyleLight1"
});
var stylesheetExtension2 = new StylesheetExtension()
{
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
};
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
stylesheetExtension2.Append(new TimelineStyles() { DefaultTimelineStyle = "TimeSlicerStyleLight1" }); stylesheetExtension2.Append(new TimelineStyles()
{
DefaultTimelineStyle = "TimeSlicerStyleLight1"
});
stylesheetExtensionList.Append(stylesheetExtension1); stylesheetExtensionList.Append(stylesheetExtension1);
stylesheetExtensionList.Append(stylesheetExtension2); stylesheetExtensionList.Append(stylesheetExtension2);
sp.Stylesheet.Append(fonts); sp.Stylesheet.Append(fonts);
sp.Stylesheet.Append(fills); sp.Stylesheet.Append(fills);
sp.Stylesheet.Append(borders); sp.Stylesheet.Append(borders);
@ -128,7 +185,11 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
sp.Stylesheet.Append(tableStyles); sp.Stylesheet.Append(tableStyles);
sp.Stylesheet.Append(stylesheetExtensionList); sp.Stylesheet.Append(stylesheetExtensionList);
} }
/// <summary>
/// Получение номера стиля из типа
/// </summary>
/// <param name="styleInfo"></param>
/// <returns></returns>
private static uint GetStyleValue(ExcelStyleInfoType styleInfo) private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
{ {
return styleInfo switch return styleInfo switch
@ -139,44 +200,40 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
_ => 0U, _ => 0U,
}; };
} }
protected override void CreateExcel(ExcelInfo info) protected override void CreateExcel(ExcelInfo info)
{ {
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook); _spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
// Создаем книгу (в ней хранятся листы) SpreadsheetDocumentType.Workbook);
var workbookpart = _spreadsheetDocument.AddWorkbookPart(); var workbookpart = _spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook(); workbookpart.Workbook = new Workbook();
CreateStyles(workbookpart); CreateStyles(workbookpart);
_shareStringPart =
// Получаем/создаем хранилище текстов для книги _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any() ?
? _spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First() _spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
: _spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>(); :
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
// Создаем SharedStringTable, если его нет // Создаем SharedStringTable, если его нет
if (_shareStringPart.SharedStringTable == null) if (_shareStringPart.SharedStringTable == null)
{ {
_shareStringPart.SharedStringTable = new SharedStringTable(); _shareStringPart.SharedStringTable = new SharedStringTable();
} }
// Создаем лист в книгу // Создаем лист в книгу
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>(); var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet(new SheetData()); worksheetPart.Worksheet = new Worksheet(new SheetData());
// Добавляем лист в книгу // Добавляем лист в книгу
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets()); var sheets =
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
var sheet = new Sheet() var sheet = new Sheet()
{ {
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart), Id =
_spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
SheetId = 1, SheetId = 1,
Name = "Лист" Name = "Лист"
}; };
sheets.Append(sheet); sheets.Append(sheet);
_worksheet = worksheetPart.Worksheet; _worksheet = worksheetPart.Worksheet;
} }
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams) protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
{ {
if (_worksheet == null || _shareStringPart == null) if (_worksheet == null || _shareStringPart == null)
@ -188,7 +245,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
{ {
return; return;
} }
// Ищем строку, либо добавляем ее // Ищем строку, либо добавляем ее
Row row; Row row;
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any()) if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
@ -200,7 +256,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
row = new Row() { RowIndex = excelParams.RowIndex }; row = new Row() { RowIndex = excelParams.RowIndex };
sheetData.Append(row); sheetData.Append(row);
} }
// Ищем нужную ячейку // Ищем нужную ячейку
Cell cell; Cell cell;
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any()) if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
@ -220,22 +275,20 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
break; break;
} }
} }
var newCell = new Cell()
var newCell = new Cell() { CellReference = excelParams.CellReference }; {
CellReference = excelParams.CellReference
};
row.InsertBefore(newCell, refCell); row.InsertBefore(newCell, refCell);
cell = newCell; cell = newCell;
} }
// вставляем новый текст // вставляем новый текст
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text))); _shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
_shareStringPart.SharedStringTable.Save(); _shareStringPart.SharedStringTable.Save();
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString()); cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString); cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo); cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
} }
protected override void MergeCells(ExcelMergeParameters excelParams) protected override void MergeCells(ExcelMergeParameters excelParams)
{ {
if (_worksheet == null) if (_worksheet == null)
@ -243,7 +296,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
return; return;
} }
MergeCells mergeCells; MergeCells mergeCells;
if (_worksheet.Elements<MergeCells>().Any()) if (_worksheet.Elements<MergeCells>().Any())
{ {
mergeCells = _worksheet.Elements<MergeCells>().First(); mergeCells = _worksheet.Elements<MergeCells>().First();
@ -251,24 +303,23 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
else else
{ {
mergeCells = new MergeCells(); mergeCells = new MergeCells();
if (_worksheet.Elements<CustomSheetView>().Any()) if (_worksheet.Elements<CustomSheetView>().Any())
{ {
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<CustomSheetView>().First()); _worksheet.InsertAfter(mergeCells,
_worksheet.Elements<CustomSheetView>().First());
} }
else else
{ {
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<SheetData>().First()); _worksheet.InsertAfter(mergeCells,
_worksheet.Elements<SheetData>().First());
} }
} }
var mergeCell = new MergeCell() var mergeCell = new MergeCell()
{ {
Reference = new StringValue(excelParams.Merge) Reference = new StringValue(excelParams.Merge)
}; };
mergeCells.Append(mergeCell); mergeCells.Append(mergeCell);
} }
protected override void SaveExcel(ExcelInfo info) protected override void SaveExcel(ExcelInfo info)
{ {
if (_spreadsheetDocument == null) if (_spreadsheetDocument == null)

View File

@ -1,7 +1,6 @@
using MigraDoc.DocumentObjectModel; using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables; using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering; using MigraDoc.Rendering;
using SushiBarBusinessLogic.OfficePackage;
using SushiBarBusinessLogic.OfficePackage.HelperEnums; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels; using SushiBarBusinessLogic.OfficePackage.HelperModels;
@ -12,7 +11,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
private Document? _document; private Document? _document;
private Section? _section; private Section? _section;
private Table? _table; private Table? _table;
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type) private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
{ {
return type switch return type switch
@ -23,25 +21,24 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
_ => ParagraphAlignment.Justify, _ => ParagraphAlignment.Justify,
}; };
} }
/// <summary>
/// Создание стилей для документа
/// </summary>
/// <param name="document"></param>
private static void DefineStyles(Document document) private static void DefineStyles(Document document)
{ {
var style = document.Styles["Normal"]; var style = document.Styles["Normal"];
style.Font.Name = "Times New Roman"; style.Font.Name = "Times New Roman";
style.Font.Size = 14; style.Font.Size = 14;
style = document.Styles.AddStyle("NormalTitle", "Normal"); style = document.Styles.AddStyle("NormalTitle", "Normal");
style.Font.Bold = true; style.Font.Bold = true;
} }
protected override void CreatePdf(PdfInfo info) protected override void CreatePdf(PdfInfo info)
{ {
_document = new Document(); _document = new Document();
DefineStyles(_document); DefineStyles(_document);
_section = _document.AddSection(); _section = _document.AddSection();
} }
protected override void CreateParagraph(PdfParagraph pdfParagraph) protected override void CreateParagraph(PdfParagraph pdfParagraph)
{ {
if (_section == null) if (_section == null)
@ -53,7 +50,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment); paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
paragraph.Style = pdfParagraph.Style; paragraph.Style = pdfParagraph.Style;
} }
protected override void CreateTable(List<string> columns) protected override void CreateTable(List<string> columns)
{ {
if (_document == null) if (_document == null)
@ -61,13 +57,11 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
return; return;
} }
_table = _document.LastSection.AddTable(); _table = _document.LastSection.AddTable();
foreach (var elem in columns) foreach (var elem in columns)
{ {
_table.AddColumn(elem); _table.AddColumn(elem);
} }
} }
protected override void CreateRow(PdfRowParameters rowParameters) protected override void CreateRow(PdfRowParameters rowParameters)
{ {
if (_table == null) if (_table == null)
@ -78,24 +72,19 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
for (int i = 0; i < rowParameters.Texts.Count; ++i) for (int i = 0; i < rowParameters.Texts.Count; ++i)
{ {
row.Cells[i].AddParagraph(rowParameters.Texts[i]); row.Cells[i].AddParagraph(rowParameters.Texts[i]);
if (!string.IsNullOrEmpty(rowParameters.Style)) if (!string.IsNullOrEmpty(rowParameters.Style))
{ {
row.Cells[i].Style = rowParameters.Style; row.Cells[i].Style = rowParameters.Style;
} }
Unit borderWidth = 0.5; Unit borderWidth = 0.5;
row.Cells[i].Borders.Left.Width = borderWidth; row.Cells[i].Borders.Left.Width = borderWidth;
row.Cells[i].Borders.Right.Width = borderWidth; row.Cells[i].Borders.Right.Width = borderWidth;
row.Cells[i].Borders.Top.Width = borderWidth; row.Cells[i].Borders.Top.Width = borderWidth;
row.Cells[i].Borders.Bottom.Width = borderWidth; row.Cells[i].Borders.Bottom.Width = borderWidth;
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment); row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
row.Cells[i].VerticalAlignment = VerticalAlignment.Center; row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
} }
} }
protected override void SavePdf(PdfInfo info) protected override void SavePdf(PdfInfo info)
{ {
var renderer = new PdfDocumentRenderer(true) var renderer = new PdfDocumentRenderer(true)

View File

@ -1,9 +1,9 @@
using DocumentFormat.OpenXml; using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing; using DocumentFormat.OpenXml.Wordprocessing;
using SushiBarBusinessLogic.OfficePackage;
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels;
namespace SushiBarBusinessLogic.OfficePackage.Implements namespace SushiBarBusinessLogic.OfficePackage.Implements
{ {
@ -11,8 +11,13 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
{ {
private WordprocessingDocument? _wordDocument; private WordprocessingDocument? _wordDocument;
private Body? _docBody; private Body? _docBody;
/// <summary>
private static JustificationValues GetJustificationValues(WordJustificationType type) /// Получение типа выравнивания
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
private static JustificationValues
GetJustificationValues(WordJustificationType type)
{ {
return type switch return type switch
{ {
@ -21,47 +26,50 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
_ => JustificationValues.Left, _ => JustificationValues.Left,
}; };
} }
/// <summary>
/// Настройки страницы
/// </summary>
/// <returns></returns>
private static SectionProperties CreateSectionProperties() private static SectionProperties CreateSectionProperties()
{ {
var properties = new SectionProperties(); var properties = new SectionProperties();
var pageSize = new PageSize var pageSize = new PageSize
{ {
Orient = PageOrientationValues.Portrait Orient = PageOrientationValues.Portrait
}; };
properties.AppendChild(pageSize); properties.AppendChild(pageSize);
return properties; return properties;
} }
/// <summary>
/// Задание форматирования для абзаца
/// </summary>
/// <param name="paragraphProperties"></param>
/// <returns></returns>
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties) private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
{ {
if (paragraphProperties == null) if (paragraphProperties == null)
{ {
return null; return null;
} }
var properties = new ParagraphProperties(); var properties = new ParagraphProperties();
properties.AppendChild(new Justification() properties.AppendChild(new Justification()
{ {
Val = GetJustificationValues(paragraphProperties.JustificationType) Val = GetJustificationValues(paragraphProperties.JustificationType)
}); });
properties.AppendChild(new SpacingBetweenLines properties.AppendChild(new SpacingBetweenLines
{ {
LineRule = LineSpacingRuleValues.Auto LineRule = LineSpacingRuleValues.Auto
}); });
properties.AppendChild(new Indentation()); properties.AppendChild(new Indentation());
var paragraphMarkRunProperties = new ParagraphMarkRunProperties(); var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
if (!string.IsNullOrEmpty(paragraphProperties.Size)) if (!string.IsNullOrEmpty(paragraphProperties.Size))
{ {
paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperties.Size }); paragraphMarkRunProperties.AppendChild(new FontSize
{
Val = paragraphProperties.Size
});
} }
properties.AppendChild(paragraphMarkRunProperties); properties.AppendChild(paragraphMarkRunProperties);
return properties; return properties;
} }
protected override void CreateWord(WordInfo info) protected override void CreateWord(WordInfo info)
@ -80,11 +88,9 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
var docParagraph = new Paragraph(); var docParagraph = new Paragraph();
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties)); docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
foreach (var run in paragraph.Texts) foreach (var run in paragraph.Texts)
{ {
var docRun = new Run(); var docRun = new Run();
var properties = new RunProperties(); var properties = new RunProperties();
properties.AppendChild(new FontSize { Val = run.Item2.Size }); properties.AppendChild(new FontSize { Val = run.Item2.Size });
if (run.Item2.Bold) if (run.Item2.Bold)
@ -92,12 +98,13 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
properties.AppendChild(new Bold()); properties.AppendChild(new Bold());
} }
docRun.AppendChild(properties); docRun.AppendChild(properties);
docRun.AppendChild(new Text
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve }); {
Text = run.Item1,
Space = SpaceProcessingModeValues.Preserve
});
docParagraph.AppendChild(docRun); docParagraph.AppendChild(docRun);
} }
_docBody.AppendChild(docParagraph); _docBody.AppendChild(docParagraph);
} }
protected override void SaveWord(WordInfo info) protected override void SaveWord(WordInfo info)
@ -107,9 +114,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
return; return;
} }
_docBody.AppendChild(CreateSectionProperties()); _docBody.AppendChild(CreateSectionProperties());
_wordDocument.MainDocumentPart!.Document.Save(); _wordDocument.MainDocumentPart!.Document.Save();
_wordDocument.Dispose(); _wordDocument.Dispose();
} }
} }

View File

@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" /> <PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.9" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -11,6 +11,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SushiBarView.Reports;
namespace SushiBarView namespace SushiBarView
{ {

View File

@ -1,4 +1,4 @@
namespace SushiBarView namespace SushiBarView.Reports
{ {
partial class FormReportOrders partial class FormReportOrders
{ {
@ -28,104 +28,102 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel = new System.Windows.Forms.Panel(); panel = new Panel();
this.labelFrom = new System.Windows.Forms.Label(); labelFrom = new Label();
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker(); buttonToPdf = new Button();
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker(); dateTimePickerDateFrom = new DateTimePicker();
this.labelTo = new System.Windows.Forms.Label(); labelTo = new Label();
this.buttonMake = new System.Windows.Forms.Button(); dateTimePickerDateTo = new DateTimePicker();
this.buttonToPDF = new System.Windows.Forms.Button(); buttonMake = new Button();
this.panel.SuspendLayout(); panel.SuspendLayout();
this.SuspendLayout(); SuspendLayout();
// //
// panel // panel
// //
this.panel.Controls.Add(this.buttonToPDF); panel.Controls.Add(labelFrom);
this.panel.Controls.Add(this.buttonMake); panel.Controls.Add(buttonToPdf);
this.panel.Controls.Add(this.dateTimePickerTo); panel.Controls.Add(dateTimePickerDateFrom);
this.panel.Controls.Add(this.labelTo); panel.Controls.Add(labelTo);
this.panel.Controls.Add(this.dateTimePickerFrom); panel.Controls.Add(dateTimePickerDateTo);
this.panel.Controls.Add(this.labelFrom); panel.Controls.Add(buttonMake);
this.panel.Dock = System.Windows.Forms.DockStyle.Top; panel.Dock = DockStyle.Top;
this.panel.Location = new System.Drawing.Point(0, 0); panel.Location = new Point(0, 0);
this.panel.Name = "panel"; panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(958, 52); panel.Size = new Size(1321, 71);
this.panel.TabIndex = 0; panel.TabIndex = 3;
// //
// labelFrom // labelFrom
// //
this.labelFrom.AutoSize = true; labelFrom.AutoSize = true;
this.labelFrom.Location = new System.Drawing.Point(12, 14); labelFrom.Location = new Point(16, 31);
this.labelFrom.Name = "labelFrom"; labelFrom.Name = "labelFrom";
this.labelFrom.Size = new System.Drawing.Size(18, 20); labelFrom.Size = new Size(18, 20);
this.labelFrom.TabIndex = 0; labelFrom.TabIndex = 3;
this.labelFrom.Text = "C"; labelFrom.Text = "С";
// //
// dateTimePickerFrom // buttonToPdf
// //
this.dateTimePickerFrom.Location = new System.Drawing.Point(36, 9); buttonToPdf.Location = new Point(1200, 27);
this.dateTimePickerFrom.Name = "dateTimePickerFrom"; buttonToPdf.Name = "buttonToPdf";
this.dateTimePickerFrom.Size = new System.Drawing.Size(199, 27); buttonToPdf.Size = new Size(94, 29);
this.dateTimePickerFrom.TabIndex = 1; buttonToPdf.TabIndex = 4;
buttonToPdf.Text = "В PDF";
buttonToPdf.UseVisualStyleBackColor = true;
buttonToPdf.Click += ButtonToPdf_Click;
// //
// dateTimePickerTo // dateTimePickerDateFrom
// //
this.dateTimePickerTo.Location = new System.Drawing.Point(300, 9); dateTimePickerDateFrom.Location = new Point(51, 27);
this.dateTimePickerTo.Name = "dateTimePickerTo"; dateTimePickerDateFrom.Name = "dateTimePickerDateFrom";
this.dateTimePickerTo.Size = new System.Drawing.Size(199, 27); dateTimePickerDateFrom.Size = new Size(250, 27);
this.dateTimePickerTo.TabIndex = 3; dateTimePickerDateFrom.TabIndex = 0;
// //
// labelTo // labelTo
// //
this.labelTo.AutoSize = true; labelTo.AutoSize = true;
this.labelTo.Location = new System.Drawing.Point(254, 14); labelTo.Location = new Point(317, 31);
this.labelTo.Name = "labelTo"; labelTo.Name = "labelTo";
this.labelTo.Size = new System.Drawing.Size(27, 20); labelTo.Size = new Size(29, 20);
this.labelTo.TabIndex = 2; labelTo.TabIndex = 4;
this.labelTo.Text = "по"; labelTo.Text = "По";
//
// dateTimePickerDateTo
//
dateTimePickerDateTo.Location = new Point(365, 27);
dateTimePickerDateTo.Name = "dateTimePickerDateTo";
dateTimePickerDateTo.Size = new Size(250, 27);
dateTimePickerDateTo.TabIndex = 1;
// //
// buttonMake // buttonMake
// //
this.buttonMake.Location = new System.Drawing.Point(542, 10); buttonMake.Location = new Point(677, 27);
this.buttonMake.Name = "buttonMake"; buttonMake.Name = "buttonMake";
this.buttonMake.Size = new System.Drawing.Size(165, 29); buttonMake.Size = new Size(132, 29);
this.buttonMake.TabIndex = 4; buttonMake.TabIndex = 3;
this.buttonMake.Text = "Сформировать"; buttonMake.Text = "Сформировать";
this.buttonMake.UseVisualStyleBackColor = true; buttonMake.UseVisualStyleBackColor = true;
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click); buttonMake.Click += ButtonMake_Click;
//
// buttonToPDF
//
this.buttonToPDF.Location = new System.Drawing.Point(781, 9);
this.buttonToPDF.Name = "buttonToPDF";
this.buttonToPDF.Size = new System.Drawing.Size(165, 29);
this.buttonToPDF.TabIndex = 5;
this.buttonToPDF.Text = "В PDF";
this.buttonToPDF.UseVisualStyleBackColor = true;
this.buttonToPDF.Click += new System.EventHandler(this.ButtonToPdf_Click);
// //
// FormReportOrders // FormReportOrders
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(958, 450); ClientSize = new Size(1321, 450);
this.Controls.Add(this.panel); Controls.Add(panel);
this.Name = "FormReportOrders"; Name = "FormReportOrders";
this.Text = "Заказы"; Text = "FormReportOrders";
this.panel.ResumeLayout(false); panel.ResumeLayout(false);
this.panel.PerformLayout(); panel.PerformLayout();
this.ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion
private Panel panel; private Panel panel;
private Button buttonToPDF; private DateTimePicker dateTimePickerDateTo;
private DateTimePicker dateTimePickerDateFrom;
private Button buttonMake; private Button buttonMake;
private DateTimePicker dateTimePickerTo; private Button buttonToPdf;
private Label labelTo; private Label labelTo;
private DateTimePicker dateTimePickerFrom;
private Label labelFrom; private Label labelFrom;
} }
} }

View File

@ -1,16 +1,15 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Reporting.WinForms;
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using Microsoft.Reporting.WinForms;
namespace SushiBarView namespace SushiBarView.Reports
{ {
public partial class FormReportOrders : Form public partial class FormReportOrders : Form
{ {
private readonly ReportViewer reportViewer; private readonly ReportViewer reportViewer;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IReportLogic _logic; private readonly IReportLogic _logic;
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic) public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
{ {
InitializeComponent(); InitializeComponent();
@ -20,35 +19,36 @@ namespace SushiBarView
{ {
Dock = DockStyle.Fill Dock = DockStyle.Fill
}; };
reportViewer.LocalReport.LoadReportDefinition(new FileStream("Report.rdlc", FileMode.Open)); var path = Directory.GetParent(Directory.GetCurrentDirectory())?.Parent?.Parent?.ToString() + "\\ReportOrders.rdlc";
reportViewer.LocalReport.LoadReportDefinition(new FileStream(path, FileMode.Open));
//reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
Controls.Clear(); Controls.Clear();
Controls.Add(reportViewer); Controls.Add(reportViewer);
Controls.Add(panel); Controls.Add(panel);
} }
private void ButtonMake_Click(object sender, EventArgs e) private void ButtonMake_Click(object sender, EventArgs e)
{ {
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) if (dateTimePickerDateFrom.Value.Date >= dateTimePickerDateTo.Value.Date)
{ {
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Дата начала должна быть меньше даты окончания",
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
try try
{ {
var dataSource = _logic.GetOrders(new ReportBindingModel var dataSource = _logic.GetOrders(new ReportBindingModel
{ {
DateFrom = dateTimePickerFrom.Value, DateFrom = dateTimePickerDateFrom.Value,
DateTo = dateTimePickerTo.Value DateTo = dateTimePickerDateTo.Value
}); });
var source = new ReportDataSource("DataSetOrders", dataSource); var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source); reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter("ReportParameterPeriod", var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c {dateTimePickerDateFrom.Value.ToShortDateString()} по {dateTimePickerDateTo.Value.ToShortDateString()}") };
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
reportViewer.LocalReport.SetParameters(parameters); reportViewer.LocalReport.SetParameters(parameters);
reportViewer.RefreshReport(); reportViewer.RefreshReport();
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); _logger.LogInformation("Загрузка списка заказов на период {From}-{To}",
dateTimePickerDateFrom.Value.ToShortDateString(), dateTimePickerDateTo.Value.ToShortDateString());
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -56,15 +56,17 @@ namespace SushiBarView
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void ButtonToPdf_Click(object sender, EventArgs e) private void ButtonToPdf_Click(object sender, EventArgs e)
{ {
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) if (dateTimePickerDateFrom.Value.Date >= dateTimePickerDateTo.Value.Date)
{ {
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf"
};
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
{ {
try try
@ -72,10 +74,11 @@ namespace SushiBarView
_logic.SaveOrdersToPdfFile(new ReportBindingModel _logic.SaveOrdersToPdfFile(new ReportBindingModel
{ {
FileName = dialog.FileName, FileName = dialog.FileName,
DateFrom = dateTimePickerFrom.Value, DateFrom = dateTimePickerDateFrom.Value,
DateTo = dateTimePickerTo.Value DateTo = dateTimePickerDateTo.Value
}); });
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); _logger.LogInformation("Сохранение списка заказов на период {From}-{To} ",
dateTimePickerDateFrom.Value.ToShortDateString(), dateTimePickerDateTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -10,6 +10,7 @@ using NLog.Extensions.Logging;
using SushiBarBusinessLogic.OfficePackage.Implements; using SushiBarBusinessLogic.OfficePackage.Implements;
using SushiBarBusinessLogic.OfficePackage; using SushiBarBusinessLogic.OfficePackage;
using SushiBarBusinessLogic; using SushiBarBusinessLogic;
using SushiBarView.Reports;
namespace SushiBarView namespace SushiBarView
{ {

View File

@ -25,6 +25,10 @@
<DataField>DateCreate</DataField> <DataField>DateCreate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName> <rd:TypeName>System.DateTime</rd:TypeName>
</Field> </Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SushiName"> <Field Name="SushiName">
<DataField>SushiName</DataField> <DataField>SushiName</DataField>
<rd:TypeName>System.String</rd:TypeName> <rd:TypeName>System.String</rd:TypeName>
@ -33,10 +37,6 @@
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Decimal</rd:TypeName>
</Field> </Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields> </Fields>
<rd:DataSetInfo> <rd:DataSetInfo>
<rd:DataSetName>SushiBarContracts.ViewModels</rd:DataSetName> <rd:DataSetName>SushiBarContracts.ViewModels</rd:DataSetName>
@ -49,15 +49,18 @@
<ReportSection> <ReportSection>
<Body> <Body>
<ReportItems> <ReportItems>
<Textbox Name="TextboxTitle"> <Textbox Name="ReportParameterPeriod">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Заказы</Value> <Value>=Parameters!ReportParameterPeriod.Value</Value>
<Style /> <Style>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
@ -65,8 +68,10 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Height>0.6cm</Height> <rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Width>16.51cm</Width> <Top>1cm</Top>
<Height>1cm</Height>
<Width>21cm</Width>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@ -78,15 +83,18 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Textbox Name="ReportParameterPeriod"> <Textbox Name="TextboxTitle">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Parameters!ReportParameterPeriod.Value</Value> <Value>Заказы</Value>
<Style /> <Style>
<FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
@ -94,10 +102,8 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName> <Height>1cm</Height>
<Top>0.6cm</Top> <Width>21cm</Width>
<Height>0.6cm</Height>
<Width>16.51cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
@ -110,21 +116,21 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Tablix Name="Tablix"> <Tablix Name="Tablix1">
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn>
<Width>2.60583cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.262cm</Width>
</TablixColumn>
<TablixColumn>
<Width>4.8495cm</Width>
</TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn>
<Width>3.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>4.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>7.23317cm</Width>
</TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
@ -135,7 +141,7 @@
<TablixCells> <TablixCells>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="TextboxId"> <Textbox Name="Textbox1">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -143,70 +149,15 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Номер</Value> <Value>Номер</Value>
<Style /> <Style>
</TextRun> <FontWeight>Bold</FontWeight>
</TextRuns> </Style>
<Style />
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="TextboxDateCreate">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Дата создания</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="TextboxSushiName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Пицца</Value>
<Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -229,8 +180,10 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Статус</Value> <Value>Дата создания</Value>
<Style /> <Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
@ -252,7 +205,71 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="TextboxSum"> <Textbox Name="Textbox3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Суши</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox4</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -260,12 +277,15 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Сумма</Value> <Value>Сумма</Value>
<Style /> <Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -324,7 +344,9 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!DateCreate.Value</Value> <Value>=Fields!DateCreate.Value</Value>
<Style /> <Style>
<Format>d</Format>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
@ -344,6 +366,39 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Status">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Status.Value.ToString()</Value>
<Style>
<Format>d</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Status</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="SushiName"> <Textbox Name="SushiName">
@ -374,36 +429,6 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Status1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Status.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Status1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Sum"> <Textbox Name="Sum">
@ -458,18 +483,18 @@
</TablixMembers> </TablixMembers>
</TablixRowHierarchy> </TablixRowHierarchy>
<DataSetName>DataSetOrders</DataSetName> <DataSetName>DataSetOrders</DataSetName>
<Top>1.9177cm</Top> <Top>2.48391cm</Top>
<Left>0.79267cm</Left> <Left>0.55245cm</Left>
<Height>1.2cm</Height> <Height>1.2cm</Height>
<Width>15.71733cm</Width> <Width>20.66193cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>Double</Style>
</Border> </Border>
</Style> </Style>
</Tablix> </Tablix>
<Textbox Name="TextboxResout"> <Textbox Name="TextboxTotalSum">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -477,7 +502,9 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Итого:</Value> <Value>Итого:</Value>
<Style /> <Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
@ -485,8 +512,8 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>3.46287cm</Top> <Top>4cm</Top>
<Left>11.51cm</Left> <Left>12cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>3</ZIndex> <ZIndex>3</ZIndex>
@ -500,7 +527,7 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Textbox Name="Textbox10"> <Textbox Name="SumTotal">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -508,15 +535,18 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value> <Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style /> <Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox10</rd:DefaultName> <Top>4cm</Top>
<Top>3.46287cm</Top> <Left>14.5cm</Left>
<Left>14.01cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>4</ZIndex> <ZIndex>4</ZIndex>
@ -531,10 +561,10 @@
</Style> </Style>
</Textbox> </Textbox>
</ReportItems> </ReportItems>
<Height>2in</Height> <Height>5.72875cm</Height>
<Style /> <Style />
</Body> </Body>
<Width>7.48425in</Width> <Width>21.21438cm</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>
@ -568,5 +598,5 @@
</GridLayoutDefinition> </GridLayoutDefinition>
</ReportParametersLayout> </ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>0c9e94bc-df40-42bd-a526-01713dd3057f</rd:ReportID> <rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
</Report> </Report>