отчёт
This commit is contained in:
parent
74259a391f
commit
b503bc0099
@ -115,8 +115,7 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
{
|
||||
foreach (var mp in conferenceBooking.ConferenceBookingLunches.Values)
|
||||
{
|
||||
var conferenceId = conferenceBooking.ConferenceId;
|
||||
var conference = conferenced.FirstOrDefault(dp => dp.Id == conferenceId);
|
||||
var conference = conferenced.FirstOrDefault(dp => dp.Id == conferenceBooking.ConferenceId);
|
||||
listAll.Add(new ReportLunchesViewModel
|
||||
{
|
||||
LunchName = mp.LunchName,
|
||||
|
@ -6,6 +6,7 @@ using HotelContracts.StoragesContracts;
|
||||
using HotelContracts.ViewModels;
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelDataBaseImplement.Implemets;
|
||||
using HotelDataBaseImplement.Models;
|
||||
|
||||
namespace HotelBusinessLogic.BusinessLogics
|
||||
{
|
||||
@ -15,16 +16,18 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
private readonly IMemberStorage _memberStorage;
|
||||
private readonly IConferenceStorage _conferenceStorage;
|
||||
private readonly IConferenceBookingStorage _conferenceBookingStorage;
|
||||
private readonly IRoomStorage _roomStorage;
|
||||
private readonly AbstractSaveToExcelOrganiser _saveToExcel;
|
||||
private readonly AbstractSaveToWordOrganiser _saveToWord;
|
||||
private readonly AbstractSaveToPdfOrganiser _saveToPdf;
|
||||
|
||||
public ReportLogicOrganiser(IMealPlanStorage mealPlanStorage, IMemberStorage memberStorage, IConferenceStorage conferenceStorage, IConferenceBookingStorage conferenceBookingStorage, AbstractSaveToExcelOrganiser saveToExcel, AbstractSaveToWordOrganiser saveToWord, AbstractSaveToPdfOrganiser saveToPdf)
|
||||
public ReportLogicOrganiser(IMealPlanStorage mealPlanStorage, IMemberStorage memberStorage, IConferenceStorage conferenceStorage, IConferenceBookingStorage conferenceBookingStorage, IRoomStorage roomStorage, AbstractSaveToExcelOrganiser saveToExcel, AbstractSaveToWordOrganiser saveToWord, AbstractSaveToPdfOrganiser saveToPdf)
|
||||
{
|
||||
_mealPlanStorage = mealPlanStorage;
|
||||
_memberStorage = memberStorage;
|
||||
_conferenceStorage = conferenceStorage;
|
||||
_conferenceBookingStorage = conferenceBookingStorage;
|
||||
_roomStorage = roomStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
@ -106,17 +109,20 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
OrganiserId = model.OrganiserId,
|
||||
});
|
||||
|
||||
var rooms = _roomStorage.GetFullList();
|
||||
|
||||
foreach (var mealPlan in listMealPlans)
|
||||
{
|
||||
foreach (var mp in mealPlan.MealPlanMembers.Values)
|
||||
{
|
||||
var room = rooms.FirstOrDefault(r => r.MealPlanId == mealPlan.Id);
|
||||
listAll.Add(new ReportMembersViewModel
|
||||
{
|
||||
MemberSurname = mp.MemberSurname,
|
||||
MemberName = mp.MemberName,
|
||||
MemberPatronymic = mp.MemberPatronymic,
|
||||
MealPlanName = mealPlan.MealPlanName,
|
||||
MealPlanPrice = mealPlan.MealPlanPrice
|
||||
RoomName = room.RoomName,
|
||||
RoomPrice = room.RoomPrice
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ namespace HotelBusinessLogic.OfficePackage
|
||||
}
|
||||
|
||||
bool IsCost = true;
|
||||
if (member.MealPlanPrice.ToString() == "0")
|
||||
if (member.RoomPrice.ToString() == "0")
|
||||
{
|
||||
IsCost = false;
|
||||
}
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { $"{member.MemberSurname} {member.MemberName} {member.MemberPatronymic}", member.ConferenceName, IsDate is true ? member.StartDate.ToShortDateString() : string.Empty, member.MealPlanName, IsCost is true ? member.MealPlanPrice.ToString() : string.Empty },
|
||||
Texts = new List<string> { $"{member.MemberSurname} {member.MemberName} {member.MemberPatronymic}", member.ConferenceName, IsDate is true ? member.StartDate.ToShortDateString() : string.Empty, member.RoomName, IsCost is true ? member.RoomPrice.ToString() : string.Empty },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
@ -56,7 +56,7 @@ namespace HotelBusinessLogic.OfficePackage
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Итого: {info.Members.Sum(x => x.MealPlanPrice)}\t",
|
||||
Text = $"Итого: {info.Members.Sum(x => x.RoomPrice)}\t",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
||||
});
|
||||
|
@ -8,7 +8,7 @@
|
||||
public string MemberName { get; set; } = string.Empty;
|
||||
public string MemberPatronymic { get; set; } = string.Empty;
|
||||
public string ConferenceName { get; set; } = string.Empty;
|
||||
public string MealPlanName { get; set; } = string.Empty;
|
||||
public double MealPlanPrice { get; set; }
|
||||
public string RoomName { get; set; } = string.Empty;
|
||||
public double RoomPrice { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -680,22 +680,16 @@ namespace HotelOrganiserApp.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)
|
||||
@ -706,24 +700,26 @@ namespace HotelOrganiserApp.Controllers
|
||||
IsDate = false;
|
||||
}
|
||||
bool IsCost = true;
|
||||
if (report.MealPlanPrice.ToString() == "0")
|
||||
if (report.RoomPrice.ToString() == "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.MemberSurname} {report.MemberName} {report.MemberPatronymic}</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\">{(IsDate is true ? report.StartDate.ToShortDateString() : 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.MealPlanName}</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.MealPlanPrice.ToString() : string.Empty)}</td>";
|
||||
table += "<tbody>";
|
||||
table += "<tr>";
|
||||
table += $"<td>{report.MemberSurname} {report.MemberName} {report.MemberPatronymic}</td>";
|
||||
table += $"<td>{report.ConferenceName}</td>";
|
||||
table += $"<td>{(IsDate is true ? report.StartDate.ToShortDateString() : string.Empty)}</td>";
|
||||
table += $"<td>{report.RoomName}</td>";
|
||||
table += $"<td>{(IsCost is true ? report.RoomPrice.ToString() : string.Empty)}</td>";
|
||||
table += "</tr>";
|
||||
table += "</tbody>";
|
||||
sum += report.MealPlanPrice;
|
||||
sum += report.RoomPrice;
|
||||
}
|
||||
table += "<tfoot class=\"table-secondary\">";
|
||||
table += $"<tr><th colspan=\"4\">Итого:</th><th>{sum}</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;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ builder.Services.AddTransient<IMemberStorage, MemberStorage>();
|
||||
builder.Services.AddTransient<IMealPlanStorage, MealPlanStorage>();
|
||||
builder.Services.AddTransient<IConferenceStorage, ConferenceStorage>();
|
||||
builder.Services.AddTransient<IConferenceBookingStorage, ConferenceBookingStorage>();
|
||||
builder.Services.AddTransient<IRoomStorage, RoomStorage>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcelOrganiser, SaveToExcelOrganiser>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfOrganiser, SaveToPdfOrganiser>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordOrganiser, SaveToWordOrganiser>();
|
||||
|
@ -0,0 +1,60 @@
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ListMembersToPdfFile";
|
||||
}
|
||||
|
||||
<div class="container">
|
||||
<div class="text-center mb-4">
|
||||
<h2 class="text-custom-color-1">Отчет по участникам за период</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="dateFrom" class="form-label text-custom-color-1">Начало периода:</label>
|
||||
<input type="datetime-local" id="dateFrom" name="dateFrom" class="form-control" placeholder="Выберите дату начала периода">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="dateTo" class="form-label text-custom-color-1">Окончание периода:</label>
|
||||
<input type="datetime-local" id="dateTo" name="dateTo" class="form-control" placeholder="Выберите дату окончания периода">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-8"></div>
|
||||
<div class="col-md-4">
|
||||
<button type="button" id="demonstrate" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Продемонстрировать</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="report"></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function check() {
|
||||
var dateFrom = $('#dateFrom').val();
|
||||
var dateTo = $('#dateTo').val();
|
||||
if (dateFrom && dateTo) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetMembersReport",
|
||||
data: { dateFrom: dateFrom, dateTo: dateTo },
|
||||
success: function (result) {
|
||||
if (result != null) {
|
||||
$('#report').html(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#demonstrate').on('click', (e) => check());
|
||||
</script>
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user