Esempio n. 1
0
        public void DiagrammCCInit()
        {
            var qry2 = from o in MonthUseCCList
                       select new
            {
                o.FactCost,
                o.DifferenceCost,
                o.IdCostCenter
            };
            double Total     = qry2.Sum(n => n.FactCost);
            double TotalDiff = qry2.Sum(n => Math.Abs(n.DifferenceCost));

            var qry3 = from o in MonthUseCCList
                       where o.FactCost >= Total * Proc / 100
                       orderby o.IdCostCenter
                       select new
            {
                o.FactCost,
                o.IdCostCenter
            };
            var qry4 = from o in MonthUseCCList
                       where o.FactCost < Total * Proc / 100
                       select new
            {
                o.FactCost,
                o.IdCostCenter
            };
            double Total1 = qry4.Sum(n => n.FactCost);

            SeriesCollection3.Clear();
            foreach (var newY in qry3.ToList())
            {
                PieSeries ps10 = new PieSeries
                {
                    Title      = newY.IdCostCenter.ToString(),
                    DataLabels = true,
                    FontSize   = 14,
                    FontWeight = FontWeights.Bold,
                    LabelPoint = point => string.Format("ЦЗ-{0},\r\n {1:N0}", newY.IdCostCenter, point.Y),
                    Values     = new ChartValues <ObservableValue> {
                        new ObservableValue(newY.FactCost)
                    }
                };
                SeriesCollection3.Add(ps10);
            }
            PieSeries ps2 = new PieSeries
            {
                Title      = "Прочие",
                DataLabels = true,
                FontSize   = 14,
                FontWeight = FontWeights.Bold,
                LabelPoint = point => string.Format("{0},\r\n {1:N0}", "Прочие", point.Y),
                Values     = new ChartValues <ObservableValue> {
                    new ObservableValue(Total1)
                }
            };

            SeriesCollection3.Add(ps2);
        }
Esempio n. 2
0
        public void DiagrammCCInit()
        {
            var qry2 = from o in MonthUseCCList
                       select new
            {
                o.FactCost,
                o.DifferenceCost,
                o.IdCostCenter
            };
            double Total     = qry2.Sum(n => n.FactCost);
            double TotalDiff = qry2.Sum(n => Math.Abs(n.DifferenceCost));

            var qry3 = from o in MonthUseCCList
                       where o.FactCost >= Total * Proc / 100
                       orderby o.FactCost descending
                       select new
            {
                o.FactCost,
                o.IdCostCenter
            };
            var qry4 = from o in MonthUseCCList
                       where o.FactCost < Total * Proc / 100
                       select new
            {
                o.FactCost,
                o.IdCostCenter
            };
            double Total1 = qry4.Sum(n => n.FactCost);

            SeriesCollection3.Clear();
            foreach (var newY in qry3.ToList())
            {
                PieSeries ps10 = new PieSeries
                {
                    Title      = newY.IdCostCenter.ToString(),
                    DataLabels = true,
                    FontSize   = 10,
                    FontWeight = FontWeights.Bold,
                    LabelPoint = point => string.Format("ЦЗ-{0},\r\n {1:N0}", newY.IdCostCenter, point.Y),
                    Values     = new ChartValues <ObservableValue> {
                        new ObservableValue(newY.FactCost)
                    }
                };
                SeriesCollection3.Add(ps10);
            }
            PieSeries ps2 = new PieSeries
            {
                Title      = "Прочие",
                DataLabels = true,
                FontSize   = 10,
                FontWeight = FontWeights.Bold,
                LabelPoint = point => string.Format("{0},\r\n {1:N0}", "Прочие", point.Y),
                Values     = new ChartValues <ObservableValue> {
                    new ObservableValue(Total1)
                }
            };

            SeriesCollection3.Add(ps2);

            var qry5 = from o in MonthUseCCList
                       where Math.Abs(o.DifferenceCost) >= TotalDiff * Proc / 100
                       orderby o.DifferenceCost descending
                       select new
            {
                o.DifferenceCost,
                o.IdCostCenter
            };
            var qry6 = from o in MonthUseCCList
                       where Math.Abs(o.DifferenceCost) < TotalDiff * Proc / 100
                       select new
            {
                o.DifferenceCost,
                o.IdCostCenter
            };
            double Total2 = qry6.Sum(n => n.DifferenceCost);

            SeriesCollection4.Clear();
            ColumnSeries ps1 = new ColumnSeries()
            {
                //LabelsPosition = BarLabelPosition.Parallel,
                //Fill = System.Windows.Media.Brushes.PowderBlue,
                DataLabels = true,
                LabelPoint = point => string.Format("{0:N0}", point.Y),
                FontSize   = 10,
                FontWeight = FontWeights.Bold,
                Values     = new ChartValues <ObservableValue>()
            };

            foreach (var newY in qry5.ToList())
            {
                ps1.Values.Add(new ObservableValue(newY.DifferenceCost));
            }
            ps1.Values.Add(new ObservableValue(Total2));
            SeriesCollection4.Add(ps1);

            LabelsCC.Clear();
            foreach (var newX in qry5.ToList())
            {
                LabelsCC.Add(newX.IdCostCenter.ToString());
            }
            ;
            LabelsCC.Add("Прочие");
        }