Ejemplo n.º 1
0
        public ActionResult Details(ExcelModel eModel)
        {
            var curModel = new T_XSMX();

            if (eModel.SCQYID != null)
            {
                T_SupQY qycp = new T_SupQY();
                qycp.SupID = (int)eModel.SCQYID;
                curModel.T_YLCP.T_SupQY1 = qycp;
            }
            if (eModel.CPID != null)
            {
                curModel.CPID = (int)eModel.CPID;
            }

            int pagesize    = eModel.PageSize;
            int pagecount   = 0;
            int currentPage = eModel.PageNum;
            var DataList    = T_XSMXDomain.GetInstance().PageT_XSMX(curModel, eModel.StartDate, eModel.EndDate, currentPage, pagesize, out pagecount, out resultCount);


            ViewData["ParaStr"] = ExportExcelPR(DataList);
            return(View("~/Views/T_XSHZ/Details.cshtml", eModel));
        }
Ejemplo n.º 2
0
        public void ExportExcel(ExcelModel eModel)
        {
            var curModel = new T_XSMX();

            if (eModel.SCQYID != null)
            {
                T_SupQY qycp = new T_SupQY();
                qycp.SupID = (int)eModel.SCQYID;
                curModel.T_YLCP.T_SupQY1 = qycp;
            }
            if (eModel.CPID != null)
            {
                curModel.CPID = (int)eModel.CPID;
            }

            int pagesize    = eModel.PageSize;
            int pagecount   = 0;
            int currentPage = eModel.PageNum;
            var DataList    = T_XSMXDomain.GetInstance().PageT_XSMX(curModel, eModel.StartDate, eModel.EndDate, currentPage, pagesize, out pagecount, out resultCount);
            var str         = ExportExcelPR(DataList);

            //调用输出Excel表的方法
            ExportToExcel("application/vnd.ms-excel", "销售汇总.xls", str);
        }
Ejemplo n.º 3
0
        public int resultCount = 0; // 总条数
        // GET: T_XSHZ
        public ActionResult Index(T_XSMXModels evalModel)
        {
            try
            {
                evalModel.currentPage = int.Parse(Request["pageNum"].ToString());
            }
            catch { }
            string order = "";
            string qyid  = "";

            try
            {
                order = Request["orderField"].ToString();
            }
            catch { }
            if (order.Trim() == "${param.orderField}")
            {
                order = "";
            }
            evalModel.DataModel        = evalModel.DataModel ?? new T_XSMX();
            evalModel.DataModel.T_YLCP = evalModel.DataModel.T_YLCP ?? new T_YLCP();

            //加载产品生产企业
            T_SupQYModels qymode = new T_SupQYModels();

            qymode.DataModel = qymode.DataModel ?? new T_SupQY();
            qymode.DataList  = T_SupQYDomain.GetInstance().GetAllT_SupQY(qymode.DataModel);
            ViewData["QY"]   = new SelectList(qymode.DataList, "SupID", "SupMC");
            if (Request["QYList"] != null)
            {
                qyid = Request["QYList"].ToString();
                if (!String.IsNullOrEmpty(qyid))
                {
                    T_SupQY qycp = new T_SupQY();
                    qycp.SupID = int.Parse(qyid);
                    evalModel.DataModel.T_YLCP.T_SupQY1 = qycp;
                }
            }
            ViewData["QYList"] = qyid;

            Expression <Func <T_YLCP, bool> > where = PredicateBuilder.True <T_YLCP>();
            var lst = T_YLCPDomain.GetInstance().GetAllModels <int>(where);

            ViewData["XSHZ_YLCP"] = new SelectList(lst, "CPID", "CPMC");
            var cpid = "";

            if (Request["XSHZ_CPID"] != null)
            {
                cpid = Request["XSHZ_CPID"].ToString();
                if (!String.IsNullOrEmpty(cpid))
                {
                    evalModel.DataModel.CPID = int.Parse(cpid);
                }
            }
            ViewData["XSHZ_CPID"] = cpid;

            int pagesize    = Convert.ToInt32(evalModel.pageSize);
            int pagecount   = Convert.ToInt32(evalModel.pagecount);
            int currentPage = Convert.ToInt32(evalModel.currentPage);

            evalModel.DataModel   = evalModel.DataModel ?? new T_XSMX();
            evalModel.DataList    = T_XSMXDomain.GetInstance().PageT_XSMX(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount);
            evalModel.resultCount = resultCount;

            var totalNum = 0;

            if (evalModel.DataList != null && evalModel.DataList.Count > 0)
            {
                evalModel.DataList.ForEach(p =>
                {
                    totalNum += (p.CPSL ?? 0);
                });
            }
            ViewBag.TotalNum = totalNum;
            return(View("~/Views/T_XSHZ/Index.cshtml", evalModel));
        }