На всяикй случай комичу, боюсь сломать. Оказывается в отчете PDF обязательно нужна выборка по дате, опять добавляем в сущность новые поля, кайфуем
This commit is contained in:
parent
7b269fb7ec
commit
daaeac9e89
@ -622,5 +622,33 @@ namespace HostrelHeadwaiterApp.Controllers
|
|||||||
{
|
{
|
||||||
return new PhysicalFileResult("E:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
return new PhysicalFileResult("E:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ListDinnersToPdfFile()
|
||||||
|
{
|
||||||
|
if (APIClient.Headwaiter == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void ListDinnersToPdfFile(string roomName)
|
||||||
|
{
|
||||||
|
if (APIClient.Headwaiter == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Не авторизованы");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/Report/CreateHeadwaiterReportToPdfFile", new ReportHeadwaiterBindingModel()
|
||||||
|
{
|
||||||
|
RoomName = roomName,
|
||||||
|
HeadwaiterId = APIClient.Headwaiter.Id
|
||||||
|
});
|
||||||
|
|
||||||
|
Response.Redirect("ListDinnersToPdfFile");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "ListDinnersToPdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h2
|
||||||
|
class="u-text u-text-custom-color-1 u-text-default u-text-1"
|
||||||
|
>
|
||||||
|
Создание отчета по участникам за период
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<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="text"
|
||||||
|
placeholder="Выберите название комнаты"
|
||||||
|
id="roomName" name="roomName"
|
||||||
|
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>
|
||||||
|
</form>
|
@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ListDinnerRoomToFile">Отчет (word/excel) </a>
|
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ListDinnerRoomToFile">Отчет (word/excel) </a>
|
||||||
|
|
||||||
|
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ListDinnersToPdfFile">Отчет (pdf) </a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,8 @@ using HotelContracts.BindingModels;
|
|||||||
using HotelContracts.SearchModels;
|
using HotelContracts.SearchModels;
|
||||||
using HotelContracts.StoragesContracts;
|
using HotelContracts.StoragesContracts;
|
||||||
using HotelContracts.ViewModels;
|
using HotelContracts.ViewModels;
|
||||||
|
using HotelDataBaseImplement;
|
||||||
|
using HotelDataBaseImplement.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -78,24 +80,33 @@ namespace HotelBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
foreach (var room in listСonferences)
|
foreach (var room in listСonferences)
|
||||||
{
|
{
|
||||||
foreach (var c in room.RoomDinners)
|
foreach (var m in room.RoomDinners.Values)
|
||||||
{
|
{
|
||||||
listAll.Add(new ReportDinnersViewModel
|
listAll.Add(new ReportDinnersViewModel
|
||||||
{
|
{
|
||||||
RoomName = room.RoomName,
|
RoomName = room.RoomName,
|
||||||
DinnerName = c.Value.DinnerName
|
RoomPrice = room.RoomPrice,
|
||||||
|
DinnerName = m.DinnerName,
|
||||||
|
DinnerPrice = m.DinnerPrice
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var listConferenceBookings = _conferenceBookingStorage.GetFilteredList(new ConferenceBookingSearchModel());
|
var listConferenceBookings = _conferenceBookingStorage.GetFilteredList(new ConferenceBookingSearchModel
|
||||||
|
{
|
||||||
|
HeadwaiterId = model.HeadwaiterId,
|
||||||
|
});
|
||||||
|
|
||||||
foreach (var conferenceBooking in listConferenceBookings)
|
foreach (var conferenceBooking in listConferenceBookings)
|
||||||
{
|
{
|
||||||
listAll.Add(new ReportDinnersViewModel
|
foreach (var mp in conferenceBooking.ConferenceBookingDinners.Values)
|
||||||
{
|
{
|
||||||
NameHall = conferenceBooking.NameHall
|
listAll.Add(new ReportDinnersViewModel
|
||||||
});
|
{
|
||||||
|
DinnerName = mp.DinnerName,
|
||||||
|
DinnerPrice = mp.DinnerPrice,
|
||||||
|
NameHall = conferenceBooking.NameHall
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return listAll;
|
return listAll;
|
||||||
|
@ -25,18 +25,18 @@ namespace HotelBusinessLogic.OfficePackage
|
|||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
CreateTable(new List<string> { "3cm", "3cm", "3cm", "4cm", "4cm" });
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "Название команты", "Корпус комнтаы", "Цена комнаты" },
|
Texts = new List<string> { "Обед", "Комната", "Цена комнаты", "Бронирование" },
|
||||||
Style = "NormalTitle",
|
Style = "NormalTitle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
foreach (var conferenceBindingRooms in info.Dinners)
|
foreach (var dinner in info.Dinners)
|
||||||
{
|
{
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { conferenceBindingRooms.Id.ToString(), conferenceBindingRooms.RoomName, conferenceBindingRooms.RoomFrame, conferenceBindingRooms.RoomPrice.ToString() },
|
Texts = new List<string> { dinner.DinnerName.ToString(), dinner.RoomName, dinner.RoomPrice.ToString(), dinner.NameHall },
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,7 @@ namespace HotelContracts.ViewModels
|
|||||||
public string RoomName { get; set; } = string.Empty;
|
public string RoomName { get; set; } = string.Empty;
|
||||||
public string NameHall { get; set; } = string.Empty;
|
public string NameHall { get; set; } = string.Empty;
|
||||||
public string DinnerName { get; set; } = string.Empty;
|
public string DinnerName { get; set; } = string.Empty;
|
||||||
|
public double DinnerPrice { get; set; }
|
||||||
public double RoomPrice { get; set; }
|
public double RoomPrice { get; set; }
|
||||||
public string RoomFrame { get; set; } = string.Empty;
|
public string RoomFrame { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace HotelDataBaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=HotelDataBaseFu;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,24 @@ namespace HotelRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateHeadwaiterReportToPdfFile(ReportHeadwaiterBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_reportHeadwaiterLogic.SaveDinnersToPdfFile(new ReportHeadwaiterBindingModel
|
||||||
|
{
|
||||||
|
FileName = "Отчет PDF.pdf",
|
||||||
|
RoomName = model.RoomName,
|
||||||
|
HeadwaiterId = model.HeadwaiterId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка создания отчета");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user