Ну вроде все

This commit is contained in:
dasha 2023-03-10 18:23:51 +04:00
parent 59cb3e269f
commit b63ef37d04
16 changed files with 181 additions and 79 deletions

View File

@ -32,16 +32,16 @@
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ингредиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ингредиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.сушиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.сушиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокИнгредиентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ингредиентыПоСушиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonUpdate = new System.Windows.Forms.Button(); this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonSetToFinish = new System.Windows.Forms.Button(); this.buttonSetToFinish = new System.Windows.Forms.Button();
this.buttonSetToDone = new System.Windows.Forms.Button(); this.buttonSetToDone = new System.Windows.Forms.Button();
this.buttonSetToWork = new System.Windows.Forms.Button(); this.buttonSetToWork = new System.Windows.Forms.Button();
this.buttonCreateOrder = new System.Windows.Forms.Button(); this.buttonCreateOrder = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView(); this.dataGridView = new System.Windows.Forms.DataGridView();
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокИнгредиентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ингредиентыПоСушиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -80,6 +80,37 @@
this.сушиToolStripMenuItem.Text = "Суши"; this.сушиToolStripMenuItem.Text = "Суши";
this.сушиToolStripMenuItem.Click += new System.EventHandler(this.SushiToolStripMenuItem_Click); this.сушиToolStripMenuItem.Click += new System.EventHandler(this.SushiToolStripMenuItem_Click);
// //
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокИнгредиентовToolStripMenuItem,
this.ингредиентыПоСушиToolStripMenuItem,
this.списокЗаказовToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокИнгредиентовToolStripMenuItem
//
this.списокИнгредиентовToolStripMenuItem.Name = "списокИнгредиентовToolStripMenuItem";
this.списокИнгредиентовToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.списокИнгредиентовToolStripMenuItem.Text = "Список суши";
this.списокИнгредиентовToolStripMenuItem.Click += new System.EventHandler(this.SushiListToolStripMenuItem_Click);
//
// ингредиентыПоСушиToolStripMenuItem
//
this.ингредиентыПоСушиToolStripMenuItem.Name = "ингредиентыПоСушиToolStripMenuItem";
this.ингредиентыПоСушиToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.ингредиентыПоСушиToolStripMenuItem.Text = "Суши с ингредиентами";
this.ингредиентыПоСушиToolStripMenuItem.Click += new System.EventHandler(this.SushiIngredientToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// buttonUpdate // buttonUpdate
// //
this.buttonUpdate.Location = new System.Drawing.Point(780, 314); this.buttonUpdate.Location = new System.Drawing.Point(780, 314);
@ -147,37 +178,6 @@
this.dataGridView.Size = new System.Drawing.Size(755, 426); this.dataGridView.Size = new System.Drawing.Size(755, 426);
this.dataGridView.TabIndex = 7; this.dataGridView.TabIndex = 7;
// //
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокИнгредиентовToolStripMenuItem,
this.ингредиентыПоСушиToolStripMenuItem,
this.списокЗаказовToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокИнгредиентовToolStripMenuItem
//
this.списокИнгредиентовToolStripMenuItem.Name = "списокИнгредиентовToolStripMenuItem";
this.списокИнгредиентовToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.списокИнгредиентовToolStripMenuItem.Text = "Список ингредиентов";
this.списокИнгредиентовToolStripMenuItem.Click += new System.EventHandler(this.IngredientToolStripMenuItem_Click);
//
// ингредиентыПоСушиToolStripMenuItem
//
this.ингредиентыПоСушиToolStripMenuItem.Name = "ингредиентыПоСушиToolStripMenuItem";
this.ингредиентыПоСушиToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.ингредиентыПоСушиToolStripMenuItem.Text = "Ингредиенты по суши";
this.ингредиентыПоСушиToolStripMenuItem.Click += new System.EventHandler(this.IngredientSushiToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// FormMain // FormMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);

View File

@ -145,17 +145,17 @@ namespace SushiBarView
{ {
LoadData(); LoadData();
} }
private void IngredientToolStripMenuItem_Click(object sender, EventArgs e) private void SushiListToolStripMenuItem_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)
{ {
_reportLogic.SaveIngredientsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); _reportLogic.SaveListSushiToWordFile(new ReportBindingModel { FileName = dialog.FileName });
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
private void IngredientSushiToolStripMenuItem_Click(object sender, EventArgs e) private void SushiIngredientToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiIngredients)); var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiIngredients));
if (service is FormReportSushiIngredients form) if (service is FormReportSushiIngredients form)

View File

@ -27,8 +27,8 @@ namespace SushiBarView
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var elem in dict) foreach (var elem in dict)
{ {
dataGridView.Rows.Add(new object[] { elem.IngredientName, "", "" }); dataGridView.Rows.Add(new object[] { elem.SushiName, "", "" });
foreach (var listElem in elem.ListSushi) foreach (var listElem in elem.Ingredients)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
} }

View File

@ -30,8 +30,8 @@
{ {
this.dataGridView = new System.Windows.Forms.DataGridView(); this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonSaveToExcel = new System.Windows.Forms.Button(); this.buttonSaveToExcel = new System.Windows.Forms.Button();
this.ColumnIngredient = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnSushi = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnSushi = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnIngredient = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -46,8 +46,8 @@
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ColumnIngredient,
this.ColumnSushi, this.ColumnSushi,
this.ColumnIngredient,
this.ColumnCount}); this.ColumnCount});
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom; this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
this.dataGridView.Location = new System.Drawing.Point(0, 47); this.dataGridView.Location = new System.Drawing.Point(0, 47);
@ -70,13 +70,6 @@
this.buttonSaveToExcel.UseVisualStyleBackColor = true; this.buttonSaveToExcel.UseVisualStyleBackColor = true;
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click); this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
// //
// ColumnIngredient
//
this.ColumnIngredient.HeaderText = "Ингредиент";
this.ColumnIngredient.Name = "ColumnIngredient";
this.ColumnIngredient.ReadOnly = true;
this.ColumnIngredient.Width = 200;
//
// ColumnSushi // ColumnSushi
// //
this.ColumnSushi.HeaderText = "Суши"; this.ColumnSushi.HeaderText = "Суши";
@ -84,6 +77,13 @@
this.ColumnSushi.ReadOnly = true; this.ColumnSushi.ReadOnly = true;
this.ColumnSushi.Width = 200; this.ColumnSushi.Width = 200;
// //
// ColumnIngredient
//
this.ColumnIngredient.HeaderText = "Ингредиент";
this.ColumnIngredient.Name = "ColumnIngredient";
this.ColumnIngredient.ReadOnly = true;
this.ColumnIngredient.Width = 200;
//
// ColumnCount // ColumnCount
// //
this.ColumnCount.HeaderText = "Количество"; this.ColumnCount.HeaderText = "Количество";
@ -110,8 +110,8 @@
private System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.Button buttonSaveToExcel; private System.Windows.Forms.Button buttonSaveToExcel;
private DataGridViewTextBoxColumn ColumnIngredient;
private DataGridViewTextBoxColumn ColumnSushi; private DataGridViewTextBoxColumn ColumnSushi;
private DataGridViewTextBoxColumn ColumnIngredient;
private DataGridViewTextBoxColumn ColumnCount; private DataGridViewTextBoxColumn ColumnCount;
} }
} }

View File

@ -29,6 +29,10 @@
<DataField>SushiName</DataField> <DataField>SushiName</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>
@ -127,6 +131,9 @@
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns> </TablixColumns>
<TablixRows> <TablixRows>
<TablixRow> <TablixRow>
@ -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>Статус</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>18.94755cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>

View File

@ -12,7 +12,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
{ {
private readonly IIngredientStorage _ingredientStorage; private readonly IIngredientStorage _ingredientStorage;
private readonly ISushiStorage _productStorage; private readonly ISushiStorage _sushiStorage;
private readonly IOrderStorage _orderStorage; private readonly IOrderStorage _orderStorage;
@ -25,7 +25,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
public ReportLogic(ISushiStorage productStorage, IIngredientStorage ingredientStorage, IOrderStorage orderStorage, public ReportLogic(ISushiStorage productStorage, IIngredientStorage ingredientStorage, IOrderStorage orderStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{ {
_productStorage = productStorage; _sushiStorage = productStorage;
_ingredientStorage = ingredientStorage; _ingredientStorage = ingredientStorage;
_orderStorage = orderStorage; _orderStorage = orderStorage;
@ -42,24 +42,25 @@ namespace SushiBarBusinessLogic.BusinessLogics
{ {
var ingredients = _ingredientStorage.GetFullList(); var ingredients = _ingredientStorage.GetFullList();
var products = _productStorage.GetFullList(); var sushiList = _sushiStorage.GetFullList();
var list = new List<ReportSushiIngredientViewModel>(); var list = new List<ReportSushiIngredientViewModel>();
foreach (var ingredient in ingredients) foreach (var sushi in sushiList)
{ {
var record = new ReportSushiIngredientViewModel var record = new ReportSushiIngredientViewModel
{ {
IngredientName = ingredient.IngredientName, SushiName = sushi.SushiName,
ListSushi = new List<(string, int)>(), Ingredients = new(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var product in products) foreach (var ingredient in ingredients)
{ {
if (product.SushiIngredients.ContainsKey(ingredient.Id)) if (sushi.SushiIngredients.ContainsKey(ingredient.Id))
{ {
record.ListSushi.Add(new(product.SushiName, product.SushiIngredients[ingredient.Id].Item2)); record.Ingredients.Add(new(ingredient.IngredientName,
record.TotalCount += product.SushiIngredients[ingredient.Id].Item2; sushi.SushiIngredients[ingredient.Id].Item2));
record.TotalCount += sushi.SushiIngredients[ingredient.Id].Item2;
} }
} }
@ -82,22 +83,23 @@ namespace SushiBarBusinessLogic.BusinessLogics
Id = x.Id, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
SushiName = x.SushiName, SushiName = x.SushiName,
OrderStatus = x.Status.ToString(),
Sum = x.Sum Sum = x.Sum
}) })
.ToList(); .ToList();
} }
/// <summary> /// <summary>
/// Сохранение ингредиентов в файл-Word /// Сохранение суши в файл-Word
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
public void SaveIngredientsToWordFile(ReportBindingModel model) public void SaveListSushiToWordFile(ReportBindingModel model)
{ {
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список ингредиентов", Title = "Список суши",
Ingredients = _ingredientStorage.GetFullList() ListSushi = _sushiStorage.GetFullList()
}); });
} }
@ -110,7 +112,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список ингредиентов", Title = "Список суши",
SushiIngredients = GetSushiIngredient() SushiIngredients = GetSushiIngredient()
}); });
} }

View File

@ -34,18 +34,18 @@ namespace SushiBarBusinessLogic.OfficePackage
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.IngredientName, Text = pc.SushiName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var (Sushi, Count) in pc.ListSushi) foreach (var (Ingredient, Count) in pc.Ingredients)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = Sushi, Text = Ingredient,
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });

View File

@ -11,11 +11,11 @@ namespace SushiBarBusinessLogic.OfficePackage
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" }); CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "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
}); });
@ -24,7 +24,7 @@ namespace SushiBarBusinessLogic.OfficePackage
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SushiName, order.Sum.ToString() }, Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SushiName, order.OrderStatus, order.Sum.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });

View File

@ -19,11 +19,14 @@ namespace SushiBarBusinessLogic.OfficePackage
} }
}); });
foreach (var ingredient in info.Ingredients) foreach (var sushi in info.ListSushi)
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { (ingredient.IngredientName, new WordTextProperties { Size = "24", }) }, Texts = new List<(string, WordTextProperties)> {
(sushi.SushiName+' ', new WordTextProperties { Size = "24", Bold = true }),
(sushi.Price.ToString(), new WordTextProperties { Size = "24" })
},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",

View File

@ -8,6 +8,6 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<IngredientViewModel> Ingredients { get; set; } = new(); public List<SushiViewModel> ListSushi { get; set; } = new();
} }
} }

View File

@ -22,7 +22,7 @@ namespace SushiBarContracts.BusinessLogicsContracts
/// Сохранение индгредиентов в файл-Word /// Сохранение индгредиентов в файл-Word
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
void SaveIngredientsToWordFile(ReportBindingModel model); void SaveListSushiToWordFile(ReportBindingModel model);
/// <summary> /// <summary>
/// Сохранение индгредиентов с указаеним суши в файл-Excel /// Сохранение индгредиентов с указаеним суши в файл-Excel

View File

@ -8,6 +8,8 @@
public string SushiName { get; set; } = string.Empty; public string SushiName { get; set; } = string.Empty;
public string OrderStatus { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
} }
} }

View File

@ -2,10 +2,10 @@
{ {
public class ReportSushiIngredientViewModel public class ReportSushiIngredientViewModel
{ {
public string IngredientName { get; set; } = string.Empty; public string SushiName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<(string Sushi, int Count)> ListSushi { get; set; } = new(); public List<(string Ingredient, int Count)> Ingredients { get; set; } = new();
} }
} }

View File

@ -39,11 +39,19 @@ namespace SushiBarDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue)
{ {
return new(); return new();
} }
using var context = new SushiBarDatabase(); using var context = new SushiBarDatabase();
if (model.DateFrom.HasValue)
{
return context.Orders
.Include(x => x.Sushi)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return context.Orders return context.Orders
.Include(x => x.Sushi) .Include(x => x.Sushi)
.Where(x => x.Id == model.Id) .Where(x => x.Id == model.Id)

View File

@ -25,6 +25,13 @@ namespace SushiBarFileImplement.Implements
{ {
return new(); return new();
} }
if (model.DateFrom.HasValue)
{
return source.Orders
.Where(x => x.Id.Equals(model.Id) && x.DateCreate >= model.DateFrom)
.Select(x => GetViewModel(x))
.ToList();
}
return source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList(); return source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList();
} }

View File

@ -29,6 +29,16 @@ namespace SushiBarListImplement.Implements
{ {
return result; return result;
} }
if (model.DateFrom.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.Id == model.Id && order.DateCreate >= model.DateFrom)
{
result.Add(GetViewModel(order));
}
}
}
foreach (var order in _source.Orders) foreach (var order in _source.Orders)
{ {
if (order.Id == model.Id) if (order.Id == model.Id)