Completed Excel for Client.

This commit is contained in:
Programmist73 2023-05-19 13:04:22 +04:00
parent 52e55d4da4
commit 5ed47eea9e
23 changed files with 278 additions and 433 deletions

View File

@ -21,16 +21,16 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
private readonly IClientStorage _clientStorage;
private readonly AbstractSaveToExcelCashier _saveToExcel;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWordCashier _saveToWord;
private readonly AbstractSaveToPdfClient _saveToPdf;
private readonly AbstractSaveToPdf _saveToPdf;
//инициализируем поля класса через контейнер
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
IClientStorage clientStorage, AbstractSaveToExcelCashier saveToExcel,
AbstractSaveToWordCashier saveToWord, AbstractSaveToPdfClient saveToPdf)
IClientStorage clientStorage, AbstractSaveToExcel saveToExcel,
AbstractSaveToWordCashier saveToWord, AbstractSaveToPdf saveToPdf)
{
_moneyTransferStorage = moneyTransferStorage;
_cashWithdrawalStorage = cashWithdrawalStorage;

View File

@ -18,16 +18,21 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
{
private readonly ICreditingStorage _creditingStorage;
private readonly IDebitingStorage _debitingStorage;
private readonly ICardStorage _cardStorage;
private readonly IMoneyTransferStorage _moneyTransferStorage;
private readonly AbstractSaveToExcelClient _saveToExcel;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWordClient _saveToWord;
private readonly AbstractSaveToPdfClient _saveToPdf;
private readonly AbstractSaveToPdf _saveToPdf;
public ReportClientLogic(ICreditingStorage creditingStorage, IDebitingStorage debitingStorage,
AbstractSaveToExcelClient saveToExcel, AbstractSaveToWordClient saveToWord, AbstractSaveToPdfClient saveToPdf)
AbstractSaveToExcel saveToExcel, AbstractSaveToWordClient saveToWord, AbstractSaveToPdf saveToPdf,
ICardStorage cardStorage, IMoneyTransferStorage moneyTransferStorage)
{
_creditingStorage = creditingStorage;
_debitingStorage = debitingStorage;
_cardStorage = cardStorage;
_moneyTransferStorage = moneyTransferStorage;
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
@ -64,22 +69,31 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
}).ToList();
}
public void SaveCreditingToExcelFile(ReportBindingModel model)
public List<MoneyTransferViewModel>? GetMoneyTransfer(ReportBindingModel model)
{
throw new NotImplementedException();
var accountId = _cardStorage.GetElement(new CardSearchModel
{
Id = model.CardId
}).AccountId;
return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel
{
AccountPayeeId = accountId,
AccountSenderId = accountId
});
}
public void SaveCreditingToWordFile(ReportBindingModel model)
public void SaveToExcelFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
_saveToExcel.CreateReport(new ExcelInfo
{
FileName = model.FileName,
Title = "Список переводов денег",
MoneyTransfer = GetMoneyTransfer(model)
});
}
public void SaveDebitingToExcelFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
public void SaveDebitingToWordFile(ReportBindingModel model)
public void SaveToWordFile(ReportBindingModel model)
{
throw new NotImplementedException();
}

View File

@ -0,0 +1,126 @@
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 AbstractSaveToExcel
{
//Создание отчета. Описание методов ниже
public void CreateReport(ExcelInfo info)
{
CreateExcel(info);
//вставляет заголовок
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = 1,
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
//соединяет 3 ячейки для заголовка
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
//номер строчки в докуметне
uint rowIndex = 2;
foreach (var mt in info.MoneyTransfer)
{
//вставляет номер перевода
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Перевод №" + mt.Id,
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
//строчка с номером счёта отправителя
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = "Номер счёта отправителя: ",
StyleInfo = ExcelStyleInfoType.TextWithBorder
});
//вставка номера отправителя
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = mt.AccountSenderNumber,
StyleInfo = ExcelStyleInfoType.TextWithBorder
});
rowIndex++;
//строчка с номером счёта получателя
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = "Номер счёта получателя: ",
StyleInfo = ExcelStyleInfoType.TextWithBorder
});
//вставка номера отправителя
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = mt.AccountPayeeNumber,
StyleInfo = ExcelStyleInfoType.TextWithBorder
});
rowIndex++;
//Вставляет слово "Сумма перевода"
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Сумма перевода: ",
StyleInfo = ExcelStyleInfoType.Text
});
//подсчитывает общее кол-во заготовок в изделии
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = mt.Sum.ToString(),
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
}
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

@ -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 AbstractSaveToExcelClient
{
//Создание отчета. Описание методов ниже
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

@ -1,98 +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 AbstractSaveToPdfCashier
{
//публичный метод создания документа. Описание методов ниже
public void CreateDoc(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
{
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}",
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
//параграф с отчётом по выдаче наличных с карт
CreateParagraph(new PdfParagraph { Text = "Отчёт по выдаче наличных с карт", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер счёта получателя", "Сумма операции", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportCashWithdrawal)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { report.OperationId.ToString(), report.AccountPayeeNumber.ToString(), report.SumOperation.ToString(), report.DateComplite.ToShortDateString(), },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма снятий за период: {info.ReportCashWithdrawal.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
//параграф с отчётом по переводу денег со счёта на счёт
CreateParagraph(new PdfParagraph { Text = "Отчёт по денежным переводам между счетами", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "3cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер счёта отправителя", "Номер счёта получателя", "Сумма операции", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportMoneyTransfer)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { report.OperationId.ToString(), report.AccountSenderNumber, report.AccountPayeeNumber, report.SumOperation.ToString(), report.DateComplite.ToShortDateString(), },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма переводов за период: {info.ReportMoneyTransfer.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
SavePdf(info);
}
/// Создание pdf-файла
protected abstract void CreatePdf(PdfInfo info);
/// Создание параграфа с текстом
protected abstract void CreateParagraph(PdfParagraph paragraph);
/// Создание таблицы
protected abstract void CreateTable(List<string> columns);
/// Создание и заполнение строки
protected abstract void CreateRow(PdfRowParameters rowParameters);
/// Сохранение файла
protected abstract void SavePdf(PdfInfo info);
}
}

View File

@ -1,191 +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 AbstractSaveToPdfClient
{
//публичный метод создания документа. Описание методов ниже
public void CreateDoc(PdfInfo info)
{
if(info.ForClient)
{
CreateDocClient(info);
}
else
{
CreateDocCashier(info);
}
}
#region Отчёт для клиента
public void CreateDocClient(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
{
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}",
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
//параграф с отчётом на пополнения
CreateParagraph(new PdfParagraph { Text = "Отчёт по пополнениям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер карты", "Сумма", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportCrediting)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { report.OperationId.ToString(), report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
//подсчёт суммы операций на пополнение
CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма поступлений за период: {info.ReportCrediting.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
//отчёт с отчётом на снятие
CreateParagraph(new PdfParagraph { Text = "Отчёт по снятиям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер карты", "Сумма", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportDebiting)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { report.OperationId.ToString(), report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
//подсчёт суммы операций на пополнение
CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма снятий за период: {info.ReportDebiting.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
SavePdf(info);
}
#endregion
#region Отчёт для кассира
//создание отчёта для кассира
public void CreateDocCashier(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
{
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}\nФИО клиента: {info.FullClientName}",
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
//параграф с отчётом по выдаче наличных с карт
CreateParagraph(new PdfParagraph { Text = "Отчёт по выдаче наличных со счёта", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3.5cm", "3.5cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер счёта", "Сумма операции", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportCashWithdrawal)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { report.OperationId.ToString(), report.AccountPayeeNumber, report.SumOperation.ToString(), report.DateComplite.ToShortDateString(), },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма снятий за период: {info.ReportCashWithdrawal.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
//параграф с отчётом по переводу денег со счёта на счёт
CreateParagraph(new PdfParagraph { Text = "Отчёт по денежным переводам между счетами", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "3cm", "4cm", "4cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер счёта отправителя", "Номер счёта получателя", "Сумма операции", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportMoneyTransfer)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { report.OperationId.ToString(), report.AccountSenderNumber, report.AccountPayeeNumber, report.SumOperation.ToString(), report.DateComplite.ToShortDateString(), },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма переводов за период: {info.ReportMoneyTransfer.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
SavePdf(info);
}
#endregion
/// Создание pdf-файла
protected abstract void CreatePdf(PdfInfo info);
/// Создание параграфа с текстом
protected abstract void CreateParagraph(PdfParagraph paragraph);
/// Создание таблицы
protected abstract void CreateTable(List<string> columns);
/// Создание и заполнение строки
protected abstract void CreateRow(PdfRowParameters rowParameters);
/// Сохранение файла
protected abstract void SavePdf(PdfInfo info);
}
}

View File

@ -16,6 +16,6 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperEnums
Text,
//текст в рамке
TextWithBroder
TextWithBorder
}
}

View File

@ -1,4 +1,5 @@
using BankYouBankruptContracts.ViewModels;
using BankYouBankruptContracts.ViewModels.Client.Default;
using System;
using System.Collections.Generic;
using System.Linq;
@ -16,7 +17,10 @@ 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<DebitingViewModel> Debiting { get; set; } = new();
}
}

View File

@ -14,7 +14,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
public string Title { get; set; } = string.Empty;
//список счетов для вывода и сохранения
//списки для формирования отчёта клиента
public List<AccountViewModel> Accounts { get; set; } = new();
}
}

View File

@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
{
public class SaveToExcel : AbstractSaveToExcelClient
public class SaveToExcel : AbstractSaveToExcel
{
private SpreadsheetDocument? _spreadsheetDocument;
@ -227,7 +227,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
return styleInfo switch
{
ExcelStyleInfoType.Title => 2U,
ExcelStyleInfoType.TextWithBroder => 1U,
ExcelStyleInfoType.TextWithBorder => 1U,
ExcelStyleInfoType.Text => 0U,
_ => 0U,
};

View File

@ -1,32 +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 SaveToExcelCashier : AbstractSaveToExcelCashier
{
protected override void CreateExcel(ExcelInfo info)
{
throw new NotImplementedException();
}
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
{
throw new NotImplementedException();
}
protected override void MergeCells(ExcelMergeParameters excelParams)
{
throw new NotImplementedException();
}
protected override void SaveExcel(ExcelInfo info)
{
throw new NotImplementedException();
}
}
}

View File

@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
{
//реализация астрактного класса создания pdf документа
public class SaveToPdf : AbstractSaveToPdfClient
public class SaveToPdf : AbstractSaveToPdf
{
private Document? _document;

View File

@ -275,8 +275,45 @@ namespace BankYouBankruptClientApp.Controllers
#endregion
#region Получение отчета по картам
[HttpGet]
#region Excel отчёт
[HttpGet]
public IActionResult CreateExcelReport()
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
return View();
}
[HttpPost]
public IActionResult CreateExcelReport(int cardId)
{
if (APIClient.Client == null)
{
throw new Exception("Не авторизованы");
}
//ViewBag.DataOfClientReport = APIClient.GetRequest<ReportClientViewModelForHTML>($"api/Report/GetDataOfClientReport");
APIClient.PostRequest("api/Report/CreateExcelClient", new ReportSupportBindingModel()
{
CardId = cardId
});
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
return View();
}
#endregion
#region Получение отчета по картам
[HttpGet]
public IActionResult ReportWithCards()
{
if (APIClient.Client == null)
@ -348,7 +385,6 @@ namespace BankYouBankruptClientApp.Controllers
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
return View();
}

View File

@ -0,0 +1,20 @@
@{
ViewData["Title"] = "Создание Excel отчёта";
}
<div class="text-center">
<h2 class="display-4">Создание отчёта</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Выберите карту:</div>
<div class="col-8">
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "Number"))"></select>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Создание" class="btn btn-primary" />
</div>
</div>
</form>

View File

@ -24,26 +24,29 @@
</a>
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
@{ if (authenticated) {
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CardsList">Карты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="DebitingList">Снятие средств</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreditingList">Пополнить средства</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ReportWithCards">Отчет по картам</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreateReport">Отчёт за период</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Diagram">Диаграмма</a>
</li>
</ul>
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CardsList">Карты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="DebitingList">Снятие средств</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreditingList">Пополнить средства</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ReportWithCards">Отчет по картам</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreateExcelReport">Отчет Excel</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreateReport">Отчёт за период</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Diagram">Диаграмма</a>
</li>
</ul>
}
}
</div>

View File

@ -12,6 +12,8 @@ namespace BankYouBankruptContracts.BindingModels
public int? ClientId { get; set; }
public int? CardId { get; set; }
public string? ClientFullName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }

View File

@ -14,5 +14,8 @@ namespace BankYouBankruptContracts.BindingModels
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
//для Excel отчёта клиента
public int? CardId { get; set; }
}
}

View File

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

View File

@ -35,6 +35,15 @@ namespace BankYouBankruptDatabaseImplement.Implements
.Include(x => x.AccountSender)
.ToList();
if(model.AccountPayeeId.HasValue && model.AccountSenderId.HasValue && model.AccountPayeeId == model.AccountSenderId)
{
return result.Where(x => (x.AccountSenderId == model.AccountSenderId || x.AccountPayeeId == model.AccountPayeeId)
&& x.AccountSender != null)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
if (model.AccountPayeeId.HasValue) result = result.Where(x => x.AccountPayeeId == model.AccountPayeeId).ToList();
if (model.AccountSenderId.HasValue) result = result.Where(x => x.AccountSenderId == model.AccountSenderId).ToList();

View File

@ -80,12 +80,16 @@ namespace BankYouBankruptRestAPI.Controllers
}
//передача данных из отчёта клиента
[HttpGet]
public ReportClientViewModelForHTML GetDataOfClientReport()
[HttpPost]
public void CreateExcelClient(ReportSupportBindingModel model)
{
try
{
return _reportClientViewModelForHTML;
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
{
FileName = "Отчёт_по_переводам",
CardId = model.CardId
});
}
catch (Exception ex)
{

View File

@ -40,12 +40,12 @@ builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
//теперь общий
builder.Services.AddTransient<AbstractSaveToPdfClient, SaveToPdf>();
//общие классы формировани отчётов
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
builder.Services.AddTransient<AbstractSaveToExcelClient, SaveToExcel>();
builder.Services.AddTransient<AbstractSaveToWordClient, SaveToWord>();
builder.Services.AddTransient<AbstractSaveToExcelCashier, SaveToExcelCashier>();
builder.Services.AddTransient<AbstractSaveToWordCashier, SaveToWordCashier>();
builder.Services.AddControllers();