예제 #1
0
        public ActionResult Index()
        {
            var model = new RptPOModel();
            //model.SearchView.PeriodFrom = Convert.ToDateTime("2013-07-15");
            //model.SearchView.PeriodTo = Convert.ToDateTime("2018-07-14");
            //model.SearchView.MonthFrom = 11;
            //model.SearchView.MonthTo = 12;
            //model.SearchView.PoliceNumber = "L1976HS";
            var input = Mapper.Map <RptPoByParamInput>(model.SearchView);
            var data  = _rptPoBLL.GetRptPo(input);

            model.MainMenu     = _mainMenu;
            model.TitleForm    = "PO Report";
            model.TitleExport  = "ExportPO";
            model.CurrentLogin = CurrentUser;
            var settingData = _settingBLL.GetSetting();

            model.RptPOItem = Mapper.Map <List <RptPOItem> >(data);

            var listEmployee = _fleetBLL.GetFleet().Select(x => new { x.EmployeeName }).Distinct().OrderBy(x => x.EmployeeName).ToList();
            var listCost     = _fleetBLL.GetFleet().Select(x => new { x.CostCenter }).Distinct().OrderBy(x => x.CostCenter).ToList();
            var listSM       = _fleetBLL.GetFleet().Select(x => new { x.SupplyMethod }).Distinct().OrderBy(x => x.SupplyMethod).ToList();

            model.SearchView.EmployeeNameList = new SelectList(listEmployee, "EmployeeName", "EmployeeName");
            model.SearchView.CostCenterList   = new SelectList(listCost, "CostCenter", "CostCenter");
            model.SearchView.SupplyMethodList = new SelectList(listSM, "SupplyMethod", "SupplyMethod");

            return(View(model));
        }
예제 #2
0
        public PartialViewResult FilterPO(RptPOModel model)
        {
            //model.startMonth = 10;
            //model.startYear = 2017;
            //model.toMonth = 12;
            //model.toYear = 2017;

            model.RptPOItem = GetPOData(model.SearchView);
            var input = Mapper.Map <RptPoByParamInput>(model.SearchView);

            return(PartialView("_ListPo", model));
        }
예제 #3
0
        public void ExportPO(RptPOModel model)
        {
            string pathFile = "";

            var input = Mapper.Map <RptPoByParamInput>(model.SearchViewExport);

            pathFile = CreateXlsRptPO(input);

            var newFile = new FileInfo(pathFile);

            var fileName = Path.GetFileName(pathFile);

            string attachment = string.Format("attachment; filename={0}", fileName);

            Response.Clear();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.WriteFile(newFile.FullName);
            Response.Flush();
            newFile.Delete();
            Response.End();
        }