Почти готовый PDF для кассира.
This commit is contained in:
parent
a0e644d9d1
commit
1e33e50a8b
@ -25,12 +25,12 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
private readonly AbstractSaveToWordCashier _saveToWord;
|
||||
|
||||
private readonly AbstractSaveToPdfCashier _saveToPdf;
|
||||
private readonly AbstractSaveToPdfClient _saveToPdf;
|
||||
|
||||
//инициализируем поля класса через контейнер
|
||||
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||
IAccountStorage accountStorage, AbstractSaveToExcelCashier saveToExcel, AbstractSaveToWordCashier saveToWord,
|
||||
AbstractSaveToPdfCashier saveToPdf)
|
||||
AbstractSaveToPdfClient saveToPdf)
|
||||
{
|
||||
_moneyTransferStorage = moneyTransferStorage;
|
||||
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||
@ -41,25 +41,30 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
_saveToPdf = saveToPdf;
|
||||
}
|
||||
|
||||
//формирование списка переводов между счетами за период
|
||||
public List<ReportCashierViewModel>? GetMoneyTransfers(ReportBindingModel model)
|
||||
{
|
||||
return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo})
|
||||
.Select(x => new ReportCashierViewModel
|
||||
{
|
||||
OperationId = x.Id,
|
||||
DateComplite = x.DateOperation,
|
||||
AccountPayeeId = x.AccountPayeeId,
|
||||
AccountSenderId = x.AccountSenderId,
|
||||
AccountPayeeNumber = x.AccountPayeeNumber,
|
||||
AccountSenderNumber = x.AccountSenderNumber,
|
||||
SumOperation = x.Sum
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//формирование списка выдаци наличных со счёта за период
|
||||
public List<ReportCashierViewModel>? GetCashWithrawals(ReportBindingModel model)
|
||||
{
|
||||
return _cashWithdrawalStorage.GetFilteredList(new CashWithdrawalSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
|
||||
.Select(x => new ReportCashierViewModel
|
||||
{
|
||||
AccountPayeeId = x.Id,
|
||||
OperationId = x.Id,
|
||||
DebitingId = x.DebitingId,
|
||||
AccountPayeeNumber = x.AccountNumber,
|
||||
DateComplite = x.DateOperation,
|
||||
SumOperation = x.Sum
|
||||
})
|
||||
@ -81,7 +86,16 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
//Сохранение заказов в файл-Pdf
|
||||
public void SaveAccountsToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_saveToPdf.CreateDoc(new PdfInfo
|
||||
{
|
||||
ForClient = false,
|
||||
FileName = model.FileName,
|
||||
Title = "Отчёт по операциям начислений и переводов между счетами",
|
||||
DateFrom = model.DateFrom!.Value,
|
||||
DateTo = model.DateTo!.Value,
|
||||
ReportMoneyTransfer = GetMoneyTransfers(model),
|
||||
ReportCashWithdrawal = GetCashWithrawals(model)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,38 +17,65 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = info.Title,
|
||||
Style = "NormalTitle",
|
||||
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}",
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||
Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
||||
//параграф с отчётом по выдаче наличных с карт
|
||||
CreateParagraph(new PdfParagraph { Text = "Отчёт по выдаче наличных с карт", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
|
||||
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm" });
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
|
||||
Texts = new List<string> { "Номер операции", "Номер счёта получателя", "Сумма операции", "Дата операции" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
foreach (var report in info.Accounts)
|
||||
foreach (var report in info.ReportCashWithdrawal)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { report.AccountSenderId.ToString(), report.AccountPayeeId.ToString(), report.DateComplite.ToShortDateString(), report.SumOperation.ToString() },
|
||||
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.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
|
||||
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);
|
||||
}
|
||||
|
@ -13,27 +13,41 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
//публичный метод создания документа. Описание методов ниже
|
||||
public void CreateDoc(PdfInfo info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
if(info.ForClient)
|
||||
{
|
||||
CreateDocClient(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateDocCashier(info);
|
||||
}
|
||||
}
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = info.Title + $"\nот { DateTime.Now.ToShortDateString() }",
|
||||
#region Отчёт для клиента
|
||||
|
||||
public void CreateDocClient(PdfInfo info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}",
|
||||
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||
Style = "Normal",
|
||||
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"});
|
||||
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm" });
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
@ -83,8 +97,84 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
SavePdf(info);
|
||||
}
|
||||
|
||||
/// Создание pdf-файла
|
||||
protected abstract void CreatePdf(PdfInfo info);
|
||||
#endregion
|
||||
|
||||
#region Отчёт для кассира
|
||||
|
||||
//создание отчёта для кассира
|
||||
public void CreateDocCashier(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> { "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);
|
||||
|
@ -18,13 +18,19 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
||||
|
||||
public DateTime DateTo { get; set; }
|
||||
|
||||
//по умолчанию отчёт делается для клиента
|
||||
public bool ForClient { get; set; } = true;
|
||||
|
||||
//перечень заказов за указанный период для вывода/сохранения
|
||||
public List<ReportClientViewModel> ReportCrediting { get; set; } = new();
|
||||
|
||||
//перечень заказов за указанный период для вывода/сохранения
|
||||
public List<ReportClientViewModel> ReportDebiting { get; set; } = new();
|
||||
|
||||
//перечень счетов для отчёта кассира
|
||||
public List<ReportCashierViewModel> Accounts { get; set; } = new();
|
||||
}
|
||||
//перечень переводов со счёта на счёт
|
||||
public List<ReportCashierViewModel> ReportMoneyTransfer { get; set; } = new();
|
||||
|
||||
//перечень зачислений денежных средств на карту (т. е. на её счёт)
|
||||
public List<ReportCashierViewModel> ReportCashWithdrawal { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -202,44 +202,6 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
//открытие формы отчёта. Получаем и передаём список изделий во вьюху?
|
||||
[HttpGet]
|
||||
public IActionResult CreateReport()
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Accountes = APICashier.GetRequest<List<AccountViewModel>>("api/main/getaccountlist");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
//создание отчёта Post-запросом
|
||||
[HttpPost]
|
||||
public void CreateReport(DateTime DateFrom, DateTime DateTo)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (DateFrom > DateTo)
|
||||
{
|
||||
throw new Exception("Дата начала периода не может быть позже даты конца периода");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("api/main/createreport", new ReportBindingModel
|
||||
{
|
||||
FileName = APICashier.Cashier.Surname
|
||||
|
||||
//TODO
|
||||
});
|
||||
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
//для страницы "Заявки на снятие"
|
||||
[HttpGet]
|
||||
public IActionResult Debiting()
|
||||
@ -460,5 +422,35 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
#region Получение отчёта PDF
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CreateReport()
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateReport(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("api/Report/CreateCashierReport", new ReportSupportBindingModel()
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -2,6 +2,34 @@
|
||||
ViewData["Title"] = "Создание отчёта";
|
||||
}
|
||||
|
||||
<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">
|
||||
<input id="dateFrom" name="dateFrom" class="form-control" type="date" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата конца периода:</div>
|
||||
<div class="col-8">
|
||||
<input id="dateTo" name="dateTo" class="form-control" type="date" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сформировать отчёт" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!--@{
|
||||
ViewData["Title"] = "Создание отчёта";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание отчёта</h2>
|
||||
</div>
|
||||
@ -44,4 +72,4 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Отчёт:</div>
|
||||
</div>
|
||||
</form>
|
||||
</form> -->
|
@ -8,9 +8,14 @@ namespace BankYouBankruptContracts.ViewModels
|
||||
{
|
||||
public class ReportCashierViewModel
|
||||
{
|
||||
public int AccountPayeeId { get; set; }
|
||||
|
||||
public int? AccountSenderId { get; set; }
|
||||
public int OperationId { get; set; }
|
||||
|
||||
public int DebitingId { get; set; }
|
||||
|
||||
public string AccountPayeeNumber { get; set; }
|
||||
|
||||
public string? AccountSenderNumber { get; set; }
|
||||
|
||||
public double SumOperation { get; set; }
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
return context.CashWithdrawals
|
||||
.Include(x => x.Cashier)
|
||||
.Include(x => x.Debiting)
|
||||
.Include(x => x.Account)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -39,14 +40,27 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
return context.CashWithdrawals
|
||||
.Include(x => x.Cashier)
|
||||
.Include(x => x.Debiting)
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.CashierId == model.CashierId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if(model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.CashWithdrawals
|
||||
.Include(x => x.Cashier)
|
||||
.Include(x => x.Debiting)
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.DateOperation >= model.DateFrom && x.DateOperation <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return context.CashWithdrawals
|
||||
.Include(x => x.Cashier)
|
||||
.Include(x => x.Debiting)
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.AccountId == model.AccountId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -64,6 +78,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
return context.CashWithdrawals
|
||||
.Include(x => x.Cashier)
|
||||
.Include(x => x.Debiting)
|
||||
.Include(x => x.Account)
|
||||
.FirstOrDefault(x => (!(model.AccountId < 0) && x.AccountId == model.AccountId) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
|
@ -35,6 +35,17 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
|
||||
using var context = new BankYouBancruptDatabase();
|
||||
|
||||
if(model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.MoneyTransfers
|
||||
.Include(x => x.AccountPayeer)
|
||||
.Include(x => x.AccountSender)
|
||||
.Include(x => x.Cashier)
|
||||
.Where(x => x.DateOperation >= model.DateFrom && x.DateOperation <= model.DateTo && x.AccountSenderId != null)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return context.MoneyTransfers
|
||||
.Include(x => x.AccountPayeer)
|
||||
.Include(x => x.AccountSender)
|
||||
|
@ -19,11 +19,13 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
|
||||
private readonly IReportClientLogic _reportClientLogic;
|
||||
|
||||
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic)
|
||||
private readonly IReportCashierLogic _reportCashierLogic;
|
||||
|
||||
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_reportClientLogic = reportClientLogic;
|
||||
//_reportCashierLogic = reportCashierLogic;
|
||||
_reportCashierLogic = reportCashierLogic;
|
||||
}
|
||||
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
@ -45,5 +47,25 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//метод генерации отчёта по всем счетм клиентов
|
||||
[HttpPost]
|
||||
public void CreateCashierReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по счетам за " + DateTime.Now.ToShortDateString() + ".pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,10 +32,15 @@ builder.Services.AddTransient<IDebitingLogic, DebitingLogic>();
|
||||
builder.Services.AddTransient<ICashWithdrawalLogic, CashWithdrawalLogic>();
|
||||
|
||||
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
|
||||
builder.Services.AddTransient<IReportCashierLogic, ReportCashierLogic>();
|
||||
|
||||
//теперь общий
|
||||
builder.Services.AddTransient<AbstractSaveToPdfClient, SaveToPdf>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToExcelClient, SaveToExcel>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordClient, SaveToWord>();
|
||||
//builder.Services.AddTransient<AbstractSaveToPdfCashier, SaveToPdf>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcelCashier, SaveToExcelCashier>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordCashier, SaveToWordCashier>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user