Готовые отчёты.

This commit is contained in:
Programmist73 2023-05-19 23:32:09 +04:00
parent c59af0f780
commit e36b57e9fd
20 changed files with 562 additions and 174 deletions

View File

@ -29,14 +29,14 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWordCashier _saveToWord;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
//инициализируем поля класса через контейнер
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
IClientStorage clientStorage, AbstractSaveToExcel saveToExcel,
AbstractSaveToWordCashier saveToWord, AbstractSaveToPdf saveToPdf,
AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf,
IDebitingStorage debitingStorage, ICardStorage cardStorage)
{
_moneyTransferStorage = moneyTransferStorage;
@ -124,7 +124,14 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
//Сохранение мороженных в файл-Word
public void SaveAccountsToWordFile(ReportBindingModel model)
{
throw new NotImplementedException();
_saveToWord.CreateDoc(new WordInfo
{
FileName = model.FileName,
Title = "Заявки на снятия со счёта",
Debiting = GetDebitings(model)
}, OfficeOperationEnum.Дляассира);
}
//Сохранение заготовок с указаеним изделий в файл-Excel
@ -137,7 +144,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
Title = "Заявки на счёт",
Debiting = GetDebitings(model)
}, ExcelOperationEnum.Дляассира);
}, OfficeOperationEnum.Дляассира);
}
//Сохранение заказов в файл-Pdf

View File

@ -24,11 +24,11 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
private readonly IMoneyTransferStorage _moneyTransferStorage;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWordClient _saveToWord;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
public ReportClientLogic(ICreditingStorage creditingStorage, IDebitingStorage debitingStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWordClient saveToWord, AbstractSaveToPdf saveToPdf,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf,
ICardStorage cardStorage, IMoneyTransferStorage moneyTransferStorage)
{
_creditingStorage = creditingStorage;
@ -136,9 +136,9 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
return totalList;
}
public void SaveToExcelFile(ReportBindingModel model, ExcelOperationEnum operationEnum)
public void SaveToExcelFile(ReportBindingModel model, OfficeOperationEnum operationEnum)
{
if(operationEnum == ExcelOperationEnum.Между_cчетами)
if(operationEnum == OfficeOperationEnum.Между_cчетами)
{
_saveToExcel.CreateReport(new ExcelInfo
{
@ -148,7 +148,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
}, operationEnum);
}
if (operationEnum == ExcelOperationEnum.Пополнениеарт)
if (operationEnum == OfficeOperationEnum.Пополнениеарт)
{
_saveToExcel.CreateReport(new ExcelInfo
{
@ -158,7 +158,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
}, operationEnum);
}
if (operationEnum == ExcelOperationEnum.Cнятие_сарты)
if (operationEnum == OfficeOperationEnum.Cнятие_сарты)
{
_saveToExcel.CreateReport(new ExcelInfo
{
@ -169,9 +169,37 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
}
}
public void SaveToWordFile(ReportBindingModel model)
public void SaveToWordFile(ReportBindingModel model, OfficeOperationEnum operationEnum)
{
throw new NotImplementedException();
if (operationEnum == OfficeOperationEnum.Между_cчетами)
{
_saveToWord.CreateDoc(new WordInfo
{
FileName = model.FileName,
Title = "Отчёт по переводам",
MoneyTransfer = GetMoneyTransfer(model)
}, operationEnum);
}
if (operationEnum == OfficeOperationEnum.Пополнениеарт)
{
_saveToWord.CreateDoc(new WordInfo
{
FileName = model.FileName,
Title = "Отчёт по пополнениям (переводам из налички на карту)",
Crediting = GetExcelCrediting(model)
}, operationEnum);
}
if (operationEnum == OfficeOperationEnum.Cнятие_сарты)
{
_saveToWord.CreateDoc(new WordInfo
{
FileName = model.FileName,
Title = "Отчёт по снятиям денежных средств",
Debiting = GetExcelDebiting(model)
}, operationEnum);
}
}
//отчёт в формате PDF для клиента

View File

@ -12,24 +12,24 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
public abstract class AbstractSaveToExcel
{
//Создание отчета. Описание методов ниже
public void CreateReport(ExcelInfo info, ExcelOperationEnum operationEnum)
public void CreateReport(ExcelInfo info, OfficeOperationEnum operationEnum)
{
if(operationEnum == ExcelOperationEnum.Между_cчетами)
if(operationEnum == OfficeOperationEnum.Между_cчетами)
{
CreateMoneyTransferExcel(info);
}
if (operationEnum == ExcelOperationEnum.Пополнениеарт)
if (operationEnum == OfficeOperationEnum.Пополнениеарт)
{
CreateCreditingExcel(info);
}
if (operationEnum == ExcelOperationEnum.Cнятие_сарты)
if (operationEnum == OfficeOperationEnum.Cнятие_сарты)
{
CreateDebitingExcel(info);
}
if (operationEnum == ExcelOperationEnum.Дляассира)
if (operationEnum == OfficeOperationEnum.Дляассира)
{
CreateCashierExcel(info);
}
@ -130,6 +130,26 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
});
rowIndex++;
//Вставляет слово "Сумма перевода"
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Дата операции: ",
StyleInfo = ExcelStyleInfoType.Text
});
//подсчитывает общее кол-во заготовок в изделии
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = mt.DateOperation.ToString(),
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
}
rowIndex++;
@ -442,6 +462,26 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
});
rowIndex++;
//строчка с номером счёта получателя
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = "Дата: ",
StyleInfo = ExcelStyleInfoType.TextWithBorder
});
//вставка номера отправителя
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = cr.DateClose == null ? "В обработке" : cr.DateClose.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBorder
});
rowIndex++;
}
rowIndex++;

View File

@ -1,51 +0,0 @@
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcelCashier
{
//Создание отчета. Описание методов ниже
public void CreateReport(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;
///TODO
SaveExcel(info);
}
//Создание excel-файла
protected abstract void CreateExcel(ExcelInfo info);
//Добавляем новую ячейку в лист
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
//Объединение ячеек
protected abstract void MergeCells(ExcelMergeParameters excelParams);
//Сохранение файла
protected abstract void SaveExcel(ExcelInfo info);
}
}

View File

@ -0,0 +1,286 @@
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
using BankYouBankruptDataModels.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
//метод создания документа
public void CreateDoc(WordInfo info, OfficeOperationEnum operationEnum)
{
if (operationEnum == OfficeOperationEnum.Между_cчетами)
{
CreateMoneyTransferWord(info);
}
if (operationEnum == OfficeOperationEnum.Пополнениеарт)
{
CreateCreditingWord(info);
}
if (operationEnum == OfficeOperationEnum.Cнятие_сарты)
{
CreateDebitingWord(info);
}
if (operationEnum == OfficeOperationEnum.Дляассира)
{
CreateCashierWord(info);
}
}
private void CreateMoneyTransferWord(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var transfer in info.MoneyTransfer)
{
List<List<(string, WordTextProperties)>> rowList = new()
{
new()
{
new("Номер счёта отправителя", new WordTextProperties { Bold = true, Size = "20" } ),
new("Номер счёта получателя", new WordTextProperties { Bold = true, Size = "20" } ),
new("Сумма операции", new WordTextProperties { Bold = true, Size = "20" } ),
new("Дата перевода", new WordTextProperties { Bold = true, Size = "20" } )
}
};
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ("Перевод №" + transfer.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
List<(string, WordTextProperties)> cellList = new()
{
new(transfer.AccountSenderNumber, new WordTextProperties { Size = "20" }),
new(transfer.AccountPayeeNumber, new WordTextProperties { Size = "20" }),
new(transfer.Sum.ToString(), new WordTextProperties { Size = "20"}),
new(transfer.DateOperation.ToString(), new WordTextProperties { Size = "20"}),
};
rowList.Add(cellList);
CreateTable(new WordParagraph
{
RowTexts = rowList,
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
}
SaveWord(info);
}
private void CreateCreditingWord(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var crediting in info.Crediting)
{
List<List<(string, WordTextProperties)>> rowList = new()
{
new()
{
new("Номер карты", new WordTextProperties { Bold = true, Size = "24" } ),
new("Сумма пополнения", new WordTextProperties { Bold = true, Size = "24" } ),
new("Дата выполнения", new WordTextProperties { Bold = true, Size = "24" } )
}
};
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ("Пополнение №" + crediting.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
List<(string, WordTextProperties)> cellList = new()
{
new(crediting.CardNumber, new WordTextProperties { Size = "24" }),
new(crediting.Sum.ToString(), new WordTextProperties { Size = "24" }),
new(crediting.DateClose == null ? "В обработке" : crediting.DateClose.ToString(), new WordTextProperties { Size = "24" })
};
rowList.Add(cellList);
CreateTable(new WordParagraph
{
RowTexts = rowList,
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
}
SaveWord(info);
}
private void CreateDebitingWord(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var crediting in info.Debiting)
{
List<List<(string, WordTextProperties)>> rowList = new()
{
new()
{
new("Номер карты", new WordTextProperties { Bold = true, Size = "24" } ),
new("Сумма снятия", new WordTextProperties { Bold = true, Size = "24" } ),
new("Дата выполнения", new WordTextProperties { Bold = true, Size = "24" } )
}
};
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ("Снятие №" + crediting.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
List<(string, WordTextProperties)> cellList = new()
{
new(crediting.CardNumber, new WordTextProperties { Size = "24" }),
new(crediting.Sum.ToString(), new WordTextProperties { Size = "24" }),
new(crediting.DateClose == null ? "В обработке" : crediting.DateClose.ToString(), new WordTextProperties { Size = "24" })
};
rowList.Add(cellList);
CreateTable(new WordParagraph
{
RowTexts = rowList,
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
}
SaveWord(info);
}
private void CreateCashierWord(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var crediting in info.Debiting)
{
List<List<(string, WordTextProperties)>> rowList = new()
{
new()
{
new("Сумма заявки", new WordTextProperties { Bold = true, Size = "24" } ),
new("Дата открытия", new WordTextProperties { Bold = true, Size = "24" } ),
new("Статус", new WordTextProperties { Bold = true, Size = "24" } )
}
};
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ("Заявка №" + crediting.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
List<(string, WordTextProperties)> cellList = new()
{
new(crediting.Sum.ToString(), new WordTextProperties { Size = "24" }),
new(crediting.DateOpen.ToString(), new WordTextProperties { Size = "24" }),
new(crediting.Status.ToString(), new WordTextProperties { Size = "24" })
};
rowList.Add(cellList);
CreateTable(new WordParagraph
{
RowTexts = rowList,
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
}
SaveWord(info);
}
// Создание doc-файла
protected abstract void CreateWord(WordInfo info);
// Создание абзаца с текстом
protected abstract void CreateParagraph(WordParagraph paragraph);
//Создание таблицы
protected abstract void CreateTable(WordParagraph paragraph);
// Сохранение файла
protected abstract void SaveWord(WordInfo info);
}
}

View File

@ -1,43 +0,0 @@
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWordClient
{
//метод создания документа
public void CreateDoc(WordInfo info)
{
CreateWord(info);
//создание ряда абзацев
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
//TODO
SaveWord(info);
}
// Создание doc-файла
protected abstract void CreateWord(WordInfo info);
// Создание абзаца с текстом
protected abstract void CreateParagraph(WordParagraph paragraph);
// Сохранение файла
protected abstract void SaveWord(WordInfo info);
}
}

View File

@ -1,4 +1,5 @@
using BankYouBankruptContracts.ViewModels;
using BankYouBankruptContracts.ViewModels.Client.Default;
using System;
using System.Collections.Generic;
using System.Linq;
@ -14,7 +15,12 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
public string Title { get; set; } = string.Empty;
//списки для формирования отчёта клиента
public List<AccountViewModel> Accounts { get; set; } = new();
//списки для отчёта клиента
public List<MoneyTransferViewModel> MoneyTransfer { get; set; } = new();
public List<CreditingViewModel> Crediting { get; set; } = new();
//список для отчёта кассира и клиента
public List<DebitingViewModel> Debiting { get; set; } = new();
}
}

View File

@ -14,5 +14,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
//свойства параграфа, если они есть
public WordTextProperties? TextProperties { get; set; }
public List<List<(string, WordTextProperties)>> RowTexts { get; set; } = new();
}
}

View File

@ -8,7 +8,7 @@ using DocumentFormat.OpenXml.Wordprocessing;
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
{
//реализация абстрактного класса сохранения в word
public class SaveToWord : AbstractSaveToWordClient
public class SaveToWord : AbstractSaveToWord
{
private WordprocessingDocument? _wordDocument;
@ -135,6 +135,77 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
_docBody.AppendChild(docParagraph);
}
//метод, отвечающий за создание таблицы
protected override void CreateTable(WordParagraph paragraph)
{
if (_docBody == null || paragraph == null)
{
return;
}
Table table = new Table();
var tableProp = new TableProperties();
tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
tableProp.AppendChild(new TableBorders(
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
));
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
table.AppendChild(tableProp);
TableGrid tableGrid = new TableGrid();
for (int j = 0; j < paragraph.RowTexts[0].Count; ++j)
{
tableGrid.AppendChild(new GridColumn() { Width = "2500" });
}
table.AppendChild(tableGrid);
for (int i = 0; i < paragraph.RowTexts.Count; ++i)
{
TableRow docRow = new TableRow();
for (int j = 0; j < paragraph.RowTexts[i].Count; ++j)
{
var docParagraph = new Paragraph();
docParagraph.AppendChild(CreateParagraphProperties(paragraph.RowTexts[i][j].Item2));
var docRun = new Run();
var properties = new RunProperties();
properties.AppendChild(new FontSize { Val = paragraph.RowTexts[i][j].Item2.Size });
if (paragraph.RowTexts[i][j].Item2.Bold)
{
properties.AppendChild(new Bold());
}
docRun.AppendChild(properties);
docRun.AppendChild(new Text { Text = paragraph.RowTexts[i][j].Item1, Space = SpaceProcessingModeValues.Preserve });
docParagraph.AppendChild(docRun);
TableCell docCell = new TableCell();
docCell.AppendChild(docParagraph);
docRow.AppendChild(docCell);
}
table.AppendChild(docRow);
}
_docBody.AppendChild(table);
}
//метод сохранения документа
protected override void SaveWord(WordInfo info)
{

View File

@ -1,27 +0,0 @@
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
{
public class SaveToWordCashier : AbstractSaveToWordCashier
{
protected override void CreateParagraph(WordParagraph paragraph)
{
throw new NotImplementedException();
}
protected override void CreateWord(WordInfo info)
{
throw new NotImplementedException();
}
protected override void SaveWord(WordInfo info)
{
throw new NotImplementedException();
}
}
}

View File

@ -18,10 +18,10 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts
List<ReportClientViewModel>? GetDebiting(ReportBindingModel model);
//Сохранение отчёта по картам в файл-Word
void SaveToWordFile(ReportBindingModel model);
void SaveToWordFile(ReportBindingModel model, OfficeOperationEnum operationEnum);
//Сохранение отчёта по картам в файл-Excel
void SaveToExcelFile(ReportBindingModel model, ExcelOperationEnum operationEnum);
void SaveToExcelFile(ReportBindingModel model, OfficeOperationEnum operationEnum);
//Сохранение отчёта по картам в файл-Pdf
ReportClientViewModelForHTML SaveClientReportToPdfFile(ReportBindingModel model);

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace BankYouBankruptDataModels.Enums
{
public enum ExcelOperationEnum
public enum OfficeOperationEnum
{
Между_cчетами = 0,

View File

@ -35,6 +35,8 @@ namespace BankYouBankruptRestAPI.Controllers
_reportCashierLogic = reportCashierLogic;
}
#region Работа с pdf
//метод генерации отчёта за период по картам клиента
[HttpPost]
public ReportClientViewModelForHTML CreateClientReport(ReportSupportBindingModel model)
@ -80,20 +82,9 @@ namespace BankYouBankruptRestAPI.Controllers
}
}
/*//передача данных из отчёта кассира
[HttpGet]
public ReportCashierViewModelForHTML GetDataOfCashierReport()
{
try
{
return _reportCashierViewModelForHTML;
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}*/
#endregion
#region Работа с Excel
//отчёт клиента Excel по переводу денег
[HttpPost]
@ -103,9 +94,9 @@ namespace BankYouBankruptRestAPI.Controllers
{
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
{
FileName = "Отчёт по переводам.xls",
FileName = "Отчёт по переводам.xlsx",
CardList = model.CardList
}, ExcelOperationEnum.Между_cчетами);
}, OfficeOperationEnum.Между_cчетами);
}
catch (Exception ex)
{
@ -122,9 +113,9 @@ namespace BankYouBankruptRestAPI.Controllers
{
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
{
FileName = "Отчёт по пополнениям.xls",
FileName = "Отчёт по пополнениям.xlsx",
CardList = model.CardList
}, ExcelOperationEnum.Пополнениеарт);
}, OfficeOperationEnum.Пополнениеарт);
}
catch (Exception ex)
{
@ -141,9 +132,9 @@ namespace BankYouBankruptRestAPI.Controllers
{
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
{
FileName = "Отчёт по снятиям.xls",
FileName = "Отчёт по снятиям.xlsx",
CardList = model.CardList
}, ExcelOperationEnum.Cнятие_сарты);
}, OfficeOperationEnum.Cнятие_сарты);
}
catch (Exception ex)
{
@ -160,7 +151,7 @@ namespace BankYouBankruptRestAPI.Controllers
{
_reportCashierLogic.SaveAccountsToExcelFile(new ReportBindingModel
{
FileName = "Отчёт по зявкам на снятие.xls",
FileName = "Отчёт по зявкам на снятие.xlsx",
AccountId = model.AccountId
});
}
@ -171,5 +162,86 @@ namespace BankYouBankruptRestAPI.Controllers
}
}
#endregion
#region Работа с word
//отчёт клиента Word по переводу денег
[HttpPost]
public void CreateWordClient(ReportSupportBindingModel model)
{
try
{
_reportClientLogic.SaveToWordFile(new ReportBindingModel
{
FileName = "Отчёт по переводам.docx",
CardList = model.CardList
}, OfficeOperationEnum.Между_cчетами);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}
//отчёт клиента Word по переводу денег
[HttpPost]
public void CreateWordCrediting(ReportSupportBindingModel model)
{
try
{
_reportClientLogic.SaveToWordFile(new ReportBindingModel
{
FileName = "Отчёт по пополнениям.docx",
CardList = model.CardList
}, OfficeOperationEnum.Пополнениеарт);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}
//отчёт клиента Word по выдаче денег
[HttpPost]
public void CreateWordDebiting(ReportSupportBindingModel model)
{
try
{
_reportClientLogic.SaveToWordFile(new ReportBindingModel
{
FileName = "Отчёт по снятиям.docx",
CardList = model.CardList
}, OfficeOperationEnum.Cнятие_сарты);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}
//отчёт клиента Word по переводу денег
[HttpPost]
public void CreateWordCashier(ReportSupportBindingModel model)
{
try
{
_reportCashierLogic.SaveAccountsToWordFile(new ReportBindingModel
{
FileName = "Отчёт по зявкам на снятие.docx",
AccountId = model.AccountId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}
#endregion
}
}

View File

@ -42,11 +42,8 @@ builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
//общие классы формировани отчётов
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
builder.Services.AddTransient<AbstractSaveToWordClient, SaveToWord>();
builder.Services.AddTransient<AbstractSaveToWordCashier, SaveToWordCashier>();
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
builder.Services.AddControllers();