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

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)
{
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);
}

View File

@ -9,6 +9,8 @@ using System.Web.Helpers;
using System.Reflection;
using HotelBusinessLogic.BusinessLogics;
using HotelContracts.BusinessLogicsContracts;
using System.Linq;
using DocumentFormat.OpenXml.Wordprocessing;
namespace HotelOrganiserApp.Controllers
{
@ -152,30 +154,41 @@ namespace HotelOrganiserApp.Controllers
_logger.LogError(ex, "Ошибка создания отчета");
throw;
}
double sum = 0;
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)
{
table += $"<h2>{report.MemberFIO}</h2>";
table += $"<table>";
table += "<thead>";
table += "<tr>";
table += $"<th>Конференция</th>";
table += $"<th>Дата начала конференции</th>";
table += $"<th>План питания</th>";
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 += "<tbody class=\"u-table-body\">";
table += "<tr style=\"height: 75px\">";
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 += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.ConferenceName}</td>";
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 += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MealPlanName}</td>";
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 += "</tr>";
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;
}

View File

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