Сделал красивую табличку (тока кнопки до сих пор не очень красиво) :(

This commit is contained in:
Кашин Максим 2023-05-19 21:58:49 +04:00
parent 8b8ffbcb32
commit c967df43b3

View File

@ -670,8 +670,8 @@ namespace HostrelHeadwaiterApp.Controllers
APIClient.PostRequest("api/report/SendPdfToMail", new MailSendInfoBindingModel
{
MailAddress = headwaiterEmail,
Subject = "Отчет по участникам (pdf)",
Text = "Отчет по участникам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
Subject = "Отчет по обедам (pdf)",
Text = "Отчет по обедам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
});
Response.Redirect("ListDinnersToPdfFile");
}
@ -700,45 +700,41 @@ namespace HostrelHeadwaiterApp.Controllers
}
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 += "<h2 class=\"text-custom-color-1\">Предварительный отчет</h2>";
table += "<div class=\"table-responsive\">";
table += "<table class=\"table table-striped table-bordered table-hover\">";
table += "<thead class=\"table-dark\">";
table += "<tr>";
table += "<th scope=\"col\">Обед</th>";
table += "<th scope=\"col\">Имя комнаты</th>";
table += "<th scope=\"col\">Цена комнаты</th>";
table += "<th scope=\"col\">Название зала</th>";
table += "<th scope=\"col\">Дата броинирования</th>";
table += "</tr>";
table += "</thead>";
foreach (var report in result)
{
bool IsCost = true;
if (report.RoomPrice.ToString() == "0")
if (report.RoomPrice == 0)
{
IsCost = false;
}
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.DinnerName}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.RoomName}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{(IsCost is true ? report.RoomPrice.ToString() : string.Empty)}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.NameHall}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.BookingDate}</td>";
table += "<tbody>";
table += "<tr>";
table += $"<td>{report.DinnerName}</td>";
table += $"<td>{report.RoomName}</td>";
table += $"<td>{(IsCost ? report.RoomPrice.ToString() : string.Empty)}</td>";
table += $"<td>{report.NameHall}</td>";
table += $"<td>{report.BookingDate?.ToShortDateString()}</td>";
table += "</tr>";
table += "</tbody>";
sum += report.RoomPrice;
}
table += "<tfoot class=\"table-secondary\">";
table += $"<tr><th colspan=\"2\">Итого:</th><th>{sum}</th><th colspan=\"2\"></th></tr>";
table += "</tfoot>";
table += "</table>";
table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Итого: {sum}</h2>";
table += "</div>";
return table;
}
}