//public SelectList GardenSelection() //{ // var UserName = User.Identity.Name; // var brans = _employeeService.All().Where(x => x.Email == UserName).ToList().FirstOrDefault(); // var UserId = brans.Id; // var items = _userbranchService.All().ToList().Where(x => x.Userid == UserId.ToString()).ToList(); // List<Branch> branchList = new List<Branch>(); // foreach (var item in items) // { // var branch = _BranchService.All().ToList().FirstOrDefault(x => x.BranchCode == item.BranchCode); // branchList.Add(branch); // } // branchList.Insert(0, new Branch() { BranchCode = "0", BranchName = "---- Select ----" }); // //List<Branch> BranchCode = new SelectList(branchList, "BranchCode", "BranchName"); // return new SelectList(branchList.OrderBy(x => x.BranchCode), "BranchCode", "BranchName"); //} public ActionResult GetSummaryReport(RptSearchVModel vmodel, string finyear) { var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.toDate), Session["FinYear"].ToString()); if (ChkFYR != "") { return(RedirectToAction("Search", "SummaryReport", new { errMsg = ChkFYR })); } RBACUser rUser = new RBACUser(Session["UserName"].ToString()); if (!rUser.HasPermission("RptTrialBalance_Preview")) { string errMsg = "No Preview Permission for this User !!"; return(RedirectToAction("Search", "SummaryReport", new { errMsg })); } Session["Branch"] = (vmodel.BranchCode == null) ? "" : vmodel.BranchCode; Session["LedgerType"] = vmodel.LedgerTypeCode; Session["fDate"] = vmodel.fDate; Session["tDate"] = vmodel.toDate; if (vmodel.LevelNo == null) { vmodel.LevelNo = "0"; } Session["LevelNo"] = vmodel.LevelNo; // Session["LevelNo"] = vmodel.LevelNo; var rptCap = _LedgerCapService.All().ToList().FirstOrDefault(x => x.SP_Name == vmodel.LedgerTypeCode); ViewBag.LedgerCap = rptCap.LedgerCap; ViewBag.RptCap = rptCap.RptCap; ViewBag.Col1Cap = rptCap.Col1Cap; ViewBag.Col2Cap = rptCap.Col2Cap; ViewBag.Col3Cap = rptCap.Col3Cap; ViewBag.Col4Cap = rptCap.Col4Cap; ViewBag.Col5Cap = rptCap.Col5Cap; ViewBag.Col6Cap = rptCap.Col6Cap; ViewBag.Col7Cap = rptCap.Col7Cap; ViewBag.Col8Cap = rptCap.Col8Cap; ViewBag.fDate = InWord.GetAbbrMonthNameDate(vmodel.fDate); ViewBag.tDate = InWord.GetAbbrMonthNameDate(vmodel.toDate); ViewBag.foDate = vmodel.fDate.ToString("MM/dd/yyyy"); ViewBag.toDate = vmodel.toDate.ToString("MM/dd/yyyy"); ViewBag.LocCode = vmodel.LocCode;//----location---// ViewBag.BranchCode = vmodel.BranchCode; if (vmodel.BranchCode != null && vmodel.BranchCode != "0") { ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString(); } else { ViewBag.Branch = "All"; } //---------------Location---------------------------// if (vmodel.LocCode != null && vmodel.LocCode != "0") { ViewBag.Location = _locationService.All().FirstOrDefault(x => x.LocCode == vmodel.LocCode.Trim()).LocName.ToString(); } else { ViewBag.Location = "All"; } finyear = Session["FinYear"].ToString(); if (vmodel.LevelNo == null) { vmodel.LevelNo = "0"; } string sql = string.Format(" EXEC " + rptCap.SP_Name + " '" + finyear + "','01','" + vmodel.LocCode + "','" + vmodel.fDate.ToString("MM/dd/yyyy") + "','" + vmodel.toDate.ToString("MM/dd/yyyy") + "','" + vmodel.DisControl + "','" + vmodel.LevelNo + "'"); List <SummaryReport> summaryReport = _SumRptService.SqlQueary(sql).ToList(); Session["Discardcntl"] = vmodel.DisControl; //if (summaryReport.Count == 0) //{ // string errMsg = "There is no data in this combination. Please try again !!!"; // return RedirectToAction("Search", "SummaryReport", new { errMsg }); //} //else //{ if (rptCap.RptCap == "Stock Summary") { return(View("~/Views/SummaryReport/GetSummaryStockReport.cshtml", summaryReport)); } //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(View(summaryReport)); //} }
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\"" }); }