This commit is contained in:
Владимир Данилов 2024-04-19 09:01:13 +04:00
parent dfc0fb1c1f
commit 90bdd2cc2a
3 changed files with 15 additions and 24 deletions

View File

@ -34,7 +34,7 @@ namespace RenovationWorkView
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
//try try
{ {
var dataSource = _logic.GetOrders(new ReportBindingModel var dataSource = _logic.GetOrders(new ReportBindingModel
{ {
@ -51,11 +51,11 @@ namespace RenovationWorkView
reportViewer.RefreshReport(); reportViewer.RefreshReport();
_logger.LogInformation("Loading list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); _logger.LogInformation("Loading list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
} }
//catch (Exception ex) catch (Exception ex)
//{ {
// _logger.LogError(ex, "Loading list of orders for period error"); _logger.LogError(ex, "Loading list of orders for period error");
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
//} }
} }
private void ButtonToPdf_Click(object sender, EventArgs e) private void ButtonToPdf_Click(object sender, EventArgs e)

View File

@ -1,15 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh> <AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="RenovationWorkContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets> <DataSets>
<DataSet Name="DataSetOrders"> <DataSet Name="DataSetOrders">
<Query> <Query>
@ -104,7 +95,7 @@
</Paragraphs> </Paragraphs>
<rd:DefaultName>TextboxTitle</rd:DefaultName> <rd:DefaultName>TextboxTitle</rd:DefaultName>
<Height>0.83812cm</Height> <Height>0.83812cm</Height>
<Width>16.51cm</Width> <Width>21cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
@ -368,7 +359,7 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="EngineName"> <Textbox Name="RepairName">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -382,7 +373,7 @@
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>EngineName</rd:DefaultName> <rd:DefaultName>RepairName</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -595,5 +586,5 @@
</GridLayoutDefinition> </GridLayoutDefinition>
</ReportParametersLayout> </ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>51339ff3-57a4-433f-b70d-c4e0508adcb3</rd:ReportID> <rd:ReportID>4d09d569-730a-46f4-8266-77bb279f2dec</rd:ReportID>
</Report> </Report>

View File

@ -42,19 +42,19 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
public List<ReportRepairComponentViewModel> GetRepairComponent() public List<ReportRepairComponentViewModel> GetRepairComponent()
{ {
var engines = _repairStorage.GetFullList(); var repairs = _repairStorage.GetFullList();
var list = new List<ReportRepairComponentViewModel>(); var list = new List<ReportRepairComponentViewModel>();
foreach (var engine in engines) foreach (var repair in repairs)
{ {
var record = new ReportRepairComponentViewModel var record = new ReportRepairComponentViewModel
{ {
RepairName = engine.RepairName, RepairName = repair.RepairName,
Repairs = new List<(string Component, int Count)>(), Repairs = new List<(string Component, int Count)>(),
TotalCount = 0, TotalCount = 0,
}; };
foreach (var component in engine.RepairComponents) foreach (var component in repair.RepairComponents)
{ {
record.Repairs.Add(new(component.Value.Item1.ComponentName, component.Value.Item2)); record.Repairs.Add(new(component.Value.Item1.ComponentName, component.Value.Item2));
record.TotalCount += component.Value.Item2; record.TotalCount += component.Value.Item2;