Пример #1
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;
        }
Пример #2
0
        /// <summary>
        /// Creates a list of plans from an array gained from IO
        /// </summary>
        /// <param name="jArray">The array from IO</param>
        /// <returns>a list of plans</returns>
        public static List <MLFSPlan> CreateList(JArray jArray)
        {
            List <MLFSPlan> plans = new List <MLFSPlan>();

            foreach (JObject p in jArray)
            {
                MLFSPlan plan = new MLFSPlan(p);
                plans.Add(plan);
            }
            return(plans);
        }
Пример #3
0
 /// <summary>
 /// Updates the object from plan and fee data gained from IO Api
 /// </summary>
 /// <param name="plan">The plan</param>
 /// <param name="fee">the Fee</param>
 public void AddPlanData(MLFSPlan plan, MLFSFee fee)
 {
     ProviderName = plan.Provider;
     if (!plan.IsPreExistingClient)
     {
         IsNew = true;
     }
     Investment = plan.ContributionsToDate;
     if (fee != null)
     {
         OnGoingPercentage = fee.FeePercentage;
         Organisation      = "";
     }
 }
Пример #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;
            }
        }