Готово

This commit is contained in:
dimazhelovanov 2023-03-25 21:25:38 +03:00
parent 2e91117b67
commit d052f1bdd7
13 changed files with 596 additions and 113 deletions

View File

@ -20,7 +20,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.2" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
</ItemGroup>

View File

@ -28,93 +28,92 @@
/// </summary>
private void InitializeComponent()
{
this.panel = new System.Windows.Forms.Panel();
this.ButtonToPdf = new System.Windows.Forms.Button();
this.ButtonMake = new System.Windows.Forms.Button();
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
this.label2 = new System.Windows.Forms.Label();
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
this.label1 = new System.Windows.Forms.Label();
this.panel.SuspendLayout();
this.SuspendLayout();
panel = new Panel();
ButtonToPdf = new Button();
ButtonMake = new Button();
dateTimePickerTo = new DateTimePicker();
label2 = new Label();
dateTimePickerFrom = new DateTimePicker();
label1 = new Label();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
this.panel.Controls.Add(this.ButtonToPdf);
this.panel.Controls.Add(this.ButtonMake);
this.panel.Controls.Add(this.dateTimePickerTo);
this.panel.Controls.Add(this.label2);
this.panel.Controls.Add(this.dateTimePickerFrom);
this.panel.Controls.Add(this.label1);
this.panel.Location = new System.Drawing.Point(0, 2);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(932, 42);
this.panel.TabIndex = 0;
panel.Controls.Add(ButtonToPdf);
panel.Controls.Add(ButtonMake);
panel.Controls.Add(dateTimePickerTo);
panel.Controls.Add(label2);
panel.Controls.Add(dateTimePickerFrom);
panel.Controls.Add(label1);
panel.Location = new Point(-6, 2);
panel.Name = "panel";
panel.Size = new Size(943, 42);
panel.TabIndex = 0;
//
// ButtonToPdf
//
this.ButtonToPdf.Location = new System.Drawing.Point(829, 8);
this.ButtonToPdf.Name = "ButtonToPdf";
this.ButtonToPdf.Size = new System.Drawing.Size(94, 29);
this.ButtonToPdf.TabIndex = 5;
this.ButtonToPdf.Text = "в PDF";
this.ButtonToPdf.UseVisualStyleBackColor = true;
this.ButtonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
ButtonToPdf.Location = new Point(829, 8);
ButtonToPdf.Name = "ButtonToPdf";
ButtonToPdf.Size = new Size(94, 29);
ButtonToPdf.TabIndex = 5;
ButtonToPdf.Text = "в PDF";
ButtonToPdf.UseVisualStyleBackColor = true;
ButtonToPdf.Click += ButtonToPdf_Click;
//
// ButtonMake
//
this.ButtonMake.Location = new System.Drawing.Point(550, 8);
this.ButtonMake.Name = "ButtonMake";
this.ButtonMake.Size = new System.Drawing.Size(128, 29);
this.ButtonMake.TabIndex = 4;
this.ButtonMake.Text = "Сформировать";
this.ButtonMake.UseVisualStyleBackColor = true;
this.ButtonMake.Click += new System.EventHandler(this.ButtonMake_Click);
ButtonMake.Location = new Point(550, 8);
ButtonMake.Name = "ButtonMake";
ButtonMake.Size = new Size(128, 29);
ButtonMake.TabIndex = 4;
ButtonMake.Text = "Сформировать";
ButtonMake.UseVisualStyleBackColor = true;
ButtonMake.Click += ButtonMake_Click;
//
// dateTimePickerTo
//
this.dateTimePickerTo.Location = new System.Drawing.Point(269, 10);
this.dateTimePickerTo.Name = "dateTimePickerTo";
this.dateTimePickerTo.Size = new System.Drawing.Size(250, 27);
this.dateTimePickerTo.TabIndex = 3;
dateTimePickerTo.Location = new Point(269, 10);
dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(250, 27);
dateTimePickerTo.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(236, 12);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(27, 20);
this.label2.TabIndex = 2;
this.label2.Text = "по";
label2.AutoSize = true;
label2.Location = new Point(236, 12);
label2.Name = "label2";
label2.Size = new Size(27, 20);
label2.TabIndex = 2;
label2.Text = "по";
//
// dateTimePickerFrom
//
this.dateTimePickerFrom.Location = new System.Drawing.Point(42, 10);
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
this.dateTimePickerFrom.Size = new System.Drawing.Size(188, 27);
this.dateTimePickerFrom.TabIndex = 1;
dateTimePickerFrom.Location = new Point(42, 10);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(188, 27);
dateTimePickerFrom.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(20, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(16, 20);
this.label1.TabIndex = 0;
this.label1.Text = "с";
label1.AutoSize = true;
label1.Location = new Point(20, 12);
label1.Name = "label1";
label1.Size = new Size(16, 20);
label1.TabIndex = 0;
label1.Text = "с";
//
// FormReportOrders
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(935, 450);
this.Controls.Add(this.panel);
this.Name = "FormReportOrders";
this.Text = "FormReportOrders";
this.panel.ResumeLayout(false);
this.panel.PerformLayout();
this.ResumeLayout(false);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(938, 450);
Controls.Add(panel);
Name = "FormReportOrders";
Text = "FormReportOrders";
panel.ResumeLayout(false);
panel.PerformLayout();
ResumeLayout(false);
}
#endregion

View File

@ -30,10 +30,11 @@ namespace BlacksmithWorkshop
Dock = DockStyle.Fill
};
reportViewer.LocalReport.LoadReportDefinition(new
FileStream("C:\\Users\\User\\source\\repos\\BlacksmithWorkshop\\BlacksmithWorkshop\\BlacksmithWorkshop\\ReportOrders.rdlc", FileMode.Open));
FileStream("C:\\Users\\User\\source\\repos\\BlacksmithWorkshop\\BlacksmithWorkshop\\BlacksmithWorkshop\\ReportOrders.rdlc", FileMode.Open));
Controls.Clear();
Controls.Add(reportViewer);
Controls.Add(panel);
Controls.Add(reportViewer);
}
private void ButtonMake_Click(object sender, EventArgs e)
@ -51,13 +52,16 @@ namespace BlacksmithWorkshop
DateFrom = dateTimePickerFrom.Value,
DateTo = dateTimePickerTo.Value
});
var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") }; reportViewer.LocalReport.SetParameters(parameters);
var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
reportViewer.LocalReport.SetParameters(parameters);
reportViewer.RefreshReport();
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(),
dateTimePickerTo.Value.ToShortDateString());
}
catch (Exception ex)
{
@ -99,12 +103,12 @@ namespace BlacksmithWorkshop
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}
}
}

View File

@ -1,6 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="BlacksmithWorkshopContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>605c80d0-7d6c-4474-934b-337c1a3114c7</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSetOrders">
<Query>
<DataSourceName>BlacksmithWorkshopContractsViewModels</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Id">
<DataField>Id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="DateCreate">
<DataField>DateCreate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="ManufactureName">
<DataField>ManufactureName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>BlacksmithWorkshopDataModels.OrderStatus</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>BlacksmithWorkshopContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrdersViewModel</rd:TableName>
<rd:ObjectDataSourceType>BlacksmithWorkshopContracts.ViewModels.ReportOrdersViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportSections>
<ReportSection>
<Body>
@ -12,9 +56,8 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>Заказ</Value>
<Value>Заказы</Value>
<Style>
<FontFamily>Times New Roman</FontFamily>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
@ -26,7 +69,8 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName>
<Height>0.84553cm</Height>
<Top>0.61383cm</Top>
<Height>1.03603cm</Height>
<Width>16.51cm</Width>
<Style>
<Border>
@ -44,19 +88,21 @@
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value xml:space="preserve"> </Value>
<Style />
</TextRun>
<TextRun>
<Value>=Parameters!ReportParameterPeriod.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Top>0.91609cm</Top>
<Height>0.77611cm</Height>
<Top>1.64986cm</Top>
<Height>0.6985cm</Height>
<Width>16.51cm</Width>
<ZIndex>1</ZIndex>
<Style>
@ -69,11 +115,445 @@
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1.73518cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.66134cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.87301cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.76214cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Номер</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Дата создания</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox4</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox6">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Изделие</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox6</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox8">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Сумма</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox8</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox14">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox14</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.76214cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Id">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Id.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Id</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="DateCreate">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!DateCreate.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>DateCreate</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="ManufactureName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!ManufactureName.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>ManufactureName</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Sum">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Sum.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="OrderStatus">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!OrderStatus.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>OrderStatus</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="Подробности" />
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSetOrders</DataSetName>
<Top>2.86342cm</Top>
<Left>2.26483cm</Left>
<Height>1.52428cm</Height>
<Width>14.26953cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
<Textbox Name="Textbox10">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Итого</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox10</rd:DefaultName>
<Top>4.85987cm</Top>
<Left>10.06687cm</Left>
<Height>0.89633cm</Height>
<Width>2.373cm</Width>
<ZIndex>3</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="Textbox11">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox11</rd:DefaultName>
<Top>4.85987cm</Top>
<Left>12.47514cm</Left>
<Height>0.89633cm</Height>
<Width>2.5cm</Width>
<ZIndex>4</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Height>2in</Height>
<Height>2.75in</Height>
<Style />
</Body>
<Width>6.5in</Width>
<Width>6.58367in</Width>
<Page>
<PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth>
@ -107,5 +587,5 @@
</GridLayoutDefinition>
</ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>57846e0b-e3a0-4418-ab77-05190e6a6b9e</rd:ReportID>
<rd:ReportID>ae77169d-5beb-4d55-9ff7-96b65ad9bcfa</rd:ReportID>
</Report>

View File

@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2010.ExcelAc;
namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
{
@ -40,25 +41,25 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
public List<ReportManufactureComponentViewModel> GetManufactureComponent()
{
var components = _componentStorage.GetFullList();
var products = _manufactureStorage.GetFullList();
var manufactures = _manufactureStorage.GetFullList();
var list = new List<ReportManufactureComponentViewModel>();
foreach (var component in components)
foreach (var manufacture in manufactures)
{
var record = new ReportManufactureComponentViewModel
{
ManufactureName = component.ComponentName,
ManufactureName = manufacture.ManufactureName,
Components = new List<Tuple<string, int>>(),
TotalCount = 0
};
foreach (var product in products)
foreach (var component in manufacture.ManufactureComponents)
{
if (product.ManufactureComponents.ContainsKey(component.Id))
{
record.Components.Add(new Tuple<string,
int>(product.ManufactureName, product.ManufactureComponents[component.Id].Item2));
record.TotalCount +=
product.ManufactureComponents[component.Id].Item2;
}
int>(component.Value.Item1.ComponentName, component.Value.Item2));
record.TotalCount += component.Value.Item2;
}
list.Add(record);
}
@ -71,7 +72,8 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
/// <returns></returns>
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
{
return _orderStorage.GetFilteredList(new OrderSearchModel
return _orderStorage.GetFilteredList(new OrderSearchModel
{
DateFrom
= model.DateFrom,
@ -82,9 +84,12 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
Id = x.Id,
DateCreate = x.DateCreate,
ManufactureName = x.ManufactureName,
Sum = x.Sum
Sum = x.Sum,
OrderStatus = x.Status.ToString()
})
.ToList();
}
/// <summary>
/// Сохранение компонент в файл-Word
@ -123,9 +128,12 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
FileName = model.FileName,
Title = "Список заказов",
DateFrom = model.DateFrom!.Value,
DateTo = model.DateTo!.Value,
Orders = GetOrders(model)
});
}
}
}

View File

@ -26,11 +26,11 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage
= "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "2cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие",
"Сумма" },
"Сумма", "Статус" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@ -39,7 +39,7 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage
CreateRow(new PdfRowParameters
{
Texts = new List<string> { order.Id.ToString(),
order.DateCreate.ToShortDateString(), order.ManufactureName, order.Sum.ToString() },
order.DateCreate.ToShortDateString(), order.ManufactureName, order.Sum.ToString(), order.OrderStatus.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IReportLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>BlacksmithWorkshopContracts.BusinessLogicsContracts.IReportLogic, BlacksmithWorkshopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -12,6 +12,7 @@ namespace BlacksmithWorkshopContracts.ViewModels
public DateTime DateCreate { get; set; }
public string ManufactureName { get; set; } = string.Empty;
public double Sum { get; set; }
public string OrderStatus { get; set; } = string.Empty;
}
}

View File

@ -44,13 +44,13 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
{
return new();
}
using var context = new BlacksmithWorkshopDatabase();
return context.Orders
.ToList()
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}

View File

@ -36,9 +36,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Models
return _manufactureComponents;
}
}
[ForeignKey("ProductId")]
[ForeignKey("ManufactureId")]
public virtual List<ManufactureComponent> Components { get; set; } = new();
[ForeignKey("ProductId")]
[ForeignKey("ManufactureId")]
public virtual List<Order> Orders { get; set; } = new();
public static Manufacture Create(BlacksmithWorkshopDatabase context,
ManufactureBindingModel model)

View File

@ -26,6 +26,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Models
public DateTime? DateImplement { get; private set; }
public int Id { get; private set; }
//public virtual Manufacture Manufacture { get; set; }
public static Order? Create(OrderBindingModel model)
{
if (model == null)

View File

@ -39,7 +39,7 @@ namespace BlacksmithWorkshopFileImplement.Implements
}
return source.Orders
.FirstOrDefault(x =>
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
(model.Id.HasValue && x.Id == model.Id) && model.DateFrom <= x.DateCreate && x.DateCreate >= model.DateTo)?.GetViewModel;
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)

View File

@ -59,7 +59,7 @@ namespace BlacksmithWorkshopListImplement.Implements
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)
if (order.Id == model.Id )/*|| model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo)*/
{
result.Add(order.GetViewModel);
}