diff --git a/LawFirm/LawFirm/FormReportDateOrders.Designer.cs b/LawFirm/LawFirm/FormReportDateOrders.Designer.cs index a8f19ff..543ddb5 100644 --- a/LawFirm/LawFirm/FormReportDateOrders.Designer.cs +++ b/LawFirm/LawFirm/FormReportDateOrders.Designer.cs @@ -31,10 +31,6 @@ this.panel = new System.Windows.Forms.Panel(); this.buttonCreateToPdf = new System.Windows.Forms.Button(); this.buttonCreateReport = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.dateTimePickerEnd = new System.Windows.Forms.DateTimePicker(); - this.dateTimePickerStart = new System.Windows.Forms.DateTimePicker(); this.panel.SuspendLayout(); this.SuspendLayout(); // @@ -42,10 +38,6 @@ // this.panel.Controls.Add(this.buttonCreateToPdf); this.panel.Controls.Add(this.buttonCreateReport); - this.panel.Controls.Add(this.label2); - this.panel.Controls.Add(this.label1); - this.panel.Controls.Add(this.dateTimePickerEnd); - this.panel.Controls.Add(this.dateTimePickerStart); this.panel.Dock = System.Windows.Forms.DockStyle.Top; this.panel.Location = new System.Drawing.Point(0, 0); this.panel.Name = "panel"; @@ -72,38 +64,6 @@ this.buttonCreateReport.UseVisualStyleBackColor = true; this.buttonCreateReport.Click += new System.EventHandler(this.buttonCreateReport_Click); // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(369, 9); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(56, 20); - this.label2.TabIndex = 3; - this.label2.Text = "Конец:"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(87, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(64, 20); - this.label1.TabIndex = 2; - this.label1.Text = "Начало:"; - // - // dateTimePickerEnd - // - this.dateTimePickerEnd.Location = new System.Drawing.Point(307, 39); - this.dateTimePickerEnd.Name = "dateTimePickerEnd"; - this.dateTimePickerEnd.Size = new System.Drawing.Size(187, 27); - this.dateTimePickerEnd.TabIndex = 1; - // - // dateTimePickerStart - // - this.dateTimePickerStart.Location = new System.Drawing.Point(35, 39); - this.dateTimePickerStart.Name = "dateTimePickerStart"; - this.dateTimePickerStart.Size = new System.Drawing.Size(187, 27); - this.dateTimePickerStart.TabIndex = 0; - // // FormReportDateOrders // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); @@ -113,7 +73,6 @@ this.Name = "FormReportDateOrders"; this.Text = "Заказы по датам"; this.panel.ResumeLayout(false); - this.panel.PerformLayout(); this.ResumeLayout(false); } @@ -123,9 +82,5 @@ private Panel panel; private Button buttonCreateToPdf; private Button buttonCreateReport; - private Label label2; - private Label label1; - private DateTimePicker dateTimePickerEnd; - private DateTimePicker dateTimePickerStart; } } \ No newline at end of file diff --git a/LawFirm/LawFirm/FormReportDateOrders.cs b/LawFirm/LawFirm/FormReportDateOrders.cs index c0c0f25..9bce4aa 100644 --- a/LawFirm/LawFirm/FormReportDateOrders.cs +++ b/LawFirm/LawFirm/FormReportDateOrders.cs @@ -38,25 +38,14 @@ namespace LawFirmView private void buttonCreateReport_Click(object sender, EventArgs e) { - if (dateTimePickerStart.Value.Date >= dateTimePickerEnd.Value.Date) - { - MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } try { - var dataSource = _logic.GetDateOrders(new ReportBindingModel - { - DateFrom = dateTimePickerStart.Value, - DateTo = dateTimePickerEnd.Value - }); + var dataSource = _logic.GetDateOrders(); var source = new ReportDataSource("DataSetOrders", dataSource); reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(source); - var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c {dateTimePickerStart.Value.ToShortDateString()} по {dateTimePickerEnd.Value.ToShortDateString()}") }; - reportViewer.LocalReport.SetParameters(parameters); reportViewer.RefreshReport(); - _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerStart.Value.ToShortDateString(), dateTimePickerEnd.Value.ToShortDateString()); + _logger.LogInformation("Загрузка списка заказов на весь период по датам"); } catch (Exception ex) { @@ -67,11 +56,6 @@ namespace LawFirmView private void buttonCreateToPdf_Click(object sender, EventArgs e) { - if (dateTimePickerStart.Value.Date >= dateTimePickerEnd.Value.Date) - { - MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; if (dialog.ShowDialog() == DialogResult.OK) { @@ -79,11 +63,9 @@ namespace LawFirmView { _logic.SaveDateOrdersToPdfFile(new ReportBindingModel { - FileName = dialog.FileName, - DateFrom = dateTimePickerStart.Value, - DateTo = dateTimePickerEnd.Value + FileName = dialog.FileName }); - _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerStart.Value.ToShortDateString(), dateTimePickerEnd.Value.ToShortDateString()); + _logger.LogInformation("Сохранение списка заказов на весь период по датам"); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) diff --git a/LawFirm/LawFirm/ReportOrdersByDate.rdlc b/LawFirm/LawFirm/ReportOrdersByDate.rdlc index 7ce32cb..6755bc1 100644 --- a/LawFirm/LawFirm/ReportOrdersByDate.rdlc +++ b/LawFirm/LawFirm/ReportOrdersByDate.rdlc @@ -26,7 +26,7 @@ System.Decimal - TotalSumOrders + SumOrders System.Double @@ -41,40 +41,6 @@ - - true - true - - - - - =Parameters!ReportParameterPeriod.Value - - - - - - - ReportParameterPeriod - 1cm - 1cm - 21cm - - - Middle - 2pt - 2pt - 2pt - 2pt - - true true @@ -96,7 +62,6 @@ 1cm 21cm - 1 @@ -134,7 +99,7 @@ - Дата создания + Дата @@ -166,7 +131,7 @@ - Количество заказов + Количество @@ -316,7 +281,6 @@ 2pt - true @@ -345,7 +309,7 @@ 0.55245cm 1.2cm 13cm - 2 + 1 @@ -374,7 +338,7 @@ 8.55245cm 0.6cm 2.5cm - 3 + 2 @@ -407,7 +371,7 @@ 11.05245cm 0.6cm 2.5cm - 4 + 3 diff --git a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs index 3925d99..3423cff 100644 --- a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs @@ -123,7 +123,7 @@ namespace LawFirmBusinessLogic.BusinessLogics _saveToExcel.CreateShopReport(new ExcelInfo { FileName = model.FileName, - Title = "Список магазинов с изделиями", + Title = "Загруженность магазинов", ShopDocuments = GetShopDocuments() }); } @@ -140,17 +140,17 @@ namespace LawFirmBusinessLogic.BusinessLogics Documents = new List>(), Count = 0 }; - foreach (var furnitureCount in shop.ShopDocuments.Values) + foreach (var docCount in shop.ShopDocuments.Values) { - record.Documents.Add(new Tuple(furnitureCount.Item1.DocumentName, furnitureCount.Item2)); - record.Count += furnitureCount.Item2; + record.Documents.Add(new Tuple(docCount.Item1.DocumentName, docCount.Item2)); + record.Count += docCount.Item2; } list.Add(record); } return list; } - public List GetDateOrders(ReportBindingModel model) + public List GetDateOrders() { return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportDateOrdersViewModel { @@ -164,10 +164,8 @@ namespace LawFirmBusinessLogic.BusinessLogics _saveToPdf.CreateReportDateDoc(new PdfInfo { FileName = model.FileName, - Title = "Список объединенных по дате заказов", - DateFrom = model.DateFrom!.Value, - DateTo = model.DateTo!.Value, - DateOrders = GetDateOrders(model) + Title = "Заказы по датам", + DateOrders = GetDateOrders() }); } } diff --git a/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 4322a00..eff0ed0 100644 --- a/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -56,16 +56,10 @@ namespace LawFirmBusinessLogic.OfficePackage Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateParagraph(new PdfParagraph - { - Text = $"с{info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", - Style = "Normal", - ParagraphAlignment = PdfParagraphAlignmentType.Center - }); CreateTable(new List { "3cm", "3cm", "7cm" }); CreateRow(new PdfRowParameters { - Texts = new List { "Дата заказа", "Количество заказов", "Сумма" }, + Texts = new List { "Дата", "Количество", "Сумма" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); @@ -82,7 +76,7 @@ namespace LawFirmBusinessLogic.OfficePackage { Text = $"Итого: {info.DateOrders.Sum(x => x.SumOrders)}\t", Style = "Normal", - ParagraphAlignment = PdfParagraphAlignmentType.Right + ParagraphAlignment = PdfParagraphAlignmentType.Center }); SavePdf(info); } diff --git a/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs b/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs index bd47c3c..17bff04 100644 --- a/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs +++ b/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs @@ -24,7 +24,7 @@ namespace LawFirmContracts.BusinessLogicContracts void SaveShopsToWordFile(ReportBindingModel model); void SaveShopDocumentsToExcelFile(ReportBindingModel model); List GetShopDocuments(); - List GetDateOrders(ReportBindingModel model); + List GetDateOrders(); void SaveDateOrdersToPdfFile(ReportBindingModel model); } }