diff --git a/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs b/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs index 06e9df5..6078833 100644 --- a/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs @@ -89,7 +89,7 @@ namespace BankBusinessLogic.BusinessLogic public void SaveTransfersToExcelFile(ReportBindingModel model) { - _saveToExcel.CreateDoc(new ExcelInfo + _saveToExcel.CreateTransfersDoc(new ExcelInfo { FileName = model.FileName, Title = "Список переводов", diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 1d49016..fcb7fca 100644 --- a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -11,11 +11,7 @@ namespace BankBusinessLogic.OfficePackage { public abstract class AbstractSaveToExcel { - /// - /// Создание отчета - /// - /// - public void CreateDoc(ExcelInfo info) + public void CreateRequestsDoc(ExcelInfo info) { CreateExcel(info); InsertCellInWorksheet(new ExcelCellParameters @@ -78,12 +74,76 @@ namespace BankBusinessLogic.OfficePackage rowIndex++; } SaveExcel(info); - } - /// - /// Создание excel-файла - /// - /// - protected abstract void CreateExcel(ExcelInfo info); + } + public void CreateTransfersDoc(ExcelInfo info) + { + CreateExcel(info); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = 1, + Text = info.Title, + StyleInfo = ExcelStyleInfoType.Title + }); + MergeCells(new ExcelMergeParameters + { + CellFromName = "A1", + CellToName = "C1" + }); + uint rowIndex = 2; + foreach (var transfer in info.Transfers) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = "", + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + foreach (var component in transfer.Transfers) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "B", + RowIndex = rowIndex, + Text = "", + StyleInfo = + ExcelStyleInfoType.TextWithBroder + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + Text = "", + StyleInfo = + ExcelStyleInfoType.TextWithBroder + }); + rowIndex++; + } + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = "Итого", + StyleInfo = ExcelStyleInfoType.Text + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + Text = "", + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + } + SaveExcel(info); + } + /// + /// Создание excel-файла + /// + /// + protected abstract void CreateExcel(ExcelInfo info); /// /// Добавляем новую ячейку в лист /// diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs index 1bac77c..8e45211 100644 --- a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -38,8 +38,7 @@ namespace BankBusinessLogic.OfficePackage CreateTable(wordTable); SaveWord(info); } - - public void CreateTransfersDoc(WordInfo info) + public void CreateTransfersDoc(WordInfo info) { CreateWord(info); List> list = new List>(); @@ -49,7 +48,7 @@ namespace BankBusinessLogic.OfficePackage { shop.ShopName, shop.Address, - shop.DateOpen.ToShortDateString() + shop.OpeningDate.ToShortDateString() }; list.Add(ls); }