コード例 #1
0
ファイル: ReportController.cs プロジェクト: Yurik72/catering
        //  [MiddlewareFilter(typeof(JsReportPipeline))]
        public async Task <IActionResult> UserFinancePeriodReportWithGroup(DateTime?datefrom, DateTime?dateto, string format, int?userSubGroupId)
        {
            SelectFormat(format);
            datefrom       = datefrom.SetDefaultIfNotSet(DateTime.Now);
            dateto         = dateto.SetDefaultIfNotSet(DateTime.Now);
            userSubGroupId = _companyRep.GetUserSubGroupId(User.GetUserId());
            var toplevelsubgroup = _companyRep.GetTopLevelSubGroup();

            if (User.IsInRole(Core.UserExtension.UserRole_Admin) ||
                User.IsInRole(Core.UserExtension.UserRole_UserAdmin)
                )
            {
                userSubGroupId = toplevelsubgroup;
            }

            ViewData["datefrom"]     = datefrom;
            ViewData["dateto"]       = dateto;
            ViewData["CompanyModel"] = _reportrepo.GetOwnCompany(User.GetCompanyID());
            if (userSubGroupId.HasValue)
            {
                ViewData["UserSubGroupName"] = _companyRep.GetUserSubGroupName(userSubGroupId.Value);
            }
            else
            {
                ViewData["UserSubGroupName"] = string.Empty;
            }

            var model = await _reportrepo.GetUserFinancePeriodReportWithGroup(datefrom.Value, dateto.Value, User.GetCompanyID(), userSubGroupId);

            return(PartialView(model));
        }