private void OnIncomeAmountPropertyChanged(object sender, EventArgs propertyChangedEventArgs)
        {
            if (!this.isLoadingBudgetModel && IncomeTotal != 0)
            {
                Dirty = true;
            }

            IncomeTotal = Incomes.Sum(x => x.Amount);
            Surplus     = IncomeTotal - ExpenseTotal;
        }
Example #2
0
        public int Balance()
        {
            if (Incomes != null &&
                Expenses != null &&
                TransfersTo != null &&
                TransfersFrom != null)
            {
                return(OpeningBalance +
                       Incomes.Sum(i => i.Amount) -
                       Expenses.Sum(e => e.Amount) -
                       TransfersFrom.Sum(t => t.Amount) +
                       TransfersTo.Sum(t => t.Amount));
            }

            return(0);
        }
Example #3
0
 private Amount TotalIncome() => Amount.FromDecimal(Incomes.Sum(i => i.Amount));
Example #4
0
 public virtual int Rest()
 {
     return(Incomes.Sum(income => income.QuantityCurrent));
 }