completed LabWork_04
This commit is contained in:
parent
ce35ed8f72
commit
ff43bf55eb
@ -34,9 +34,9 @@ namespace FishFactoryView
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ComponentName,
|
||||
dataGridView.Rows.Add(new object[] { elem.CannedName,
|
||||
"", "" });
|
||||
foreach (var listElem in elem.Canneds)
|
||||
foreach (var listElem in elem.Components)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "",
|
||||
listElem.Item1, listElem.Item2 });
|
||||
|
@ -29,7 +29,7 @@ namespace FishFactoryView
|
||||
{
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream(@"C:\Users\Admin\Desktop\RPP_Labs\Lab4\pibd-22_emelyanov_a.s._fishfactory\FishFactory\FishFactory\ReportOrders.rdlc", FileMode.Open));
|
||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream(@"C:\Users\Admin\source\repos\FishFactory\FishFactory\FishFactory\ReportOrders.rdlc", FileMode.Open));
|
||||
Controls.Clear();
|
||||
Controls.Add(reportViewer);
|
||||
Controls.Add(panel);
|
||||
|
@ -29,6 +29,10 @@
|
||||
<DataField>CannedName</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="OrderStatus">
|
||||
<DataField>OrderStatus</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="Sum">
|
||||
<DataField>Sum</DataField>
|
||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||
@ -127,6 +131,9 @@
|
||||
<TablixColumn>
|
||||
<Width>2.5cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>2.5cm</Width>
|
||||
</TablixColumn>
|
||||
</TablixColumns>
|
||||
<TablixRows>
|
||||
<TablixRow>
|
||||
@ -205,7 +212,7 @@
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Изделие</Value>
|
||||
<Value>Консерва</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
@ -228,6 +235,38 @@
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</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>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox7">
|
||||
@ -357,6 +396,36 @@
|
||||
</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>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Sum">
|
||||
@ -397,6 +466,7 @@
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
</TablixMembers>
|
||||
</TablixColumnHierarchy>
|
||||
<TablixRowHierarchy>
|
||||
@ -413,7 +483,7 @@
|
||||
<Top>2.48391cm</Top>
|
||||
<Left>0.55245cm</Left>
|
||||
<Height>1.2cm</Height>
|
||||
<Width>16.44755cm</Width>
|
||||
<Width>18.94755cm</Width>
|
||||
<ZIndex>2</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
|
@ -44,22 +44,20 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
||||
var components = _componentStorage.GetFullList();
|
||||
var canneds = _cannedStorage.GetFullList();
|
||||
var list = new List<ReportCannedComponentViewModel>();
|
||||
foreach (var component in components)
|
||||
foreach (var canned in canneds)
|
||||
{
|
||||
var record = new ReportCannedComponentViewModel
|
||||
{
|
||||
ComponentName = component.ComponentName,
|
||||
Canneds = new List<Tuple<string, int>>(),
|
||||
CannedName = canned.CannedName,
|
||||
Components = new (),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var canned in canneds)
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (canned.CannedComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.Canneds.Add(new Tuple<string,
|
||||
int>(canned.CannedName, canned.CannedComponents[component.Id].Item2));
|
||||
record.TotalCount +=
|
||||
canned.CannedComponents[component.Id].Item2;
|
||||
record.Components.Add(new (component.ComponentName, canned.CannedComponents[component.Id].Item2));
|
||||
record.TotalCount += canned.CannedComponents[component.Id].Item2;
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
@ -75,8 +73,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
||||
{
|
||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||
{
|
||||
DateFrom
|
||||
= model.DateFrom,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
})
|
||||
.Select(x => new ReportOrdersViewModel
|
||||
@ -84,6 +81,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
||||
Id = x.Id,
|
||||
DateCreate = x.DateCreate,
|
||||
CannedName = x.CannedName,
|
||||
OrderStatus = x.Status.ToString(),
|
||||
Sum = x.Sum
|
||||
})
|
||||
.ToList();
|
||||
@ -97,8 +95,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список консерв",
|
||||
Canneds = _cannedStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
@ -110,7 +108,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Title = "Изделия и их комопоненты",
|
||||
CannedComponents = GetCannedComponent()
|
||||
});
|
||||
}
|
||||
|
@ -36,27 +36,25 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.ComponentName,
|
||||
Text = pc.CannedName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var product in pc.Canneds)
|
||||
foreach (var (Components, Count) in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = product.Item1,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
Text = Components,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = product.Item2.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
Text = Count.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
@ -16,19 +16,16 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = info.Title,
|
||||
Style =
|
||||
"NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
Style = "NormalTitle", 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
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие",
|
||||
"Сумма" },
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Консерва", "Статус", "Сумма" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
@ -36,8 +33,7 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { order.Id.ToString(),
|
||||
order.DateCreate.ToShortDateString(), order.CannedName, order.Sum.ToString() },
|
||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.CannedName, order.OrderStatus, order.Sum.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
|
@ -23,12 +23,14 @@ WordTextProperties { Bold = true, Size = "24", }) },
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
foreach (var component in info.Components)
|
||||
foreach (var canned in info.Canneds)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
(canned.CannedName +' ', new WordTextProperties { Size = "24", Bold = true }),
|
||||
(canned.Price.ToString(), new WordTextProperties { Size = "24" })
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
@ -11,6 +11,6 @@ namespace FishFactoryBusinessLogic.OfficePackage.HelperModels.Word
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ComponentViewModel> Components { get; set; } = new();
|
||||
public List<CannedViewModel> Canneds { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace FishFactoryContracts.ViewModels
|
||||
{
|
||||
public class ReportCannedComponentViewModel
|
||||
{
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public string CannedName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<Tuple<string, int>> Canneds { get; set; } = new();
|
||||
public List<(string Components, int Count)> Components { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace FishFactoryContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public DateTime DateCreate { get; set; }
|
||||
public string CannedName { get; set; } = string.Empty;
|
||||
public string OrderStatus { get; set; } = string.Empty;
|
||||
public double Sum { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace FishFactoryFileImplement.Implements
|
||||
return new();
|
||||
}
|
||||
|
||||
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();
|
||||
return source.Orders.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo).Select(x => GetViewModel(x)).ToList();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFullList()
|
||||
|
@ -57,7 +57,7 @@ namespace FishFactoryListImplement.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(GetViewModel(order));
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ namespace FishFactoryListImplement.Models
|
||||
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
|
Loading…
Reference in New Issue
Block a user