コード例 #1
0
        public void ExportExpenses(DateTime?minExpDate, DateTime?maxExpDate)
        {
            if (System.Web.HttpContext.Current.Session["minExpDate"] != null && System.Web.HttpContext.Current.Session["maxExpDate"] != null)
            {
                minExpDate = (DateTime)System.Web.HttpContext.Current.Session["minExpDate"];
                maxExpDate = (DateTime)System.Web.HttpContext.Current.Session["maxExpDate"];
            }
            //if (minExpDate != null && maxExpDate != null)
            //{
            //    query = query.Where(x => x.expense_date >= minExpDate && x.expense_date <= maxExpDate);
            //}
            //else
            //{
            //    query = query.Where(x => x.expense_date >= dtTmp);
            //}
            DomainModel.BusinessLayer.Expense Exp = new DomainModel.BusinessLayer.Expense();
            var x = Exp.GetExpenditure(UserDetails.Current.SchoolId, minExpDate, maxExpDate);

            //var query = from exp in x
            //            select new ExpenseTrans()
            //            {
            //                id = exp.id,
            //                amount = exp.amount,
            //                expense_date = exp.expense_date,
            //                expense_type = exp.expense_type,
            //                remarks = exp.remarks
            //            };

            //IList<ExpenseTrans> qryList= query.ToList();
            Export2Excel("ExpenseReport", x.ToList());
        }
コード例 #2
0
        // GET: Finance/Expenditure

        public ActionResult Expenditure(DateTime?minExpDate, DateTime?maxExpDate)
        {
            DomainModel.BusinessLayer.Expense Exp = new DomainModel.BusinessLayer.Expense();
            var qryExp = Exp.GetExpenditure(UserDetails.Current.SchoolId, minExpDate, maxExpDate);

            //var query = from exp in x
            //            select new ExpenseTrans()
            //            {
            //                id = exp.id,
            //                amount = exp.amount,
            //                expense_date = exp.expense_date,
            //                expense_type = exp.expense_type,
            //                remarks = exp.remarks
            //            };

            System.Web.HttpContext.Current.Session["minExpDate"] = minExpDate;
            System.Web.HttpContext.Current.Session["maxExpDate"] = maxExpDate;
            return(View(qryExp.ToList()));
        }