Exemplo n.º 1
0
 public MLFSSale(MLFSIncome income)
 {
     IOId = income.IOReference;
     ReportingPeriodId = income.ReportingPeriodId;
     Organisation      = income.Organisation;
     ClientName        = income.ClientName;
     ClientId          = income.ClientId;
     JointClientId     = income.JointClientId;
     JointClientName   = income.JointClientName;
     AdvisorId         = income.AdvisorId;
     Advisor           = income.Advisor;
     ProviderName      = income.ProviderName;
     PlanType          = income.PlanType;
     IsNew             = false;
     if (income.RelevantDate != null)
     {
         RelevantDate = (DateTime)income.RelevantDate;
     }
     else
     {
         RelevantDate = DateTime.Parse("01/" + income.ReportingPeriod.Month + "/" + income.ReportingPeriod.Year);
     }
     NetAmount            = income.Amount;
     VAT                  = 0;
     Investment           = 0;
     OnGoingPercentage    = 0;
     PlanReference        = income.PlanNumber;
     EstimatedOtherIncome = 0;
     RelatedClients       = new string[] { };
 }
        /// <summary>
        /// matches the income to the sale/debtor
        /// </summary>
        /// <param name="sale"></param>
        /// <param name="income"></param>
        public MLFSDebtorAdjustment(MLFSSale sale, MLFSIncome income)
        {
            MLFSReportingPeriod period = income.ReportingPeriod;

            ReportingPeriodId = period.Id;
            ReportingPeriod   = period;
            DebtorId          = (int)sale.Id;
            Debtor            = sale;
            ReceiptId         = income.Id;
            Amount            = income.Amount * -1;
            IsVariance        = false;
            NotTakenUp        = false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Converts a datatable row into our domain object
        /// </summary>
        /// <param name="income">the datatable</param>
        /// <param name="advisors">the advisors to match</param>
        /// <param name="period">the period it relates to</param>
        /// <returns>List or MLFSIncome</returns>
        public static List <MLFSIncome> CreateFromDataTable(DataTable income, List <MLFSAdvisor> advisors, MLFSReportingPeriod period)
        {
            List <MLFSIncome> returnedTrans = new List <MLFSIncome>();

            foreach (DataRow row in income.Rows)
            {
                MLFSIncome tran = new MLFSIncome(row, advisors)
                {
                    ReportingPeriodId = period.Id,
                    ReportingPeriod   = period
                };
                returnedTrans.Add(tran);
            }
            return(returnedTrans);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Runs through a a bathc of receipts and compares it to the debtors using IORefernece and adds a receipt entry where a match is found
        /// </summary>
        /// <param name="debtors">The current debtors</param>
        /// <param name="receipts">The batch of receipts</param>
        /// <returns>A list of the adjustments (receipts) to be added</returns>
        public static List <MLFSDebtorAdjustment> CheckForReceipts(List <MLFSSale> debtors, List <MLFSIncome> receipts)
        {
            receipts = receipts.Where(x => x.IsNewBusiness && x.Amount != 0).ToList();
            List <MLFSDebtorAdjustment> adjs = new List <MLFSDebtorAdjustment>();

            for (int i = 0; i < debtors.Count; i++)
            {
                MLFSSale debtor = debtors[i];
                for (int j = 0; j < receipts.Count; j++)
                {
                    MLFSIncome receipt = receipts[j];
                    if (receipt.IOReference == debtor.IOReference || (receipt.IOReference == debtor.PlanReference && receipt.Amount == debtor.GrossAmount))
                    {
                        MLFSDebtorAdjustment adj = new MLFSDebtorAdjustment(debtor, receipt);
                        receipts.Remove(receipt);
                        debtor.Adjustments.Add(adj);
                        adjs.Add(adj);
                    }
                }
            }
            return(adjs);
        }