Сashier's report on the task.
This commit is contained in:
parent
36910cd4b4
commit
eb8a5172d5
@ -0,0 +1,33 @@
|
|||||||
|
using BankYouBankruptContracts.BindingModels;
|
||||||
|
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class MessageInfoLogic : IMessageInfoLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
//private readonly IMessageInfoStorage _messageInfoStorage;
|
||||||
|
|
||||||
|
public MessageInfoLogic(ILogger<MessageInfoLogic> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
private readonly ICashWithdrawalStorage _cashWithdrawalStorage;
|
private readonly ICashWithdrawalStorage _cashWithdrawalStorage;
|
||||||
|
|
||||||
private readonly IAccountStorage _accountStorage;
|
private readonly IClientStorage _clientStorage;
|
||||||
|
|
||||||
private readonly AbstractSaveToExcelCashier _saveToExcel;
|
private readonly AbstractSaveToExcelCashier _saveToExcel;
|
||||||
|
|
||||||
@ -29,22 +29,22 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
//инициализируем поля класса через контейнер
|
//инициализируем поля класса через контейнер
|
||||||
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
|
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||||
IAccountStorage accountStorage, AbstractSaveToExcelCashier saveToExcel, AbstractSaveToWordCashier saveToWord,
|
IClientStorage clientStorage, AbstractSaveToExcelCashier saveToExcel,
|
||||||
AbstractSaveToPdfClient saveToPdf)
|
AbstractSaveToWordCashier saveToWord, AbstractSaveToPdfClient saveToPdf)
|
||||||
{
|
{
|
||||||
_moneyTransferStorage = moneyTransferStorage;
|
_moneyTransferStorage = moneyTransferStorage;
|
||||||
_cashWithdrawalStorage = cashWithdrawalStorage;
|
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||||
_accountStorage = accountStorage;
|
|
||||||
|
|
||||||
_saveToExcel = saveToExcel;
|
_saveToExcel = saveToExcel;
|
||||||
_saveToWord = saveToWord;
|
_saveToWord = saveToWord;
|
||||||
_saveToPdf = saveToPdf;
|
_saveToPdf = saveToPdf;
|
||||||
|
_clientStorage = clientStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
//формирование списка переводов между счетами за период
|
//формирование списка переводов между счетами за период
|
||||||
public List<ReportCashierViewModel>? GetMoneyTransfers(ReportBindingModel model)
|
public List<ReportCashierViewModel>? GetMoneyTransfers(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo})
|
return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel { ClientId = model.ClientId, DateFrom = model.DateFrom, DateTo = model.DateTo})
|
||||||
.Select(x => new ReportCashierViewModel
|
.Select(x => new ReportCashierViewModel
|
||||||
{
|
{
|
||||||
OperationId = x.Id,
|
OperationId = x.Id,
|
||||||
@ -59,7 +59,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
//формирование списка выдаци наличных со счёта за период
|
//формирование списка выдаци наличных со счёта за период
|
||||||
public List<ReportCashierViewModel>? GetCashWithrawals(ReportBindingModel model)
|
public List<ReportCashierViewModel>? GetCashWithrawals(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
return _cashWithdrawalStorage.GetFilteredList(new CashWithdrawalSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
|
return _cashWithdrawalStorage.GetFilteredList(new CashWithdrawalSearchModel { ClientId = model.ClientId, DateFrom = model.DateFrom, DateTo = model.DateTo })
|
||||||
.Select(x => new ReportCashierViewModel
|
.Select(x => new ReportCashierViewModel
|
||||||
{
|
{
|
||||||
OperationId = x.Id,
|
OperationId = x.Id,
|
||||||
@ -71,6 +71,17 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//формирование полного имени клиента для отчёта
|
||||||
|
public string GetFullName(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
var client = _clientStorage.GetElement(new ClientSearchModel
|
||||||
|
{
|
||||||
|
Id = model.ClientId
|
||||||
|
});
|
||||||
|
|
||||||
|
return client.Surname + " " + client.Name + " " + client.Patronymic;
|
||||||
|
}
|
||||||
|
|
||||||
//Сохранение мороженных в файл-Word
|
//Сохранение мороженных в файл-Word
|
||||||
public void SaveAccountsToWordFile(ReportBindingModel model)
|
public void SaveAccountsToWordFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
@ -90,6 +101,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
ForClient = false,
|
ForClient = false,
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
|
FullClientName = GetFullName(model),
|
||||||
Title = "Отчёт по операциям начислений и переводов между счетами",
|
Title = "Отчёт по операциям начислений и переводов между счетами",
|
||||||
DateFrom = model.DateFrom!.Value,
|
DateFrom = model.DateFrom!.Value,
|
||||||
DateTo = model.DateTo!.Value,
|
DateTo = model.DateTo!.Value,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||||
|
using BankYouBankruptContracts.BindingModels;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Authentication;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MailKit.Net.Pop3;
|
using MailKit.Net.Pop3;
|
||||||
|
@ -108,7 +108,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
|||||||
|
|
||||||
CreateParagraph(new PdfParagraph
|
CreateParagraph(new PdfParagraph
|
||||||
{
|
{
|
||||||
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}",
|
Text = info.Title + $"\nот {DateTime.Now.ToShortDateString()}\nФИО клиента: {info.FullClientName}",
|
||||||
Style = "NormalTitle",
|
Style = "NormalTitle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
|
@ -21,6 +21,9 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
|||||||
//по умолчанию отчёт делается для клиента
|
//по умолчанию отчёт делается для клиента
|
||||||
public bool ForClient { get; set; } = true;
|
public bool ForClient { get; set; } = true;
|
||||||
|
|
||||||
|
//для передачи полного имени клиента в отчёт
|
||||||
|
public string FullClientName { get; set; } = string.Empty;
|
||||||
|
|
||||||
//перечень заказов за указанный период для вывода/сохранения
|
//перечень заказов за указанный период для вывода/сохранения
|
||||||
public List<ReportClientViewModel> ReportCrediting { get; set; } = new();
|
public List<ReportClientViewModel> ReportCrediting { get; set; } = new();
|
||||||
|
|
||||||
|
@ -433,11 +433,18 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//запрашиваем список в формате вспомогательной вьюшки из-за работы select в asp net
|
||||||
|
ViewBag.Clients = APICashier.GetRequest<List<ClientViewModel>>($"/api/Client/GetAllClients").Select(x => new ClientSelectViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
FullName = x.Surname + " " + x.Name + " " + x.Patronymic
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateReport(DateTime dateFrom, DateTime dateTo)
|
public void CreateReport(int clientId, DateTime dateFrom, DateTime dateTo)
|
||||||
{
|
{
|
||||||
if (APICashier.Cashier == null)
|
if (APICashier.Cashier == null)
|
||||||
{
|
{
|
||||||
@ -446,6 +453,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
|
|
||||||
APICashier.PostRequest("api/Report/CreateCashierReport", new ReportSupportBindingModel()
|
APICashier.PostRequest("api/Report/CreateCashierReport", new ReportSupportBindingModel()
|
||||||
{
|
{
|
||||||
|
ClientId = clientId,
|
||||||
DateFrom = dateFrom,
|
DateFrom = dateFrom,
|
||||||
DateTo = dateTo
|
DateTo = dateTo
|
||||||
});
|
});
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
<h2 class="display-4">Отчёт по счетам за выбранный период</h2>
|
<h2 class="display-4">Отчёт по счетам за выбранный период</h2>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Клиент:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="clientId" name="clientId" class="form-control" asp-items="@(new SelectList( @ViewBag.Clients, "Id", "FullName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Дата начала периода:</div>
|
<div class="col-4">Дата начала периода:</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptContracts.BindingModels
|
||||||
|
{
|
||||||
|
//один из двух классов для обмена информацией по почте
|
||||||
|
public class MailSendInfoBindingModel
|
||||||
|
{
|
||||||
|
public string MailAddress { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
using BankYouBankruptDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class MessageInfoBindingModel : IMessageInfoModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string MessageId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
|
public string SenderName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateDelivery { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public bool IsRead { get; set; } = false;
|
||||||
|
|
||||||
|
public string? Answer { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,10 @@ namespace BankYouBankruptContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
|
public string? ClientFullName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
|
@ -9,6 +9,8 @@ namespace BankYouBankruptContracts.BindingModels
|
|||||||
//вспомогательная модель для передачи DateTime при формировании отчёта
|
//вспомогательная модель для передачи DateTime при формировании отчёта
|
||||||
public class ReportSupportBindingModel
|
public class ReportSupportBindingModel
|
||||||
{
|
{
|
||||||
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
public DateTime DateFrom { get; set; }
|
public DateTime DateFrom { get; set; }
|
||||||
|
|
||||||
public DateTime DateTo { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
using BankYouBankruptContracts.BindingModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IMessageInfoLogic
|
||||||
|
{
|
||||||
|
//List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
|
||||||
|
|
||||||
|
//MessageInfoViewModel? ReadElement(MessageInfoSearchModel model);
|
||||||
|
|
||||||
|
bool Create(MessageInfoBindingModel model);
|
||||||
|
|
||||||
|
bool Update(MessageInfoBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,8 @@ namespace BankYouBankruptContracts.SearchModels
|
|||||||
|
|
||||||
public int? CashierId { get; set; }
|
public int? CashierId { get; set; }
|
||||||
|
|
||||||
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
public int? Sum { get; set; }
|
public int? Sum { get; set; }
|
||||||
|
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
|
@ -12,6 +12,8 @@ namespace BankYouBankruptContracts.SearchModels
|
|||||||
|
|
||||||
public int? Sum { get; set; }
|
public int? Sum { get; set; }
|
||||||
|
|
||||||
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
public int? AccountSenderId { get; set; }
|
public int? AccountSenderId { get; set; }
|
||||||
|
|
||||||
public int? AccountPayeeId { get; set; }
|
public int? AccountPayeeId { get; set; }
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IMessageInfoModel : IId
|
||||||
|
{
|
||||||
|
string MessageId { get; }
|
||||||
|
|
||||||
|
int? ClientId { get; }
|
||||||
|
|
||||||
|
string SenderName { get; }
|
||||||
|
|
||||||
|
DateTime DateDelivery { get; }
|
||||||
|
|
||||||
|
string Subject { get; }
|
||||||
|
|
||||||
|
string Body { get; }
|
||||||
|
|
||||||
|
public bool IsRead { get; }
|
||||||
|
|
||||||
|
public string Answer { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -46,13 +46,14 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//выборка для заполнения отчёта
|
||||||
if(model.DateFrom.HasValue && model.DateTo.HasValue)
|
if(model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return context.CashWithdrawals
|
return context.CashWithdrawals
|
||||||
.Include(x => x.Cashier)
|
.Include(x => x.Cashier)
|
||||||
.Include(x => x.Debiting)
|
.Include(x => x.Debiting)
|
||||||
.Include(x => x.Account)
|
.Include(x => x.Account)
|
||||||
.Where(x => x.DateOperation >= model.DateFrom && x.DateOperation <= model.DateTo)
|
.Where(x => x.DateOperation >= model.DateFrom && x.DateOperation <= model.DateTo && x.Account.ClientId == model.ClientId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
.Include(x => x.AccountPayeer)
|
.Include(x => x.AccountPayeer)
|
||||||
.Include(x => x.AccountSender)
|
.Include(x => x.AccountSender)
|
||||||
.Include(x => x.Cashier)
|
.Include(x => x.Cashier)
|
||||||
.Where(x => x.DateOperation >= model.DateFrom && x.DateOperation <= model.DateTo && x.AccountSenderId != null)
|
.Where(x => x.DateOperation >= model.DateFrom && x.DateOperation <= model.DateTo && x.AccountSenderId != null
|
||||||
|
&& (x.AccountPayeer.ClientId == model.ClientId || x.AccountSender.Id == model.ClientId))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ namespace BankYouBankruptRestAPI.Controllers
|
|||||||
|
|
||||||
private readonly IReportCashierLogic _reportCashierLogic;
|
private readonly IReportCashierLogic _reportCashierLogic;
|
||||||
|
|
||||||
|
|
||||||
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic)
|
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -57,6 +58,7 @@ namespace BankYouBankruptRestAPI.Controllers
|
|||||||
_reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
_reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = "Отчёт по счетам за " + DateTime.Now.ToShortDateString() + ".pdf",
|
FileName = "Отчёт по счетам за " + DateTime.Now.ToShortDateString() + ".pdf",
|
||||||
|
ClientId = model.ClientId,
|
||||||
DateFrom = model.DateFrom,
|
DateFrom = model.DateFrom,
|
||||||
DateTo = model.DateTo
|
DateTo = model.DateTo
|
||||||
});
|
});
|
||||||
|
@ -35,6 +35,9 @@ builder.Services.AddTransient<ICashWithdrawalLogic, CashWithdrawalLogic>();
|
|||||||
|
|
||||||
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
|
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
|
||||||
builder.Services.AddTransient<IReportCashierLogic, ReportCashierLogic>();
|
builder.Services.AddTransient<IReportCashierLogic, ReportCashierLogic>();
|
||||||
|
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
|
|
||||||
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
|
|
||||||
//теперь общий
|
//теперь общий
|
||||||
builder.Services.AddTransient<AbstractSaveToPdfClient, SaveToPdf>();
|
builder.Services.AddTransient<AbstractSaveToPdfClient, SaveToPdf>();
|
||||||
|
Loading…
Reference in New Issue
Block a user