Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.Accounts.Instructions.ClientDepartureInstruction">ClientDepartureInstruction</see> class.
 /// </summary>
 /// <param name="account">The account the withdrawal will belong to</param>
 /// <param name="executionDate">The date the instruction should execute</param>
 /// <param name="doNotChargeCommission">The instruction is without any charges</param>
 /// <param name="counterAccount">counter Account</param>
 /// <param name="transferDescription">transfer Description</param>
 public ClientDepartureInstruction(IAccountTypeCustomer account, DateTime executionDate, bool doNotChargeCommission, ICounterAccount counterAccount, string transferDescription)
     : base(account, executionDate, OrderActionTypes.Departure, doNotChargeCommission, null)
 {
     this.CounterAccount = counterAccount;
     this.TransferDescription = transferDescription;
     this.status = ClientDepartureInstructionStati.New;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.Accounts.Instructions.InstructionTypeRebalance">InstructionTypeRebalance</see> class.
 /// </summary>
 /// <param name="account">The account the withdrawal will belong to</param>
 /// <param name="executionDate">The date the instruction should execute</param>
 /// <param name="orderActionType">The type of instruction that is placed on the orders</param>
 /// <param name="doNotChargeCommission">The instruction is without any charges</param>
 /// <param name="cashTransfers">The transfers involved</param>
 internal InstructionTypeRebalance(IAccountTypeCustomer account, DateTime executionDate, OrderActionTypes orderActionType, bool doNotChargeCommission, IList<IJournalEntryLine> cashTransfers)
     : base(account, executionDate, doNotChargeCommission)
 {
     this.OrderActionType = orderActionType;
     this.status = RebalanceInstructionStati.New;
     CashTransfers.AddTransfers(cashTransfers);
 }
        public GeneralOperationsBookingTaxeable(IAccountTypeCustomer account, IMemorialBooking journalEntry, string description, decimal taxPercentage)
            : base(account, journalEntry, description)
        {
            if (taxPercentage < 0 || taxPercentage > 1)
                throw new ApplicationException("The Tax Percentage can only be between 0 and 1");

            this.TaxPercentage = taxPercentage;
        }
Exemplo n.º 4
0
 public ModelHistory(IAccountTypeCustomer account, ILifecycle lifecycle, IPortfolioModel model, 
     bool isExecOnlyCustomer, AccountEmployerRelationship employerRelationship,
     IInternalEmployeeLogin employee, DateTime changeDate)
 {
     Account = account;
     Lifecycle = lifecycle;
     ModelPortfolio = model;
     IsExecOnlyCustomer = isExecOnlyCustomer;
     EmployerRelationship = employerRelationship;
     Employee = employee;
     ChangeDate = changeDate.Date;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.Accounts.Instructions.CashWithdrawalInstruction">CashWithdrawalInstruction</see> class.
 /// </summary>
 /// <param name="account">The account the withdrawal will belong to</param>
 /// <param name="executionDate">The day from which the instruction should be taken into account</param>
 /// <param name="withdrawalDate">The day that the money should be withdrawn</param>
 /// <param name="amount">The relevant amount</param>
 /// <param name="counterAccount">The account the money should go to</param>
 /// <param name="rule">The rule that is responsible for this periodic instruction</param>
 /// <param name="doNotChargeCommission">The instruction is without any charges</param>
 internal CashWithdrawalInstruction(IAccountTypeCustomer account, DateTime executionDate, DateTime withdrawalDate, Money amount,
         ICounterAccount counterAccount, IWithdrawalRule rule, string transferDescription, bool doNotChargeCommission)
     : base(account, executionDate, doNotChargeCommission)
 {
     this.Account = account;
     this.WithdrawalDate = withdrawalDate;
     this.Amount = amount;
     this.CounterAccount = counterAccount;
     this.Rule = rule;
     this.TransferDescription = transferDescription;
     this.status = CashWithdrawalInstructionStati.New;
     if (rule != null)
         this.IsPeriodic = true;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dividendDetails">The details of the cash dividend (date, price)</param>
        /// <param name="units">The total number of units over which dividend is paid</param>
        public CashDividend(IAccountTypeCustomer account, IMemorialBooking journalEntry, string description, decimal taxPercentage, IDividendHistory dividendDetails, InstrumentSize units, IGLLookupRecords lookups)
            : base(account, journalEntry, description, taxPercentage)
        {
            if (dividendDetails == null)
                throw new ApplicationException("Dividend details are mandatory.");

            if (units == null || units.IsZero)
                throw new ApplicationException("The number of units is mandatory.");

            this.DividendDetails = dividendDetails;
            this.UnitsInPossession = units;
            //this.CashGeneratingInstrument = dividendDetails.Instrument;

            createComponents(lookups);
        }
Exemplo n.º 7
0
        public ManagementFee(IAccountTypeCustomer account, DateTime startDate, DateTime endDate, IList<IManagementPeriodUnit> units, IMemorialBooking journalEntry, decimal taxPercentage, IGLLookupRecords lookups)
            : base(account, journalEntry, journalEntry.Description, taxPercentage)
        {
            this.StartDate = startDate;
            this.EndDate = endDate;

            if (units == null)
                throw new ApplicationException("The units can not be null");

            foreach (IManagementPeriodUnit unit in units)
            {
                if (unit.ManagementFee != null)
                    throw new ApplicationException(string.Format("The unit {0} is already used for a management fee transaction.", unit.Key.ToString()));

                if (!(unit.Success && unit.FeesCalculated == FeesCalculatedStates.Yes))
                    throw new ApplicationException(string.Format("The unit {0} is not correct for the management fee transaction.", unit.Key.ToString()));
            }

            this.Units = units;
            this.GeneralOpsJournalEntry = journalEntry;
            createComponents(lookups);
        }
Exemplo n.º 8
0
 private void setAccountValidityDate(IDalSession session, IAccountTypeCustomer account, DateTime maxValuationDate)
 {
     account.ValuationMutationValidityDate = maxValuationDate;
     session.Update(account);
 }
Exemplo n.º 9
0
        private bool runValuationMutationsForAccount(IDalSession session, IAccountTypeCustomer account, DateTime maxDate, out string message)
        {
            bool success = false;
            message = "";
            try
            {
                IList<IFundPositionTx> posTxs;
                IList<IJournalEntryLine> lines;
                List<IValuationMutation> mutationsToSave = null;
                IValuationCashMutation[] cashMutationsToSave = null;

                if (getFundPositionTxData(session, account, maxDate, out posTxs))
                {
                    // Calculate the valuations
                    runValuationMutationJobForAccount(session, posTxs, account, maxDate, ref mutationsToSave);
                }
                if (getJournalEntryLineData(session, account, maxDate, out lines))
                {
                    // Calculate the valuations
                    runValuationMutationJobForAccount(session, lines, account, maxDate, ref mutationsToSave);
                    // Calculate the cash valuations
                    runCashValuationMutationJobForAccount(session, lines, account, maxDate, out cashMutationsToSave);
                }
                // save data
                saveMutations(session, ref mutationsToSave, ref cashMutationsToSave);

                // Get the ValuationMutationValidityDate of the mutations
                DateTime validityDate = DateTime.MinValue;
                foreach (ICommonPosition pos in account.Portfolio.AllPositions)
                {
                    if (pos.LastMutation != null && pos.LastMutation.Size.IsZero)
                    {
                        if (validityDate < pos.LastMutation.Date)
                            validityDate = pos.LastMutation.Date;
                    }
                    else
                    {
                        // Not all positions are closed -> take maxDate
                        validityDate = maxDate;
                        break;
                    }
                }

                //// save the Validity Date
                setAccountValidityDate(session, account, validityDate);
                success = true;
            }
            catch (Exception ex)
            {
                message = Util.GetMessageFromException(ex);
                string logMessage = string.Format("Error in runValuationMutationsForAccount -> account: {0}; {1}", account.Key, message);
                log.Error(logMessage);
            }
            return success;
        }
Exemplo n.º 10
0
        private void runValuationMutationJobForAccount(IDalSession session, IList<IJournalEntryLine> lines, IAccountTypeCustomer account, DateTime maxDate, ref List<IValuationMutation> mutationsToSave)
        {
            ////raiseProgressEvent(string.Format("Create valuations for {0}", account.DisplayNumberWithName));
            IDictionary<string, IValuationMutation> mutations = new Dictionary<string, IValuationMutation>();
            IMonetaryValuationMutation mutation;
            IList<IJournalEntryLine> notRelevantLines = new List<IJournalEntryLine>();

            if (lines != null && lines.Count > 0)
            {
                foreach (IJournalEntryLine line in lines)
                {
                    if (line.BookDate <= maxDate && (Util.IsNullDate(account.ValuationsEndDate) || line.BookDate <= account.ValuationsEndDate))
                    {
                        if (line.IsRelevant && line.ParentSubPosition.SettledFlag == CashPositionSettleStatus.Settled)
                        {
                            if (line.ParentSubPosition.ParentPosition.LastMutation == null)
                                mutation = new MonetaryValuationMutation(line);
                            else
                            {
                                // check that Date of LastMutation is not after the TxDate
                                if (line.ParentSubPosition.ParentPosition.LastMutation.Date > line.BookDate)
                                    throw new ApplicationException(string.Format("The date of the LastMutation can not be greater than the TxDate for Account: {0}, Instrument: {1}, Date: {2}", account.Key, line.Currency.Key, line.BookDate));

                                // Is the TxDate the same
                                if (line.ParentSubPosition.ParentPosition.LastMutation.Date.Equals(line.BookDate))
                                    mutation = (IMonetaryValuationMutation)line.ParentSubPosition.ParentPosition.LastMutation;
                                // else Create New Valuation from Previous Valuation
                                else
                                    mutation = new MonetaryValuationMutation(line.BookDate, (IMonetaryValuationMutation)line.ParentSubPosition.ParentPosition.LastMutation);
                            }
                            mutation.AddLine(line);

                            account.Portfolio.PortfolioCashGL.GetPosition(line.Currency).LastMutation = mutation;
                            if (!mutations.Keys.Contains(mutation.GetUniqueCode))
                                mutations.Add(mutation.GetUniqueCode, mutation);
                        }
                        else
                            notRelevantLines.Add(line);
                    }
                }
                if (mutations != null && mutations.Count > 0)
                {
                    if (mutationsToSave == null)
                        mutationsToSave = new List<IValuationMutation>(mutations.Count);
                    mutationsToSave.AddRange(mutations.Values);
                    if (notRelevantLines.Count > 0)
                        addNotRelevantLinesToMutations(ref mutationsToSave, notRelevantLines);

                    // Validate mutations
                    foreach (IValuationMutation mut in mutationsToSave)
                        mut.Validate();
                }
                else if (notRelevantLines.Count > 0)
                {
                    IValuationMutation mut = lines[0].ParentSubPosition.ParentPosition.LastMutation;
                    if (mut != null)
                    {
                        mutationsToSave = new List<IValuationMutation>(1);
                        mutationsToSave.Add(mut);
                        addNotRelevantLinesToMutations(ref mutationsToSave, notRelevantLines);
                    }
                }
            }
        }
Exemplo n.º 11
0
        public void ResetValuations(IDalSession session, IAccountTypeCustomer account)
        {
            // Run TG_ResetValuations
            //raiseProgressEvent(string.Format("Run TG_ResetValuations for {0}", (account != null ? account.DisplayNumberWithName: "all accounts")));

            SqlCommand command = new SqlCommand("TG_ResetValuations", (SqlConnection)session.Connection);
            SqlParameter param1 = new SqlParameter("endDate", MaxValuationDate);
            command.Parameters.Add(param1);
            SqlParameter param2 = new SqlParameter("AccountID", (account != null ? account.Key : 0));
            command.Parameters.Add(param2);
            command.CommandType = CommandType.StoredProcedure;
            command.CommandTimeout = 0;
            int i = command.ExecuteNonQuery();
        }
Exemplo n.º 12
0
        private void runValuationMutationJobForAccount(IDalSession session, IList<IFundPositionTx> posTxs, IAccountTypeCustomer account, DateTime maxDate, ref List<IValuationMutation> mutationsToSave)
        {
            ////raiseProgressEvent(string.Format("Create valuations for {0}", account.DisplayNumberWithName));
            IDictionary<string, IValuationMutation> mutations = new Dictionary<string, IValuationMutation>();
            ISecurityValuationMutation mutation;
            IList<IFundPositionTx> notRelevantPositionTxs = new List<IFundPositionTx>();

            if (posTxs != null && posTxs.Count > 0)
            {
                foreach (IFundPositionTx posTx in posTxs)
                {
                    if (posTx.TransactionDate <= maxDate && (Util.IsNullDate(account.ValuationsEndDate) || posTx.TransactionDate <= account.ValuationsEndDate))
                    {
                        if (posTx.IsRelevant)
                        {
                            if (posTx.ParentPosition.LastMutation == null)
                            {
                                IList<IFundPosition> convertedPositions = null;
                                if (posTx.IsConversion)
                                {
                                    // Check whether the Instrument has changed
                                    convertedPositions = getPositionsConvertedInstrument(posTx.Instrument, account.Portfolio.PortfolioInstrument);
                                }

                                if (convertedPositions != null && convertedPositions.Count > 0)
                                    mutation = new SecurityValuationMutation(convertedPositions, posTx, posTx.TransactionDate);
                                // Create Complete New Valuation
                                else
                                    mutation = new SecurityValuationMutation(posTx);
                            }
                            else
                            {
                                // check that Date of LastMutation is not after the TxDate
                                if (posTx.ParentPosition.LastMutation.Date > posTx.TransactionDate)
                                    throw new ApplicationException(string.Format("The date of the LastMutation can not be greater than the TxDate for Account: {0}, Instrument: {1}, Date: {2}", posTx.Account.Key, posTx.Instrument.Key, posTx.TransactionDate));

                                // Is the TxDate the same
                                if (posTx.ParentPosition.LastMutation.Date.Equals(posTx.TransactionDate))
                                    mutation = (ISecurityValuationMutation)posTx.ParentPosition.LastMutation;
                                // else Create New Valuation from Previous Valuation
                                else
                                    mutation = new SecurityValuationMutation(posTx.TransactionDate, (ISecurityValuationMutation)posTx.ParentPosition.LastMutation);
                            }
                            mutation.AddTx(posTx);

                            account.Portfolio.PortfolioInstrument.GetPosition(posTx.Instrument).LastMutation = mutation;
                            if (!mutations.Keys.Contains(mutation.GetUniqueCode))
                                mutations.Add(mutation.GetUniqueCode, mutation);
                        }
                        else
                            notRelevantPositionTxs.Add(posTx);
                    }
                }
                if (mutations != null && mutations.Count > 0)
                {
                    mutationsToSave = mutations.Values.ToList();
                    if (notRelevantPositionTxs.Count > 0)
                        addNotRelevantPosTxToMutations(ref mutationsToSave, notRelevantPositionTxs);

                    // Validate mutations
                    foreach (IValuationMutation mut in mutationsToSave)
                        mut.Validate();
                }
            }
        }
Exemplo n.º 13
0
        private void runCashValuationMutationJobForAccount(IDalSession session, IList<IJournalEntryLine> lines, IAccountTypeCustomer account, DateTime maxDate, out IValuationCashMutation[] cashMutationsToSave)
        {
            //raiseProgressEvent(string.Format("Create Cash valuations for {0}", account.DisplayNumberWithName));
            cashMutationsToSave = null;
            IDictionary<string, IValuationCashMutation> mutations = new Dictionary<string, IValuationCashMutation>();
            IValuationCashMutation mutation;
            IList<IJournalEntryLine> notRelevantLines = new List<IJournalEntryLine>();

            if (lines != null && lines.Count > 0)
            {
                foreach (IJournalEntryLine line in lines.Where(u => u.GLAccount.ValuationCashType != ValuationCashTypes.None))
                {
                    if (line.BookDate <= maxDate && (Util.IsNullDate(account.ValuationsEndDate) || line.BookDate <= account.ValuationsEndDate))
                    {
                        if (line.IsRelevant)
                        {
                            ValuationCashMutationKey key = new ValuationCashMutationKey((IAccountTypeCustomer)line.GiroAccount, line.BookingRelatedInstrument, line.GLAccount.ValuationCashType);

                            // search key in account
                            // It's possible because of storno's or earlier tx that there is no LastCashMutation
                            // In this case create new CashMutation
                            if (account.LastValuationCashMutations.Count > 0 && account.LastValuationCashMutations.ContainsKey(key) && account.LastValuationCashMutations[key].LastCashMutation != null)
                            {
                                ILastValuationCashMutationHolder holder = account.LastValuationCashMutations[key];

                                // If pos Date is earlier than last recorded date -> skip it
                                if (holder.LastCashMutation.Date <= line.BookDate)
                                {
                                    // Is the TxDate the same
                                    if (holder.LastCashMutation.Date.Equals(line.BookDate))
                                    {
                                        // check whether line not already stored
                                        if (!holder.LastCashMutation.ContainsLine(line))
                                            mutation = holder.LastCashMutation;
                                        else
                                            mutation = null;
                                    }
                                    else
                                    {
                                        mutation = new ValuationCashMutation(line.BookDate, holder.LastCashMutation);
                                    }
                                }
                                else
                                    mutation = null;
                            }
                            else
                            {
                                // Create Complete New Cash Valuation
                                mutation = new ValuationCashMutation(line);
                            }

                            if (mutation != null)
                            {
                                mutation.AddLine(line);

                                if (account.LastValuationCashMutations.ContainsKey(key))
                                    account.LastValuationCashMutations[key].LastCashMutation = mutation;
                                else
                                    account.LastValuationCashMutations.Add(key, mutation);

                                if (!mutations.Keys.Contains(mutation.GetUniqueCode))
                                    mutations.Add(mutation.GetUniqueCode, mutation);
                            }
                        }
                        else
                            notRelevantLines.Add(line);
                    }
                }
                if (mutations != null && mutations.Count > 0)
                {
                    cashMutationsToSave = new IValuationCashMutation[mutations.Count];
                    mutations.Values.CopyTo(cashMutationsToSave, 0);

                    if (notRelevantLines.Count > 0)
                        addNotRelevantLinesToCashMutations(ref cashMutationsToSave, notRelevantLines);

                    // Validate mutations
                    foreach (IValuationCashMutation mut in cashMutationsToSave)
                        mut.Validate();
                }
            }
        }
Exemplo n.º 14
0
        public static string GetAllMessages(IAccountTypeCustomer account, bool HTMLLayout, out NotificationTypes notificationType)
        {
            if (account == null)
                throw new ApplicationException("The account can not be null");

            IList<Notification> notifications = account.Notifications;
            if (account.PrimaryAccountHolder != null &&
                account.PrimaryAccountHolder.Contact != null &&
                account.PrimaryAccountHolder.Contact.Notifications.Count > 0)
            {
                foreach (Notification notification in account.PrimaryAccountHolder.Contact.Notifications)
                {
                    if (notification.IsActive && !notifications.Contains(notification))
                        notifications.Add(notification);
                }
            }
            return GetAllMessages(notifications, HTMLLayout, out notificationType);
        }
Exemplo n.º 15
0
        private bool getFundPositionTxData(IDalSession session, IAccountTypeCustomer account, DateTime maxDate, out IList<IFundPositionTx> posTxs)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("accountID",account.Key);
            parameters.Add("maxDate",maxDate);

            posTxs = session.GetTypedListByNamedQuery<IFundPositionTx>(
                "B4F.TotalGiro.Valuations.GetFundPositionTxData",
                parameters);
            return (posTxs != null && posTxs.Count > 0);
        }
Exemplo n.º 16
0
        public bool RunDailyValuationsForAccount(IDalSession session, IAccountTypeCustomer account, DateTime lastValuationDate, out string message)
        {
            bool success = false;
            message = "";
            try
            {
                SqlCommand command = new SqlCommand("TG_CreateValuationsForAccount", (SqlConnection)session.Connection);
                SqlParameter param1 = new SqlParameter("AccountID", account.Key);
                command.Parameters.Add(param1);
                SqlParameter param2 = new SqlParameter("lastValuationDate", (Util.IsNullDate(lastValuationDate) ? null : lastValuationDate.ToString("yyyy-MM-dd")));
                command.Parameters.Add(param2);
                SqlParameter param3 = new SqlParameter("success", success);
                param3.SqlDbType = SqlDbType.Bit;
                param3.Direction = ParameterDirection.Output;
                command.Parameters.Add(param3);
                SqlParameter param4 = new SqlParameter("errMessage", message);
                param4.SqlDbType = SqlDbType.VarChar;
                param4.Size = 2000;
                param4.Direction = ParameterDirection.Output;
                command.Parameters.Add(param4);
                command.CommandType = CommandType.StoredProcedure;
                command.CommandTimeout = 0;
                command.ExecuteNonQuery();

                if (!((System.Data.SqlTypes.SqlString)param4.SqlValue).IsNull)
                    message = param4.SqlValue.ToString();
                success = ((System.Data.SqlTypes.SqlBoolean)param3.SqlValue).IsTrue;
            }
            catch (Exception ex)
            {
                message = Util.GetMessageFromException(ex);
                string logMessage = string.Format("Error in RunDailyValuationsForAccount -> account: {0}; {1}", account.Key, message);
                log.Error(logMessage);
            }
            return success;
        }
Exemplo n.º 17
0
        private static List<ICurrency> getCurrencies(IAccountTypeCustomer account, IInstrument instrument)
        {
            List<ICurrency> currencies = new List<ICurrency>();
            ICurrency baseCurrency = null, instrumentCurrency = null;

            if (account != null)
            {
                baseCurrency = account.AccountOwner.StichtingDetails.BaseCurrency;
                currencies.Add(baseCurrency);
            }

            if (instrument != null)
            {
                instrumentCurrency = ((ITradeableInstrument)instrument).CurrencyNominal;
                if (!instrumentCurrency.IsActive && instrumentCurrency.ParentInstrument != null)
                    instrumentCurrency = instrumentCurrency.ParentInstrument.ToCurrency;

                if (baseCurrency == null || baseCurrency.Key != instrumentCurrency.Key)
                    currencies.Add(instrumentCurrency);
            }

            return currencies;
        }
Exemplo n.º 18
0
 public static AccountDetailsView GetAccountDetails(IAccountTypeCustomer account, ICurrency baseCurrency)
 {
     return account != null ? new AccountDetailsView(account) : new AccountDetailsView(baseCurrency);
 }
Exemplo n.º 19
0
 internal LastValuationCashMutationHolder(IAccountTypeCustomer account, ITradeableInstrument instrument, ValuationCashTypes valuationCashType, IValuationCashMutation lastCashMutation)
 {
     this.CashMutKey = new ValuationCashMutationKey(account, instrument, valuationCashType);
     this.LastCashMutation = lastCashMutation;
 }
Exemplo n.º 20
0
        public static DataSet GetPositions(IDalSession session, IAccountTypeCustomer account)
        {
            if (account != null)
            {
                List<PositionRowView> positionRowViews = FundPositionMapper.GetPositions(session, account, PositionsView.NotZero)
                                                                           .Select(p => new PositionRowView(p))
                                                                           .ToList();

                decimal totalValue = account.TotalPositionAmount(PositionAmountReturnValue.All).Quantity;
                if (totalValue != 0m)
                    foreach (PositionRowView rowView in positionRowViews.Where(pv => pv.Value != null))
                        rowView.Percentage = Math.Round(100m * rowView.Value.Quantity / totalValue, 2);

                return positionRowViews.ToDataSet();
            }
            else
                return (new List<PositionRowView>()).ToDataSet();
        }
Exemplo n.º 21
0
        public void RunValuationMutationsForAccount(IDalSession session, IAccountTypeCustomer account, bool runSP)
        {
            DateTime maxDate = MaxValuationDate;
            string message;

            // Run TG_ResetValuations for account
            if (runSP)
                ResetValuations(session, account);

            bool success = runValuationMutationsForAccount(session, account, maxDate, out message);
            if (!success)
                throw new ApplicationException(message);
        }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.Accounts.Instructions.BuyModelInstruction">BuyModelInstruction</see> class.
 /// </summary>
 /// <param name="account">The account the withdrawal will belong to</param>
 /// <param name="executionDate">The date the instruction should execute</param>
 /// <param name="orderActionType">The type of instruction that is placed on the orders</param>
 /// <param name="doNotChargeCommission">The instruction is without any charges</param>
 /// <param name="cashTransfers">The transfers involved</param>
 public BuyModelInstruction(IAccountTypeCustomer account, DateTime executionDate, OrderActionTypes orderActionType, bool doNotChargeCommission,
     IList<IJournalEntryLine> cashTransfers)
     : base(account, executionDate, orderActionType, doNotChargeCommission, cashTransfers)
 {
     //DepositCashPositionDifference = depositCashPositionDifference;
 }
Exemplo n.º 23
0
        private bool getJournalEntryLineData(IDalSession session, IAccountTypeCustomer account, DateTime maxDate, out IList<IJournalEntryLine> lines)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("accountID", account.Key);
            parameters.Add("maxDate", maxDate);
            parameters.Add("settledFlag", CashPositionSettleStatus.Settled);
            parameters.Add("unSettledFlag", CashPositionSettleStatus.UnSettled);
            parameters.Add("statusBooked", JournalEntryLineStati.Booked);

            lines = session.GetTypedListByNamedQuery<IJournalEntryLine>(
                "B4F.TotalGiro.Valuations.GetJournalEntryLineData",
                parameters);
            return (lines != null && lines.Count > 0);
        }
Exemplo n.º 24
0
        public AccountDetailsView(IAccountTypeCustomer account)
        {
            AccountNumberWithName = account.DisplayNumberWithName;
            AccountName = account.ShortName;
            ManagementStartDate = account.ManagementStartDate;

            // Set the flag for Crumble account
            IsCrumbleAccount = account.AccountType == AccountTypes.Crumble;

            ICustomerAccount customerAccount = null;
            if (account.AccountType == AccountTypes.Customer)
            {
                customerAccount = (ICustomerAccount)account;
                if (customerAccount.AccountHolders.PrimaryAccountHolder != null)
                {
                    PrimaryAccountHolderName = customerAccount.Formatter.AddressFirstLine;
                    SecondaryAccountHolderName = customerAccount.Formatter.AddressSecondLine;
                    StreetAddressLine = customerAccount.Formatter.Address.Get(a => a.StreetAddressLine);
                    CityAddressLine = customerAccount.Formatter.Address.Get(a => a.CityAddressLine);
                    CountryAddressLine = customerAccount.Formatter.Address.Get(a => a.CountryAddressLine);
                }

                if (customerAccount.RemisierEmployee != null)
                {
                    RemisierEmployee = customerAccount.RemisierEmployee.LoginPerson.FullName;
                    Remisier = customerAccount.RemisierEmployee.Remisier.Name;
                }

                if (customerAccount.VerpandSoort != null)
                    VerpandSoort = Util.Capitalize(Util.SplitCamelCase(customerAccount.VerpandSoort.Description).ToLower());

                if (customerAccount.PandHouder != null)
                    Pandhouder = customerAccount.PandHouder.Name;
            }

            ModelName = account.ModelPortfolio != null ? account.ModelPortfolio.ModelName : "";
            AccountNumber = account.Number;
            Status = account.Status;
            StatusIsOpen = account.Status == AccountStati.Active;
            IsTradeable = account.TradeableStatus == Tradeability.Tradeable;

            Money totalAll = account.TotalPositionAmount(PositionAmountReturnValue.All);
            Money totalCash = account.TotalCashAmount;
            Money totalPositions = totalAll - totalCash;

            TotalAll = totalAll.DisplayString;
            TotalCash = totalCash.DisplayString;
            TotalCashQuantity = totalCash.Quantity;
            TotalPositions = totalPositions.DisplayString;

            LastRebalanceDate = account.LastRebalanceDate;
            CurrentRebalanceDate = account.CurrentRebalanceDate;
            if (account.IsDeparting)
            {
                IsDeparting = true;
                FutureWithdrawalAmount = totalAll.Quantity;
                DisplayFutureWithdrawalAmount = TotalAll + " (Portfolio Liquidation)";
            }
            else if (account.ActiveWithdrawalInstructions != null)
            {
                Money withdrawalAmount = account.ActiveWithdrawalInstructions.TotalAmount;
                if (withdrawalAmount != null && withdrawalAmount.IsNotZero)
                {
                    FutureWithdrawalAmount = withdrawalAmount.Quantity;
                    DisplayFutureWithdrawalAmount = withdrawalAmount.DisplayString;
                }
            }
            IsUnderRebalance = account.IsUnderRebalance;

            if (customerAccount != null && !(IsDeparting || IsUnderRebalance))
                ActiveOrderCount = customerAccount.OpenOrdersForAccount.Count;

            // Notifications
            Notification = account.Notifications.DisplayMessages;
            NotificationType = account.Notifications.DisplayNotificationType;
        }