Пример #1
0
        public virtual IActionResult ExportExcelBalanceReport(ReportBalanceSearchModel searchModel)
        {
            if (!permissionService.Authorize(StandardPermissionProvider.ManageTrips))
            {
                return(AccessDeniedView());
            }

            var list = tripService.StatisticsBalance(
                frequency: searchModel.Frequency,
                tripShippingTimeFrom: searchModel.TripShippingTimeFrom,
                tripShippingTimeTo: searchModel.TripShippingTimeTo);

            try
            {
                var bytes = exportManager.ExportLogisticsBalanceReportToXlsx(list);

                return(File(bytes, MimeTypes.TextXlsx, $"{localizationService.GetResource("Admin.LogisticsReports.Trips.Balance")}.xlsx"));
            }
            catch (Exception ex)
            {
                ErrorNotification(ex);
                return(RedirectToAction("List"));
            }
        }