diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportEmployeeLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportEmployeeLogic.cs index 5bed993..2820338 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportEmployeeLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportEmployeeLogic.cs @@ -87,6 +87,8 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic { Title = "Список оплат электротоваров", ListProduct = GetProducts(model), + DateTo = model.DateTo, + DateFrom = model.DateFrom }); return document; } @@ -110,7 +112,9 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic { var document = _saveToWord.CreateDoc(new WordInfoEmployee { Title = "Список оплат электротоваров", - ListProduct = GetProducts(model) + ListProduct = GetProducts(model), + DateFrom = model.DateFrom, + DateTo = model.DateTo, }); return document; } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToExcelEmployee.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToExcelEmployee.cs index 4f8738e..4e104d3 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToExcelEmployee.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToExcelEmployee.cs @@ -23,7 +23,19 @@ namespace ElectronicsShopBusinessLogic.OfficePackage CellToName = "C1" }); - uint rowIndex = 2; + InsertCellInWorksheet(new ExcelCellParameters { + ColumnName = "A", + RowIndex = 2, + Text = $"С {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", + StyleInfo = ExcelStyleInfoType.Title + }); + + MergeCells(new ExcelMergeParameters { + CellFromName = "A2", + CellToName = "H2" + }); + + uint rowIndex = 3; foreach (var product in info.ListProduct) { InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "A", @@ -37,38 +49,92 @@ namespace ElectronicsShopBusinessLogic.OfficePackage ColumnName = "B", RowIndex = rowIndex, Text = "Номер оплаты:", - StyleInfo = ExcelStyleInfoType.TextWithBroder + StyleInfo = ExcelStyleInfoType.TextWithBroder, + }); + InsertCellInWorksheet(new ExcelCellParameters { - ColumnName = "C", + ColumnName = "c", + RowIndex = rowIndex, + StyleInfo = ExcelStyleInfoType.TextWithBroder, + + }); + + MergeCells(new ExcelMergeParameters { + CellFromName = $"B{rowIndex}", + CellToName = $"C{rowIndex}" + }); + + InsertCellInWorksheet(new ExcelCellParameters { + ColumnName = "D", RowIndex = rowIndex, Text = paymeant.PaymeantID.ToString(), StyleInfo = ExcelStyleInfoType.TextWithBroder }); + + InsertCellInWorksheet(new ExcelCellParameters { - ColumnName = "D", + ColumnName = "E", RowIndex = rowIndex, Text = "В количестве:", - StyleInfo = ExcelStyleInfoType.TextWithBroder + StyleInfo = ExcelStyleInfoType.TextWithBroder, + }); + InsertCellInWorksheet(new ExcelCellParameters { - ColumnName = "E", + ColumnName = "F", + RowIndex = rowIndex, + StyleInfo = ExcelStyleInfoType.TextWithBroder, + + }); + + MergeCells(new ExcelMergeParameters { + CellFromName = $"E{rowIndex}", + CellToName = $"F{rowIndex}" + }); + + InsertCellInWorksheet(new ExcelCellParameters { + ColumnName = "G", RowIndex = rowIndex, Text = paymeant.ProducCount.ToString(), StyleInfo = ExcelStyleInfoType.TextWithBroder }); InsertCellInWorksheet(new ExcelCellParameters { - ColumnName = "F", + ColumnName = "H", RowIndex = rowIndex, Text = "Статус оплаты:", StyleInfo = ExcelStyleInfoType.TextWithBroder }); + InsertCellInWorksheet(new ExcelCellParameters { - ColumnName = "G", + ColumnName = "I", + RowIndex = rowIndex, + StyleInfo = ExcelStyleInfoType.TextWithBroder, + + }); + + MergeCells(new ExcelMergeParameters { + CellFromName = $"H{rowIndex}", + CellToName = $"I{rowIndex}" + }); + + InsertCellInWorksheet(new ExcelCellParameters { + ColumnName = "J", RowIndex = rowIndex, Text = paymeant.PaymeantStatus.ToString(), StyleInfo = ExcelStyleInfoType.TextWithBroder }); + + InsertCellInWorksheet(new ExcelCellParameters { + ColumnName = "k", + RowIndex = rowIndex, + StyleInfo = ExcelStyleInfoType.TextWithBroder + }); + + MergeCells(new ExcelMergeParameters { + CellFromName = $"J{rowIndex}", + CellToName = $"K{rowIndex}" + }); rowIndex++; } InsertCellInWorksheet(new ExcelCellParameters { diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordEmployee.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordEmployee.cs index 19b6d1c..0718557 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordEmployee.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordEmployee.cs @@ -24,7 +24,16 @@ namespace ElectronicsShopBusinessLogic.OfficePackage } }); - foreach (var data in info.ListProduct) { + CreateParagraph(new WordParagraph { + Texts = new List<(string, WordTextProperties)> { ($"С {info.DateFrom} по {info.DateTo}", new WordTextProperties { Bold = true, Size = "24", }) }, + TextProperties = new WordTextProperties { + Size = "24", + JustificationType = WordJustificationType.Both + } + }); + + + foreach (var data in info.ListProduct) { CreateParagraph(new WordParagraph { Texts = new List<(string, WordTextProperties)> { (data.ProductName, new WordTextProperties { Bold = true, Size = "24", }) }, TextProperties = new WordTextProperties { diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoEmployee.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoEmployee.cs index 2f5ff9e..3de5a24 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoEmployee.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoEmployee.cs @@ -6,6 +6,9 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels { public string Title { get; set; } = string.Empty; + public DateTime DateFrom { get; set; } + public DateTime DateTo { get; set; } + public List ListProduct { get; set; } = new(); } } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoEmployee.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoEmployee.cs index d872337..47d8550 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoEmployee.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoEmployee.cs @@ -7,6 +7,9 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels { public string Title { get; set; } = string.Empty; + public DateTime DateFrom { get; set; } + public DateTime DateTo { get; set; } + public List ListProduct { get; set; } = new(); } }