public async Task <IActionResult> ConvertToRecurring(int incomeId)
        {
            MLFSIncome income = await _incomeData.GetIncomeById(incomeId);

            if (income == null)
            {
                return(NotFound());
            }
            income.IncomeType = "Converted";
            _incomeData.Update(income);
            return(Ok());
        }
        public async Task <IActionResult> CreateFromIncome(int incomeId)
        {
            MLFSIncome income = await _incomeData.GetIncomeById(incomeId);

            if (income.MLFSDebtorAdjustment != null)
            {
                return(NotFound());
            }
            MLFSSale             sale = new MLFSSale(income);
            MLFSDebtorAdjustment adj  = new MLFSDebtorAdjustment(sale, income);
            await _salesData.Add(sale);

            _adjData.Insert(adj);
            return(Ok());
        }
Пример #3
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());
        }