public ActionResult AttendanceLeaveReport() { AttendanceReportsDTO result = new AttendanceReportsDTO(); IEnumerable <OfficeDTOs> officelist = _officeServices.GetOfficeAllData(); List <int> nepaliyears = _reportServices.GetYearList(); List <SelectListItem> sl = new List <SelectListItem>(); List <SelectListItem> yrs = new List <SelectListItem>(); List <SelectListItem> Mth = _reportServices.NepaliMonthList(); foreach (int str in nepaliyears) { yrs.Add(new SelectListItem { Text = str.ToString(), Value = str.ToString() }); } foreach (OfficeDTOs str in officelist) { sl.Add(new SelectListItem { Text = str.OfficeName, Value = str.OfficeId.ToString() }); } result.BranchSelectList = sl; result.MonthList = Mth; result.YearList = yrs; return(View(result)); }
public ActionResult AttendanceReport() { int empcode = Convert.ToInt32(Session["EmpCode"]); AttendanceReportsDTO result = new AttendanceReportsDTO(); IEnumerable <OfficeDTOs> officelist = _officeServices.GetClildOfficeListByEmpCode(empcode); List <int> nepaliyears = _reportServices.GetYearList(); List <SelectListItem> sl = new List <SelectListItem>(); List <SelectListItem> yrs = new List <SelectListItem>(); List <SelectListItem> Mth = _reportServices.NepaliMonthList(); foreach (int str in nepaliyears) { yrs.Add(new SelectListItem { Text = str.ToString(), Value = str.ToString() }); } foreach (OfficeDTOs str in officelist) { sl.Add(new SelectListItem { Text = str.OfficeName, Value = str.OfficeId.ToString() }); } result.BranchSelectList = sl; result.MonthList = Mth; result.YearList = yrs; return(View(result)); }
public ActionResult AttendnaceSummaryExcel(AttendanceReportsDTO att) { // Step 1 - get the data from database var data = _reportServices.AttendanceMonthlySummary(att.ExcelStartDate, att.ExcelEndDate, att.OfficeId); GridView gridview = new GridView(); gridview.DataSource = data; gridview.DataBind(); // Clear all the content from the current response Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename = AttendanceSummary" + DateTime.Now + ".xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; // create HtmlTextWriter object with StringWriter using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { // render the GridView to the HtmlTextWriter gridview.RenderControl(htw); // Output the GridView content saved into StringWriter Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); } } return(View()); }
public ActionResult AttendanceReport(AttendanceReportsDTO attd) { AttendanceReportsDTO result = new AttendanceReportsDTO(); string StartDate = null; string EndDate = null; _reportServices.GetStartAndEndDate(attd.month_code, attd.nepali_year, out StartDate, out EndDate); DateTime sdate = DateTime.Parse(StartDate); DateTime edate = DateTime.Parse(EndDate); int empcode = Convert.ToInt32(Session["EmpCode"]); IEnumerable <OfficeDTOs> officelist = _officeServices.GetClildOfficeListByEmpCode(empcode); List <int> nepaliyears = _reportServices.GetYearList(); List <SelectListItem> sl = new List <SelectListItem>(); List <SelectListItem> yrs = new List <SelectListItem>(); List <SelectListItem> Mth = _reportServices.NepaliMonthList(); foreach (int str in nepaliyears) { yrs.Add(new SelectListItem { Text = str.ToString(), Value = str.ToString() }); } foreach (OfficeDTOs str in officelist) { sl.Add(new SelectListItem { Text = str.OfficeName, Value = str.OfficeId.ToString() }); } result.OfficeId = attd.OfficeId; result.ExcelStartDate = sdate; result.ExcelEndDate = edate; ViewBag.attreport = _attendanceDailyServices.GetMonthlyAttendanceAll(sdate, edate, attd.OfficeId); result.BranchSelectList = sl; result.MonthList = Mth; result.YearList = yrs; return(View(result)); }