start adding pdf report

This commit is contained in:
Zakharov_Rostislav 2024-05-27 01:22:25 +04:00
parent 60688b1147
commit 9068da1cac
6 changed files with 48 additions and 19 deletions

View File

@ -13,5 +13,6 @@ namespace BankContracts.BindingModels
public DateTime? DateTo { get; set; }
public List<int>? SelectedAccountIds { get; set; }
public List<int>? SelectedCardIds { get; set; }
public string? Email { get; set; }
}
}

View File

@ -4,6 +4,7 @@ using BankContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@ -21,7 +22,6 @@ namespace BankContracts.BusinessLogicsContracts
void SaveTransfersToExcelFile(ReportBindingModel model);
void SaveOperationsRequestsToPdfFile(ReportBindingModel model);
void SaveTransfersWithdrawalsToPdfFile(ReportBindingModel model);
void SendTransfersWithdrawalsToEmail(ReportBindingModel model);
}
}

View File

@ -16,8 +16,6 @@ namespace BankContracts.BusinessLogicsContracts
bool Create(RequestBindingModel model);
bool Update(RequestBindingModel model);
bool Delete(RequestBindingModel model);
//todo методы смены статуса
//bool DeclineRequest(RequestBindingModel model);
//bool SatisfyRequest(RequestBindingModel model);
}
}

View File

@ -512,10 +512,27 @@ namespace BankManagersClientApp.Controllers
}
return View();
}
#endregion
#region//Error
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[HttpPost]
public void TransfersWithdrawalsListReport(DateTime dateFrom, DateTime dateTo)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/report/sendtransferswithdrawalstoemail", new ReportBindingModel
{
FileName = "C:\\Users\\user\\Downloads\\TransfersWithdrawalsList.pdf",
DateFrom = dateFrom,
DateTo = dateTo,
Email = APIClient.Client.Email,
});
Response.Redirect("TransfersWithdrawalsListReport");
}
#endregion
#region//Error
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });

View File

@ -2,22 +2,30 @@
ViewData["Title"] = "TransfersWithdrawalsListReport";
}
<div class="text-center">
<h3 class="display-4">Список счетов с расшифровкой по переводам и выдачам</h3>
<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">
<input type="date" id="dateFrom" name="dateFrom" 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">
<input type="date" id="dateTo" name="dateTo" class="form-control">
</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 class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Отправить на почту" class="btn btn-primary" /></div>
</div>
<table class="table">
<thead>
<tr>
@ -30,13 +38,5 @@
</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

@ -70,5 +70,18 @@ namespace BankRestApi.Controllers
throw;
}
}
[HttpPost]
public void SendTransfersWithdrawalsToEmail(ReportBindingModel model)
{
try
{
_logic.SendTransfersWithdrawalsToEmail(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения переводов в ворд");
throw;
}
}
}
}