} //end method ComputeDailyLoanInterestAccrued public void SaveDailyIncomeAndExpenseBalance() { var allIncomes = glRepo.GetByMainCategory(MainGlCategory.Income); //save daily balance of all income acccounts foreach (var account in allIncomes) { var entry = new ExpenseIncomeEntry(); entry.AccountName = account.AccountName; entry.Amount = account.AccountBalance; entry.Date = today; entry.EntryType = PandLType.Income; db.ExpenseIncomeEntries.Add(entry); db.SaveChanges(); //new ProfitAndLossRepository().Insert(entry); } //save daily balance off all expense accounts var allExpenses = glRepo.GetByMainCategory(MainGlCategory.Expenses); foreach (var account in allExpenses) { var entry = new ExpenseIncomeEntry(); entry.AccountName = account.AccountName; entry.Amount = account.AccountBalance; entry.Date = today; entry.EntryType = PandLType.Expenses; db.ExpenseIncomeEntries.Add(entry); db.SaveChanges();; } }
public List<GlAccount> ExtractIncomeGLs() { var output = glActRepo.GetByMainCategory(MainGlCategory.Income); output.Insert(0, new GlAccount { ID = 0, AccountName = "--select--" }); return output; }
public List <GlAccount> GetAllAssetAccounts() { var assetAccounts = _glAccContext.GetByMainCategory(MainAccountCategory.Asset); var loanAccountsBalance = _customerAccContext.GetLoanAccounts().Sum(c => c.Balance); var loanAssetAcc = new GlAccount { Name = "Loan Accounts", Balance = loanAccountsBalance }; assetAccounts.Add(loanAssetAcc); return(assetAccounts); }
public ActionResult Edit(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AccountConfiguration accountconfiguration = configRepo.GetById((int)id); if (accountconfiguration == null) { return(HttpNotFound()); } ViewBag.SavingsInterestExpenseGl_GlAccountId = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Expenses), "ID", "AccountName", accountconfiguration.SavingsInterestExpenseGl != null ? accountconfiguration.SavingsInterestExpenseGl.ID : 0); ViewBag.SavingsInterestPayableGl_Id = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Liability), "ID", "AccountName", accountconfiguration.SavingsInterestPayableGl != null ? accountconfiguration.SavingsInterestPayableGl.ID : 0); ViewBag.CurrentIntExpGlId = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Expenses), "ID", "AccountName", accountconfiguration.CurrentInterestExpenseGl != null ? accountconfiguration.CurrentInterestExpenseGl.ID : 0); ViewBag.CurrentCotIncGlId = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Income), "ID", "AccountName", accountconfiguration.CurrentCotIncomeGl != null ? accountconfiguration.CurrentCotIncomeGl.ID : 0); ViewBag.LoanIntIncomeGlId = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Income), "ID", "AccountName", accountconfiguration.LoanInterestIncomeGl != null ? accountconfiguration.LoanInterestIncomeGl.ID : 0); //ViewBag.LoanIntExpGlId = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Expenses), "ID", "AccountName", accountconfiguration.LoanInterestExpenseGl != null ? accountconfiguration.LoanInterestExpenseGl.ID : 0); ViewBag.LoanInterestReceivableGl_Id = new SelectList(glaRepo.GetByMainCategory(MainGlCategory.Asset), "ID", "AccountName", accountconfiguration.LoanInterestReceivableGl != null ? accountconfiguration.LoanInterestReceivableGl.ID : 0); return(View(accountconfiguration)); } catch (Exception) { //ErrorLogger.Log("Message= " + ex.Message + "\nInner Exception= " + ex.InnerException + "\n"); return(PartialView("Error")); } }