Artyom_Yashin 2024-05-02 18:40:22 +04:00
commit bfc5e87973
17 changed files with 400 additions and 36 deletions

View File

@ -10,7 +10,9 @@ namespace BankContracts.SearchModels
{
public int? Id { get; set; }
public string? Number { get; set; }
public DateTime? ReleaseDate { get; set; }
public DateTime? DateTo { get; set; }
public DateTime? DateFrom { get; set; }
public int? ManagerId { get; set; }
public List<int>? SelectedAccountIds { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankContracts.ViewModels
{
public class ReportRequestsViewModel
{
public string AccountNumber { get; set; } = string.Empty;
public List<RequestViewModel> Requests { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankContracts.ViewModels
{
public class ReportTransfersWithdrawalsViewModel
{
public string AccountNumber { get; set; } = string.Empty;
public List<TransferViewModel> SenderTransfers { get; set; } = new();
public List<TransferViewModel> RecipientTransfers { get; set; } = new();
public List<WithdrawalViewModel> Withdrawals { get; set; } = new();
}
}

View File

@ -103,5 +103,58 @@ namespace BankDatabaseImplement.Implements
}
return null;
}
public List<ReportRequestsViewModel> GetRequestsReport(AccountSearchModel model)
{
using var context = new BankDatabase();
return context.Accounts
.Where(a => model.SelectedAccountIds == null || model.SelectedAccountIds.Contains(a.Id))
.Select(a => new ReportRequestsViewModel()
{
AccountNumber = a.Number,
Requests = context.Requests
.Include(x => x.Withdrawal)
.ThenInclude(x => x.Accounts)
.Where(x => x.Withdrawal != null && x.Withdrawal.Accounts
.Select(x => x.AccountId)
.ToList()
.Contains(a.Id))
.Select (r => r.GetViewModel)
.ToList()
})
.ToList();
}
public List<ReportTransfersWithdrawalsViewModel> GetTransfersWithdrawalsReport(AccountSearchModel model)
{
using var context = new BankDatabase();
return context.Accounts
.Select(a => new ReportTransfersWithdrawalsViewModel()
{
AccountNumber = a.Number,
SenderTransfers = context.Transfers
.Where(t => t.TransferTime <= model.DateTo &&
t.TransferTime >= model.DateFrom &&
t.SenderAccountId == a.Id)
.Select(t => t.GetViewModel)
.ToList(),
RecipientTransfers = context.Transfers
.Where(t => t.TransferTime <= model.DateTo &&
t.TransferTime >= model.DateFrom &&
t.RecipientAccountId == a.Id)
.Select(t => t.GetViewModel)
.ToList(),
Withdrawals = context.Withdrawals
.Include(w => w.Accounts)
.Where(w => w.WithdrawalTime <= model.DateTo &&
w.WithdrawalTime >= model.DateFrom && w.Accounts
.Select(x => x.AccountId)
.ToList()
.Contains(a.Id))
.Select(w => w.GetViewModel)
.ToList()
})
.ToList();
}
}
}

View File

@ -22,7 +22,10 @@ namespace BankDatabaseImplement.Models
public RequestStatus Status { get; set; }
[ForeignKey("RequestId")]
public virtual List<CardRequest> Cards { get; set; } = new();
private Dictionary<int, ICardModel>? _cardRequests { get; set; } = null;
[ForeignKey("RequestId")]
public virtual Withdrawal? Withdrawal { get; set; }
private Dictionary<int, ICardModel>? _cardRequests { get; set; } = null;
[NotMapped]
public Dictionary<int, ICardModel> CardRequests
{

View File

@ -89,27 +89,90 @@ namespace BankManagersClientApp.Controllers
return Redirect("~/Home/Enter");
}
return View();
}
}
public IActionResult Withdrawals()
public IActionResult TransferUpdate()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult TransferDelete()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult Withdrawals()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
}
public IActionResult WithdrawalRequest()
public IActionResult WithdrawalCreate()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult WithdrawalUpdate()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult WithdrawalDelete()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult WithdrawalRequest()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult RequestsListReport()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult TransfersWithdrawalsListReport()
{
if (APIClient.Manager == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });

View File

@ -0,0 +1,27 @@
@using BankContracts.ViewModels;
@{
ViewData["Title"] = "RequestsListReport";
}
<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 name="accounts" id="accounts" class="form-control" multiple size="5">
@foreach (var account in ViewBag.Accounts)
{
<option value="@account.Id">@account.Number</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-9"></div>
<div class="col-1"><input type="submit" value="Получить в формате Word" class="btn btn-primary" /></div>
<div class="col-1"><input type="submit" value="Получить в формате Excel" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,18 @@
@{
ViewData["Title"] = "TransferDelete";
}
<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="transfer" name="transfer" class="form-control" asp-items="@(new SelectList(@ViewBag.Transfers, "Id", "Id"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>

View File

@ -0,0 +1,36 @@
@{
ViewData["Title"] = "TransferUpdate";
}
<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="transfer" name="transfer" class="form-control" asp-items="@(new SelectList(@ViewBag.Transfers, "Id", "Id"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8">
<input type="text" name="sum" id="sum" />
</div>
</div>
<div class="row">
<div class="col-4">Отправитель:</div>
<div class="col-8">
<select id="sender-account" name="sender-account" class="form-control" asp-items="@(new SelectList(@ViewBag.Accounts, "Id", "Number"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Получатель:</div>
<div class="col-8">
<select id="recipient-account" name="recipient-account" class="form-control" asp-items="@(new SelectList(@ViewBag.Accounts, "Id", "Number"))"></select>
</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>

View File

@ -14,7 +14,9 @@
return;
}
<p>
<a asp-action="TransferCreate">Сделать перевод</a>
<a asp-action="TransferCreate">Создать перевод</a>
<a asp-action="TransferUpdate">Обновить перевод</a>
<a asp-action="TransferDelete">Удалить перевод</a>
</p>
<table class="table">
<thead>

View File

@ -0,0 +1,42 @@
@{
ViewData["Title"] = "TransfersWithdrawalsListReport";
}
<div class="text-center">
<h3 class="display-4">Список счетов с расшифровкой по переводам и выдачам</h3>
</div>
<div class="text-center">
@{
<div class="row mb-5">
<div class="col-4">Начальная дата:</div>
<div class="col-8">
<input type="date" id="startDate" name="startDate" class="form-control">
</div>
</div>
<div class="row mb-5">
<div class="col-4">Конечная дата:</div>
<div class="col-8">
<input type="date" id="endDate" name="endDate" class="form-control">
</div>
</div>
<table class="table">
<thead>
<tr>
<th>Номер</th>
<th>Дата/th>
<th>Счёт</th>
<th>Перевод</th>
<th>Выдача</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать отчет" class="btn btn-primary" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Отправить на почту" class="btn btn-primary" /></div>
</div>
}
</div>

View File

@ -0,0 +1,31 @@
@{
ViewData["Title"] = "WithdrawalCreate";
}
<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 type="number" name="sum" id="sum" />
</div>
</div>
<div class="row">
<div class="col-4">Счета:</div>
<div class="col-8">
<select name="accounts" id="accounts" class="form-control" multiple size="5">
@foreach (var account in ViewBag.Accounts)
{
<option value="@account.Id">@account.Number</option>
}
</select>
</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>

View File

@ -0,0 +1,18 @@
@{
ViewData["Title"] = "WithdrawalDelete";
}
<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="withdrawal" name="withdrawal" class="form-control" asp-items="@(new SelectList(@ViewBag.Withdrawals, "Id", "Id"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>

View File

@ -2,19 +2,14 @@
ViewData["Title"] = "WithdrawalRequest";
}
<div class="text-center">
<h2 class="display-4">Выдача наличных</h2>
<h2 class="display-4">Привязывание выдачи к заявке</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Клиент:</div>
<div class="col-4">Выдача:</div>
<div class="col-8">
<input type="text" name="sum" id="sum" readonly />
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8">
<input type="number" name="sum" id="sum" readonly />
<select name="request" id="request" class="form-control"
asp-items="@(new SelectList(@ViewBag.Withdrawals, "Id", "Id"))"></select>
</div>
</div>
<div class="row">
@ -24,20 +19,8 @@
asp-items="@(new SelectList(@ViewBag.Requests, "Id", "Id"))"></select>
</div>
</div>
<table class="table">
<thead>
<tr>
<th>Карты</th>
<th>Сумма</th>
</tr>
</thead>
<tbody id="table-elements">
</tbody>
</table>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Сделать выдачу" class="btn btn-primary" />
</div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,37 @@
@{
ViewData["Title"] = "WithdrawalUpdate";
}
<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="withdrawal" name="withdrawal" class="form-control" asp-items="@(new SelectList(@ViewBag.Withdrawals, "Id", "Id"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8">
<input type="number" name="sum" id="sum" />
</div>
</div>
<div class="row">
<div class="col-4">Счета:</div>
<div class="col-8">
<select name="accounts" id="accounts" class="form-control" multiple size="5">
@foreach (var account in ViewBag.Accounts)
{
<option value="@account.Id" data-name="@account.Number">@account.Number</option>
}
</select>
</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>

View File

@ -14,7 +14,10 @@
return;
}
<p>
<a asp-action="WithdrawalRequest">Выполнить заявку на выдачу</a>
<a asp-action="WithdrawalCreate">Создать выдачу</a>
<a asp-action="WithdrawalUpdate">Обновить выдачу</a>
<a asp-action="WithdrawalDelete">Удалить выдачу</a>
<a asp-action="WithdrawalRequest">Привязать выдачу к заявке</a>
</p>
<table class="table">
<thead>

View File

@ -19,10 +19,6 @@
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Счета</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
@ -31,6 +27,25 @@
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Счета</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Transfers">Переводы</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Withdrawals">Выдачи</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="WithdrawalRequest">Привязка выдач к заявкам</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="RequestsListReport">Список заявок по выбранным картам</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="TransfersWithdrawalsListReport">Отчёт по счетам с расшифровкой по переводам и выдачам</a>
</li>
</ul>
</div>
</div>