예제 #1
0
 public EndTermValue(IAccountTypeInternal Account, IPeriodicReporting reportingPeriod)
 {
     this.Account = Account;
     this.ReportingPeriod = reportingPeriod;
     //this.EndTermDate = EndTermDate;
     //this.TermType = termType;
 }
예제 #2
0
 public EndTermValue(IAccountTypeInternal Account, IPeriodicReporting reportingPeriod, Money ClosingValue, Money GreenFundValue, Money CultureFundValue)
     : this(Account, reportingPeriod)
 {
     this.ClosingValue = ClosingValue;
     this.GreenFundValue = GreenFundValue;
     this.CultureFundValue = CultureFundValue;
 }
예제 #3
0
        private static void InsertEndTermValue(IDalSession session, IPortfolioHistorical portfolio, IList<IJournalEntryLine> dividends, IPeriodicReporting reportingPeriod)
        {
            IAccountTypeInternal account = portfolio.ParentAccount;
            IEndTermValue etv = new EndTermValue(account, reportingPeriod);

            Money InternalDividend = new Money(0m, account.BaseCurrency);
            Money InternalDividendTax = new Money(0m, account.BaseCurrency);
            Money ExternalDividend = new Money(0m, account.BaseCurrency);
            Money ExternalDividendTax = new Money(0m, account.BaseCurrency);

            if (dividends != null)
            {
                List<IJournalEntryLine> divs = dividends.ToList();
                if (divs.Exists(d => d.GiroAccount.Key == account.Key))
                {
                    if (divs.Exists(d => d.GLAccount.IsGrossDividendInternal))
                        InternalDividend = divs.Where(d => (d.GLAccount.IsGrossDividendInternal && (d.GiroAccount.Key == account.Key))).Select(m => m.Balance.BaseAmount).Sum();
                    if (divs.Exists(d => d.GLAccount.IsDividendTaxInternal))
                        InternalDividendTax = divs.Where(d => (d.GLAccount.IsDividendTaxInternal && (d.GiroAccount.Key == account.Key))).Select(m => m.Balance.BaseAmount).Sum();
                    if (divs.Exists(d => d.GLAccount.IsGrossDividendExternal))
                        ExternalDividend = divs.Where(d => (d.GLAccount.IsGrossDividendExternal && (d.GiroAccount.Key == account.Key))).Select(m => m.Balance.BaseAmount).Sum();
                    if (divs.Exists(d => d.GLAccount.IsDividendTaxExternal))
                        ExternalDividendTax = divs.Where(d => (d.GLAccount.IsDividendTaxExternal && (d.GiroAccount.Key == account.Key))).Select(m => m.Balance.BaseAmount).Sum();
                }
            }

            etv.CashValue = portfolio.CashPortfolio.TotalPortfolioValue;
            etv.FundValue = portfolio.FundPortfolio.TotalPortfolioValue;
            etv.ClosingValue = etv.FundValue + etv.CashValue;
            etv.CultureFundValue = portfolio.FundPortfolio.CultureFundValue.Abs();
            etv.GreenFundValue = portfolio.FundPortfolio.GreenFundValue.Abs();
            etv.InternalDividend = InternalDividend.Abs();
            etv.InternalDividendTax = InternalDividendTax.Abs();
            etv.ExternalDividend = ExternalDividend.Abs();
            etv.ExternalDividendTax = ExternalDividendTax.Abs();
            session.InsertOrUpdate(etv);
        }