using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using Payroll.BO; using Ease.CoreV35; using Ease.Core.Model; using Ease.Core.Utility; using System.Windows.Forms; using HRM.BO; using HRM.DA; using System.IO; using Microsoft.Reporting.NETCore; namespace HRM.Report { public class OTReport { ReportParameter rParam = null; private List reportParameters = new List(); public OTReport() { } public byte[] OTMonthlySheet(int PayrollTypeID, DateTime Month, string sEmpID, string reportType) { int count = 0; DataRow oDR = null; DataSet oOTMonthlySheets = null; string lastEmpNo = ""; oOTMonthlySheets = new OTProcessService().GetOTProcessData(GlobalFunctions.LastDateOfMonth(Month), sEmpID); PayrollDataSet.PayrollDataSet.OTMonthlySheetDataTable dTableOT = new PayrollDataSet.PayrollDataSet.OTMonthlySheetDataTable(); foreach (DataRow oDRow in oOTMonthlySheets.Tables[0].Rows) { oDR = dTableOT.NewRow(); oDR["EmoNo"] = oDRow["EmployeeNo"]; oDR["Name"] = oDRow["EmpName"]; oDR["OTDescription"] = oDRow["TermName"]; oDR["OTRate"] = oDRow["Hours"]; oDR["OTAmount"] = GlobalFunctions.Round(Convert.ToDouble(oDRow["Amount"])); // Math.Round(oDRow["Amount"]); //oDR["OTMonth"] = Convert.ToDateTime(oDRow["ProcessMonth"]).ToString("dd MMM yyyy"); oDR["OTMonth"] = Convert.ToDateTime(oDRow["OTMonth"]).ToString("dd MMM yyyy"); oDR["Basic"] = oDRow["BasicSalary"]; oDR["SeqNo"] = oDRow["SeqNo"]; if (oDR["EmoNo"].ToString() != lastEmpNo) count++; oDR["SLNo"] = count; dTableOT.Rows.Add(oDR); lastEmpNo = oDR["EmoNo"].ToString(); } ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.ShowDlgForMonthlyOTSheet(null, dTableOT, Month, PayrollTypeID, reportType); } public byte[] OTBankDisbursement(int PayrollTypeID, DateTime Month, string sEmpID, string reportType) { /*DateTime dOTMonth = _selectedParameter.FromDate.Value; string sEmpID = _selectedParameter.ReportItem.INSQL;*/ DataRow oDR = null; DataSet dsOT = null; dsOT = new OTProcessService().GetCostCenterWiseOT(GlobalFunctions.LastDateOfMonth(Month), sEmpID); PayrollDataSet.dsCompany.DTOPIDataTable dtOT = new PayrollDataSet.dsCompany.DTOPIDataTable(); if (dsOT.Tables.Count > 0) { foreach (DataRow orr in dsOT.Tables[0].Rows) { oDR = dtOT.NewRow(); oDR["EmpNo"] = orr["EmployeeNo"].ToString(); oDR["Name"] = orr["EmpName"].ToString(); oDR["AccountNo"] = orr["ACCOUNTNO"].ToString(); oDR["Amount"] = GlobalFunctions.Round(Convert.ToDouble(orr["Amount"].ToString())); oDR["Designation"] = orr["Designation"].ToString(); oDR["CostCenter"] = orr["CostCenter"].ToString(); dtOT.Rows.Add(oDR); } /*if (dtOT.Rows.Count > 0) { ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.ShowDlgForOTBankDisbursement(null, dtOT, Month, PayrollTypeID, reportType); }*/ } rParam = new ReportParameter("Month", Month.ToString()); reportParameters.Add(rParam); ReportProcessor reportProcessor = new ReportProcessor(); dtOT.TableName = "dsCompany_DTOPI"; string RDLCName = "HRM.Report.RDLC.OTBankDisbursement.rdlc"; dsOT.Tables.Add(dtOT); // return reportProcessor.ShowDlgForOTBankDisbursement(null, dtOT, Month, PayrollTypeID, reportType); return reportProcessor.CommonReportView(null, RDLCName, dsOT, null, null, true, PayrollTypeID, reportType); } public byte[] OTCostCenter(int PayrollTypeID, DateTime Month, string sEmpID, string reportType) { DataSet _dsCCWiseOPISummary = new DataSet(); DataSet _dsCCWiseOPI = new DataSet(); _dsCCWiseOPISummary = new OTProcessService().GetCCWiseOTSummary(GlobalFunctions.LastDateOfMonth(Month), sEmpID); _dsCCWiseOPISummary.Tables[0].Columns.Add("month", typeof(string)); foreach (DataRow row in _dsCCWiseOPISummary.Tables[0].Rows) { row["month"] = Month.ToString("MMMM yyyy"); } _dsCCWiseOPI = new OTProcessService().GetCostCenterWiseOT(GlobalFunctions.LastDateOfMonth(Month), sEmpID); _dsCCWiseOPI.Tables[0].Columns.Add("month", typeof(string)); foreach (DataRow row in _dsCCWiseOPI.Tables[0].Rows) { row["month"] = Month.ToString("MMMM yyyy"); } DataSet dSet = new DataSet(); _dsCCWiseOPISummary.Tables[0].TableName = "dsCompany_CCWiseDeductSummary"; dSet.Tables.Add(_dsCCWiseOPISummary.Tables[0].Copy()); _dsCCWiseOPI.Tables[0].TableName = "dsCompany_CCWiseDeduction"; dSet.Tables.Add(_dsCCWiseOPI.Tables[0].Copy()); string RDLCName = "HRM.Report.RDLC.CCWiseOTSummary.rdlc"; ReportProcessor reportProcessor = new ReportProcessor(); //return reportProcessor.OTCostCenter(null, dSet, Month, PayrollTypeID, reportType); return reportProcessor.CommonReportView(null, RDLCName, dSet, null, null, true, PayrollTypeID, reportType); } public DataTable OTHourlySheet(DateTime Month, string sEmpID) { int count = 1; DataRow oDR = null; DataSet oOTHourlySheets = null; oOTHourlySheets = OTProcess.GetOTProcessData(Month, sEmpID); PayrollDataSet.PayrollDataSet.OTHourlySheetDataTable dTableOT = new PayrollDataSet.PayrollDataSet.OTHourlySheetDataTable(); foreach (DataRow oDRow in oOTHourlySheets.Tables[0].Rows) { oDR = dTableOT.NewRow(); oDR["EmpNo"] = oDRow["EmployeeNo"]; oDR["Name"] = oDRow["EmpName"]; oDR["OTDescription"] = oDRow["TermName"]; oDR["Hours"] = oDRow["Hours"]; oDR["OTMonth"] = Convert.ToDateTime(oDRow["OTMonth"]).ToString("dd MMM yyyy"); oDR["SLNo"] = count; dTableOT.Rows.Add(oDR); count++; } return dTableOT; } public byte[] OTBranchWise(string reportType, DateTime fromDate, int payrollTypeID) { ReportProcessor reportProcessor = new ReportProcessor(); int count = 1; DataRow oDR = null; DataSet oOTBranchWSheets = null; oOTBranchWSheets = new OTProcessService().GetBranchWiseOT(GlobalFunctions.LastDateOfMonth(fromDate)); PayrollDataSet.PayrollDataSet.BranchWiseOTDataTable dTableOT = new PayrollDataSet.PayrollDataSet.BranchWiseOTDataTable(); foreach (DataRow oDRow in oOTBranchWSheets.Tables[0].Rows) { oDR = dTableOT.NewRow(); oDR["Branch"] = oDRow["Location"]; oDR["Division"] = oDRow["Department"]; oDR["Month"] = oDRow["Month"]; oDR["TotalOT"] = oDRow["OTHours"]; dTableOT.Rows.Add(oDR); count++; } return reportProcessor.ShowDlgForBranchWOT(reportType, dTableOT, payrollTypeID); } public byte[] OTLocationWise(string reportType, DateTime fromYear, int payrollTypeID) { ReportProcessor reportProcessor = new ReportProcessor(); int count = 1; DataRow oDR = null; DataSet oOTLocationWSheets = null; oOTLocationWSheets = new OTProcessService().GetLocationWiseOT(PayrollGlobalFunctions.FirstDateOfYear(fromYear), PayrollGlobalFunctions.LastDateOfYear(fromYear)); PayrollDataSet.PayrollDataSet.DivisionWiseOTDataTable dTableOT = new PayrollDataSet.PayrollDataSet.DivisionWiseOTDataTable(); foreach (DataRow oDRow in oOTLocationWSheets.Tables[0].Rows) { oDR = dTableOT.NewRow(); oDR["Branch"] = oDRow["Location"]; oDR["Division"] = oDRow["Department"]; oDR["Month"] = oDRow["Month"]; oDR["Value"] = oDRow["OTHours"]; oDR["Year"] = oDRow["Year"]; //oDR["SLNo"] = count; dTableOT.Rows.Add(oDR); count++; } return reportProcessor.ShowDlgForDivisionWOT(reportType, dTableOT, payrollTypeID); } public DataTable CostCenterWiseOT(DateTime dOTMonth, string sEmpID) { DataRow oDR = null; DataSet dsOT = null; dsOT = new OTProcessService().GetCostCenterWiseOT(GlobalFunctions.LastDateOfMonth(dOTMonth), sEmpID); PayrollDataSet.dsCompany.DTOPIDataTable dtOT = new PayrollDataSet.dsCompany.DTOPIDataTable(); if (dsOT.Tables.Count > 0) { foreach (DataRow orr in dsOT.Tables[0].Rows) { oDR = dtOT.NewRow(); oDR["EmpNo"] = orr["EmployeeNo"].ToString(); oDR["Name"] = orr["EmpName"].ToString(); oDR["AccountNo"] = orr["ACCOUNTNO"].ToString(); oDR["Amount"] = Math.Round(Convert.ToDouble(orr["Amount"].ToString()), 2); oDR["Designation"] = orr["Designation"].ToString(); oDR["CostCenter"] = orr["CostCenter"].ToString(); dtOT.Rows.Add(oDR); } } return dtOT; } public DataTable OTBankDisbursement(DateTime dOTMonth, string sEmpID) { DataRow oDR = null; DataSet dsOT = null; dsOT = new OTProcessService().GetCostCenterWiseOT(GlobalFunctions.LastDateOfMonth(dOTMonth), sEmpID); PayrollDataSet.dsCompany.DTOPIDataTable dtOT = new PayrollDataSet.dsCompany.DTOPIDataTable(); if (dsOT.Tables.Count > 0) { foreach (DataRow orr in dsOT.Tables[0].Rows) { oDR = dtOT.NewRow(); oDR["EmpNo"] = orr["EmployeeNo"].ToString(); oDR["Name"] = orr["EmpName"].ToString(); oDR["AccountNo"] = orr["ACCOUNTNO"].ToString(); oDR["Amount"] = Math.Round(Convert.ToDouble(orr["Amount"].ToString()), 2); oDR["Designation"] = orr["Designation"].ToString(); oDR["CostCenter"] = orr["CostCenter"].ToString(); dtOT.Rows.Add(oDR); } } return dtOT; } public byte[] OTMonthRange(string reportType, DateTime fromDate, DateTime toDate, int payrollTypeId) { ReportProcessor reportProcessor = new ReportProcessor(); int count = 1; DataRow oDR = null; DataSet oOTMRangeSheets = null; oOTMRangeSheets = new OTProcessService().GetOTMonthRangeData(fromDate, toDate); PayrollDataSet.PayrollDataSet.OTMonthRangeDataTable dTableOT = new PayrollDataSet.PayrollDataSet.OTMonthRangeDataTable(); foreach (DataRow oDRow in oOTMRangeSheets.Tables[0].Rows) { oDR = dTableOT.NewRow(); oDR["Division"] = oDRow["DESCRIPTION"]; oDR["EmpNo"] = oDRow["EMPLOYEENO"]; oDR["Name"] = oDRow["NAME"]; oDR["Month"] = oDRow["OTMonth"]; oDR["Value"] = oDRow["Hours"];//Convert.ToDateTime(oDRow["OTMonth"]).ToString("dd MMM yyyy"); oDR["Branch"] = oDRow["Location"]; //oDR["SLNo"] = count; dTableOT.Rows.Add(oDR); count++; } return reportProcessor.ShowDlgForMRange(reportType, dTableOT, payrollTypeId); ; } } }