using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Payroll.Report; using Microsoft.Reporting.WinForms; using Payroll.BO; using Ease.CoreV35.Model; namespace Payroll.Report { public partial class fReports : Form { ReportParameter _parameter = null; public fReports() { InitializeComponent(); } private void btnMonthlyAttnReport_Click(object sender, EventArgs e) { DataSet dSet = new DataSet(); String RDLC = string.Empty; DataTable oDataTable = null; AttendanceReport attnReport = new AttendanceReport(); //oDataTable = attnReport.GetMonthlyAttnForBuyer(dtpFromDate.Value, dtpToDate.Value); oDataTable.TableName = "AttendenceDataSet_MonthlyAttn"; RDLC = "Payroll.Report.Attendence.RDLC.MonthlyAttn.rdlc"; dSet.Tables.Add(oDataTable); List parameters = new List(); _parameter = new ReportParameter("FromDate", dtpFromDate.Value.ToString("dd MMM yyyy")); parameters.Add(_parameter); _parameter = new ReportParameter("ToDate", dtpToDate.Value.ToString("dd MMM yyyy")); parameters.Add(_parameter); fReportViewer form = new fReportViewer(); form.CommonReportViewer(null, RDLC, dSet, parameters); } private void btnDailyInOut_Click(object sender, EventArgs e) { DataSet dSet = new DataSet(); String RDLC = string.Empty; DataTable oDataTable = null; AttendanceReport attnReport = new AttendanceReport(); //oDataTable = attnReport.GetDailyInOutForBuyer(dtpFromDate.Value); oDataTable.TableName = "AttendenceDataSet_DailyInOut"; RDLC = "Payroll.Report.Attendence.RDLC.DailyInOut.rdlc"; dSet.Tables.Add(oDataTable); List parameters = new List(); _parameter = new ReportParameter("AttnDate", dtpFromDate.Value.ToString("dd MMM yyyy")); parameters.Add(_parameter); fReportViewer form = new fReportViewer(); form.CommonReportViewer(null, RDLC, dSet, parameters); } private void btnMonthlyDetail_Click(object sender, EventArgs e) { DataSet dSet = new DataSet(); String RDLC = string.Empty; DataTable oDataTable = null; AttendanceReport attnReport = new AttendanceReport(); //oDataTable = attnReport.GetMonthlyDetailForBuyer(dtpFromDate.Value, dtpToDate.Value); oDataTable.TableName = "AttendenceDataSet_MonthlyDetail"; RDLC = "Payroll.Report.Attendence.RDLC.MontjlyDetail.rdlc"; dSet.Tables.Add(oDataTable); List parameters = new List(); _parameter = new ReportParameter("Fromdate", dtpFromDate.Value.ToString("dd MMM yyyy")); parameters.Add(_parameter); _parameter = new ReportParameter("ToDate", dtpToDate.Value.ToString("dd MMM yyyy")); parameters.Add(_parameter); fReportViewer form = new fReportViewer(); form.CommonReportViewer(null, RDLC, dSet, parameters); } private void btnPreview_Click(object sender, EventArgs e) { if (ctlEmployee.SelectedEmployee == null) { MessageBox.Show("Please Select an Employee", "Select Employee", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataSet dSet = new DataSet(); String RDLC = string.Empty; DataTable oDataTable = null; AttendanceReport attnReport = new AttendanceReport(); //oDataTable = attnReport.GetEmpDailyAttnForBuyer(ctlEmployee.SelectedEmployee.EmployeeID, dtpFromDate.Value, dtpToDate.Value); List oTHours = new List(); List latehours = new List(); foreach (DataRow dr in oDataTable.Rows) { string oTHour = Convert.ToString(dr["OTHr"]); string latehour = Convert.ToString(dr["LateBy"]); oTHours.Add(oTHour); latehours.Add(latehour); } string totalOT = GlobalFunctions.GetHourMinutes(oTHours); string totalLateHour = GlobalFunctions.GetHourMinutes(latehours); List parameters = new List(); parameters = GetReportParameters(ctlEmployee.SelectedEmployee.EmployeeID, dtpFromDate.Value, dtpToDate.Value, totalOT, totalLateHour); oDataTable.TableName = "AttendenceDataSet_EmpDailyAttn"; RDLC = "Payroll.Report.Attendence.RDLC.EmpDailyAttn.rdlc"; dSet.Tables.Add(oDataTable); fReportViewer form = new fReportViewer(); form.CommonReportViewer(null, RDLC, dSet, parameters); } public List GetReportParameters(ID empID, DateTime fromDate, DateTime toDate, string totalOT, string totalLateHour) { Employee employee = new Employee(); employee = Employee.Get(empID); List parameters = new List(); _parameter = new ReportParameter("FromDate", fromDate.ToString("dd MMM yyyy")); parameters.Add(_parameter); _parameter = new ReportParameter("ToDate", toDate.ToString("dd MMM yyyy")); parameters.Add(_parameter); _parameter = new ReportParameter("EmpNo", employee.EmployeeNo); parameters.Add(_parameter); _parameter = new ReportParameter("EmpName", employee.Name); parameters.Add(_parameter); _parameter = new ReportParameter("EmpDesignation", employee.Designation.Name); parameters.Add(_parameter); _parameter = new ReportParameter("EmpJoinDate", employee.JoiningDate.ToString("dd MMM yyyy")); parameters.Add(_parameter); _parameter = new ReportParameter("EmpDepartment", employee.Department.Name); parameters.Add(_parameter); _parameter = new ReportParameter("EmpSection", ""); parameters.Add(_parameter); _parameter = new ReportParameter("TotalOT", totalOT); parameters.Add(_parameter); _parameter = new ReportParameter("TotalLateHour", totalLateHour); parameters.Add(_parameter); return parameters; } private void btnDailyAbsent_Click(object sender, EventArgs e) { DataSet dSet = new DataSet(); String RDLC = string.Empty; DataTable oDataTable = null; AttendanceReport attnReport = new AttendanceReport(); //oDataTable = attnReport.GetDailyAbsentForBuyer(dtpFromDate.Value); oDataTable.TableName = "AttendenceDataSet_DailyAbsent"; RDLC = "Payroll.Report.Attendence.RDLC.DailyAbsent.rdlc"; dSet.Tables.Add(oDataTable); List parameters = new List(); _parameter = new ReportParameter("AttnDate", dtpFromDate.Value.ToString("dd MMM yyyy")); parameters.Add(_parameter); fReportViewer form = new fReportViewer(); form.CommonReportViewer(null, RDLC, dSet, parameters); } private void btnClose_Click(object sender, EventArgs e) { this.Close(); } } }