Example #1
0
 public TransactionSchedule()
 {
     name = string.Empty;
     period = Period.Today;
 }
Example #2
0
 public Period Intersection(Period period)
 {
     if (endDate.HasValue && period.endDate.HasValue)
     {
         return new Period(DateFunctions.MaxDate(startDate, period.startDate), DateFunctions.MinDate(endDate.Value, period.endDate.Value));
     }
     return new Period(DateFunctions.MaxDate(startDate, period.startDate), endDate.HasValue ? endDate.Value : period.endDate);
 }
Example #3
0
 public Period Union(Period period)
 {
     if (!endDate.HasValue || !period.endDate.HasValue)
     {
         return new Period(DateFunctions.MinDate(startDate, period.startDate), null);
     }
     return new Period(DateFunctions.MinDate(startDate, period.startDate), DateFunctions.MaxDate(endDate.Value, period.endDate.Value));
 }
Example #4
0
 /// <summary>
 /// Determines whether this budget intersects with the given budget period
 /// </summary>
 public bool Intersects(Period period)
 {
     if ((!endDate.HasValue && !period.endDate.HasValue)
         || (endDate.HasValue && period.startDate >= startDate && period.startDate <= endDate.Value)
         || (period.endDate.HasValue && startDate >= period.startDate && startDate <= period.endDate.Value))
     {
         return true;
     }
     return false;
 }
Example #5
0
        public Dictionary<DateTime, CashFlow> GetCashFlowByDate(Period period)
        {
            var cashflow = new Dictionary<DateTime, CashFlow>();
            var flow = new CashFlow();

            foreach (var t in Document.GetTransactions(period, this))
            {
                if (!cashflow.ContainsKey(t.Date))
                    cashflow.Add(t.Date, flow = new CashFlow());

                flow = cashflow[t.Date];

                if (t.Source == this)
                    flow.Outflow += t.Amount;
                else
                    flow.Inflow += t.Amount;

                cashflow[t.Date] = flow;
            }
            return cashflow;
        }
Example #6
0
        public Dictionary<ITransactable, CashFlow> GetCashFlowByContribution(Period period)
        {
            var cashflow = new Dictionary<ITransactable, CashFlow>();
            var flow = new CashFlow();
            ITransactable obj = null;

            foreach (var t in Document.GetTransactions(period, this))
            {
                obj = (t.Source == this) ? t.Target : t.Source;

                if (!cashflow.ContainsKey(obj))
                    cashflow.Add(obj, flow = new CashFlow());

                flow = cashflow[obj];

                if (t.Source == this)
                    flow.Outflow += t.Amount;
                else
                    flow.Inflow += t.Amount;

                cashflow[obj] = flow;
            }
            return cashflow;
        }