+исправленный эксель
This commit is contained in:
parent
84eed7fd39
commit
80bf9899df
@ -17,6 +17,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage
|
|||||||
public void CreateReport(ExcelInfo info)
|
public void CreateReport(ExcelInfo info)
|
||||||
{
|
{
|
||||||
CreateExcel(info);
|
CreateExcel(info);
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
@ -24,11 +25,13 @@ namespace ConfectioneryBusinessLogic.OfficePackage
|
|||||||
Text = info.Title,
|
Text = info.Title,
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
});
|
});
|
||||||
|
|
||||||
MergeCells(new ExcelMergeParameters
|
MergeCells(new ExcelMergeParameters
|
||||||
{
|
{
|
||||||
CellFromName = "A1",
|
CellFromName = "A1",
|
||||||
CellToName = "C1"
|
CellToName = "C1"
|
||||||
});
|
});
|
||||||
|
|
||||||
uint rowIndex = 2;
|
uint rowIndex = 2;
|
||||||
foreach (var pc in info.PastryComponents)
|
foreach (var pc in info.PastryComponents)
|
||||||
{
|
{
|
||||||
@ -36,30 +39,32 @@ namespace ConfectioneryBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = pc.ComponentName,
|
Text = pc.PastryName,
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var product in pc.Pastrys)
|
|
||||||
|
foreach (var (Component, Count) in pc.Components)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "B",
|
ColumnName = "B",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = product.Item1,
|
Text = Component,
|
||||||
StyleInfo =
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
});
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "C",
|
ColumnName = "C",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = product.Item2.ToString(),
|
Text = Count.ToString(),
|
||||||
StyleInfo =
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
});
|
||||||
|
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
@ -76,6 +81,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage
|
|||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveExcel(info);
|
SaveExcel(info);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -32,30 +32,12 @@ namespace ConfectioneryBusinessLogic
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<ReportPastryComponentViewModel> GetPastryComponent()
|
public List<ReportPastryComponentViewModel> GetPastryComponent()
|
||||||
{
|
{
|
||||||
var components = _componentStorage.GetFullList();
|
return _pastryStorage.GetFullList().Select(x => new ReportPastryComponentViewModel
|
||||||
var products = _pastryStorage.GetFullList();
|
|
||||||
var list = new List<ReportPastryComponentViewModel>();
|
|
||||||
foreach (var component in components)
|
|
||||||
{
|
{
|
||||||
var record = new ReportPastryComponentViewModel
|
PastryName = x.PastryName,
|
||||||
{
|
Components = x.PastryComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
|
||||||
ComponentName = component.ComponentName,
|
TotalCount = x.PastryComponents.Select(x => x.Value.Item2).Sum()
|
||||||
Pastrys = new List<Tuple<string, int>>(),
|
}).ToList();
|
||||||
TotalCount = 0
|
|
||||||
};
|
|
||||||
foreach (var product in products)
|
|
||||||
{
|
|
||||||
if (product.PastryComponents.ContainsKey(component.Id))
|
|
||||||
{
|
|
||||||
record.Pastrys.Add(new Tuple<string,
|
|
||||||
int>(product.PastryName, product.PastryComponents[component.Id].Item2));
|
|
||||||
record.TotalCount +=
|
|
||||||
product.PastryComponents[component.Id].Item2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.Add(record);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение списка заказов за определенный период
|
/// Получение списка заказов за определенный период
|
||||||
|
@ -8,8 +8,8 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportPastryComponentViewModel
|
public class ReportPastryComponentViewModel
|
||||||
{
|
{
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
public int TotalCount { get; set; }
|
public int TotalCount { get; set; }
|
||||||
public List<Tuple<string, int>> Pastrys { get; set; } = new();
|
public List<(string Component, int Count)> Components { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
dataGridView.BackgroundColor = Color.AliceBlue;
|
dataGridView.BackgroundColor = Color.AliceBlue;
|
||||||
dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
||||||
dataGridViewCellStyle1.BackColor = SystemColors.Control;
|
dataGridViewCellStyle1.BackColor = SystemColors.Control;
|
||||||
dataGridViewCellStyle1.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
dataGridViewCellStyle1.Font = new Font("Segoe UI", 9F);
|
||||||
dataGridViewCellStyle1.ForeColor = SystemColors.WindowText;
|
dataGridViewCellStyle1.ForeColor = SystemColors.WindowText;
|
||||||
dataGridViewCellStyle1.SelectionBackColor = SystemColors.Highlight;
|
dataGridViewCellStyle1.SelectionBackColor = SystemColors.Highlight;
|
||||||
dataGridViewCellStyle1.SelectionForeColor = SystemColors.HighlightText;
|
dataGridViewCellStyle1.SelectionForeColor = SystemColors.HighlightText;
|
||||||
@ -54,7 +54,7 @@
|
|||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnComponent, ColumnPastry, ColumnCount });
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnComponent, ColumnPastry, ColumnCount });
|
||||||
dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
||||||
dataGridViewCellStyle2.BackColor = SystemColors.Window;
|
dataGridViewCellStyle2.BackColor = SystemColors.Window;
|
||||||
dataGridViewCellStyle2.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
dataGridViewCellStyle2.Font = new Font("Segoe UI", 9F);
|
||||||
dataGridViewCellStyle2.ForeColor = SystemColors.ControlText;
|
dataGridViewCellStyle2.ForeColor = SystemColors.ControlText;
|
||||||
dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight;
|
dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight;
|
||||||
dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText;
|
dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText;
|
||||||
@ -64,14 +64,13 @@
|
|||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
||||||
dataGridViewCellStyle3.BackColor = SystemColors.Control;
|
dataGridViewCellStyle3.BackColor = SystemColors.Control;
|
||||||
dataGridViewCellStyle3.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
dataGridViewCellStyle3.Font = new Font("Segoe UI", 9F);
|
||||||
dataGridViewCellStyle3.ForeColor = SystemColors.WindowText;
|
dataGridViewCellStyle3.ForeColor = SystemColors.WindowText;
|
||||||
dataGridViewCellStyle3.SelectionBackColor = SystemColors.Highlight;
|
dataGridViewCellStyle3.SelectionBackColor = SystemColors.Highlight;
|
||||||
dataGridViewCellStyle3.SelectionForeColor = SystemColors.HighlightText;
|
dataGridViewCellStyle3.SelectionForeColor = SystemColors.HighlightText;
|
||||||
dataGridViewCellStyle3.WrapMode = DataGridViewTriState.True;
|
dataGridViewCellStyle3.WrapMode = DataGridViewTriState.True;
|
||||||
dataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
|
dataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
|
||||||
dataGridView.RowHeadersWidth = 62;
|
dataGridView.RowHeadersWidth = 62;
|
||||||
dataGridView.RowTemplate.Height = 33;
|
|
||||||
dataGridView.Size = new Size(875, 498);
|
dataGridView.Size = new Size(875, 498);
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
@ -115,6 +114,7 @@
|
|||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormReportPastryComponents";
|
Name = "FormReportPastryComponents";
|
||||||
Text = "Компоненты по изделиям";
|
Text = "Компоненты по изделиям";
|
||||||
|
Load += FormReportPastryComponents_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ namespace ConfectioneryView
|
|||||||
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.PastryName, "", "" });
|
||||||
foreach (var listElem in elem.Pastrys)
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,64 @@
|
|||||||
<root>
|
<?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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
Loading…
Reference in New Issue
Block a user