示例#1
0
        public ActionResult ExpenseList()
        {
            DateTime           bdate    = DateTime.Now;
            DateTime           edate    = bdate.AddDays(15);
            IEnumerable <bill> BillList = billRepository.GetAllBill();

            ViewBag.BillsDue    = billRepository.GetBillByDueDateRange(bdate.Date, edate.Date);
            ViewBag.RecordCount = BillList.Count();
            return(PartialView(BillList));
        }
示例#2
0
        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"
                }));
            }
        }