Compare commits

...

2 Commits

10 changed files with 92 additions and 44 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -19,12 +19,11 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
<PackageReference Include="WinFormsLibrary" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.1.1" /> <PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\Controls\Controls.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup>

View File

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
</ItemGroup>

View File

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -12,7 +12,7 @@
<PackageReference Include="CreateVisualComponent" Version="1.0.0" />
<PackageReference Include="CustomComponentsTest" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.35" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" />
</ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -14,6 +14,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.29" />
</ItemGroup>

View File

@ -41,7 +41,9 @@
редактироватьtoolStripMenuItem = new ToolStripMenuItem();
controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable();
largeTextComponent = new Controls.LargeTextComponent(components);
componentDocumentWithChartPieWord = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieWord(components);
pieChartWord1 = new CustomComponents.NonViewComponents.PieChartWord(components);
componentDocumentWithTableMultiHeaderExcel1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel(components);
excelHardTable1 = new NotVisualComponent.ExcelHardTable(components);
menuStrip1.SuspendLayout();
SuspendLayout();
//
@ -102,6 +104,7 @@
excelОтчётToolStripMenuItem.Name = "excelОтчётToolStripMenuItem";
excelОтчётToolStripMenuItem.Size = new Size(98, 24);
excelОтчётToolStripMenuItem.Text = "Excel отчёт";
excelОтчётToolStripMenuItem.Click += excelОтчётToolStripMenuItem_Click;
//
// wordДиаграммаToolStripMenuItem
//
@ -155,6 +158,8 @@
private ToolStripMenuItem редактироватьtoolStripMenuItem;
private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable;
private Controls.LargeTextComponent largeTextComponent;
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieWord componentDocumentWithChartPieWord;
private CustomComponents.NonViewComponents.PieChartWord pieChartWord1;
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel componentDocumentWithTableMultiHeaderExcel1;
private NotVisualComponent.ExcelHardTable excelHardTable1;
}
}

View File

@ -1,12 +1,13 @@
using ComponentsLibraryNet60.DocumentWithChart;
using ComponentsLibraryNet60.Models;
using Contracts.BindlingModels;
using Contracts.BindlingModels;
using Contracts.BusinessLogicContracts;
using Contracts.ViewModels;
using Controls;
using ControlsLibraryNet60.Data;
using ControlsLibraryNet60.Models;
using CustomComponents;
using CustomComponents.NonViewComponents.Enums;
using CustomComponents.NonViewComponents.SupportClasses;
using CustomComponents.NonViewComponents;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -16,7 +17,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DatabaseImplement.Models;
using ComponentsLibraryNet60.DocumentWithTable;
using ComponentsLibraryNet60.Models;
using NotVisualComponent.Models;
using NotVisualComponent;
namespace Forms
{
public partial class FormMain : Form
@ -139,35 +144,59 @@ namespace Forms
saveFileDialog.ShowDialog();
string path = saveFileDialog.FileName + ".docx";
var list = _dlogic.ReadList(null);
var data = new List<(int Date, double Value)> { };
string header = "График доставок известной даты\n";
var chart = new Dictionary<string, List<(int Date, double Value)>> { };
int index = 1;
foreach (var type in _dtlogic.ReadList(null)!)
var data = list
.Where(x => x.DeliveryDate != "Даты доставки нет")
.GroupBy(x => x.DeliveryType)
.Select(g => (type: g.Key, Value: g.Count()))
.ToList();
var categoriesX = data.Select(d => d.type).ToList();
var valuesY = data.Select(d => (double)d.Value).ToList();
var series = new List<SeriesData>
{
int sum = 0;
foreach (var item in list)
new()
{
if (item.DeliveryType == type.Name)
{
sum++;
}
SeriesName = "Количество доставок",
ValuesY = valuesY,
Color = Color.FromArgb(100, 150, 200)
}
header += $"{index} - {type.Name}\n";
if (sum != 0) data.Add((index, sum));
index++;
}
chart.Add("ИП", data);
var conf = new ComponentDocumentWithChartConfig
};
pieChartWord1.CreateDiagramDocument(new PieChartData()
{
FileName = path,
DocumentTitle = "Диаграмма",
DiagramTitle = "Количество доставок по типам",
LegendLayout = PieChartLegendAlign.Bottom,
CategoriesX = categoriesX,
SeriesData = series
});
MessageBox.Show("Отчет готов");
}
private void excelОтчётToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.ShowDialog();
string path = saveFileDialog.FileName + ".xlsx";
var list = _dlogic.ReadList(null);
excelHardTable1.CreateDoc(new TableWithHeaderConfig<DeliveryViewModel>
{
FilePath = path,
Header = header,
ChartTitle = "Диаграмма по типам доставок",
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
Data = chart,
};
componentDocumentWithChartPieWord.CreateDoc(conf);
Header = "Deliveryies",
ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (20, 5), (10, 0), (15, 0), },
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
{
(0, 0, "Id", "Id"),
(1, 0, "FCs", "FCs"),
(2, 0, "DeliveryType", "DeliveryType"),
(3, 0, "DeliveryDate", "DeliveryDate"),
},
Data = list
});
MessageBox.Show("Отчет готов");
}
}
}

View File

@ -123,7 +123,13 @@
<metadata name="largeTextComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value>
</metadata>
<metadata name="componentDocumentWithChartPieWord.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="pieChartWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>348, 17</value>
</metadata>
<metadata name="componentDocumentWithTableMultiHeaderExcel1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>504, 17</value>
</metadata>
<metadata name="excelHardTable1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 58</value>
</metadata>
</root>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -19,12 +19,11 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
<PackageReference Include="WinFormsLibrary" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.1.1" /> <PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\Controls\Controls.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.35" />
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
</Project>