статистика по поставщикам
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>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = 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.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
||||
chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||
dateTimePickerTo = new DateTimePicker();
|
||||
dateTimePickerFrom = new DateTimePicker();
|
||||
panel1 = new Panel();
|
||||
comboBox1 = new ComboBox();
|
||||
checkBoxPending = new CheckBox();
|
||||
checkBoxArriving = new CheckBox();
|
||||
checkBoxCompleted = new CheckBox();
|
||||
@ -45,14 +46,14 @@
|
||||
//
|
||||
// chart
|
||||
//
|
||||
chartArea1.Name = "ChartArea1";
|
||||
chart.ChartAreas.Add(chartArea1);
|
||||
chartArea2.Name = "ChartArea1";
|
||||
chart.ChartAreas.Add(chartArea2);
|
||||
chart.Dock = DockStyle.Bottom;
|
||||
legend1.Name = "Legend1";
|
||||
chart.Legends.Add(legend1);
|
||||
chart.Location = new Point(0, 30);
|
||||
legend2.Name = "Legend1";
|
||||
chart.Legends.Add(legend2);
|
||||
chart.Location = new Point(0, 57);
|
||||
chart.Name = "chart";
|
||||
chart.Size = new Size(800, 420);
|
||||
chart.Size = new Size(800, 393);
|
||||
chart.TabIndex = 0;
|
||||
chart.Text = "chart1";
|
||||
chart.Click += chart_Click;
|
||||
@ -76,6 +77,7 @@
|
||||
// panel1
|
||||
//
|
||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel1.Controls.Add(comboBox1);
|
||||
panel1.Controls.Add(checkBoxPending);
|
||||
panel1.Controls.Add(checkBoxArriving);
|
||||
panel1.Controls.Add(checkBoxCompleted);
|
||||
@ -86,13 +88,23 @@
|
||||
panel1.Dock = DockStyle.Top;
|
||||
panel1.Location = new Point(0, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(800, 24);
|
||||
panel1.Size = new Size(800, 51);
|
||||
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.AutoSize = true;
|
||||
checkBoxPending.Location = new Point(481, 3);
|
||||
checkBoxPending.Location = new Point(3, 27);
|
||||
checkBoxPending.Name = "checkBoxPending";
|
||||
checkBoxPending.Size = new Size(92, 19);
|
||||
checkBoxPending.TabIndex = 7;
|
||||
@ -103,7 +115,7 @@
|
||||
// checkBoxArriving
|
||||
//
|
||||
checkBoxArriving.AutoSize = true;
|
||||
checkBoxArriving.Location = new Point(590, 3);
|
||||
checkBoxArriving.Location = new Point(101, 27);
|
||||
checkBoxArriving.Name = "checkBoxArriving";
|
||||
checkBoxArriving.Size = new Size(61, 19);
|
||||
checkBoxArriving.TabIndex = 6;
|
||||
@ -114,7 +126,7 @@
|
||||
// checkBoxCompleted
|
||||
//
|
||||
checkBoxCompleted.AutoSize = true;
|
||||
checkBoxCompleted.Location = new Point(668, 4);
|
||||
checkBoxCompleted.Location = new Point(168, 27);
|
||||
checkBoxCompleted.Name = "checkBoxCompleted";
|
||||
checkBoxCompleted.Size = new Size(104, 19);
|
||||
checkBoxCompleted.TabIndex = 5;
|
||||
@ -148,7 +160,7 @@
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(chart);
|
||||
Name = "FormStatistics";
|
||||
Text = "FormStatistics";
|
||||
Text = "Статистика по поставкам";
|
||||
Load += FormStatistics_Load;
|
||||
((System.ComponentModel.ISupportInitialize)chart).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
@ -167,5 +179,6 @@
|
||||
private CheckBox checkBoxPending;
|
||||
private CheckBox checkBoxArriving;
|
||||
private CheckBox checkBoxCompleted;
|
||||
private ComboBox comboBox1;
|
||||
}
|
||||
}
|
@ -13,16 +13,19 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace WinFormsApp
|
||||
{
|
||||
public partial class FormStatistics : Form
|
||||
{
|
||||
ISupplyLogic _supplyLogic;
|
||||
public FormStatistics(ISupplyLogic supplyLogic)
|
||||
ISupplierLogic _supplierLogic;
|
||||
public FormStatistics(ISupplyLogic supplyLogic, ISupplierLogic supplierLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_supplyLogic = supplyLogic;
|
||||
_supplierLogic = supplierLogic;
|
||||
}
|
||||
|
||||
private void FormStatistics_Load(object sender, EventArgs e)
|
||||
@ -33,59 +36,88 @@ namespace WinFormsApp
|
||||
private void LoadData()
|
||||
{
|
||||
chart.Series.Clear();
|
||||
var list = _supplyLogic.ReadList(new SupplySearchModel()
|
||||
if (comboBox1.SelectedIndex == 0)
|
||||
{
|
||||
DateStart = dateTimePickerTo.Value,
|
||||
DateEnd = dateTimePickerFrom.Value,
|
||||
});
|
||||
if (checkBoxPending.Checked)
|
||||
{
|
||||
var date = dateTimePickerTo.Value;
|
||||
chart.Series.Add("Pending");
|
||||
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||
var list = _supplyLogic.ReadList(new SupplySearchModel()
|
||||
{
|
||||
var count = list.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Pending).ToList().Count;
|
||||
DataPoint dataPoint = new DataPoint();
|
||||
dataPoint.XValue = i;
|
||||
dataPoint.IsVisibleInLegend = false;
|
||||
dataPoint.Label = $"{date.Year}.{date.Month}";
|
||||
dataPoint.SetValueY(count);
|
||||
chart.Series["Pending"].Points.Add(dataPoint);
|
||||
date = date.AddMonths(1);
|
||||
DateStart = dateTimePickerTo.Value,
|
||||
DateEnd = dateTimePickerFrom.Value,
|
||||
});
|
||||
if (checkBoxPending.Checked)
|
||||
{
|
||||
var date = dateTimePickerTo.Value;
|
||||
chart.Series.Add("Pending");
|
||||
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||
{
|
||||
var count = list.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Pending).ToList().Count;
|
||||
DataPoint dataPoint = new DataPoint();
|
||||
dataPoint.XValue = i;
|
||||
dataPoint.IsVisibleInLegend = false;
|
||||
dataPoint.Label = $"{date.Year}.{date.Month}";
|
||||
dataPoint.SetValueY(count);
|
||||
chart.Series["Pending"].Points.Add(dataPoint);
|
||||
date = date.AddMonths(1);
|
||||
}
|
||||
}
|
||||
if (checkBoxArriving.Checked)
|
||||
{
|
||||
var date = dateTimePickerTo.Value;
|
||||
chart.Series.Add("Arriving");
|
||||
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||
{
|
||||
var count = list.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Arriving).ToList().Count;
|
||||
DataPoint dataPoint = new DataPoint();
|
||||
dataPoint.XValue = i;
|
||||
dataPoint.IsVisibleInLegend = false;
|
||||
dataPoint.Label = $"{date.Year}.{date.Month}";
|
||||
dataPoint.SetValueY(count);
|
||||
chart.Series["Arriving"].Points.Add(dataPoint);
|
||||
date = date.AddMonths(1);
|
||||
}
|
||||
}
|
||||
if (checkBoxCompleted.Checked)
|
||||
{
|
||||
var date = dateTimePickerTo.Value;
|
||||
chart.Series.Add("Completed");
|
||||
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||
{
|
||||
var count = list.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Completed).ToList().Count;
|
||||
DataPoint dataPoint = new DataPoint();
|
||||
dataPoint.XValue = i;
|
||||
dataPoint.IsVisibleInLegend = false;
|
||||
dataPoint.Label = $"{date.Year}.{date.Month}";
|
||||
dataPoint.SetValueY(count);
|
||||
chart.Series["Completed"].Points.Add(dataPoint);
|
||||
date = date.AddMonths(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkBoxArriving.Checked)
|
||||
if (comboBox1.SelectedIndex == 1)
|
||||
{
|
||||
var date = dateTimePickerTo.Value;
|
||||
chart.Series.Add("Arriving");
|
||||
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||
var supplylist = _supplyLogic.ReadList(new SupplySearchModel()
|
||||
{
|
||||
var count = list.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Arriving).ToList().Count;
|
||||
DataPoint dataPoint = new DataPoint();
|
||||
dataPoint.XValue = i;
|
||||
dataPoint.IsVisibleInLegend = false;
|
||||
dataPoint.Label = $"{date.Year}.{date.Month}";
|
||||
dataPoint.SetValueY(count);
|
||||
chart.Series["Arriving"].Points.Add(dataPoint);
|
||||
date = date.AddMonths(1);
|
||||
}
|
||||
}
|
||||
if (checkBoxCompleted.Checked)
|
||||
{
|
||||
var date = dateTimePickerTo.Value;
|
||||
chart.Series.Add("Completed");
|
||||
for (int i = 0; i <= diff_month(dateTimePickerFrom.Value, dateTimePickerTo.Value); i++)
|
||||
{
|
||||
var count = list.Where(x => x.Date.Month == date.Month && x.Status == SupplyStatus.Completed).ToList().Count;
|
||||
DataPoint dataPoint = new DataPoint();
|
||||
dataPoint.XValue = i;
|
||||
dataPoint.IsVisibleInLegend = false;
|
||||
dataPoint.Label = $"{date.Year}.{date.Month}";
|
||||
dataPoint.SetValueY(count);
|
||||
chart.Series["Completed"].Points.Add(dataPoint);
|
||||
date = date.AddMonths(1);
|
||||
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)
|
||||
@ -122,5 +154,22 @@ namespace WinFormsApp
|
||||
{
|
||||
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