+эксель +мораль
This commit is contained in:
parent
5a2f7da8a8
commit
508830d62f
@ -31,27 +31,25 @@ namespace SushiBarBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.ComponentName,
|
||||
Text = pc.SushiName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var Sushi in pc.Sushis)
|
||||
foreach (var (Component, Count) in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Sushi.Item1,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
Text = Component,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = Sushi.Item2.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
Text = Count.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
@ -21,7 +21,10 @@ namespace SushiBarBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (sushi.SushiName, new WordTextProperties { Size = "24", }) },
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(sushi.SushiName, new WordTextProperties { Size = "24", Bold = true}),
|
||||
("\t"+sushi.Price.ToString(), new WordTextProperties{Size = "24"})
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
@ -32,29 +32,12 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
/// <returns></returns>
|
||||
public List<ReportSushiComponentViewModel> GetSushiComponent()
|
||||
{
|
||||
var components = _componentStorage.GetFullList();
|
||||
var Sushis = _SushiStorage.GetFullList();
|
||||
var list = new List<ReportSushiComponentViewModel>();
|
||||
foreach (var component in components)
|
||||
return _SushiStorage.GetFullList().Select(x => new ReportSushiComponentViewModel
|
||||
{
|
||||
var record = new ReportSushiComponentViewModel
|
||||
{
|
||||
ComponentName = component.ComponentName,
|
||||
Sushis = new List<Tuple<string, int>>(),
|
||||
TotalCount = 0
|
||||
}; foreach (var Sushi in Sushis)
|
||||
{
|
||||
if (Sushi.SushiComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.Sushis.Add(new Tuple<string,
|
||||
int>(Sushi.SushiName, Sushi.SushiComponents[component.Id].Item2));
|
||||
record.TotalCount +=
|
||||
Sushi.SushiComponents[component.Id].Item2;
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
SushiName = x.SushiName,
|
||||
Components = x.SushiComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
|
||||
TotalCount = x.SushiComponents.Select(x => x.Value.Item2).Sum()
|
||||
}).ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение списка заказов за определенный период
|
||||
|
@ -22,7 +22,9 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||
sp.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||
|
||||
var fontUsual = new Font();
|
||||
fontUsual.Append(new FontSize() { Val = 12D });
|
||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||
@ -30,6 +32,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 14D });
|
||||
@ -40,8 +43,11 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
fonts.Append(fontUsual);
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 2U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
|
||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None }); var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill()
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
{
|
||||
public class ReportSushiComponentViewModel
|
||||
{
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public string SushiName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<Tuple<string, int>> Sushis { get; set; } = new();
|
||||
public List<(string Component, int Count)> Components { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ namespace SushiBarView
|
||||
dataGridViewExcel.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridViewExcel.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
||||
foreach (var listElem in elem.Sushis)
|
||||
dataGridViewExcel.Rows.Add(new object[] { elem.SushiName, "", "" });
|
||||
foreach (var listElem in elem.Components)
|
||||
{
|
||||
dataGridViewExcel.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user