Ejemplo n.º 1
0
        private void OnCapitalChanged(FinanceStatisticGroup <CapitalModel> capitals, bool isSortedByMonth)
        {
            ChartVis = Visibility.Visible;
            Labels.Clear();
            ColumnColletcion.Clear();
            Summary.ClearSummary();

            FillLabels(capitals.GroupDetais, isSortedByMonth);
            Summary.CreateSummaries(capitals.GroupDetais.Keys.ToArray(), isSortedByMonth);
            LineSeries line = new LineSeries
            {
                Title          = capitals.GroupName,
                DataLabels     = true,
                Stroke         = new SolidColorBrush(GlobalVariables.MainColor),
                LineSmoothness = 0,
                LabelPoint     = point => point.Y.ToString("#0.00"),
                FontSize       = 16,
                Fill           = new SolidColorBrush(Colors.Transparent),
                Values         = new ChartValues <decimal>()
            };

            foreach (decimal amount in capitals.GroupDetais.Values)
            {
                line.Values.Add(amount);
            }
            ColumnColletcion.Add(line);
            Summary.AddSummary(capitals.GroupDetais, GlobalVariables.MainColor,
                               capitals.GroupName, capitals.StatisticType);
        }
Ejemplo n.º 2
0
        private void OnFinanceStatisticChanged(List <StatisticTypeModel> statistics, List <FinanceStatisticGroup <AccountInfoModel> > normalStatistic,
                                               FinanceStatisticGroup <TeacherFeeModel> teacherFeeStatistic, FinanceStatisticGroup <ClassPaymentModel> classpaymentStatistic,
                                               Dictionary <DateTime, decimal> diffStatisticGroup, bool isSortedByMonth)
        {
            ChartVis = Visibility.Visible;
            Labels.Clear();
            ColumnColletcion.Clear();
            Summary.ClearSummary();

            if (statistics.Where(s => s.StatisticType == StatisticTypeEnum.AllIncome).FirstOrDefault() != null)
            {
                //allincome = normalincome+classpayment
                FillLabels(normalStatistic[0].GroupDetais, isSortedByMonth);
                Summary.CreateSummaries(normalStatistic[0].GroupDetais.Keys.ToArray(), isSortedByMonth);
                ColumnSeries col = CreateOneColumn(
                    StatisticTypeManagement.Instance.StatisticTypeCollection.Where(s => s.StatisticType == StatisticTypeEnum.AllIncome).First().ShownText,
                    GlobalVariables.IncomeColor);
                FinanceStatisticGroup <AccountInfoModel> allincome = normalStatistic.Where(s => s.StatisticType == StatisticTypeEnum.AllIncome).First();
                DateTime[] statisticKeys = allincome.GroupDetais.Keys.ToArray();
                foreach (DateTime span in statisticKeys)
                {
                    col.Values.Add(allincome.GroupDetais[span] + classpaymentStatistic.GroupDetais[span]);
                    allincome.GroupDetais[span] += classpaymentStatistic.GroupDetais[span];
                }
                ColumnColletcion.Add(col);
                Summary.AddSummary(allincome.GroupDetais, GlobalVariables.IncomeColor, allincome.GroupName, allincome.StatisticType);
            }
            if (statistics.Where(s => s.StatisticType == StatisticTypeEnum.AllOutcome).FirstOrDefault() != null)
            {
                //alloutcome = normaloutcome + teacherfee
                FillLabels(normalStatistic[0].GroupDetais, isSortedByMonth);
                Summary.CreateSummaries(normalStatistic[0].GroupDetais.Keys.ToArray(), isSortedByMonth);
                ColumnSeries col = CreateOneColumn(
                    StatisticTypeManagement.Instance.StatisticTypeCollection.Where(s => s.StatisticType == StatisticTypeEnum.AllOutcome).First().ShownText,
                    GlobalVariables.ExpenseColor);
                FinanceStatisticGroup <AccountInfoModel> alloutcome = normalStatistic.Where(s => s.StatisticType == StatisticTypeEnum.AllOutcome).First();
                DateTime[] statisticKeys = alloutcome.GroupDetais.Keys.ToArray();
                foreach (DateTime span in statisticKeys)
                {
                    col.Values.Add(alloutcome.GroupDetais[span] + teacherFeeStatistic.GroupDetais[span]);
                    alloutcome.GroupDetais[span] += teacherFeeStatistic.GroupDetais[span];
                }
                ColumnColletcion.Add(col);
                Summary.AddSummary(alloutcome.GroupDetais, GlobalVariables.ExpenseColor, alloutcome.GroupName, alloutcome.StatisticType);
            }
            if (statistics.Where(s => s.StatisticType == StatisticTypeEnum.Diff).FirstOrDefault() != null)
            {
                FillLabels(diffStatisticGroup, isSortedByMonth);
                Summary.CreateSummaries(normalStatistic[0].GroupDetais.Keys.ToArray(), isSortedByMonth);
                ColumnSeries col = CreateOneColumn(
                    StatisticTypeManagement.Instance.StatisticTypeCollection.Where(s => s.StatisticType == StatisticTypeEnum.Diff).First().ShownText,
                    GlobalVariables.SecondaryColor);
                foreach (decimal amount in diffStatisticGroup.Values)
                {
                    col.Values.Add(amount);
                }
                ColumnColletcion.Add(col);
                Summary.AddSummary(diffStatisticGroup, GlobalVariables.SecondaryColor,
                                   StatisticTypeManagement.Instance.StatisticTypeCollection.Where(s => s.StatisticType == StatisticTypeEnum.Diff).First().ShownText, StatisticTypeEnum.Diff);
            }
            if (statistics.Where(s => s.StatisticType == StatisticTypeEnum.TeacherFee).FirstOrDefault() != null)
            {
                FillLabels(teacherFeeStatistic.GroupDetais, isSortedByMonth);
                Summary.CreateSummaries(teacherFeeStatistic.GroupDetais.Keys.ToArray(), isSortedByMonth);
                ColumnSeries col = CreateOneColumn(teacherFeeStatistic.GroupName, _colorIndex);
                foreach (decimal amount in teacherFeeStatistic.GroupDetais.Values)
                {
                    col.Values.Add(amount);
                }
                ColumnColletcion.Add(col);
                Summary.AddSummary(teacherFeeStatistic.GroupDetais, GlobalVariables.CustomerColorSet[_colorIndex % 12],
                                   teacherFeeStatistic.GroupName, teacherFeeStatistic.StatisticType);
                _colorIndex++;
            }
            if (statistics.Where(s => s.StatisticType == StatisticTypeEnum.ClassFee).FirstOrDefault() != null)
            {
                FillLabels(classpaymentStatistic.GroupDetais, isSortedByMonth);
                Summary.CreateSummaries(classpaymentStatistic.GroupDetais.Keys.ToArray(), isSortedByMonth);
                ColumnSeries col = CreateOneColumn(classpaymentStatistic.GroupName, _colorIndex);
                foreach (decimal amount in classpaymentStatistic.GroupDetais.Values)
                {
                    col.Values.Add(amount);
                }
                ColumnColletcion.Add(col);
                Summary.AddSummary(classpaymentStatistic.GroupDetais, GlobalVariables.CustomerColorSet[_colorIndex % 12],
                                   classpaymentStatistic.GroupName, classpaymentStatistic.StatisticType);
                _colorIndex++;
            }
            if (statistics.Where(s => s.StatisticType != StatisticTypeEnum.AllIncome &&
                                 s.StatisticType != StatisticTypeEnum.AllOutcome &&
                                 s.StatisticType != StatisticTypeEnum.Diff &&
                                 s.StatisticType != StatisticTypeEnum.ClassFee &&
                                 s.StatisticType != StatisticTypeEnum.TeacherFee).FirstOrDefault() != null)
            {
                FillLabels(normalStatistic[0].GroupDetais, isSortedByMonth);
                Summary.CreateSummaries(normalStatistic[0].GroupDetais.Keys.ToArray(), isSortedByMonth);
                foreach (FinanceStatisticGroup <AccountInfoModel> item in normalStatistic)
                {
                    ColumnSeries col = CreateOneColumn(item.GroupName, _colorIndex);
                    foreach (decimal amount in item.GroupDetais.Values)
                    {
                        col.Values.Add(amount);
                    }
                    ColumnColletcion.Add(col);
                    Summary.AddSummary(item.GroupDetais, GlobalVariables.CustomerColorSet[_colorIndex % 12], item.GroupName, item.StatisticType);
                    _colorIndex++;
                }
            }
        }