public ActionResult Edit(int BankAccountID) { GetData(); bankaccount bankaccount = BankAccountRepository.GetBankAccountByID(BankAccountID); return(PartialView(bankaccount)); }
public ActionResult Create() { GetData(); IEnumerable <payee> PayeeList = PayeeRepository.GetAllPayee(); foreach (var i in PayeeList) { i.bankaccount = BankAccountRepository.GetBankAccountByID(i.BankAccountID); i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.SubCategoryID); } ViewBag.RecordCount = PayeeList.Count(); ViewBag.PayeeList = PayeeList.OrderBy(e => e.PayeeTypeID).ThenBy(e => e.PayeeName); return(PartialView(new payee { DateEntered = System.DateTime.Today, EnteredBy = User.Identity.Name.ToString(), Status = "Active" })); }
public ActionResult Create() { GetData(); IEnumerable <income> IncomeList; IncomeList = IncomeRepository.GetIncomeByStatus("Inactive"); ViewBag.RecordCount = IncomeList.Count(); foreach (var i in IncomeList) { i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID); i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID); if (i.CashAmount != null) { i.TotalIncome += (decimal)i.CashAmount; } if (i.CheckAmount != null) { i.TotalIncome += (decimal)i.CheckAmount; } if (i.CoinAmount != null) { i.TotalIncome += (decimal)i.CoinAmount; } } decimal cash = (decimal)IncomeList.Sum(e => e.CashAmount); ViewBag.TotalCash = cash; decimal check = (decimal)IncomeList.Sum(e => e.CheckAmount); ViewBag.TotalCheck = check; decimal coin = (decimal)IncomeList.Sum(e => e.CoinAmount); ViewBag.TotalCoin = coin; ViewBag.TotalAmount = cash + check + coin; ViewBag.IncomeList = IncomeList; return(PartialView(new income { DateEntered = System.DateTime.Today, EnteredBy = User.Identity.Name.ToString(), Status = "Inactive" })); }
public ActionResult Create(int payeeID = 0, decimal Amount = 0, int billID = 0) { GetData(); //get pending bills IEnumerable <bill> bills = BillRepository.GetAllBill(); ViewBag.PendingBills = bills; ViewBag.PendingBillsRecordCount = bills.Count(); //get pedning expenses IEnumerable <expense> expenses = db.expenses.Where(e => e.Status == "Unpaid"); foreach (var i in expenses) { i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID); i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID); } ViewBag.PendingExpenses = expenses; ViewBag.PendingExpenseRecordCount = expenses.Count(); ViewBag.ExpenseType = ""; if (payeeID > 0) { payee payee = PayeeRepository.GetPayeeByID(payeeID); ViewBag.ExpenseType = SubCategoryRepository.GetDisplayName(payee.SubCategoryID); return(PartialView(new expense { PendingBillID = billID, Payee = payee.PayeeName, subCategoryID = payee.SubCategoryID, bankAccountID = payee.BankAccountID, Amount = Amount, DateEntered = System.DateTime.Today, EnteredBy = User.Identity.Name.ToString(), Status = "Unpaid" })); } else { return(PartialView(new expense { DateEntered = System.DateTime.Today, EnteredBy = User.Identity.Name.ToString(), Status = "Unpaid" })); } }
public ActionResult AccountSummaryDetail(int BudgetYear, int BankAccountID = 0) { string sYear = BudgetYear.ToString(); if (BankAccountID != 0) { ViewBag.Title = string.Format("{0} {1} Total Summary (YTD)", BudgetYear, BankAccountRepository.GetBankAccountByID(BankAccountID).BankName); ViewBag.IncomeTotal = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); ViewBag.IncomeJan = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("1/31/" + sYear)); if (DateTime.IsLeapYear(Convert.ToInt16(sYear))) { ViewBag.IncomeFeb = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("2/1/" + sYear).Date, Convert.ToDateTime("2/29/" + sYear).Date); } else { ViewBag.IncomeFeb = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/28/" + sYear)); } ViewBag.IncomeMar = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("3/1/" + sYear), Convert.ToDateTime("3/31/" + sYear)); ViewBag.IncomeApr = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("4/1/" + sYear), Convert.ToDateTime("4/30/" + sYear)); ViewBag.IncomeMay = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("5/1/" + sYear), Convert.ToDateTime("5/31/" + sYear)); ViewBag.IncomeJun = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("6/1/" + sYear), Convert.ToDateTime("6/30/" + sYear)); ViewBag.IncomeJul = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("7/1/" + sYear), Convert.ToDateTime("7/31/" + sYear)); ViewBag.IncomeAug = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("8/1/" + sYear), Convert.ToDateTime("8/31/" + sYear)); ViewBag.IncomeSept = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("9/1/" + sYear), Convert.ToDateTime("9/30/" + sYear)); ViewBag.IncomeOct = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("10/1/" + sYear), Convert.ToDateTime("10/31/" + sYear)); ViewBag.IncomeNov = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("11/1/" + sYear), Convert.ToDateTime("11/30/" + sYear)); ViewBag.IncomeDec = IncomeRepository.GetIncomeTotalByBankAccount(BankAccountID, Convert.ToDateTime("12/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); ViewBag.ExpenseTotal = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); ViewBag.ExpenseJan = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("1/31/" + sYear)); if (DateTime.IsLeapYear(Convert.ToInt16(sYear))) { ViewBag.ExpenseFeb = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/29/" + sYear)); } else { ViewBag.ExpenseFeb = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/28/" + sYear)); } ViewBag.ExpenseMar = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("3/1/" + sYear), Convert.ToDateTime("3/31/" + sYear)); ViewBag.ExpenseApr = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("4/1/" + sYear), Convert.ToDateTime("4/30/" + sYear)); ViewBag.ExpenseMay = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("5/1/" + sYear), Convert.ToDateTime("5/31/" + sYear)); ViewBag.ExpenseJun = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("6/1/" + sYear), Convert.ToDateTime("6/30/" + sYear)); ViewBag.ExpenseJul = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("7/1/" + sYear), Convert.ToDateTime("7/31/" + sYear)); ViewBag.ExpenseAug = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("8/1/" + sYear), Convert.ToDateTime("8/31/" + sYear)); ViewBag.ExpenseSept = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("9/1/" + sYear), Convert.ToDateTime("9/30/" + sYear)); ViewBag.ExpenseOct = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("10/1/" + sYear), Convert.ToDateTime("10/31/" + sYear)); ViewBag.ExpenseNov = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("11/1/" + sYear), Convert.ToDateTime("11/30/" + sYear)); ViewBag.ExpenseDec = ExpenseRepository.GetExpenseTotalByBankAccount(BankAccountID, Convert.ToDateTime("12/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); } else { ViewBag.Title = string.Format("{0} All Account Summary (YTD)", BudgetYear); ViewBag.IncomeTotal = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); ViewBag.IncomeJan = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("1/31/" + sYear)); if (DateTime.IsLeapYear(Convert.ToInt16(sYear))) { ViewBag.IncomeFeb = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/29/" + sYear)); } else { ViewBag.IncomeFeb = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/28/" + sYear)); } ViewBag.IncomeMar = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("3/1/" + sYear), Convert.ToDateTime("3/31/" + sYear)); ViewBag.IncomeApr = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("4/1/" + sYear), Convert.ToDateTime("4/30/" + sYear)); ViewBag.IncomeMay = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("5/1/" + sYear), Convert.ToDateTime("5/31/" + sYear)); ViewBag.IncomeJun = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("6/1/" + sYear), Convert.ToDateTime("6/30/" + sYear)); ViewBag.IncomeJul = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("7/1/" + sYear), Convert.ToDateTime("7/31/" + sYear)); ViewBag.IncomeAug = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("8/1/" + sYear), Convert.ToDateTime("8/31/" + sYear)); ViewBag.IncomeSept = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("9/1/" + sYear), Convert.ToDateTime("9/30/" + sYear)); ViewBag.IncomeOct = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("10/1/" + sYear), Convert.ToDateTime("10/31/" + sYear)); ViewBag.IncomeNov = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("11/1/" + sYear), Convert.ToDateTime("11/30/" + sYear)); ViewBag.IncomeDec = IncomeRepository.GetIncomeTotalByDateRange(Convert.ToDateTime("12/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); ViewBag.ExpenseTotal = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); ViewBag.ExpenseJan = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("1/1/" + sYear), Convert.ToDateTime("1/31/" + sYear)); if (DateTime.IsLeapYear(Convert.ToInt16(sYear))) { ViewBag.ExpenseFeb = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/29/" + sYear)); } else { ViewBag.ExpenseFeb = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("2/1/" + sYear), Convert.ToDateTime("2/28/" + sYear)); } ViewBag.ExpenseMar = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("3/1/" + sYear), Convert.ToDateTime("3/31/" + sYear)); ViewBag.ExpenseApr = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("4/1/" + sYear), Convert.ToDateTime("4/30/" + sYear)); ViewBag.ExpenseMay = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("5/1/" + sYear), Convert.ToDateTime("5/31/" + sYear)); ViewBag.ExpenseJun = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("6/1/" + sYear), Convert.ToDateTime("6/30/" + sYear)); ViewBag.ExpenseJul = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("7/1/" + sYear), Convert.ToDateTime("7/31/" + sYear)); ViewBag.ExpenseAug = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("8/1/" + sYear), Convert.ToDateTime("8/31/" + sYear)); ViewBag.ExpenseSept = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("9/1/" + sYear), Convert.ToDateTime("9/30/" + sYear)); ViewBag.ExpenseOct = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("10/1/" + sYear), Convert.ToDateTime("10/31/" + sYear)); ViewBag.ExpenseNov = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("11/1/" + sYear), Convert.ToDateTime("11/30/" + sYear)); ViewBag.ExpenseDec = ExpenseRepository.GetExpenseTotalByDateRange(Convert.ToDateTime("12/1/" + sYear), Convert.ToDateTime("12/31/" + sYear)); } ViewBag.NetTotal = Convert.ToDecimal(ViewBag.IncomeTotal) - Convert.ToDecimal(ViewBag.ExpenseTotal); ViewBag.NetJan = Convert.ToDecimal(ViewBag.IncomeJan) - Convert.ToDecimal(ViewBag.ExpenseJan); ViewBag.NetFeb = Convert.ToDecimal(ViewBag.IncomeFeb) - Convert.ToDecimal(ViewBag.ExpenseFeb); ViewBag.NetMar = Convert.ToDecimal(ViewBag.IncomeMar) - Convert.ToDecimal(ViewBag.ExpenseMar); ViewBag.NetApr = Convert.ToDecimal(ViewBag.IncomeApr) - Convert.ToDecimal(ViewBag.ExpenseApr); ViewBag.NetMay = Convert.ToDecimal(ViewBag.IncomeMay) - Convert.ToDecimal(ViewBag.ExpenseMay); ViewBag.NetJun = Convert.ToDecimal(ViewBag.IncomeJun) - Convert.ToDecimal(ViewBag.ExpenseJun); ViewBag.NetJul = Convert.ToDecimal(ViewBag.IncomeJul) - Convert.ToDecimal(ViewBag.ExpenseJul); ViewBag.NetAug = Convert.ToDecimal(ViewBag.IncomeAug) - Convert.ToDecimal(ViewBag.ExpenseAug); ViewBag.NetSept = Convert.ToDecimal(ViewBag.IncomeSept) - Convert.ToDecimal(ViewBag.ExpenseSept); ViewBag.NetOct = Convert.ToDecimal(ViewBag.IncomeOct) - Convert.ToDecimal(ViewBag.ExpenseOct); ViewBag.NetNov = Convert.ToDecimal(ViewBag.IncomeNov) - Convert.ToDecimal(ViewBag.ExpenseNov); ViewBag.NetDec = Convert.ToDecimal(ViewBag.IncomeDec) - Convert.ToDecimal(ViewBag.ExpenseDec); return(PartialView()); }
public ActionResult List(string CategoryType = "Income", int budgetYear = 0, string SortType = "") { ViewBag.CategoryType = CategoryType; ViewBag.budgetYear = budgetYear; IEnumerable <subcategory> subCategoryList; subCategoryList = SubCategoryRepository.GetCategoryByCategoryType(CategoryType); ViewBag.RecordCount = subCategoryList.Count(); int parentCategoryID; //calendar dates int year = budgetYear; string bDateString = "1/1/" + year.ToString(); DateTime bDate = Convert.ToDateTime(bDateString).Date; ViewBag.CalendarBeginDate = bDate; string eDateString = "12/31/" + year.ToString(); DateTime eDate = Convert.ToDateTime(eDateString).Date; ViewBag.CalendarEndDate = eDate; foreach (var i in subCategoryList) { i.category = CategoryRepository.GetCategoryByID(i.categoryID); i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID); if (CategoryType == "Income") { i.TotalYTDAmount = IncomeRepository.GetTotalIncomeByCategory(i.subCategoryID, bDate.Date, eDate.Date); } else { i.TotalYTDAmount = ExpenseRepository.GetTotalExpenseByCategoryIncludeChildren(i.subCategoryID, bDate.Date, eDate.Date); } bool HasParent = SubCategoryItemRepository.HasParent(i.subCategoryID); if (HasParent) { parentCategoryID = SubCategoryItemRepository.GetCategoryByChild(i.subCategoryID).ParentCategoryID; i.ParentCategoryName = SubCategoryRepository.GetBySubCategoryID(parentCategoryID).SubCategoryName; } else { i.ParentCategoryName = ""; } } if (SortType == "Category") { return(PartialView(subCategoryList.OrderBy(e => e.SubCategoryName).ThenBy(e => e.ParentCategoryName))); } else if (SortType == "Parent") { return(PartialView(subCategoryList.OrderBy(e => e.ParentCategoryName).ThenBy(e => e.ShortTitle))); } else if (SortType == "Bank Name") { return(PartialView(subCategoryList.OrderBy(e => e.bankAccountID).ThenBy(e => e.SubCategoryName))); } else if (SortType == "Short Title") { return(PartialView(subCategoryList.OrderBy(e => e.ShortTitle).ThenBy(e => e.ParentCategoryName))); } else { return(PartialView(subCategoryList.OrderBy(e => e.ShortTitle).ThenBy(e => e.ParentCategoryName))); } }