Ejemplo n.º 1
0
        public JsonResult LoadAttendance(Parameters parameters)
        {
            string path = string.Empty;
            string reportDataSetName = string.Empty;
            string fileString        = string.Empty;
            string docType           = "pdf";

            var data = db.vw_Attendance.Where(x => x.WDate >= parameters.FromDate && x.WDate <= parameters.ToDate);

            if (parameters.EmpID != null)
            {
                data = data.Where(x => x.EmpID == parameters.EmpID);
            }

            if (parameters.Status == "A")
            {
                parameters.Status = null;
            }

            if (parameters.Status != null)
            {
                data = data.Where(x => x.LateStatus == parameters.Status);
            }
            data = data.OrderBy(x => x.WDate);

            path = Path.Combine(Server.MapPath("~/Areas/AttendanceReports/RDLCS"), "DailyAttendance.rdlc");

            reportDataSetName = "DSDailyAttendance";

            List <ReportParameter> reportParameters = new List <ReportParameter>();

            ReportParameter parameterr = new ReportParameter("fromDate");

            parameterr.Values.Add(parameters.FromDate.ToString());
            reportParameters.Add(parameterr);


            ReportParameter parameter = new ReportParameter("toDate");

            parameter.Values.Add(parameters.ToDate.ToString());
            reportParameters.Add(parameter);

            ReportParameter parameteer = new ReportParameter("status");

            parameters.Status = "All";
            parameteer.Values.Add(parameters.Status);
            reportParameters.Add(parameteer);

            fileString = commonFunctions.CallReports(docType, reportParameters, true, path, null, data, reportDataSetName);
            return(Json(fileString));
        }