почти готово БЕЗ УЧЕТА ТРЕБОВАНИЙ есть баг с загрузкой отчета

This commit is contained in:
ekallin 2024-03-24 20:42:18 +04:00
parent c3c88ad6e1
commit 1aa25cc87c
11 changed files with 50 additions and 44 deletions

View File

@ -172,7 +172,6 @@ namespace SushiBarView
{
form.ShowDialog();
}
}
}
}

View File

@ -29,12 +29,12 @@
private void InitializeComponent()
{
panel = new Panel();
dateTimePickerDateTo = new DateTimePicker();
dateTimePickerDateFrom = new DateTimePicker();
buttonMake = new Button();
buttonToPdf = new Button();
labelTo = new Label();
labelFrom = new Label();
buttonToPdf = new Button();
dateTimePickerDateFrom = new DateTimePicker();
labelTo = new Label();
dateTimePickerDateTo = new DateTimePicker();
buttonMake = new Button();
panel.SuspendLayout();
SuspendLayout();
//
@ -52,28 +52,14 @@
panel.Size = new Size(1321, 71);
panel.TabIndex = 3;
//
// dateTimePickerDateTo
// labelFrom
//
dateTimePickerDateTo.Location = new Point(365, 27);
dateTimePickerDateTo.Name = "dateTimePickerDateTo";
dateTimePickerDateTo.Size = new Size(250, 27);
dateTimePickerDateTo.TabIndex = 1;
//
// dateTimePickerDateFrom
//
dateTimePickerDateFrom.Location = new Point(51, 27);
dateTimePickerDateFrom.Name = "dateTimePickerDateFrom";
dateTimePickerDateFrom.Size = new Size(250, 27);
dateTimePickerDateFrom.TabIndex = 0;
//
// buttonMake
//
buttonMake.Location = new Point(677, 27);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(132, 29);
buttonMake.TabIndex = 3;
buttonMake.Text = "Сформировать";
buttonMake.UseVisualStyleBackColor = true;
labelFrom.AutoSize = true;
labelFrom.Location = new Point(16, 31);
labelFrom.Name = "labelFrom";
labelFrom.Size = new Size(18, 20);
labelFrom.TabIndex = 3;
labelFrom.Text = "С";
//
// buttonToPdf
//
@ -83,6 +69,14 @@
buttonToPdf.TabIndex = 4;
buttonToPdf.Text = "В PDF";
buttonToPdf.UseVisualStyleBackColor = true;
buttonToPdf.Click += ButtonToPdf_Click;
//
// dateTimePickerDateFrom
//
dateTimePickerDateFrom.Location = new Point(51, 27);
dateTimePickerDateFrom.Name = "dateTimePickerDateFrom";
dateTimePickerDateFrom.Size = new Size(250, 27);
dateTimePickerDateFrom.TabIndex = 0;
//
// labelTo
//
@ -93,14 +87,22 @@
labelTo.TabIndex = 4;
labelTo.Text = "По";
//
// labelFrom
// dateTimePickerDateTo
//
labelFrom.AutoSize = true;
labelFrom.Location = new Point(16, 31);
labelFrom.Name = "labelFrom";
labelFrom.Size = new Size(18, 20);
labelFrom.TabIndex = 3;
labelFrom.Text = "С";
dateTimePickerDateTo.Location = new Point(365, 27);
dateTimePickerDateTo.Name = "dateTimePickerDateTo";
dateTimePickerDateTo.Size = new Size(250, 27);
dateTimePickerDateTo.TabIndex = 1;
//
// buttonMake
//
buttonMake.Location = new Point(677, 27);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(132, 29);
buttonMake.TabIndex = 3;
buttonMake.Text = "Сформировать";
buttonMake.UseVisualStyleBackColor = true;
buttonMake.Click += ButtonMake_Click;
//
// FormReportOrders
//

View File

@ -28,7 +28,9 @@ namespace SushiBarView.Reports
{
Dock = DockStyle.Fill
};
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
var path = Directory.GetParent(Directory.GetCurrentDirectory())?.Parent?.Parent?.ToString() + "\\ReportOrders.rdlc";
reportViewer.LocalReport.LoadReportDefinition(new FileStream(path, FileMode.Open));
//reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
Controls.Clear();
Controls.Add(reportViewer);
Controls.Add(panel);
@ -52,11 +54,11 @@ namespace SushiBarView.Reports
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
$"c{dateTimePickerDateFrom.Value.ToShortDateString()} по {dateTimePickerDateTo.Value.ToShortDateString()}")
$"c {dateTimePickerDateFrom.Value.ToShortDateString()} по {dateTimePickerDateTo.Value.ToShortDateString()}")
};
reportViewer.LocalReport.SetParameters(parameters);
reportViewer.RefreshReport();
_logger.LogInformation("Загрузка списка заказов на период {From} - {To} ",
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}",
dateTimePickerDateFrom.Value.ToShortDateString(), dateTimePickerDateTo.Value.ToShortDateString());
}
catch (Exception ex)
@ -86,7 +88,7 @@ namespace SushiBarView.Reports
DateFrom = dateTimePickerDateFrom.Value,
DateTo = dateTimePickerDateTo.Value
});
_logger.LogInformation("Сохранение списка заказов на период { From} - { To} ",
_logger.LogInformation("Сохранение списка заказов на период {From}-{To} ",
dateTimePickerDateFrom.Value.ToShortDateString(), dateTimePickerDateTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

View File

@ -77,6 +77,7 @@
buttonSaveToExcel.TabIndex = 1;
buttonSaveToExcel.Text = "Сохранить в Excel";
buttonSaveToExcel.UseVisualStyleBackColor = false;
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
//
// FormReportSushiComponent
//
@ -87,6 +88,7 @@
Controls.Add(dataGridView1);
Name = "FormReportSushiComponent";
Text = "Компоненты по изделиям";
Load += FormReportProductComponents_Load;
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}

View File

@ -3,6 +3,8 @@ using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using SushiBarBusinessLogic;
using SushiBarBusinessLogic.BusinessLogic;
using SushiBarBusinessLogic.OfficePackage;
using SushiBarBusinessLogic.OfficePackage.Implements;
using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.StoragesContracts;
using SushiBarDatabaseImplement.Implements;
@ -48,6 +50,10 @@ namespace SushiBar
services.AddTransient<ISushiLogic, SushiLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();

View File

@ -5,11 +5,6 @@ using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.SearchModel;
using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic
{

View File

@ -25,7 +25,7 @@ namespace SushiBarDatabaseImplement.Implements
if (model.Id.HasValue)
return context.Orders.Where(x => x.Id == model.Id).Select(x => AccessViewModel(x.GetViewModel)).ToList();
else
return context.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => AccessViewModel(x.GetViewModel)).ToList();
return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => AccessViewModel(x.GetViewModel)).ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)
{