using System; using System.Data; using System.Linq; using Ease.Core.Utility; using HRM.BO; using HRM.DA; namespace HRM.Report { /// /// Component Upload Report (EnumReportType.ComponentUploadReport, /reports/component-upload-report), as GP's /// rptEmployee.ShowUploadedComponentReport / ShowUploadedComponentReportEmployee. The RDLCs are read from the /// RDLC folder (HRM.UI/RDLC), as GP renders them, through ReportProcessor.CommonReportViewer. /// public class rptComponentUpload { /// Uploaded Components tab: every upload of the upload date range. public byte[] ShowUploadedComponentReport(DateTime fromdate, DateTime todate, int payrollTypeId, string reportType) { DataTable dtUploadedComponents = new ComponentUploadSetupService().GetUploadedComponentReportData(fromdate, todate).Copy(); dtUploadedComponents.TableName = "dsCompany_dtUploadedComponent"; DataSet resultDataSet = new DataSet(); resultDataSet.Tables.Add(dtUploadedComponents); return new ReportProcessor().CommonReportViewer(null, "UploadedComponent.rdlc", resultDataSet, null, payrollTypeId, reportType); } /// /// Monthly Uploaded Components tab: the uploaded rows of the selected employees for the salary month, /// of one component (itemId) or of every component (itemId 0). /// public byte[] ShowUploadedComponentReportEmployee(string empIds, int itemId, DateTime fromdate, int payrollTypeId, string reportType) { // the IDs go into the SQL as %q, so only digits pass string ids = string.Join(",", (empIds ?? string.Empty) .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(x => int.TryParse(x.Trim(), out int id) ? id : 0) .Where(id => id > 0) .Distinct()); if (ids == string.Empty) throw new Exception("Please select employee."); DateTime uploadMonth = GlobalFunctions.LastDateOfMonth(fromdate); DataTable dtUploadedComponents = itemId != 0 ? new ComponentUploadSetupService().GetUploadedComponentEmpReportData(uploadMonth, itemId, ids).Copy() : new ComponentUploadSetupService().GetUploadedComponentEmpReportData(uploadMonth, ids).Copy(); dtUploadedComponents.TableName = "dsCompany_dtUploadedComponentEmp"; DataSet resultDataSet = new DataSet(); resultDataSet.Tables.Add(dtUploadedComponents); return new ReportProcessor().CommonReportViewer(null, "UploadedComponentEmp.rdlc", resultDataSet, null, payrollTypeId, reportType); } } }