コード例 #1
0
        private void FillRevenueStreamInfo()
        {
            var transactions  = TransactionDbService.FindAllNonRevised().OrderBy(tr => tr.Date).ToList();
            var startDate     = DateTime.Now;
            var expensesTotal = ExpenseDbService.FindAllNonRevised(string.Empty).Sum(e =>
            {
                if (e.Date < startDate)
                {
                    startDate = e.Date;
                }
                return(e.RevenueAmount);
            });
            var revenuesTotal = RevenueDbService.FindAllNonRevised(string.Empty).Sum(r =>
            {
                if (r.Date < startDate)
                {
                    startDate = r.Date;
                }
                return(r.RevenueAmount);
            });
            var oldestRevenueStream = transactions.FirstOrDefault();

            if (oldestRevenueStream != null && oldestRevenueStream.Date < startDate)
            {
                startDate = oldestRevenueStream.Date;
            }

            StartDate = startDate;
            //inserting the data
            var stDate = $"Начална дата: {startDate.ToString(Config.DateTimeFormat)}";

            SalesRevenue = transactions.Where(tr => tr.TransactionType == TransactionType.SALE)
                           .Sum(r => r.RevenueAmount);
            InsertTextBoxValues($"{expensesTotal:F2}", $"{revenuesTotal:F2}", stDate, "0", $"{SalesRevenue:F2}");
        }
コード例 #2
0
        private Revision ForgeRevision()
        {
            var revision = new Revision
            {
                StartDate     = StartDate,
                Revenue       = RevenueDbService.FindAllNonRevised(string.Empty).Sum(r => r.RevenueAmount),
                Expenses      = ExpenseDbService.FindAllNonRevised(string.Empty).Sum(e => e.RevenueAmount),
                ActualRevenue = GetRevisionSubTotal() + SalesRevenue
            };

            return(revision);
        }