diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 6726751..86c6749 100644 --- a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -88,53 +88,100 @@ namespace BankBusinessLogic.OfficePackage MergeCells(new ExcelMergeParameters { CellFromName = "A1", - CellToName = "C1" + CellToName = "F1" }); - uint rowIndex = 2; - foreach (var transfer in info.Transfers) + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = 2, + Text = "Номер карты", + StyleInfo = ExcelStyleInfoType.Title + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "B", + RowIndex = 2, + Text = "Номер перевода", + StyleInfo = ExcelStyleInfoType.Title + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = 2, + Text = "Сумма", + StyleInfo = ExcelStyleInfoType.Title + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "D", + RowIndex = 2, + Text = "Время перевода", + StyleInfo = ExcelStyleInfoType.Title + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "E", + RowIndex = 2, + Text = "Счет отправителя", + StyleInfo = ExcelStyleInfoType.Title + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "F", + RowIndex = 2, + Text = "Счет получателя", + StyleInfo = ExcelStyleInfoType.Title + }); + uint rowIndex = 3; + foreach (var report in info.Transfers) { InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "A", RowIndex = rowIndex, - Text = "", + Text = report.CardNumber, StyleInfo = ExcelStyleInfoType.Text }); rowIndex++; - foreach (var transfer1 in transfer.Transfers) + foreach (var transfer in report.Transfers) { InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "B", RowIndex = rowIndex, - Text = "", + Text = transfer.Id.ToString(), StyleInfo = ExcelStyleInfoType.TextWithBroder }); InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "C", RowIndex = rowIndex, - Text = "", - StyleInfo = - ExcelStyleInfoType.TextWithBroder + Text = transfer.Sum.ToString(), + StyleInfo = ExcelStyleInfoType.TextWithBroder + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "D", + RowIndex = rowIndex, + Text = transfer.TransferTime.ToString(), + StyleInfo = ExcelStyleInfoType.TextWithBroder + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "E", + RowIndex = rowIndex, + Text = transfer.SenderAccountNumber, + StyleInfo = ExcelStyleInfoType.TextWithBroder + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "F", + RowIndex = rowIndex, + Text = transfer.RecipientAccountNumber, + 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); } diff --git a/Bank/BankClientApp/Controllers/HomeController.cs b/Bank/BankClientApp/Controllers/HomeController.cs index 34411ca..8c5b290 100644 --- a/Bank/BankClientApp/Controllers/HomeController.cs +++ b/Bank/BankClientApp/Controllers/HomeController.cs @@ -531,7 +531,7 @@ namespace BankClientApp.Controllers case "excel": APIClient.PostRequest($"api/report/savetransferstoexcel", new ReportBindingModel { - FileName = "C:\\Users\\123\\Desktop\\excelfile.xls", + FileName = "C:\\Users\\123\\Desktop\\excelfile.xlsx", SelectedCardIds = cards, }); break; diff --git a/Bank/BankClientApp/Views/Home/OperationTransfer.cshtml b/Bank/BankClientApp/Views/Home/OperationTransfer.cshtml index 17003c9..a1ade22 100644 --- a/Bank/BankClientApp/Views/Home/OperationTransfer.cshtml +++ b/Bank/BankClientApp/Views/Home/OperationTransfer.cshtml @@ -18,110 +18,8 @@ -