This commit is contained in:
MaxKarme 2023-03-28 10:45:31 +04:00
parent f41a3493b1
commit f396af1eb9
17 changed files with 313 additions and 50 deletions

View File

@ -172,8 +172,8 @@
// //
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem"; this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(269, 26); this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(269, 26);
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов"; this.списокКомпонентовToolStripMenuItem.Text = "Список пицц";
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click); this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.PizzasToolStripMenuItem_Click);
// //
// компонентовПоПиццамToolStripMenuItem // компонентовПоПиццамToolStripMenuItem
// //

View File

@ -153,9 +153,7 @@ namespace Pizzeria
LoadData(); LoadData();
} }
private void PizzasToolStripMenuItem_Click(object sender, EventArgs e)
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
e)
{ {
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
@ -164,8 +162,7 @@ e)
{ {
FileName = dialog.FileName FileName = dialog.FileName
}); });
MessageBox.Show("Âûïîëíåíî", "Óñïåõ", MessageBoxButtons.OK, MessageBox.Show("Âûïîëíåíî", "Óñïåõ", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBoxIcon.Information);
} }
} }
private void ComponentPizzasToolStripMenuItem_Click(object sender, EventArgs e) private void ComponentPizzasToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -94,14 +94,14 @@
this.panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel.Location = new System.Drawing.Point(0, 46); this.panel.Location = new System.Drawing.Point(0, 46);
this.panel.Name = "panel"; this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(843, 409); this.panel.Size = new System.Drawing.Size(937, 409);
this.panel.TabIndex = 7; this.panel.TabIndex = 7;
// //
// FormReportOrders // FormReportOrders
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(842, 470); this.ClientSize = new System.Drawing.Size(942, 470);
this.Controls.Add(this.panel); this.Controls.Add(this.panel);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);

View File

@ -23,8 +23,8 @@ namespace Pizzeria
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var elem in dict) foreach (var elem in dict)
{ {
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); dataGridView.Rows.Add(new object[] { elem.PizzaName, "", "" });
foreach (var listElem in elem.Pizzas) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
} }

View File

@ -26,6 +26,21 @@
<ProjectReference Include="..\PizzeriaShopFileImplement\PizzeriaFileImplement.csproj" /> <ProjectReference Include="..\PizzeriaShopFileImplement\PizzeriaFileImplement.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="nlog.config"> <None Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pizzeria.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pizzeria.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -29,6 +29,10 @@
<DataField>PizzaName</DataField> <DataField>PizzaName</DataField>
<rd:TypeName>System.String</rd:TypeName> <rd:TypeName>System.String</rd:TypeName>
</Field> </Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum"> <Field Name="Sum">
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Decimal</rd:TypeName>
@ -116,16 +120,19 @@
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.0889cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>3.21438cm</Width> <Width>2.80328cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>8.23317cm</Width> <Width>7.82207cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.0889cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.0889cm</Width>
</TablixColumn> </TablixColumn>
</TablixColumns> </TablixColumns>
<TablixRows> <TablixRows>
@ -228,6 +235,38 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Order Status</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> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox7"> <Textbox Name="Textbox7">
@ -357,6 +396,36 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </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>
</CellContents>
</TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Sum"> <Textbox Name="Sum">
@ -397,6 +466,7 @@
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember />
</TablixMembers> </TablixMembers>
</TablixColumnHierarchy> </TablixColumnHierarchy>
<TablixRowHierarchy> <TablixRowHierarchy>
@ -413,7 +483,7 @@
<Top>2.48391cm</Top> <Top>2.48391cm</Top>
<Left>0.55245cm</Left> <Left>0.55245cm</Left>
<Height>1.2cm</Height> <Height>1.2cm</Height>
<Width>16.44755cm</Width> <Width>16.89205cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>
@ -491,7 +561,7 @@
<Height>6.27908cm</Height> <Height>6.27908cm</Height>
<Style /> <Style />
</Body> </Body>
<Width>17.4445cm</Width> <Width>18.27233cm</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>

View File

@ -30,11 +30,11 @@ namespace PizzeriaBusinessLogic.OfficePackage
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.ComponentName, Text = pc.PizzaName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var pizza in pc.Pizzas) foreach (var pizza in pc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {

View File

@ -18,10 +18,10 @@ namespace PizzeriaBusinessLogic.OfficePackage
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal", Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" }); CreateTable(new List<string> { "2cm", "3cm", "5cm", "4cm", "3cm" });
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" }, Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
@ -29,7 +29,7 @@ namespace PizzeriaBusinessLogic.OfficePackage
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PizzaName, order.Sum.ToString() }, Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PizzaName, order.OrderStatus, order.Sum.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });

View File

@ -16,11 +16,14 @@ namespace PizzeriaBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
foreach (var component in info.Components) foreach (var component in info.Pizzas)
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) }, Texts = new List<(string, WordTextProperties)> {
(component.PizzaName, new WordTextProperties { Size = "24", Bold = true }),
(" " + component.Price.ToString(), new WordTextProperties { Size = "24" })
},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",

View File

@ -5,6 +5,6 @@ namespace PizzeriaBusinessLogic.OfficePackage.HelperModels
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ComponentViewModel> Components { get; set; } = new(); public List<PizzaViewModel> Pizzas { get; set; } = new();
} }
} }

View File

@ -53,8 +53,7 @@ namespace PizzeriaBusinessLogic.OfficePackage.Implements
var properties = new ParagraphProperties(); var properties = new ParagraphProperties();
properties.AppendChild(new Justification() properties.AppendChild(new Justification()
{ {
Val = Val = GetJustificationValues(paragraphProperties.JustificationType)
GetJustificationValues(paragraphProperties.JustificationType)
}); });
properties.AppendChild(new SpacingBetweenLines properties.AppendChild(new SpacingBetweenLines
{ {
@ -66,8 +65,7 @@ namespace PizzeriaBusinessLogic.OfficePackage.Implements
{ {
paragraphMarkRunProperties.AppendChild(new FontSize paragraphMarkRunProperties.AppendChild(new FontSize
{ {
Val = Val = paragraphProperties.Size
paragraphProperties.Size
}); });
} }
properties.AppendChild(paragraphMarkRunProperties); properties.AppendChild(paragraphMarkRunProperties);
@ -75,8 +73,7 @@ namespace PizzeriaBusinessLogic.OfficePackage.Implements
} }
protected override void CreateWord(WordInfo info) protected override void CreateWord(WordInfo info)
{ {
_wordDocument = WordprocessingDocument.Create(info.FileName, _wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
WordprocessingDocumentType.Document);
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart(); MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
mainPart.Document = new Document(); mainPart.Document = new Document();
_docBody = mainPart.Document.AppendChild(new Body()); _docBody = mainPart.Document.AppendChild(new Body());
@ -103,8 +100,7 @@ namespace PizzeriaBusinessLogic.OfficePackage.Implements
docRun.AppendChild(new Text docRun.AppendChild(new Text
{ {
Text = run.Item1, Text = run.Item1,
Space = Space = SpaceProcessingModeValues.Preserve
SpaceProcessingModeValues.Preserve
}); });
docParagraph.AppendChild(docRun); docParagraph.AppendChild(docRun);
} }

View File

@ -34,29 +34,25 @@ namespace PizzeriaBusinessLogic
/// <returns></returns> /// <returns></returns>
public List<ReportPizzaComponentViewModel> GetPizzaComponent() public List<ReportPizzaComponentViewModel> GetPizzaComponent()
{ {
var components = _componentStorage.GetFullList();
var pizzas = _pizzaStorage.GetFullList(); var pizzas = _pizzaStorage.GetFullList();
var list = new List<ReportPizzaComponentViewModel>(); var list = new List<ReportPizzaComponentViewModel>();
foreach (var component in components) foreach(var pizza in pizzas)
{ {
var record = new ReportPizzaComponentViewModel var record = new ReportPizzaComponentViewModel
{ {
ComponentName = component.ComponentName, PizzaName = pizza.PizzaName,
Pizzas = new List<Tuple<string, int>>(), TotalCount = 0,
TotalCount = 0 Components = new List<(string componentName, int count)>()
}; };
foreach (var pizza in pizzas)
foreach(var component in pizza.PizzaComponents)
{ {
if (pizza.PizzaComponents.ContainsKey(component.Id)) record.Components.Add((component.Value.Item1.ComponentName, component.Value.Item2 ));
{ record.TotalCount += component.Value.Item2;
record.Pizzas.Add(new Tuple<string,
int>(pizza.PizzaName, pizza.PizzaComponents[component.Id].Item2));
record.TotalCount +=
pizza.PizzaComponents[component.Id].Item2;
}
} }
list.Add(record); list.Add(record);
} }
return list; return list;
} }
/// <summary> /// <summary>
@ -76,6 +72,7 @@ namespace PizzeriaBusinessLogic
Id = x.Id, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
PizzaName = x.PizzaName, PizzaName = x.PizzaName,
OrderStatus = x.Status.ToString(),
Sum = x.Sum Sum = x.Sum
}) })
.ToList(); .ToList();
@ -89,8 +86,8 @@ namespace PizzeriaBusinessLogic
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список пицц",
Components = _componentStorage.GetFullList() Pizzas = _pizzaStorage.GetFullList()
}); });
} }
/// <summary> /// <summary>

View File

@ -5,6 +5,7 @@
public int Id { get; set; } public int Id { get; set; }
public DateTime DateCreate { get; set; } public DateTime DateCreate { get; set; }
public string PizzaName { get; set; } = string.Empty; public string PizzaName { get; set; } = string.Empty;
public string OrderStatus { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
} }
} }

View File

@ -2,8 +2,8 @@
{ {
public class ReportPizzaComponentViewModel public class ReportPizzaComponentViewModel
{ {
public string ComponentName { get; set; } = string.Empty; public string PizzaName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<Tuple<string, int>> Pizzas { get; set; } = new(); public List<(string componentName, int count)> Components { get; set; } = new();
} }
} }

View File

@ -22,6 +22,7 @@ namespace PizzeriaDatabaseImplement.Implements
{ {
using var context = new PizzeriaDatabase(); using var context = new PizzeriaDatabase();
return context.Orders return context.Orders
.Include(x => x.Pizza)
.Where(x => ( .Where(x => (
(!model.Id.HasValue || x.Id == model.Id) && (!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) && (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&