Почти готово
This commit is contained in:
parent
d80e620e9a
commit
e54749d6d7
@ -33,7 +33,7 @@ namespace DiningRoomBusinessLogic.BusinessLogic
|
||||
return _componentStorage.GetComponentsOrders(SelectedComponents);
|
||||
}
|
||||
|
||||
public List<ReportComponentByDateViewModel> GetReportComponentsByCardDate(ReportBindingModel Report)
|
||||
public List<ReportComponentByDateViewModel> GetReportComponentsByDate(ReportBindingModel Report)
|
||||
{
|
||||
return _componentStorage.GetComponentsByDate(Report);
|
||||
}
|
||||
@ -42,10 +42,10 @@ namespace DiningRoomBusinessLogic.BusinessLogic
|
||||
_saveToPdf.CreateDoc(new PdfInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список заказов",
|
||||
Title = "Список продуктов",
|
||||
DateFrom = model.DateFrom!.Value,
|
||||
DateTo = model.DateTo!.Value,
|
||||
Components = GetReportComponentsByCardDate(model)
|
||||
Components = GetReportComponentsByDate(model)
|
||||
});
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace DiningRoomBusinessLogic.BusinessLogic
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = Model.FileName,
|
||||
Title = "Список изделий",
|
||||
Title = "Список заказов",
|
||||
ProductComponents = GetReportComponentsWithOrders(Model.selectedComponents)
|
||||
});
|
||||
}
|
||||
@ -64,7 +64,7 @@ namespace DiningRoomBusinessLogic.BusinessLogic
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = Model.FileName,
|
||||
Title = "Список изделий",
|
||||
Title = "Список заказов",
|
||||
ProductComponents = GetReportComponentsWithOrders(Model.selectedComponents)
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
||||
<PackageReference Include="MailKit" Version="4.6.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
<PackageReference Include="PDFsharp-MigraDoc" Version="1.50.5147" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -46,7 +46,11 @@ namespace DiningRoomBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "", "",item.CardName, item.ProductName },
|
||||
Texts = new List<string>
|
||||
{
|
||||
string.IsNullOrEmpty(item.CardName) ? "N/A" : item.CardName,
|
||||
string.IsNullOrEmpty(item.ProductName) ? "N/A" : item.ProductName
|
||||
},
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
|
@ -12,6 +12,7 @@ namespace DiningRoomContracts.BindingModels
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public List<ComponentSearchModel>? selectedComponents { get; set; }
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace DiningRoomContracts.BusinessLogicContracts
|
||||
/// <summary>
|
||||
/// Получение отчёта для отправки на почту
|
||||
/// </summary>
|
||||
List<ReportComponentByDateViewModel> GetReportComponentsByCardDate(ReportBindingModel Report);
|
||||
List<ReportComponentByDateViewModel> GetReportComponentsByDate(ReportBindingModel Report);
|
||||
|
||||
void SaveReportToWordFile(ReportBindingModel Model);
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
public double ProductPrice { get; set; }
|
||||
|
||||
public int? CardId { get; set; }
|
||||
public string CardName { get; set; }
|
||||
public string? CardName { get; set; }
|
||||
|
||||
public DateTime DateCardCreate { get; set; } = DateTime.Now;
|
||||
public DateTime DateComponentCreate { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
@ -117,29 +117,64 @@ namespace DiningRoomDatabaseImplement.Implements
|
||||
|
||||
public List<ReportComponentByDateViewModel> GetComponentsByDate(ReportBindingModel ReportModel)
|
||||
{
|
||||
//using var Context = new DiningRoomDatabase();
|
||||
|
||||
//return Context.Cards
|
||||
// .Where(card => card.DateCardCreate >= ReportModel.DateFrom && card.DateCardCreate <= ReportModel.DateTo)
|
||||
// .Include(card => card.Drinks)
|
||||
// .ThenInclude(d => d.Components)
|
||||
// .ThenInclude(dc => dc.Component)
|
||||
// .ThenInclude(c => c.ProductComponents)
|
||||
// .ThenInclude(pc => pc.Product)
|
||||
// .ToList()
|
||||
// .SelectMany(card => card.Drinks
|
||||
//.SelectMany(d => d.Components.SelectMany(dc => dc.Component.ProductComponents.Select(pc => new ReportComponentByDateViewModel
|
||||
//{
|
||||
|
||||
// ComponentId = pc.ComponentId,
|
||||
// ComponentName = dc.Component.ComponentName,
|
||||
// ComponentCost = dc.Component.Cost,
|
||||
// ProductId = pc.ProductId,
|
||||
// ProductName = pc.Product.ProductName,
|
||||
// ProductPrice = pc.Product.Cost,
|
||||
// CardId = card.Id,
|
||||
// CardName = card.CardName,
|
||||
//}))))
|
||||
//.ToList();
|
||||
using var Context = new DiningRoomDatabase();
|
||||
|
||||
return Context.Cards
|
||||
.Where(card => card.DateCardCreate >= ReportModel.DateFrom && card.DateCardCreate <= ReportModel.DateTo)
|
||||
.Include(card => card.Drinks)
|
||||
.ThenInclude(d => d.Components)
|
||||
.ThenInclude(dc => dc.Component)
|
||||
.ThenInclude(c => c.ProductComponents)
|
||||
.ThenInclude(pc => pc.Product)
|
||||
.ToList()
|
||||
.SelectMany(card => card.Drinks
|
||||
.SelectMany(d => d.Components.SelectMany(dc => dc.Component.ProductComponents.Select(pc => new ReportComponentByDateViewModel
|
||||
return Context.Components
|
||||
.Where(comp => comp.DateComponentCreate >= ReportModel.DateFrom && comp.DateComponentCreate <= ReportModel.DateTo)
|
||||
.Include(comp => comp.DrinkComponents)
|
||||
.ThenInclude(dc => dc.Drink)
|
||||
.ThenInclude(dr => dr.Card) // Включаем связь с Card для Drink
|
||||
.Include(comp => comp.ProductComponents)
|
||||
.ThenInclude(pc => pc.Product)
|
||||
.SelectMany(comp => comp.DrinkComponents.Select(dc => new ReportComponentByDateViewModel
|
||||
{
|
||||
|
||||
ComponentId = pc.ComponentId,
|
||||
ComponentName = dc.Component.ComponentName,
|
||||
ComponentCost = dc.Component.Cost,
|
||||
ProductId = pc.ProductId,
|
||||
ProductName = pc.Product.ProductName,
|
||||
ProductPrice = pc.Product.Cost,
|
||||
CardId = card.Id,
|
||||
CardName = card.CardName,
|
||||
}))))
|
||||
ComponentId = comp.Id,
|
||||
ComponentName = comp.ComponentName,
|
||||
ComponentCost = comp.Cost,
|
||||
ProductId = 0, // Устанавливаем null для ProductId, так как в этом контексте у нас Drink
|
||||
ProductName = null, // Аналогично для ProductName
|
||||
ProductPrice = 0, // Аналогично для ProductPrice
|
||||
CardId = dc.Drink.CardId,
|
||||
CardName = dc.Drink.Card.CardName,
|
||||
}))
|
||||
.Union(
|
||||
Context.Components
|
||||
.Where(comp => comp.DateComponentCreate >= ReportModel.DateFrom && comp.DateComponentCreate <= ReportModel.DateTo)
|
||||
.SelectMany(comp => comp.ProductComponents.Select(pc => new ReportComponentByDateViewModel
|
||||
{
|
||||
ComponentId = comp.Id,
|
||||
ComponentName = comp.ComponentName,
|
||||
ComponentCost = comp.Cost,
|
||||
ProductId = pc.Product.Id,
|
||||
ProductName = pc.Product.ProductName,
|
||||
ProductPrice = pc.Product.Cost,
|
||||
CardId = 0, // Устанавливаем null для CardId, так как Product не связан с Card
|
||||
CardName = null, // Устанавливаем null для CardName
|
||||
}))
|
||||
)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
@ -442,5 +442,59 @@ namespace DiningRoomRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<ReportComponentByDateViewModel> GetComponentByDateReport(string dateFrom, string dateTo, int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime DateFrom = DateTime.Parse(dateFrom);
|
||||
DateTime DateTo = DateTime.Parse(dateTo);
|
||||
ReportBindingModel model = new();
|
||||
model.DateFrom = DateFrom;
|
||||
model.DateTo = DateTo;
|
||||
return _report.GetReportComponentsByDate(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void SendComponentsByDateReportToEmail(ReportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_report.SaveComponentsToPdfFile(model);
|
||||
_mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = model.Email!,
|
||||
Subject = "Отчет по продуктам",
|
||||
Text = "Курсовая работа"
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//[HttpPost]
|
||||
//public void SendRoomsConferencesReportToEmail(ReportRoomsConferenceBindingModel model)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// _reportAdministrator.SaveDinnersToPdfFile(model);
|
||||
// _mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
// {
|
||||
// MailAddress = model.Email!,
|
||||
// Subject = "Отчет по обедам",
|
||||
// Text = "Курсовая работа"
|
||||
// });
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -16,16 +16,20 @@ using System.Numerics;
|
||||
using DiningRoomDataModels.Enums;
|
||||
using System.Reflection;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DiningRoomBusinessLogic.MailWorker;
|
||||
|
||||
namespace DiningRoomUserApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
|
||||
private readonly IReportLogic _logic;
|
||||
private readonly IComponentLogic _component;
|
||||
public HomeController(IComponentLogic component)
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
public HomeController(IComponentLogic component, IReportLogic logic, AbstractMailWorker mailWorker)
|
||||
{
|
||||
_component = component;
|
||||
_logic=logic;
|
||||
_mailWorker=mailWorker;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -454,6 +458,121 @@ namespace DiningRoomUserApp.Controllers
|
||||
}
|
||||
return new PhysicalFileResult("C:\\exelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
[HttpGet]
|
||||
public string GetComponentsReport(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
|
||||
List<GroupedComponentViewModel> displayData;
|
||||
try
|
||||
{
|
||||
var dataSource = _logic.GetReportComponentsByDate(new ReportBindingModel
|
||||
{
|
||||
DateFrom = DateTime.SpecifyKind(dateFrom, DateTimeKind.Utc),
|
||||
DateTo = DateTime.SpecifyKind(dateTo, DateTimeKind.Utc)
|
||||
});
|
||||
|
||||
// Группировка данных по ComponentName и преобразование в нужный формат
|
||||
displayData = new List<GroupedComponentViewModel>();
|
||||
var groupedData = dataSource.GroupBy(c => c.ComponentName);
|
||||
|
||||
foreach (var group in groupedData)
|
||||
{
|
||||
// Добавляем строку с именем продукта и его стоимостью
|
||||
displayData.Add(new GroupedComponentViewModel
|
||||
{
|
||||
ComponentName = group.Key,
|
||||
ComponentCost = group.First().ComponentCost
|
||||
});
|
||||
|
||||
// Добавляем только уникальные названия блюд и карт
|
||||
var uniqueProducts = new HashSet<string>();
|
||||
var uniqueCards = new HashSet<string>();
|
||||
|
||||
foreach (var item in group)
|
||||
{
|
||||
// Проверяем, есть ли название блюда и оно уникально
|
||||
if (!string.IsNullOrEmpty(item.ProductName) && uniqueProducts.Add(item.ProductName))
|
||||
{
|
||||
displayData.Add(new GroupedComponentViewModel
|
||||
{
|
||||
ProductName = item.ProductName
|
||||
});
|
||||
}
|
||||
// Проверяем, есть ли название карты и оно уникально
|
||||
if (!string.IsNullOrEmpty(item.CardName) && uniqueCards.Add(item.CardName))
|
||||
{
|
||||
displayData.Add(new GroupedComponentViewModel
|
||||
{
|
||||
CardName = item.CardName
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
// Генерация HTML таблицы
|
||||
string 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 += "</tr>";
|
||||
table += "</thead>";
|
||||
table += "<tbody>";
|
||||
|
||||
foreach (var item in displayData)
|
||||
{
|
||||
table += "<tr>";
|
||||
table += $"<td>{item.ComponentName}</td>";
|
||||
table += $"<td>{item.ProductName}</td>";
|
||||
table += $"<td>{item.CardName}</td>";
|
||||
table += $"<td>{item.ComponentCost}</td>";
|
||||
table += "</tr>";
|
||||
}
|
||||
|
||||
table += "</tbody>";
|
||||
table += "</table>";
|
||||
table += "</div>";
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
public IActionResult AddComponentsToFile()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddComponentsToFile(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIClient.PostRequest("api/main/SendComponentsByDateReportToEmail", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\Dax\\reportpdf.pdf",
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo,
|
||||
Email = APIClient.User.Email,
|
||||
|
||||
});
|
||||
Response.Redirect("AddComponentsToFile");
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
|
@ -5,6 +5,7 @@ using DiningRoomBusinessLogic.OfficePackage.Implements;
|
||||
using DiningRoomContracts.BusinessLogicContracts;
|
||||
using DiningRoomContracts.StorageContracts;
|
||||
using DiningRoomDatabaseImplement.Implements;
|
||||
using DiningRoomBusinessLogic.MailWorker;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
@ -13,7 +14,12 @@ builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
||||
builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
||||
builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
//builder.Services.AddTransient<AbstractSaveToPdfUser, SaveToPdfUser>();
|
||||
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
|
||||
var app = builder.Build();
|
||||
APIClient.Connect(builder.Configuration);
|
||||
// Configure the HTTP request pipeline.
|
||||
|
@ -0,0 +1,59 @@
|
||||
@{
|
||||
ViewData["Title"] = "AddComponentsToFile";
|
||||
}
|
||||
<head>
|
||||
<link rel="stylesheet" href="~/css/style.css" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Отчет (pdf)</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>
|
||||
<br>
|
||||
<div class="buttons-action-with-files">
|
||||
<div class="button">
|
||||
<button type ="submit" class="button-action">На почту</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<button type="button" id="demonstrate" class="button-action">Показать</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="report"></div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function check() {
|
||||
var dateFrom = $('#dateFrom').val();
|
||||
var dateTo = $('#dateTo').val();
|
||||
if (dateFrom && dateTo) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetComponentsReport",
|
||||
data: { dateFrom: dateFrom, dateTo: dateTo },
|
||||
success: function (result) {
|
||||
if (result != null) {
|
||||
$('#report').html(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#demonstrate').on('click', (e) => check());
|
||||
</script>
|
||||
}
|
@ -62,7 +62,7 @@
|
||||
<a class="nav-link" asparea="" asp-controller="Home" asp-action="ComponentOrderReport">Отчет (word/excel)</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" asparea="" asp-controller="Home" asp-action="AddDinnerToFile">Отчет (pdf) </a>
|
||||
<a class="nav-link" asparea="" asp-controller="Home" asp-action="AddComponentsToFile">Отчет (pdf) </a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
8
DiningRoom/DiningRoomView/FormMain.Designer.cs
generated
8
DiningRoom/DiningRoomView/FormMain.Designer.cs
generated
@ -117,10 +117,10 @@
|
||||
//
|
||||
// wordToolStripMenuItem
|
||||
//
|
||||
wordToolStripMenuItem.Name = "wordToolStripMenuItem";
|
||||
wordToolStripMenuItem.Size = new Size(103, 22);
|
||||
wordToolStripMenuItem.Text = "Word";
|
||||
wordToolStripMenuItem.Click += отчетWordToolStripMenuItem_Click;
|
||||
//wordToolStripMenuItem.Name = "wordToolStripMenuItem";
|
||||
//wordToolStripMenuItem.Size = new Size(103, 22);
|
||||
//wordToolStripMenuItem.Text = "Word";
|
||||
//wordToolStripMenuItem.Click += отчетWordToolStripMenuItem_Click;
|
||||
//
|
||||
// excelToolStripMenuItem
|
||||
//
|
||||
|
@ -142,39 +142,39 @@ namespace DiningRoomView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void отчетWordToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
//private void отчетWordToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
// if (dialog.ShowDialog() == DialogResult.OK)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
|
||||
using (var formProductSelection = new FormComponentSelection(_logicC, _currentUser))
|
||||
{
|
||||
// using (var formProductSelection = new FormComponentSelection(_logicC, _currentUser))
|
||||
// {
|
||||
|
||||
if (formProductSelection.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var selectedProducts = formProductSelection.SelectedProducts;
|
||||
SelectedComp = selectedProducts;
|
||||
if (selectedProducts != null && selectedProducts.Any())
|
||||
{
|
||||
var reportData = _reportLogic.GetReportComponentsWithOrders(selectedProducts);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (formProductSelection.ShowDialog() == DialogResult.OK)
|
||||
// {
|
||||
// var selectedProducts = formProductSelection.SelectedProducts;
|
||||
// SelectedComp = selectedProducts;
|
||||
// if (selectedProducts != null && selectedProducts.Any())
|
||||
// {
|
||||
// var reportData = _reportLogic.GetReportComponentsWithOrders(selectedProducts);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
_logger.LogInformation("Загрузка списка компонентов по заказам");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
_reportLogic.SaveReportToWordFile(new ReportBindingModel { FileName = dialog.FileName },SelectedComp);
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
// _logger.LogInformation("Загрузка списка компонентов по заказам");
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// _logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
||||
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// }
|
||||
// _reportLogic.SaveReportToWordFile(new ReportBindingModel { FileName = dialog.FileName },SelectedComp);
|
||||
// MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
// }
|
||||
//}
|
||||
private void списокПродуктовPDFToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportComponentsByDate));
|
||||
|
@ -32,7 +32,7 @@ namespace DiningRoomView
|
||||
}
|
||||
try
|
||||
{
|
||||
var dataSource = _logic.GetReportComponentsByCardDate(new ReportBindingModel
|
||||
var dataSource = _logic.GetReportComponentsByDate(new ReportBindingModel
|
||||
{
|
||||
DateFrom = DateTime.SpecifyKind(dateTimePickerFrom.Value, DateTimeKind.Utc),
|
||||
DateTo = DateTime.SpecifyKind(dateTimePickerTo.Value, DateTimeKind.Utc)
|
||||
@ -148,7 +148,7 @@ namespace DiningRoomView
|
||||
Title = "Отчет",
|
||||
DateFrom = dateTimePickerFrom.Value,
|
||||
DateTo = dateTimePickerTo.Value,
|
||||
Components = _logic.GetReportComponentsByCardDate(new ReportBindingModel
|
||||
Components = _logic.GetReportComponentsByDate(new ReportBindingModel
|
||||
{
|
||||
DateFrom = DateTime.SpecifyKind(dateTimePickerFrom.Value, DateTimeKind.Utc),
|
||||
DateTo = DateTime.SpecifyKind(dateTimePickerTo.Value, DateTimeKind.Utc)
|
||||
|
@ -32,7 +32,7 @@
|
||||
ColumnComponent = new DataGridViewTextBoxColumn();
|
||||
ColumnProduct = new DataGridViewTextBoxColumn();
|
||||
ColumnCount = new DataGridViewTextBoxColumn();
|
||||
buttonSaveToExcel = new Button();
|
||||
//buttonSaveToExcel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -78,21 +78,21 @@
|
||||
//
|
||||
// buttonSaveToExcel
|
||||
//
|
||||
buttonSaveToExcel.Location = new Point(14, 14);
|
||||
buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||
buttonSaveToExcel.Size = new Size(186, 27);
|
||||
buttonSaveToExcel.TabIndex = 1;
|
||||
buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
|
||||
//buttonSaveToExcel.Location = new Point(14, 14);
|
||||
//buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
|
||||
//buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||
//buttonSaveToExcel.Size = new Size(186, 27);
|
||||
//buttonSaveToExcel.TabIndex = 1;
|
||||
//buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||
//buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||
//buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
|
||||
//
|
||||
// FormReportProductComponents
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(616, 557);
|
||||
Controls.Add(buttonSaveToExcel);
|
||||
//Controls.Add(buttonSaveToExcel);
|
||||
Controls.Add(dataGridView);
|
||||
Margin = new Padding(4, 3, 4, 3);
|
||||
Name = "FormReportProductComponents";
|
||||
|
@ -95,27 +95,27 @@ namespace DiningRoomView
|
||||
|
||||
|
||||
|
||||
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
//private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||
// if (dialog.ShowDialog() == DialogResult.OK)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
|
||||
_logic.SaveReportToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
},SelectedComp);
|
||||
_logger.LogInformation("Сохранение списка изделий по компонентам");
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
// _logic.SaveReportToExcelFile(new ReportBindingModel
|
||||
// {
|
||||
// FileName = dialog.FileName
|
||||
// },SelectedComp);
|
||||
// _logger.LogInformation("Сохранение списка изделий по компонентам");
|
||||
// MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// _logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
||||
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user