示例#1
0
        /// <summary>
        /// Create a list of client objects from an array of IO data
        /// </summary>
        /// <param name="array">the array from IO</param>
        /// <returns>the list of clients</returns>
        public static List <MLFSClient> CreateList(JArray array)
        {
            List <MLFSClient> clients = new List <MLFSClient>();

            foreach (JObject obj in array)
            {
                MLFSClient c = new MLFSClient(obj);
                clients.Add(c);
            }
            return(clients);
        }
示例#2
0
        public MLFSFee(JObject fee)
        {
            Clients = new List <MLFSClient>();
            dynamic f = fee;

            PrimaryID    = f.id;
            SentToClient = f.sentToClientOn;
            if (f.feeChargingType != null)
            {
                FeeType = f.feeChargingType.name;
            }
            if (f.sellingAdvisor != null)
            {
                string advisorID = f.sellingAdvisor.id;
                Advisor = new Staff(advisorID);
            }
            NetAmount = f.net.amount;
            VAT       = f.vat.amount;
            if (f.recurring == null)
            {
                IsRecurring        = false;
                RecurringFrequency = "";
                RecurringStart     = null;
                RecurringEnd       = null;
            }
            else
            {
                IsRecurring        = true;
                RecurringFrequency = f.recurring.frequency;
                if (f.recurring.startsOn != null)
                {
                    RecurringStart = Tools.HandleStringToDate(f.recurring.startsOn.ToString());
                }
                if (f.recurring.endsOn != null)
                {
                    RecurringEnd = Tools.HandleStringToDate(f.recurring.endsOn.ToString());
                }
            }
            PaidBy        = f.paymentType.paidBy;
            InitialPeriod = f.initialPeriod;
            if (f.plan_href != null)
            {
                string planId = f.plan_href.ToString();
                planId = planId.Substring(planId.IndexOf('(') + 1, planId.LastIndexOf(')') - planId.IndexOf('(') - 1);
                Plan   = new MLFSPlan(planId);
            }
            if (f.discount != null)
            {
                DiscountPercentage = f.discount.percentage;
                DiscountTotal      = f.discount.total.amount;
            }
            Clients       = MLFSClient.CreateSummaryList(JArray.FromObject(f.clients));
            FeePercentage = f.feePercentage;
        }
示例#3
0
        /// <summary>
        /// Create a list of client objects from an array of IO data where only the Id is present
        /// </summary>
        /// <param name="array">the array from IO</param>
        /// <returns>the list of clients</returns>
        public static List <MLFSClient> CreateSummaryList(JArray array)
        {
            List <MLFSClient> clients = new List <MLFSClient>();

            foreach (JObject obj in array)
            {
                MLFSClient c = new MLFSClient(obj["id"].ToString());
                clients.Add(c);
            }
            return(clients);
        }
示例#4
0
        public MLFSPlan(JObject plan)
        {
            dynamic p = plan;

            PrimaryID = p.id;
            if (p.productProvider != null)
            {
                Provider = p.productProvider.name;
            }
            Reference = p.reference;
            StartDate = p.startOn;
            if (p.sellingAdviser != null)
            {
                string advisorID = p.sellingAdviser.id;
                Advisor = new Staff(advisorID);
            }
            if (p.paraplanner != null)
            {
                string paraID = p.paraplanner.id;
                ParaPlanner = new Staff(paraID);
            }
            if (p.administrator != null)
            {
                string adminID = p.administrator.id;
                ParaPlanner = new Staff(adminID);
            }
            PlanType            = p.planType.name;
            IsPreExistingClient = p.isPreExisting;
            ProductName         = p.productName;
            Status  = MLFSPlan.ParsePlanStatus(p.currentStatus.Value);
            Clients = MLFSClient.CreateSummaryList(JArray.FromObject(p.owners));
            IsTopUp = p.isTopup;
            if (p.latestValuation != null)
            {
                CurrentValuation = p.latestValuation.value.amount;
            }
        }
示例#5
0
        /// <summary>
        /// Takes IO client data and uses it to update information about the sale entry
        /// </summary>
        /// <param name="client">the client to which the sale relates</param>
        public void AddClientData(MLFSClient client, List <MLFSIncome> income)
        {
            RelatedClients = client.RelatedClients.ToArray();
            MLFSPlan plan = client.Plans.Where(x => x.Reference == this.PlanReference).FirstOrDefault();

            if (plan != null)
            {
                ProviderName = plan.Provider;
                if (!plan.IsPreExistingClient)
                {
                    IsNew = true;
                }
                if (plan.CurrentValuation == 0)
                {
                    this.Investment = plan.ContributionsToDate;
                }
                else
                {
                    this.Investment = plan.CurrentValuation;
                }
                MLFSFee fee = client.Fees.Where(x => x.Plan != null && x.Plan.PrimaryID == plan.PrimaryID && x.IsRecurring).FirstOrDefault();
                if (fee != null)
                {
                    if (fee.FeePercentage == 0 && fee.NetAmount != 0)
                    {
                        if (fee.RecurringFrequency == "Monthly")
                        {
                            this.TwelveMonthTrail = fee.NetAmount * 12;
                        }
                        else
                        {
                            this.TwelveMonthTrail = fee.NetAmount;
                        }
                    }
                    else
                    {
                        OnGoingPercentage = fee.FeePercentage;
                        TwelveMonthTrail  = Investment * OnGoingPercentage / 100;
                    }
                }
            }

            if (client.Plans != null && client.Plans.Count > 0)
            {
                this.EstimatedOtherIncome = 0;
                List <MLFSPlan> plans = client.Plans.Where(x => (plan == null || x.PrimaryID != plan.PrimaryID) && x.Status != PlanStatus.OutOfForce).Distinct().ToList();
                foreach (MLFSPlan p in plans)
                {
                    MLFSFee fee = client.Fees.Where(x => x.Plan != null && x.Plan.PrimaryID.Contains(p.PrimaryID) && x.IsRecurring).FirstOrDefault();
                    if (fee != null)
                    {
                        //if it is a plan older than 12 months use the last 12 months to assess income
                        List <MLFSIncome> relatedIncome = income.Where(x => x.IOReference == p.Reference && (x.IncomeType == "Ongoing Fee" || x.IncomeType.Contains("Commission"))).ToList();
                        if (relatedIncome.Where(x => x.RelevantDate <= DateTime.Now.AddYears(-1)).Count() > 0)
                        {
                            this.EstimatedOtherIncome = relatedIncome.Where(x => x.RelevantDate > DateTime.Now.AddYears(-1)).Sum(y => y.Amount);
                        }
                        else
                        {
                            decimal value = 0;
                            if (p.CurrentValuation == 0)
                            {
                                value = p.ContributionsToDate;
                            }
                            else
                            {
                                value = p.CurrentValuation;
                            }
                            decimal d = value * fee.FeePercentage / 100;
                            this.EstimatedOtherIncome += d;
                        }
                    }
                }
            }
            if (client.CreatedOn < ReportingPeriod.StartDate.AddMonths(-3))
            {
                IsNew = false;
            }
            else
            {
                IsNew = true;
            }
        }