статистика по поставщикам
This commit is contained in:
parent
2f245da975
commit
83d1365b68
39
WinFormsApp/FormStatistics.Designer.cs
generated
39
WinFormsApp/FormStatistics.Designer.cs
generated
@ -28,12 +28,13 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||||
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
||||||
chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||||
dateTimePickerTo = new DateTimePicker();
|
dateTimePickerTo = new DateTimePicker();
|
||||||
dateTimePickerFrom = new DateTimePicker();
|
dateTimePickerFrom = new DateTimePicker();
|
||||||
panel1 = new Panel();
|
panel1 = new Panel();
|
||||||
|
comboBox1 = new ComboBox();
|
||||||
checkBoxPending = new CheckBox();
|
checkBoxPending = new CheckBox();
|
||||||
checkBoxArriving = new CheckBox();
|
checkBoxArriving = new CheckBox();
|
||||||
checkBoxCompleted = new CheckBox();
|
checkBoxCompleted = new CheckBox();
|
||||||
@ -45,14 +46,14 @@
|
|||||||
//
|
//
|
||||||
// chart
|
// chart
|
||||||
//
|
//
|
||||||
chartArea1.Name = "ChartArea1";
|
chartArea2.Name = "ChartArea1";
|
||||||
chart.ChartAreas.Add(chartArea1);
|
chart.ChartAreas.Add(chartArea2);
|
||||||
chart.Dock = DockStyle.Bottom;
|
chart.Dock = DockStyle.Bottom;
|
||||||
legend1.Name = "Legend1";
|
legend2.Name = "Legend1";
|
||||||
chart.Legends.Add(legend1);
|
chart.Legends.Add(legend2);
|
||||||
chart.Location = new Point(0, 30);
|
chart.Location = new Point(0, 57);
|
||||||
chart.Name = "chart";
|
chart.Name = "chart";
|
||||||
chart.Size = new Size(800, 420);
|
chart.Size = new Size(800, 393);
|
||||||
chart.TabIndex = 0;
|
chart.TabIndex = 0;
|
||||||
chart.Text = "chart1";
|
chart.Text = "chart1";
|
||||||
chart.Click += chart_Click;
|
chart.Click += chart_Click;
|
||||||
@ -76,6 +77,7 @@
|
|||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panel1.Controls.Add(comboBox1);
|
||||||
panel1.Controls.Add(checkBoxPending);
|
panel1.Controls.Add(checkBoxPending);
|
||||||
panel1.Controls.Add(checkBoxArriving);
|
panel1.Controls.Add(checkBoxArriving);
|
||||||
panel1.Controls.Add(checkBoxCompleted);
|
panel1.Controls.Add(checkBoxCompleted);
|
||||||
@ -86,13 +88,23 @@
|
|||||||
panel1.Dock = DockStyle.Top;
|
panel1.Dock = DockStyle.Top;
|
||||||
panel1.Location = new Point(0, 0);
|
panel1.Location = new Point(0, 0);
|
||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
panel1.Size = new Size(800, 24);
|
panel1.Size = new Size(800, 51);
|
||||||
panel1.TabIndex = 3;
|
panel1.TabIndex = 3;
|
||||||
//
|
//
|
||||||
|
// comboBox1
|
||||||
|
//
|
||||||
|
comboBox1.FormattingEnabled = true;
|
||||||
|
comboBox1.Items.AddRange(new object[] { "По поставкам", "По поставщикам" });
|
||||||
|
comboBox1.Location = new Point(542, -1);
|
||||||
|
comboBox1.Name = "comboBox1";
|
||||||
|
comboBox1.Size = new Size(121, 23);
|
||||||
|
comboBox1.TabIndex = 8;
|
||||||
|
comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
|
||||||
|
//
|
||||||
// checkBoxPending
|
// checkBoxPending
|
||||||
//
|
//
|
||||||
checkBoxPending.AutoSize = true;
|
checkBoxPending.AutoSize = true;
|
||||||
checkBoxPending.Location = new Point(481, 3);
|
checkBoxPending.Location = new Point(3, 27);
|
||||||
checkBoxPending.Name = "checkBoxPending";
|
checkBoxPending.Name = "checkBoxPending";
|
||||||
checkBoxPending.Size = new Size(92, 19);
|
checkBoxPending.Size = new Size(92, 19);
|
||||||
checkBoxPending.TabIndex = 7;
|
checkBoxPending.TabIndex = 7;
|
||||||
@ -103,7 +115,7 @@
|
|||||||
// checkBoxArriving
|
// checkBoxArriving
|
||||||
//
|
//
|
||||||
checkBoxArriving.AutoSize = true;
|
checkBoxArriving.AutoSize = true;
|
||||||
checkBoxArriving.Location = new Point(590, 3);
|
checkBoxArriving.Location = new Point(101, 27);
|
||||||
checkBoxArriving.Name = "checkBoxArriving";
|
checkBoxArriving.Name = "checkBoxArriving";
|
||||||
checkBoxArriving.Size = new Size(61, 19);
|
checkBoxArriving.Size = new Size(61, 19);
|
||||||
checkBoxArriving.TabIndex = 6;
|
checkBoxArriving.TabIndex = 6;
|
||||||
@ -114,7 +126,7 @@
|
|||||||
// checkBoxCompleted
|
// checkBoxCompleted
|
||||||
//
|
//
|
||||||
checkBoxCompleted.AutoSize = true;
|
checkBoxCompleted.AutoSize = true;
|
||||||
checkBoxCompleted.Location = new Point(668, 4);
|
checkBoxCompleted.Location = new Point(168, 27);
|
||||||
checkBoxCompleted.Name = "checkBoxCompleted";
|
checkBoxCompleted.Name = "checkBoxCompleted";
|
||||||
checkBoxCompleted.Size = new Size(104, 19);
|
checkBoxCompleted.Size = new Size(104, 19);
|
||||||
checkBoxCompleted.TabIndex = 5;
|
checkBoxCompleted.TabIndex = 5;
|
||||||
@ -148,7 +160,7 @@
|
|||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Controls.Add(chart);
|
Controls.Add(chart);
|
||||||
Name = "FormStatistics";
|
Name = "FormStatistics";
|
||||||
Text = "FormStatistics";
|
Text = "Статистика по поставкам";
|
||||||
Load += FormStatistics_Load;
|
Load += FormStatistics_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)chart).EndInit();
|
((System.ComponentModel.ISupportInitialize)chart).EndInit();
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
@ -167,5 +179,6 @@
|
|||||||
private CheckBox checkBoxPending;
|
private CheckBox checkBoxPending;
|
||||||
private CheckBox checkBoxArriving;
|
private CheckBox checkBoxArriving;
|
||||||
private CheckBox checkBoxCompleted;
|
private CheckBox checkBoxCompleted;
|
||||||
|
private ComboBox comboBox1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,16 +13,19 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Forms.DataVisualization.Charting;
|
using System.Windows.Forms.DataVisualization.Charting;
|
||||||
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
|
||||||
namespace WinFormsApp
|
namespace WinFormsApp
|
||||||
{
|
{
|
||||||
public partial class FormStatistics : Form
|
public partial class FormStatistics : Form
|
||||||
{
|
{
|
||||||
ISupplyLogic _supplyLogic;
|
ISupplyLogic _supplyLogic;
|
||||||
public FormStatistics(ISupplyLogic supplyLogic)
|
ISupplierLogic _supplierLogic;
|
||||||
|
public FormStatistics(ISupplyLogic supplyLogic, ISupplierLogic supplierLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_supplyLogic = supplyLogic;
|
_supplyLogic = supplyLogic;
|
||||||
|
_supplierLogic = supplierLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormStatistics_Load(object sender, EventArgs e)
|
private void FormStatistics_Load(object sender, EventArgs e)
|
||||||
@ -33,6 +36,8 @@ namespace WinFormsApp
|
|||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
chart.Series.Clear();
|
chart.Series.Clear();
|
||||||
|
if (comboBox1.SelectedIndex == 0)
|
||||||
|
{
|
||||||
var list = _supplyLogic.ReadList(new SupplySearchModel()
|
var list = _supplyLogic.ReadList(new SupplySearchModel()
|
||||||
{
|
{
|
||||||
DateStart = dateTimePickerTo.Value,
|
DateStart = dateTimePickerTo.Value,
|
||||||
@ -87,6 +92,33 @@ namespace WinFormsApp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (comboBox1.SelectedIndex == 1)
|
||||||
|
{
|
||||||
|
var supplylist = _supplyLogic.ReadList(new SupplySearchModel()
|
||||||
|
{
|
||||||
|
DateStart = dateTimePickerTo.Value,
|
||||||
|
DateEnd = dateTimePickerFrom.Value,
|
||||||
|
});
|
||||||
|
var supplierlist = _supplierLogic.ReadList(null);
|
||||||
|
foreach (var supplier in supplierlist)
|
||||||
|
{
|
||||||
|
var date = dateTimePickerTo.Value;
|
||||||
|
chart.Series.Add(supplier.Name);
|
||||||
|
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||||
|
{
|
||||||
|
var count = supplylist.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Completed && x.SupplierId == supplier.Id).ToList().Count;
|
||||||
|
DataPoint dataPoint = new DataPoint();
|
||||||
|
dataPoint.XValue = i;
|
||||||
|
dataPoint.IsVisibleInLegend = false;
|
||||||
|
dataPoint.Label = $"{supplier.Name}";
|
||||||
|
dataPoint.SetValueY(count);
|
||||||
|
chart.Series[supplier.Name].Points.Add(dataPoint);
|
||||||
|
date = date.AddMonths(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void chart_Click(object sender, EventArgs e)
|
private void chart_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -122,5 +154,22 @@ namespace WinFormsApp
|
|||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (comboBox1.SelectedIndex != 0)
|
||||||
|
{
|
||||||
|
checkBoxArriving.Visible = false;
|
||||||
|
checkBoxCompleted.Visible = false;
|
||||||
|
checkBoxPending.Visible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkBoxArriving.Visible = true;
|
||||||
|
checkBoxCompleted.Visible = true;
|
||||||
|
checkBoxPending.Visible = true;
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user