コード例 #1
0
        public JsonResult GetDetailReportList(DayReportSearchViewModel SearchViewModel)
        {
            if (SessionDayReportSearchViewModel != null)
            {
                if (SearchViewModel != SessionDayReportSearchViewModel)
                {
                    SessionDayReportSearchViewModel = SearchViewModel;
                }
                else
                {
                    SearchViewModel = SessionDayReportSearchViewModel;
                }
            }

            ResponseViewModel result = new ResponseViewModel();

            try
            {
                result.Data           = _bookingService.GetDriverMissionReportList(SessionDayReportSearchViewModel);
                result.IsOk           = true;
                result.HttpStatusCode = HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                result.IsOk           = false;
                result.Exception      = ex;
                result.HttpStatusCode = HttpStatusCode.InternalServerError;
            }

            result.ResponseTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now);
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
コード例 #2
0
        public JsonResult GetBaseBookingReportMonth(DayReportSearchViewModel SearchViewModel)
        {
            ResponseViewModel result = new ResponseViewModel();

            try
            {
                result.Data           = _bookingService.GetBaseBookingReportMonth(SearchViewModel);
                result.IsOk           = true;
                result.HttpStatusCode = HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                result.IsOk           = false;
                result.Exception      = ex;
                result.HttpStatusCode = HttpStatusCode.InternalServerError;
            }

            result.ResponseTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now);
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
コード例 #3
0
        public ActionResult DownLoadCustomerDayReportExcel(string TypeName)
        {
            DayReportSearchViewModel SearchViewModel = Session["DayReportSearchViewModel"] as DayReportSearchViewModel;

            List <CustomerDayReportListViewModel> data = new List <CustomerDayReportListViewModel>();

            string companyName = string.Empty;

            if (SearchViewModel.SearchCompanyId.HasValue)
            {
                var queryCompany = _companyService.GetCompanyName(SearchViewModel.SearchCompanyId.Value);
                if (!string.IsNullOrEmpty(queryCompany))
                {
                    companyName = queryCompany;
                }
            }

            string licenseNumber = string.Empty;

            if (SearchViewModel.SearchVehicleId.HasValue)
            {
                var queryVehicle = _vehicleService.GetVehicle(SearchViewModel.SearchVehicleId.Value);
                if (queryVehicle != null)
                {
                    licenseNumber = queryVehicle.LicenseNumber;
                }
            }

            string driverName = string.Empty;

            if (!string.IsNullOrEmpty(SearchViewModel.SearchDriverId))
            {
                var queryDriver = _aspNetUsersService.GetUserModel(SearchViewModel.SearchDriverId);
                driverName = queryDriver.RealName;
            }

            string customerName = string.Empty;

            if (!string.IsNullOrEmpty(SearchViewModel.SearchGoodOwnerId))
            {
                var queryCustomer = _aspNetUsersService.GetUserModel(SearchViewModel.SearchGoodOwnerId);
                customerName = queryCustomer.RealName;
            }

            string title = "日報表_";

            switch (TypeName)
            {
            case "Times":
                title += "客戶趟次";
                data   = _bookingService.GetCustomerDayTimesReportList(SearchViewModel);
                break;

            case "Charge":
                title += "客戶運費";
                data   = _bookingService.GetCustomerDayChargeReportList(SearchViewModel);
                break;
            }

            string searchText = string.Format("日報表條件查詢:開始時間({0}),結束時間({1}),車行({2}),車號({3}),車主({4}),客戶({5})",
                                              SearchViewModel.BeginDateTime.Value.ToString("yyyy/MM/dd"),
                                              SearchViewModel.EndDateTime.Value.ToString("yyyy/MM/dd"),
                                              companyName,
                                              licenseNumber,
                                              driverName,
                                              customerName);

            string searchDateStr = title + DateTime.Now.ToString("yyyyMMdd");
            string Month         = SearchViewModel.BeginDateTime.Value.ToString("MM");
            int    endDayNum     = Convert.ToInt32(SearchViewModel.EndDateTime.Value.ToString("dd"));
            var    fileStream    = _bookingService.GenerateCustomerDayReportListXlsx(data, title, searchText, searchDateStr + ".xlsx", Month, endDayNum, "姓名");

            return(File(fileStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "QueryOrderData.xlsx"));
        }