Esempio n. 1
0
        // GET: MLFSDebtorAdjustments/Create
        public async Task <IActionResult> CreateVariance(int debtorId)
        {
            MLFSDebtorAdjustment adj    = new MLFSDebtorAdjustment();
            MLFSSale             debtor = await _salesData.GetSaleById(debtorId);

            adj.DebtorId              = debtorId;
            adj.Amount                = debtor.Outstanding * -1;
            adj.IsVariance            = true;
            adj.NotTakenUp            = false;
            ViewBag.ReportingPeriodId = await _periodData.SelectList();

            return(PartialView("Create", adj));
        }
Esempio n. 2
0
        // GET: Debtor/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var mLFSSale = await _debtorData.GetSaleById((int)id);

            if (mLFSSale == null)
            {
                return(NotFound());
            }
            return(View(mLFSSale));
        }
        /// <summary>
        /// Displays a list of potential matches for a debtor
        /// </summary>
        /// <param name="debtorId">the Id of the debtor we are trying to match</param>
        /// <returns>Partial view</returns>
        public async Task <IActionResult> PotentialDebtorMatches(int?debtorId)
        {
            if (debtorId == null)
            {
                return(NotFound());
            }
            MLFSSale debtor = await _salesData.GetSaleById((int)debtorId);

            if (debtor == null)
            {
                return(NotFound());
            }
            List <MLFSIncome> matches = await _incomeData.PotentialDebtorMatches(debtor);

            ViewBag.Debtor = debtor;
            return(PartialView("_SelectIndex", matches));
        }
        public async Task <IActionResult> UpdateData(int?periodId, int?saleId = null)
        {
            List <MLFSSale> sales = new List <MLFSSale>();

            if (saleId == null)
            {
                if (periodId == null)
                {
                    return(NotFound());
                }
                MLFSReportingPeriod period = await _periodData.GetPeriodById((int)periodId);

                if (period == null)
                {
                    return(NotFound());
                }
                sales = await _salesData.GetSales(period);
            }
            else
            {
                MLFSSale soleSale = await _salesData.GetSaleById((int)saleId);

                sales.Add(soleSale);
            }
            for (int i = 0; i < sales.Count; i++)
            {
                MLFSSale sale = sales[i];
                //only interested in clients which haven't been updated already or where we are forcing a particular line
                //if (saleId != null || (sale.EstimatedOtherIncome == 0))
                //{
                Console.WriteLine("Client: " + sale.ClientId + ":" + sale.Client + ":" + i.ToString());
                MLFSClient client = await _clientData.GetClient(sale.ClientId);

                List <MLFSIncome> income = await _incomeData.GetIncome(client);

                sale.AddClientData(client, income);
                _salesData.Update(sale);
                //}
            }

            return(Ok());
        }