Пример #1
0
        public static List <MLFSSale> ConvertFromDataTable(DataTable sales, DataTable plans, DataTable commissions, List <MLFSAdvisor> advisors, MLFSReportingPeriod period)
        {
            List <MLFSSale> returnedSales = new List <MLFSSale>();

            foreach (DataRow row in sales.Rows)
            {
                if (!row["Advise Fee Type"].ToString().Contains("Ongoing"))
                {
                    MLFSSale sale = new MLFSSale(row, advisors, period);
                    returnedSales.Add(sale);
                }
            }

            foreach (DataRow row in commissions.Rows)
            {
                MLFSSale sale = new MLFSSale(row, advisors, period, true);
                returnedSales.Add(sale);
            }

            for (int i = 0; i < returnedSales.Count; i++)
            {
                returnedSales[i].MatchPlan(plans);
            }

            return(returnedSales);
        }
        /// <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;
        }
Пример #3
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);
        }