Mochalov D.V. LabWork05_Hard #13
45
LawFirm/LawFirm/FormReportDateOrders.Designer.cs
generated
45
LawFirm/LawFirm/FormReportDateOrders.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
@ -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)
|
||||
|
@ -26,7 +26,7 @@
|
||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="SumOrders">
|
||||
<DataField>TotalSumOrders</DataField>
|
||||
<DataField>SumOrders</DataField>
|
||||
<rd:TypeName>System.Double</rd:TypeName>
|
||||
</Field>
|
||||
</Fields>
|
||||
@ -41,40 +41,6 @@
|
||||
<ReportSection>
|
||||
<Body>
|
||||
<ReportItems>
|
||||
<Textbox Name="ReportParameterPeriod">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
||||
<Style>
|
||||
<FontSize>14pt</FontSize>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Center</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
||||
<Top>1cm</Top>
|
||||
<Height>1cm</Height>
|
||||
<Width>21cm</Width>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<VerticalAlign>Middle</VerticalAlign>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<Textbox Name="TextboxTitle">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
@ -96,7 +62,6 @@
|
||||
</Paragraphs>
|
||||
<Height>1cm</Height>
|
||||
<Width>21cm</Width>
|
||||
<ZIndex>1</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
@ -134,7 +99,7 @@
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Дата создания</Value>
|
||||
<Value>Дата</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
@ -166,7 +131,7 @@
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Количество заказов</Value>
|
||||
<Value>Количество</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
@ -316,7 +281,6 @@
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<rd:Selected>true</rd:Selected>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
</TablixCells>
|
||||
@ -345,7 +309,7 @@
|
||||
<Left>0.55245cm</Left>
|
||||
<Height>1.2cm</Height>
|
||||
<Width>13cm</Width>
|
||||
<ZIndex>2</ZIndex>
|
||||
<ZIndex>1</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>Double</Style>
|
||||
@ -374,7 +338,7 @@
|
||||
<Left>8.55245cm</Left>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>2.5cm</Width>
|
||||
<ZIndex>3</ZIndex>
|
||||
<ZIndex>2</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
@ -407,7 +371,7 @@
|
||||
<Left>11.05245cm</Left>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>2.5cm</Width>
|
||||
<ZIndex>4</ZIndex>
|
||||
<ZIndex>3</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
|
@ -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<Tuple<string, int>>(),
|
||||
Count = 0
|
||||
};
|
||||
foreach (var furnitureCount in shop.ShopDocuments.Values)
|
||||
foreach (var docCount in shop.ShopDocuments.Values)
|
||||
{
|
||||
record.Documents.Add(new Tuple<string, int>(furnitureCount.Item1.DocumentName, furnitureCount.Item2));
|
||||
record.Count += furnitureCount.Item2;
|
||||
record.Documents.Add(new Tuple<string, int>(docCount.Item1.DocumentName, docCount.Item2));
|
||||
record.Count += docCount.Item2;
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportDateOrdersViewModel> GetDateOrders(ReportBindingModel model)
|
||||
public List<ReportDateOrdersViewModel> 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()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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<string> { "3cm", "3cm", "7cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Дата заказа", "Количество заказов", "Сумма" },
|
||||
Texts = new List<string> { "Дата", "Количество", "Сумма" },
|
||||
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);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace LawFirmContracts.BusinessLogicContracts
|
||||
void SaveShopsToWordFile(ReportBindingModel model);
|
||||
void SaveShopDocumentsToExcelFile(ReportBindingModel model);
|
||||
List<ReportShopDocumentsViewModel> GetShopDocuments();
|
||||
List<ReportDateOrdersViewModel> GetDateOrders(ReportBindingModel model);
|
||||
List<ReportDateOrdersViewModel> GetDateOrders();
|
||||
void SaveDateOrdersToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user