public ActionResult ScheduleRptPdf(string AccountCode, string BranchCode, string UnitCode, string DeptCode, string fDate, string toDate) { var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(fDate, toDate, Session["FinYear"].ToString()); if (ChkFYR != "") { return(RedirectToAction("ScheduleRpt", "ScheduleRpt", new { errMsg = ChkFYR })); } RBACUser rUser = new RBACUser(Session["UserName"].ToString()); if (!rUser.HasPermission("RptSchedule_Preview")) { string errMsg = "No View Permission for this User !!"; return(RedirectToAction("ScheduleRpt", "ScheduleRpt", new { errMsg })); } string ProjCode = "01"; VMDynSysSet DsSet = new VMDynSysSet(); DsSet.DynaCap = _dynaCapService.All().ToList().FirstOrDefault(); if (AccountCode != "") { ViewBag.Account = _NewChartService.All().FirstOrDefault(x => x.Accode == AccountCode.Trim()).AcName.ToString(); } else { ViewBag.Account = "All"; } ViewBag.RptCap = "Schedule Report of " + ViewBag.Account; ViewBag.Col1Cap = "Code"; ViewBag.Col2Cap = "Name"; ViewBag.Col3Cap = "Opening"; ViewBag.Col4Cap = "Dr. Amount"; ViewBag.Col5Cap = "Cr. Amount"; ViewBag.Col6Cap = "Balance"; ViewBag.fDate = fDate; ViewBag.tDate = toDate; var sysSet = _sysSetService.All().FirstOrDefault(); string CriteriaBranch = ""; string CriteriaUnit = ""; if (sysSet.HasBranch == true) { if (BranchCode != "") { ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == BranchCode.Trim()).BranchName.ToString(); } else { ViewBag.Branch = "All"; } CriteriaBranch = DsSet.DynaCap.Branch + ": " + ViewBag.Branch + ", "; } if (sysSet.HasUnit == true) { CriteriaUnit = DsSet.DynaCap.Unit + ": " + LoadDropDown.LoadUnitInfo(UnitCode) + ", "; } ViewBag.Criteria = CriteriaBranch + CriteriaUnit + DsSet.DynaCap.Dept + ": " + LoadDropDown.LoadDeptInfo(DeptCode); string sql = string.Format("EXEC rptSchedule '" + Session["FinYear"] + "','" + ProjCode + "','" + BranchCode + "','" + UnitCode + "','" + DeptCode + "','" + Convert.ToDateTime(fDate).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(toDate).ToString("yyyy-MM-dd") + "','" + AccountCode + "'"); List <SummaryReport> rptSchedule = _summaryReportService.SqlQueary(sql).ToList(); if (rptSchedule.Count == 0) { string errMsg = "There is no data in this combination. Please try again !!!"; return(RedirectToAction("Search", "Report", new { errMsg })); } //For us Culture Ex: 0.00 const string culture = "en-US"; CultureInfo ci = CultureInfo.GetCultureInfo(culture); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; return(new Rotativa.ViewAsPdf("rptSchedulePdf", rptSchedule) { CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\" --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\"" }); }