Наполовину готовый pdf.
This commit is contained in:
parent
1d17a40c17
commit
7aeb202e56
@ -29,9 +29,11 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "5cm", "5cm", "5cm"});
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер карты", "Сумма операции", "Дата операции" },
|
||||
Texts = new List<string> { "Номер карты", "Сумма", "Дата операции" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToExcel : AbstractSaveToExcelCashier
|
||||
public class SaveToExcel : AbstractSaveToExcelClient
|
||||
{
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
|
||||
|
@ -8,7 +8,7 @@ using DocumentFormat.OpenXml.Wordprocessing;
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
//реализация абстрактного класса сохранения в word
|
||||
public class SaveToWord : AbstractSaveToWordCashier
|
||||
public class SaveToWord : AbstractSaveToWordClient
|
||||
{
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
|
||||
|
@ -32,8 +32,6 @@ namespace BankYouBankruptСlientApp
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
|
||||
return JsonConvert.DeserializeObject<T>("");
|
||||
}
|
||||
|
||||
//Post-запрос
|
||||
|
@ -260,7 +260,7 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("/api/Report/CreateClientReport", new ReportBindingModel()
|
||||
APIClient.PostRequest("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
|
@ -21,7 +21,7 @@
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сформировать" class="btn btn-primary" />
|
||||
<input type="submit" value="Сформировать отчёт" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptContracts.BindingModels
|
||||
{
|
||||
//вспомогательная модель для передачи DateTime при формировании отчёта
|
||||
public class ReportSupportBindingModel
|
||||
{
|
||||
public DateTime DateFrom { get; set; }
|
||||
|
||||
public DateTime DateTo { get; set; }
|
||||
}
|
||||
}
|
@ -43,6 +43,15 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
List<int> cards = context.Cards.Where(x => x.ClientID == model.UserId).Select(x => x.Id).ToList();
|
||||
return context.Creditings.Include(x => x.Card).Where(x => cards.Contains(x.CardId)).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
if(model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Creditings
|
||||
.Include(x => x.Card)
|
||||
.Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return context.Creditings
|
||||
.Include(x => x.Card)
|
||||
|
@ -45,7 +45,16 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
return context.Debitings.Include(x => x.Card).Where(x => cards.Contains(x.CardId)).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
return context.Debitings
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Debitings
|
||||
.Include(x => x.Card)
|
||||
.Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return context.Debitings
|
||||
.Include(x => x.Card)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -15,28 +15,28 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IReportCashierLogic _reportCashierLogic;
|
||||
//private readonly IReportCashierLogic _reportCashierLogic;
|
||||
|
||||
private readonly IReportClientLogic _reportClientLogic;
|
||||
|
||||
public ReportController(ILogger<AccountController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic)
|
||||
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_reportClientLogic = reportClientLogic;
|
||||
_reportCashierLogic = reportCashierLogic;
|
||||
//_reportCashierLogic = reportCashierLogic;
|
||||
}
|
||||
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
[HttpGet]
|
||||
public void CreateClientReport(DateTime DateFrom, DateTime DateTo)
|
||||
[HttpPost]
|
||||
public void CreateClientReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по картам от " + DateTime.Now.ToShortDateString(),
|
||||
DateFrom = DateFrom,
|
||||
DateTo = DateTo
|
||||
FileName = "Отчёт по картам",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -31,7 +31,10 @@ builder.Services.AddTransient<IMoneyTransferLogic, MoneyTransferLogic>();
|
||||
builder.Services.AddTransient<IDebitingLogic, DebitingLogic>();
|
||||
builder.Services.AddTransient<ICashWithdrawalLogic, CashWithdrawalLogic>();
|
||||
|
||||
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfClient, SaveToPdf>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcelClient, SaveToExcel>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordClient, SaveToWord>();
|
||||
//builder.Services.AddTransient<AbstractSaveToPdfCashier, SaveToPdf>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
BIN
BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf
Normal file
BIN
BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf
Normal file
Binary file not shown.
BIN
BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf
Normal file
BIN
BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user