Exemplo n.º 1
0
        public async Task <IActionResult> Match(int?id, int?debtorId)
        {
            if (debtorId == null || id == null)
            {
                return(NotFound());
            }
            MLFSSale debtor = await _debtorData.GetSaleById((int)debtorId);

            MLFSIncome receipt = await _incomeData.GetIncomeById((int)id);

            if (debtor == null || receipt == null)
            {
                return(NotFound());
            }
            List <MLFSDebtorAdjustment> adjs = new List <MLFSDebtorAdjustment>();

            adjs.Add(new MLFSDebtorAdjustment(debtor, receipt));
            if (debtor.Outstanding != 0 && ((debtor.Outstanding < 0 && (debtor.Outstanding * -1) / debtor.GrossAmount < (decimal)0.020) || debtor.Outstanding / debtor.GrossAmount < (decimal)0.005))
            {
                adjs.Add(debtor.ClearToVariance(receipt.ReportingPeriod));
            }
            _adjustmentData.InsertList(adjs);
            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index(Upload upload)
        {
            if (upload.ReportingPeriodId == null)
            {
                return(NotFound());
            }
            MLFSReportingPeriod period = await _periodData.GetPeriodById((int)upload.ReportingPeriodId);

            if (period == null)
            {
                return(NotFound());
            }
            upload.ReportingPeriod   = period;
            upload.ReportingPeriodId = period.Id;
            if (upload.Files == null || upload.Files.Count != 4)
            {
                return(NotFound());
            }
            List <MLFSAdvisor> advisors = await _advisorData.GetAdvisors();

            string response = await upload.CreateEntities(advisors);

            if (response != "Success")
            {
                return(NotFound());
            }
            await _salesData.InsertList(upload.Sales);

            await _incomeData.InsertList(upload.Income);

            List <MLFSDebtorAdjustment> adjs = MLFSSale.CheckForReceipts(upload.Sales, upload.Income);

            _adjustmentData.InsertList(adjs);
            ViewBag.Result = "Uploaded Successfully";
            return(RedirectToAction("Index"));
        }