Таблица с предварительным просмотром пдф приведена в порядок

This commit is contained in:
AnnZhimol 2023-05-19 12:30:20 +04:00
parent 3cb30a3684
commit baa61f38d4
3 changed files with 69 additions and 41 deletions

View File

@ -9,7 +9,7 @@ namespace HotelDataBaseImplement
{ {
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-VG5USAH\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }

View File

@ -9,6 +9,8 @@ using System.Web.Helpers;
using System.Reflection; using System.Reflection;
using HotelBusinessLogic.BusinessLogics; using HotelBusinessLogic.BusinessLogics;
using HotelContracts.BusinessLogicsContracts; using HotelContracts.BusinessLogicsContracts;
using System.Linq;
using DocumentFormat.OpenXml.Wordprocessing;
namespace HotelOrganiserApp.Controllers namespace HotelOrganiserApp.Controllers
{ {
@ -152,30 +154,41 @@ namespace HotelOrganiserApp.Controllers
_logger.LogError(ex, "Ошибка создания отчета"); _logger.LogError(ex, "Ошибка создания отчета");
throw; throw;
} }
double sum = 0;
string table = ""; string table = "";
table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Предварительный отчет</h2>";
table += $"<table class=\"u-table-entity\">";
table += "<colgroup>";
table += "<col width=\"20%\" />";
table += "<col width=\"20%\" />";
table += "<col width=\"20%\" />";
table += "<col width=\"20%\" />";
table += "<col width=\"20%\" />";
table += "</colgroup>";
table += "<thead class=\"u-custom-color-1 u-table-header u-table-header-1\">";
table += "<tr style=\"height: 31px\">";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Участник</th>";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Конференция</th>";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Дата начала конференции</th>";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">План питания</th>";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Стоимость плана питания</th>";
table += "</tr>";
table += "</thead>";
foreach (var report in result) foreach (var report in result)
{ {
table += $"<h2>{report.MemberFIO}</h2>"; table += "<tbody class=\"u-table-body\">";
table += $"<table>"; table += "<tr style=\"height: 75px\">";
table += "<thead>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MemberFIO}</td>";
table += "<tr>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.ConferenceName}</td>";
table += $"<th>Конференция</th>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.StartDate}</td>";
table += $"<th>Дата начала конференции</th>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MealPlanName}</td>";
table += $"<th>План питания</th>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MealPlanPrice}</td>";
table += $"<th>Стоимость плана питания</th>";
table += "</tr>";
table += "</thead>";
table += "<tbody>";
table += "<tr>";
table += $"<td>{report.ConferenceName}</td>";
table += $"<td>{report.StartDate}</td>";
table += $"<td>{report.MealPlanName}</td>";
table += $"<td>{report.MealPlanPrice}</td>";
table += "</tr>"; table += "</tr>";
table += "</tbody>"; table += "</tbody>";
table += "</table>"; sum+= report.MealPlanPrice;
} }
//table += $"<h3 style=\"align-self: self-start;\">Итого: {result.Item2}</h3>"; table += "</table>";
table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Итого: {sum}</h2>";
return table; return table;
} }

View File

@ -3,36 +3,51 @@
@{ @{
ViewData["Title"] = "ListMembersToPdfFile"; ViewData["Title"] = "ListMembersToPdfFile";
} }
<head>
<link rel="stylesheet" href="~/css/createmember.css" asp-append-version="true" />
</head>
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Отчет по участникам за период</h1> <h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Отчет по участникам за период </h2>
</div> </div>
<div class="text-center"> <div class="text-center">
@{ @{
<form method="post"> <form method="post">
<div class="mt-3"> <div class="u-form-email u-form-group u-label-top">
<div class="form-check form-check-inline"> <label class="u-label u-text-custom-color-1 u-label-2" for="dateFrom">Начало периода</label>
<label class="form-check-label" for="dateFrom"> <input
От type="datetime-local"
</label> placeholder="Выберите дату начала периода"
<input type="datetime-local" id="dateFrom" name="dateFrom" /> id="dateFrom" name="dateFrom"
</div> class="u-input u-input-rectangle"/>
<div class="form-check form-check-inline"> </div>
<label class="form-check-label" for="dateTo"> <div class="u-form-email u-form-group u-label-top">
До <label class="u-label u-text-custom-color-1 u-label-2" for="dateTo">Окончание периода</label>
</label> <input
<input type="datetime-local" id="dateTo" name="dateTo" /> type="datetime-local"
</div> placeholder="Выберите дату окончания периода"
</div> id="dateTo" name="dateTo"
<div class="mt-3"> class="u-input u-input-rectangle"/>
Ваш email </div>
<input type="text" name="organiserEmail" /> <div class="u-form-group u-form-name u-label-top">
<button class="btn btn-primary ms-3" type="submit">Отправить на почту</button> <label class="u-label u-text-custom-color-1 u-label-1">Введите почту</label>
</div> <input
<div class="mt-3" id="report" style="display: flex; flex-direction: column;"> type="email"
placeholder="Введите вашу почту"
name="organiserEmail"
class="u-input u-input-rectangle"/>
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Отправить на почту" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
</div>
<div class="mt-3" id="report">
</div> </div>
</form> </form>
<button class="btn btn-primary" type="button" id="demonstrate">Продемонстрировать</button> <div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><button type="button" id="demonstrate" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1">Продемонстрировать</button></div>
</div>
} }
</div> </div>