fix sending pdf report to email

This commit is contained in:
Zakharov_Rostislav 2024-05-27 02:48:42 +04:00
parent a45f892454
commit a4942de30e
3 changed files with 51 additions and 50 deletions

View File

@ -116,7 +116,7 @@ namespace BankBusinessLogic.OfficePackage
recipientTransfer.Id.ToString(),
recipientTransfer.TransferTime.ToString(),
recipientTransfer.Sum.ToString(),
recipientTransfer.SenderAccountId.ToString(),
recipientTransfer.SenderAccountNumber,
},
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left

View File

@ -137,31 +137,34 @@ namespace BankDatabaseImplement.Implements
{
using var context = new BankDatabase();
return context.Accounts
.Select(a => new ReportTransfersWithdrawalsViewModel()
.Select(account => new ReportTransfersWithdrawalsViewModel()
{
AccountNumber = a.Number,
AccountNumber = account.Number,
SenderTransfers = context.Transfers
.Include(x => x.RecipientAccount)
.Where(t => t.TransferTime <= model.DateTo &&
t.TransferTime >= model.DateFrom &&
t.SenderAccountId == a.Id)
t.SenderAccountId == account.Id)
.Select(t => t.GetViewModel)
.ToList(),
RecipientTransfers = context.Transfers
.Where(t => t.TransferTime <= model.DateTo &&
.Include(x => x.SenderAccount)
.Where(t => t.TransferTime <= model.DateTo &&
t.TransferTime >= model.DateFrom &&
t.RecipientAccountId == a.Id)
t.RecipientAccountId == account.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()
})
Withdrawals = context.AccountWithdrawals
.Include(x => x.Withdrawal)
.ThenInclude(x => x.Accounts)
.Where(x => x.AccountId == account.Id)
.Select(x => x.Withdrawal)
.Where(w =>
w.WithdrawalTime <= model.DateTo &&
w.WithdrawalTime >= model.DateFrom)
.Select(w => w.GetViewModel)
.ToList(),
})
.ToList();
}
}

View File

@ -4,39 +4,37 @@
<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="dateFrom" name="dateFrom" class="form-control">
</div>
<form method="post">
<div class="row mb-5">
<div class="col-4">Начальная дата:</div>
<div class="col-8">
<input type="date" id="dateFrom" name="dateFrom" class="form-control">
</div>
<div class="row mb-5">
<div class="col-4">Конечная дата:</div>
<div class="col-8">
<input type="date" id="dateTo" name="dateTo" class="form-control">
</div>
</div>
<div class="row mb-5">
<div class="col-4">Конечная дата:</div>
<div class="col-8">
<input type="date" id="dateTo" name="dateTo" class="form-control">
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input 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>
<th>Номер</th>
<th>Дата</th>
<th>Счёт</th>
<th>Перевод</th>
<th>Выдача</th>
</tr>
</thead>
<tbody></tbody>
</table>
}
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input 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>
<th>Номер</th>
<th>Дата</th>
<th>Счёт</th>
<th>Перевод</th>
<th>Выдача</th>
</tr>
</thead>
<tbody></tbody>
</table>
</form>