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 Ease.Core; using Microsoft.Reporting.NETCore; using Org.BouncyCastle.Ocsp; namespace HRM.Report { public class rptEmployee { //private ReportSetup _selectedParameter; private DateTime _SalaryMonth; string tempEmpID = string.Empty; //List _departments = null; int count = 1; //public ReportSetup SelectedParameter //{ // set // { // _selectedParameter = value; // } //} ReportParameter rParam = null; private List reportParameters = new List(); public rptEmployee() { } public byte[] EmployeeConfirmationReport(DateTime dConfirmationMonth, int payrollType) { DataTable oDTable = null; DataSet dSet = new DataSet(); oDTable = GetEmployeeConfirmations(dConfirmationMonth, payrollType); oDTable.TableName = "PayrollDataSet_EmployeeConfirmation"; //string RDLCName = "HRM.Report.RDLC.EmployeeConfirmation.rdlc"; string RDLC = "EmployeeConfirmation.rdlc"; //rParam = new ReportParameter("ConfirmationMonth", dConfirmationMonth.ToString("MMMM yyyy")); //reportParameters.Add(rParam); dSet.Tables.Add(oDTable); return new ReportProcessor().ShowDlgForEmployeeConfirmation(dSet, RDLC, dConfirmationMonth, payrollType); //return new ReportProcessor().CommonReportView(null, RDLCName, dSet, null, reportParameters, true, payrollType, null); } public DataTable GetEmployeeConfirmations(DateTime dConfirmationMonth, int payrollType) { //bool isDesignationFromDescriptionText = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); List designations = new DesignationService().GetAll(); List departments = new DepartmentService().GetAll(); List oEmpConfirms = new EmployeeConfirmationService().GetByDateRange(GlobalFunctions.FirstDateOfMonth(dConfirmationMonth), GlobalFunctions.LastDateOfMonth(dConfirmationMonth), payrollType); List oAllEmployees = new EmployeeService().GetAllEmps(); DataRow oDR = null; PayrollDataSet.PayrollDataSet.EmployeeConfirmationDataTable dTable = new PayrollDataSet.PayrollDataSet.EmployeeConfirmationDataTable(); if (oEmpConfirms == null) return dTable; foreach (EmployeeConfirmation oConfirm in oEmpConfirms) { Employee oEmployee = oAllEmployees.Where(obj => obj.ID == oConfirm.EmployeeID).FirstOrDefault(); if (oEmployee == null) { continue; } Designation designation = designations.FirstOrDefault(x => x.ID == oEmployee.DesignationID); Department department = departments.FirstOrDefault(x => x.ID == oEmployee.DepartmentID); oDR = dTable.NewRow(); oDR["EmployeeNo"] = oConfirm.EmployeeNo; oDR["Name"] = oConfirm.EmployeeName; oDR["JoiningDate"] = oConfirm.JoiningDate.ToString("dd MMM yyyy"); oDR["ConfirmationDate"] = oConfirm.ConfirmDate.ToString("dd MMM yyyy"); oDR["Designation"] = designation != null ? designation.Name : string.Empty; oDR["Department"] = department != null ? department.Name : string.Empty; dTable.Rows.Add(oDR); } //*******6 Month Auto Confirm Logic*************** //List oUnConfirmedEmployee = oAllEmployees.Where(obj => obj.Status == EnumEmployeeStatus.Live && // obj.PayrollTypeID == Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID && // obj.IsConfirmed == false && // obj.JoiningDate.AddMonths(6)>= GlobalFunctions.FirstDateOfMonth(dConfirmationMonth) && // obj.JoiningDate.AddMonths(6)<= GlobalFunctions.LastDateOfMonth(dConfirmationMonth) && // EmployeeConfirmation.GetByEmployeeID(obj.ID)==null).ToList(); //foreach (Employee oEmployee in oUnConfirmedEmployee) //{ // oDR = dTable.NewRow(); // oDR["EmployeeNo"] = oEmployee.EmployeeNo; // oDR["Name"] = oEmployee.Name; // oDR["JoiningDate"] = oEmployee.JoiningDate.ToString("dd MMM yyyy"); // oDR["ConfirmationDate"] = oEmployee.JoiningDate.AddMonths(6).ToString("dd MMM yyyy"); // dTable.Rows.Add(oDR); //} return dTable; } public byte[] GetEmpBasicInfo(string sEmpIDs, int payrollTypeId, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); string sEmpID = sEmpIDs; DataRow dr = null; Employee oEmployee = new Employee(); DataSet oEmpsInfo = new EmployeeService().GetEmpBasicInfo(sEmpID); HRM.Report.PayrollDataSet.PayrollDataSet.EmployeeInfoDataTable dTEmpInfo = new HRM.Report.PayrollDataSet.PayrollDataSet.EmployeeInfoDataTable(); foreach (DataRow oDRow in oEmpsInfo.Tables[0].Rows) { dr = dTEmpInfo.NewRow(); dr["EmployeeNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; if (Convert.ToInt32(oDRow["GENDER"]) == 1) { dr["Gender"] = "Male"; } else if (Convert.ToInt32(oDRow["GENDER"]) == 2) { dr["Gender"] = "Female"; } else if (Convert.ToInt32(oDRow["GENDER"]) == 3) { dr["Gender"] = "Both"; } dr["Religion"] = oDRow["RName"]; if (oDRow["BIRTHDATE"] != DBNull.Value && oDRow["BIRTHDATE"] != null) dr["DOB"] = oDRow["BIRTHDATE"]; if (oDRow["JOININGDATE"] != DBNull.Value && oDRow["JOININGDATE"] != null) dr["DOJ"] = oDRow["JOININGDATE"]; if (oDRow["DATEOFCONFIRMATION"] != DBNull.Value && oDRow["DATEOFCONFIRMATION"] != null) dr["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"]; if (Convert.ToInt32(oDRow["MARITALSTATUSID"]) == 1) { dr["MaritalStatus"] = "Married"; } else if (Convert.ToInt32(oDRow["MARITALSTATUSID"]) == 2) { dr["MaritalStatus"] = "UnMarried"; } dTEmpInfo.Rows.Add(dr); } return reportProcessor.ShowDlgForEmpBasic(null, dTEmpInfo, payrollTypeId, reportType); } public string GetEmpDetails(string sEmpIDs) { ReportProcessor reportProcessor = new ReportProcessor(); string sEmpID = sEmpIDs; DataRow dr = null; List oEmps = new EmployeeService().Get(); List oGrades = new GradeService().Get(EnumStatus.Active, 1); Grade grade = null; Employee employee = null; Employee oEmployee = null; int age = 0; DateTime bDate = DateTime.MinValue; int serviceLength = 0; DateTime joiningDate = DateTime.MinValue; DataSet oEmpDetails = new EmployeeService().GetEmpDetailsView(sEmpID); //DataTable dtDFSL = Employee.GetDFSL(); PayrollDataSet.PayrollDataSet.EmployeeDetailDataTable dTEmpDetail = new PayrollDataSet.PayrollDataSet.EmployeeDetailDataTable(); bool isDesigFromEmp = false;// ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); List _empCostCenters = new List();// EmployeeCostCenter.Get(); List _costCenters = new List();// Costcenter.Get(); Costcenter cCenter = null; EmployeeCostCenter empCostCenter = null; foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows) { try { // string[] sDes = GlobalFunctions.GetDFSL(dtDFSL, oDRow["DepartmentID"].ToString()); oEmployee = oEmps.Where(o => o.EmployeeNo.ToUpper().Trim() == oDRow["EMPLOYEENO"].ToString().ToUpper().Trim()) .SingleOrDefault(); dr = dTEmpDetail.NewRow(); dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; if (isDesigFromEmp && oEmployee != null) dr["Designation"] = oEmployee.DescriptionText; else dr["Designation"] = oDRow["Designation"]; //dr["Department"] = oDRow["DepDes"]; dr["Concern"] = oDRow["Concern"]; dr["Devision"] = oDRow["Devision"]; dr["DevisionCode"] = oDRow["DevisionCode"]; dr["Region"] = oDRow["Region"]; dr["RegionCode"] = oDRow["RegionCode"]; dr["Area"] = oDRow["Area"]; dr["AreaCode"] = oDRow["AreaCode"]; dr["Teritory"] = oDRow["Teritory"]; dr["TeritoryCode"] = oDRow["TeritoryCode"]; dr["Distributor"] = oDRow["Distributor"]; dr["DistributorCode"] = oDRow["DistributorCode"]; dr["Market"] = oDRow["Market"]; dr["MarketCode"] = oDRow["MarketCode"]; dr["LMNO"] = oDRow["LMNO"]; dr["LMName"] = oDRow["LMName"]; dr["SLMNO"] = oDRow["SLMNO"]; dr["SLMName"] = oDRow["SLMName"]; dr["Division"] = oDRow["Division"]; dr["Department"] = oDRow["Department"]; dr["Company"] = oDRow["Company"]; dr["Section"] = oDRow["Section"]; dr["SubSection"] = oDRow["SubSection"]; dr["Grade"] = oDRow["Grade"]; dr["BasicSalary"] = oDRow["BASICSALARY"]; dr["DOB"] = oDRow["BIRTHDATE"]; if (oEmployee.GradeID != null) { grade = oGrades.Where(o => o.ID == oEmployee.GradeID).FirstOrDefault(); dr["Level"] = grade == null ? "" : grade.Code; } bDate = Convert.ToDateTime(oDRow["BIRTHDATE"]); if (bDate != DateTime.MinValue) { age = DateTime.Today.Year - bDate.Year; if (bDate > DateTime.Today.AddYears(-age)) { age--; } dr["EmpAge"] = age; } else { dr["EmpAge"] = 0; } if (oEmployee == null) { dr["CostCenter"] = ""; } else { empCostCenter = _empCostCenters.Where(o => o.EmployeeID == oEmployee.ID).FirstOrDefault(); if (empCostCenter != null) { cCenter = _costCenters.Where(o => o.ID == empCostCenter.CostCenterID).FirstOrDefault(); dr["CostCenter"] = cCenter == null ? "" : cCenter.Name; } } //if (Convert.ToInt32(oDRow["GENDER"]) == 0) //{ // dr["Gender"] = "None"; //} //else if (Convert.ToInt32(oDRow["GENDER"]) == 1) //{ // dr["Gender"] = "Male"; //} //else if (Convert.ToInt32(oDRow["GENDER"]) == 2) //{ // dr["Gender"] = "Female"; //} //else if (Convert.ToInt32(oDRow["GENDER"]) == 3) //{ dr["Gender"] = oDRow["Gender"]; //} dr["Religion"] = oDRow["Religion"]; dr["Bank"] = oDRow["Bank"]; dr["Branch"] = oDRow["Branch"]; dr["AccountNo"] = oDRow["ACCOUNTNO"]; dr["BankOPI"] = oDRow["OUTPayBank"]; dr["BranchOPI"] = oDRow["OUTPayBranch"]; dr["AccountNoOPI"] = oDRow["OutPayAccountNo"]; dr["DOJ"] = oDRow["JOININGDATE"]; joiningDate = Convert.ToDateTime(oDRow["JOININGDATE"]); if (joiningDate != DateTime.MinValue) { serviceLength = DateTime.Today.Year - joiningDate.Year; dr["ServiceLength"] = serviceLength; } else { dr["ServiceLength"] = 0; } dr["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"]; dr["TaxAmount"] = oDRow["TAXAMOUNT"]; dr["LocDes"] = oDRow["Location"]; dr["GrossSalary"] = oDRow["GrossSalary"]; dr["VendorCode"] = oDRow["VendorCode"]; //if (Convert.ToInt32(oDRow["MARITALSTATUSID"]) == 0) //{ // dr["MarStatus"] = "None"; //} //else if (Convert.ToInt32(oDRow["MARITALSTATUSID"]) == 1) //{ // dr["MarStatus"] = "Married"; //} //else if (Convert.ToInt32(oDRow["MARITALSTATUSID"]) == 2) //{ dr["MarStatus"] = oDRow["MaritalStatus"]; //} dr["MobileNo"] = oDRow["MOBILENO"]; dr["MailAdd"] = oDRow["EMAILADDRESS"]; dTEmpDetail.Rows.Add(dr); } catch (Exception e) { string s = oDRow["EMPLOYEENO"].ToString(); } } DataSet dSet = new DataSet(); dTEmpDetail.TableName = "PayrollDataSet_EmployeeDetail"; dSet.Tables.Add(dTEmpDetail); return Convert.ToBase64String(reportProcessor.ReportViewForEmployeeDetails(null, dSet, "EmployeeDetail.rdlc", null)); } public DataTable GetDesignationChange(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeId) { EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); DesignationService designationService = new DesignationService(); UserService userService = new UserService(); EmployeeService employeeService = new EmployeeService(); DataSet lifeCycles = empLifeCycleService.GetDesignationChange(dEffectDate, dEffectDate2, payrollTypeId); PayrollDataSet.PayrollDataSet.EmpDesCatChangeDataTable dTEmpGBasic = new PayrollDataSet.PayrollDataSet.EmpDesCatChangeDataTable(); if (lifeCycles != null && 0 < lifeCycles.Tables[0].Rows.Count) { DataTable odesChange = lifeCycles.Tables[0].AsEnumerable().Where(myRow => Convert.ToDateTime(myRow["EffectDate"].ToString()) >= dEffectDate && Convert.ToDateTime(myRow["EffectDate"].ToString()) <= dEffectDate2).CopyToDataTable(); //.Where(o => o.StatusDetailID == 3 && o.EffectDate >= dEffectDate && o.EffectDate <= dEffectDate2).ToList(); // List oDesignation = designationService.Get(EnumStatus.Regardless, payrollTypeId); //List _users = userService.GetAll(); DataRow dr = null; int count = 1; //List oEmployees = employeeService.Get(); //DataSet oEmpBasicGrade = EmployeeGradeSalary.GetEmpBasicGrade(dEffectDate, dEffectDate2); //oEmpBasicGrade.Tables[0].Columns.Add("AuthorizedDate"); //DataSet oEmpPrvBasicGrade = EmployeeGradeSalary.GetEmpPrvBasicGrade(dEffectDate); foreach (DataRow oDRow in odesChange.Rows) { // Employee emp = oEmployees.FirstOrDefault(o => o.ID == oDRow.EmployeeID); dr = dTEmpGBasic.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["Employeeno"]; dr["Name"] = oDRow["Name"]; dr["EffectDate"] = Convert.ToDateTime(oDRow["EffectDate"]).ToString("dd MMM yyyy"); //dr["EnteryDate"] = oDRow["ENTRYDATE"]; dr["PresentDesignation"] = oDRow["Designation"]; dr["PresentCategory"] = ""; dr["CommitedBy"] = oDRow["LoginID"]; dr["CommitedDate"] = Convert.ToDateTime(oDRow["CreationDate"]).ToString("dd MMM yyyy"); dr["ChangeType"] = ""; dr["StatusDate"] = Convert.ToDateTime(oDRow["EffectDate"]).ToString("dd MMM yyyy"); //EmpLifeCycle prev = lifeCycles.Where(o => o.StatusDetailID == 10 && o.DesignationID != null && o.EmployeeID == oDRow.EmployeeID && o.EffectDate < dEffectDate).ToList().OrderByDescending(x => x.Sequence).FirstOrDefault(); //.FirstOrDefault(o => o.StatusDetailID.Integer == 10 ); DataRow prev = lifeCycles.Tables[0].AsEnumerable().Where(myRow => myRow["EmployeeID"].ToString() == oDRow["EmployeeID"].ToString()).Skip(1).FirstOrDefault(); if (prev != null) { dr["PreviousDesignation"] = prev["Designation"];// oDesignation.FirstOrDefault(o => o.ID == prev.DesignationID).Name; } dr["AuthorizedDate"] = oDRow["APPROVEDDATE"].ToString() != string.Empty ? Convert.ToDateTime(oDRow["APPROVEDDATE"]).ToString("dd MMM yyyy hh:mm:ss tt") : ""; dr["AuthorizeBy"] = Convert.ToString(oDRow["AuthorizeBy"]); //ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) //{ // return oItem.EmployeeID == Convert.ToInt16(oDRow["employeeid"]) && // oItem.ObjectID == Convert.ToInt32(oDRow["emplifecycleID"]) && // oItem.SalaryMonth.Year == (Convert.ToDateTime(oDRow["EffectDate"])).Year && // oItem.SalaryMonth.Month == (Convert.ToDateTime(oDRow["EffectDate"])).Month && // oItem.FinantialDataType == EnumApprovalFinancialData.Lifecycle; //}); /* ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == nEmployeeid && oItem.ObjectID == nAdparameterEmpid && oItem.FinantialDataType == enmType; });*/ //if (finalcialData != null) //{ // User usr = _users.Find(delegate (User oItem) // { // return oItem.EmployeeID == finalcialData.Approvedby; // }); // if (usr != null) // dr["AuthorizeBy"] = usr.LoginID; // dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); //} //else // dr["AuthorizeBy"] = ""; dTEmpGBasic.Rows.Add(dr); count++; } } dTEmpGBasic.TableName = "PayrollDataSet_EmpDesCatChange"; return dTEmpGBasic; } public byte[] GetEmpBankHistory(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeId, string reportType) { DateTime dFromtDate = dEffectDate; DateTime dToDate = dEffectDate2; DataSet resultDataSet = new DataSet(); string RDLCName = "HRM.Report.RDLC.EmpBankHistory.rdlc"; EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); EmployeeBankAccountService employeeBankAccountService = new EmployeeBankAccountService(); UserService userService = new UserService(); EmployeeService employeeService = new EmployeeService(); DataRow dr = null; EmployeeBankAccount oEmpBankAccount = null; List _finalcialDatas = approveFinantialDataService.Get(); List _users = userService.GetAll(); DataSet oEmpBankHis = employeeBankAccountService.GetEmpBankHistory(dEffectDate, dEffectDate2, payrollTypeId); DataSet oEmpPBankHis = employeeBankAccountService.GetEmpPrvBankHistory(dEffectDate, payrollTypeId); List oAccountHists = employeeBankAccountService.GetByDate(dFromtDate, dToDate, payrollTypeId); oEmpBankHis.Tables[0].Columns.Add("AuthorizeBy"); oEmpBankHis.Tables[0].Columns.Add("AuthorizedDate"); PayrollDataSet.PayrollDataSet.EmpBankHistoryDataTable dTEmpGBasic = new PayrollDataSet.PayrollDataSet.EmpBankHistoryDataTable(); foreach (DataRow oDRow in oEmpBankHis.Tables[0].Rows) { dr = dTEmpGBasic.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["CBankName"] = oDRow["CBank"]; dr["CAccount"] = oDRow["CACCOUNTNO"]; dr["CBranch"] = oDRow["CBranch"]; dr["ChangeEffectDate"] = oDRow["CHANGEDATE"]; dr["CommitedBy"] = oDRow["CommitedBy"]; dr["CommitedDate"] = Convert.ToDateTime(oDRow["CreationDate"]).ToString("dd MMM yyyy hh:mm:ss tt"); dr["StatusDate"] = dEffectDate; if (oEmpBankAccount != null) { foreach (DataRow oDRows in oEmpPBankHis.Tables[0].Rows) { dr["PBankName"] = oDRows["PBank"]; dr["PAccount"] = oDRows["PACCOUNTNO"]; dr["PBranch"] = oDRows["PBranch"]; } ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == oEmpBankAccount.EmployeeID && oItem.ObjectID == oEmpBankAccount.ID && oItem.FinantialDataType == EnumApprovalFinancialData.BankAccountHistory; }); if (finalcialData != null) { User usr = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (usr != null) dr["AuthorizeBy"] = usr.LoginID; dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; dTEmpGBasic.Rows.Add(dr); count++; } dTEmpGBasic.TableName = "PayrollDataSet_EmpBankHistory"; resultDataSet.Tables.Add(dTEmpGBasic); ReportParameter oReportParameter = null; oReportParameter = new ReportParameter("FromDate", dFromtDate.ToString("dd MMM yyyy")); reportParameters.Add(oReportParameter); oReportParameter = new ReportParameter("ToDate", dToDate.ToString("dd MMM yyyy")); reportParameters.Add(oReportParameter); ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType); //return new ReportProcessor().CommonReportView(null, resultDataSet, null, RDLCName, reportParameters, true, payrollTypeId, reportType); //return dTEmpGBasic; } public byte[] GetAllTransferDataForContinueFromDiscontinue(DateTime tDate, DateTime tDate2, int payrollTypeId, string reportType) { DateTime dFromtDate = tDate; DateTime dToDate = tDate2; DataSet resultDataSet = new DataSet(); string RDLCName = "HRM.Report.RDLC.EmployeeContinueFromDiscontinue.rdlc"; EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); EmployeeService employeeService = new EmployeeService(); SystemInformation sysInfo = new SystemInformationService().Get(); sysInfo.CurrentSysInfo = new SystemInformationService().Get(); UserService userService = new UserService(); DataSet ds = employeeService.GetByMonthStartMonthEndForContinueFromDiscontinue(dFromtDate, dToDate, payrollTypeId); List _finalcialDatas = approveFinantialDataService.Get(); List _users = userService.GetAll(); List _lifeCycles = empLifeCycleService.Get(EnumStatus.Regardless, payrollTypeId); ds.Tables[0].Columns.Add("AuthorizedDate"); PayrollDataSet.PayrollDataSet.EmpContinueFromDiscontinueDataTable oDt = new PayrollDataSet.PayrollDataSet.EmpContinueFromDiscontinueDataTable(); DataRow ndr = null; int sl = 0; if (ds.Tables.Count != 0) { foreach (DataRow dr in ds.Tables[0].Rows) { ndr = oDt.NewRow(); sl++; ndr["SL"] = sl; ndr["EmployeeNo"] = dr["EmployeeNo"]; ndr["EmployeeName"] = dr["EmployeeName"]; ndr["ContinueDate"] = dr["ContinueDate"]; ndr["UserIdWhoChangedIt"] = dr["UserIdWhoChangedIt"]; ndr["ChangedDate"] = dr["ChangedDate"]; if (sysInfo.CurrentSysInfo.Code.Contains("007")) { int nlifeCycleID = Convert.ToInt32(dr["emplifecycleid"]); int nEmployeeid = Convert.ToInt32(dr["Employeeid"]); if (nlifeCycleID > 0) { EmpLifeCycle lifeCycle = _lifeCycles.Find(delegate (EmpLifeCycle oItem) { return oItem.ID == nlifeCycleID; }); if (lifeCycle != null) { ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == nEmployeeid && oItem.ObjectID == lifeCycle.ID && oItem.SalaryMonth.Year == Convert.ToDateTime(dr["ContinueDate"]).Year && oItem.SalaryMonth.Month == Convert.ToDateTime(dr["ContinueDate"]).Month && oItem.FinantialDataType == EnumApprovalFinancialData.Lifecycle; }); if (finalcialData != null) { User user = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (user != null) ndr["AuthorizeBy"] = user.LoginID; ndr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else ndr["AuthorizeBy"] = ""; } else ndr["AuthorizeBy"] = ""; } else ndr["AuthorizeBy"] = ""; } oDt.Rows.Add(ndr); } } oDt.TableName = "PayrollDataSet_EmpContinueFromDiscontinue"; resultDataSet.Tables.Add(oDt); string date = dFromtDate.ToString("dd MMM yyyy") + " - " + dToDate.ToString("dd MMM yyyy"); ReportParameter oReportParameter = null; oReportParameter = new ReportParameter("date", date); reportParameters.Add(oReportParameter); ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType); // return oDt; } public byte[] ShowCCInformationByMonth(DateTime startDate, DateTime startDate2, int payrollTypeId, string reportType) { DateTime startmonth = startDate; DateTime endmonth = startDate2; PayrollDataSet.PayrollDataSet.CCDetailReportDataTable CCReportDT = new PayrollDataSet.PayrollDataSet.CCDetailReportDataTable(); DataRow oDR = null; int count = 1; DataSet resultDataSet = new DataSet(); string RDLCName = "HRM.Report.RDLC.CCDetailReport.rdlc"; EmployeeCostCenterService employeeCostCenterService = new EmployeeCostCenterService(); CostcenterService costcenterService = new CostcenterService(); EmployeeService employeeService = new EmployeeService(); SalaryMonthlyService salaryMonthlyService = new SalaryMonthlyService(); EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); UserService userService = new UserService(); List costCenters = employeeCostCenterService.GetByMonthStartEnd(startmonth, endmonth, payrollTypeId); List crgs = costcenterService.Get(); List eployees = employeeService.Get(); List allSalEmpCost = salaryMonthlyService.GetCostCenter(GlobalFunctions.LastDateOfMonth(startDate.AddMonths(-1))); List _finalcialDatas = approveFinantialDataService.GetByMonth(startmonth, endmonth); List _users = userService.GetAll(); List _lifeCycles = empLifeCycleService.Get(EnumStatus.Regardless, payrollTypeId); foreach (EmployeeCostCenter empCst in costCenters) { Employee emp = employeeService.Get(empCst.EmployeeID); if (emp == null) continue; oDR = CCReportDT.NewRow(); oDR["SLNo"] = count; User obUser = userService.Get(empCst.CreatedBy); if (obUser != null) oDR["UserId"] = obUser.LoginID; else oDR["UserId"] = String.Empty; oDR["CreationDate"] = empCst.CreatedDate; oDR["EmpNo"] = emp.EmployeeNo; oDR["Name"] = emp.Name; oDR["CurCC"] = String.Empty; foreach (Costcenter cstCenterObj in crgs) { if (cstCenterObj.ID == empCst.CostCenterID) { oDR["CurCC"] = cstCenterObj.Code + "(" + empCst.Percentage.ToString() + ")"; oDR["CCcode"] = cstCenterObj.Code; break; } } oDR["Month"] = startDate.ToString("dd MMM yyyy"); if (allSalEmpCost != null) { SalaryEmpCostCenter semp = allSalEmpCost.Find(delegate (SalaryEmpCostCenter sitem) { return sitem.EmployeeID == empCst.EmployeeID; }); if (semp != null) { Costcenter ocrg = costcenterService.Get(semp.CostCenterID); if (ocrg != null) { oDR["PrvCC"] = ocrg.Code + "(100)"; } } } if (empCst.EmployeeID > 0) { EmpLifeCycle lifeCycle = _lifeCycles.Find(delegate (EmpLifeCycle oItem) { return oItem.CostCenterID == empCst.CostCenterID && empCst.MonthDate == oItem.SalaryMonth && oItem.EmployeeID == empCst.EmployeeID; }); if (lifeCycle != null) { ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == empCst.EmployeeID && oItem.ObjectID == lifeCycle.ID && oItem.SalaryMonth.Year == lifeCycle.EffectDate.Year && oItem.SalaryMonth.Month == lifeCycle.EffectDate.Month && oItem.FinantialDataType == EnumApprovalFinancialData.Lifecycle; }); if (finalcialData != null) { User user = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (user != null) oDR["AuthorizeBy"] = user.LoginID; oDR["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else oDR["AuthorizeBy"] = ""; } else oDR["AuthorizeBy"] = ""; } else oDR["AuthorizeBy"] = ""; CCReportDT.Rows.Add(oDR); count++; } CCReportDT.TableName = "PayrollDataSet_CCDetailReport"; resultDataSet.Tables.Add(CCReportDT); //ReportParameter oReportParameter = null; //oReportParameter = new ReportParameter("Month", startDate.ToString("dd MMM yyyy")); //reportParameters.Add(oReportParameter); ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, null, true, payrollTypeId, reportType); } public byte[] PrepareDataForExceptionPFandConfirmation(DateTime fromdate, DateTime todate, int payrollTypeId, string reportType) { DataSet resultDataSet = new DataSet(); string RDLCName = "HRM.Report.RDLC.NewPFReport.rdlc"; string sEmpIDs=string.Empty; DataRow oDR = null; DataSet dsPF = null; MiscellaneousDatasetService miscellaneousDatasetService = new MiscellaneousDatasetService(); dsPF = miscellaneousDatasetService.GetEmployeesPFNew(fromdate, todate, sEmpIDs); PayrollDataSet.dsCompany.NewPFDataTable dtMonthlyPF = new PayrollDataSet.dsCompany.NewPFDataTable(); if (dsPF.Tables.Count > 0) { foreach (DataRow orr in dsPF.Tables[0].Rows) { oDR = dtMonthlyPF.NewRow(); oDR["EmpName"] = orr["Name"].ToString(); oDR["EmpNo"] = orr["EmployeeNo"].ToString(); DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString()); oDR["JoiningDate"] = dtJoin.ToString("dd MMM yyyy"); DateTime dob = Convert.ToDateTime((orr["BirthDate"]).ToString()); oDR["DoB"] = dob.ToString("dd MMM yyyy"); oDR["Designation"] = orr["Designation"].ToString(); oDR["Department"] = orr["Department"].ToString(); oDR["GrossSalary"] = Convert.ToDouble(orr["GrossSalary"].ToString()); oDR["CPF"] = Convert.ToDouble(orr["CPF"].ToString()); oDR["EPF"] = Convert.ToDouble(orr["EPF"].ToString()); dtMonthlyPF.Rows.Add(oDR); } } dtMonthlyPF.TableName = "dsCompany_NewPF"; resultDataSet.Tables.Add(dtMonthlyPF); ReportParameter oReportParameter = null; oReportParameter = new ReportParameter("Month", fromdate.ToString("dd MMM yyyy")); reportParameters.Add(oReportParameter); ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType); } private string GetEmpPhotoPath(Employee emp) { string photoPath = string.Empty; empFileupload oempFileupload = new empFileupload(); oempFileupload = new HREmployeeService().getuploadedFile(emp.ID, emp.ID, enumEmpFileUploadType.photo); if (oempFileupload != null) { photoPath = System.IO.Path.Combine(System.Environment.CurrentDirectory + @"\EMPPHOTO"); if (!Directory.Exists(photoPath)) { Directory.CreateDirectory(photoPath); } photoPath += @"\" + emp.ID.ToString() + "_" + emp.EmployeeNo + "_" + emp.PayrollTypeID.ToString() + ".jpg"; if (!Directory.Exists(photoPath)) { File.WriteAllBytes(photoPath, (byte[])oempFileupload.fileData); } } return photoPath; } public byte[] EmpServiceBook(int payrollTypeID, string sEmpIDs) { Employee oEmployee = null; List empLst = new EmployeeService().GetByEmpIDs(sEmpIDs); EducationLevelService educationLevelService = new EducationLevelService(); DisciplineService disciplineService = new DisciplineService(); ResultTypeService resultTypeService = new ResultTypeService(); InstitutionService institutionService = new InstitutionService(); oEmployee = empLst != null ? empLst[0] : null; if (oEmployee == null) { throw new Exception("Employee Not found"); } string empPic = GetEmpPhotoPath(oEmployee); DataSet dSet = new DataSet(); DataTable dTable = new PayrollDataSet.PayrollDataSet.EmployeePersonalInfoDataTable(); DataRow oRow = null; HREmployee oHREmp = new HREmployeeService().Get(oEmployee.ID); List ewpss = new EmployeeWorkPlanSetupService().Get(); List wpgs = new WorkPlanGroupService().GetAll(); EmployeeWorkPlanSetup ewps = null; WorkPlanGroup wpg = null; if (ewpss.Count > 0) { ewps = ewpss.Where(x => x.EmployeeID == oEmployee.ID).FirstOrDefault(); } if (wpgs.Count > 0 && ewps != null) { wpg = wpgs.Where(x => x.ID == ewps.WorkPlanGroupID).FirstOrDefault(); } #region General Info oRow = dTable.NewRow(); oRow["EmployeeNo"] = oHREmp.EmployeeNo; oRow["Name"] = oHREmp.Name; oRow["Department"] = oHREmp.DepartmentName; oRow["Designation"] = oHREmp.DesignationName; oRow["DOB"] = oHREmp.BirthDate.ToString("dd-MMM-yyyy"); oRow["DOJ"] = oHREmp.JoiningDate.ToString("dd-MMM-yyyy"); oRow["Grade"] = oHREmp.Grade != null ? oHREmp.Grade.Name : ""; oRow["Bank"] = oHREmp.Branch != null && oHREmp.Branch.Bank != null ? oHREmp.Branch.Bank.Name : ""; oRow["Branch"] = oHREmp.Branch != null ? oHREmp.Branch.Name : ""; oRow["AccountNo"] = oEmployee.AccountNo; oRow["Shift"] = wpg != null ? wpg.Name : ""; List oEmpContacts = oHREmp.Contacts; EmpContact oEmpContact = null; if (oEmpContacts.Count > 0) { oEmpContact = oEmpContacts[0]; if (oEmpContact != null) { oRow["PreAddress"] = oEmpContact.PresentAddress; oRow["PreTele"] = oEmpContact.PresentTelephone; oRow["PreMobile"] = oEmpContact.PresentMobile; oRow["ParAddress"] = oEmpContact.PermanentAddress; oRow["ParTele"] = oEmpContact.PermanentTelephone; oRow["ParMobile"] = oEmpContact.PermanentMobile; oRow["EmeName"] = oEmpContact.EmergencyContactPerson; oRow["EmeAddress"] = oEmpContact.EmergencyContactAddress; oRow["EmeTele"] = oEmpContact.EmergencyTelephone; oRow["EmeMobile"] = oEmpContact.EmergencyMobile; oRow["EmeRelation"] = oEmpContact.ContactPersonRelation != null ? oEmpContact.ContactPersonRelation.Description : ""; } } oRow["FName"] = oHREmp.FatherName; oRow["FOccupation"] = oHREmp.FatherOccupation != null ? oHREmp.FatherOccupation.Description : ""; oRow["MName"] = oHREmp.MotherName; oRow["MOccupation"] = oHREmp.MotherOccupation != null ? oHREmp.MotherOccupation.Description : ""; oRow["NationalID"] = oHREmp.NationalID; oRow["Nationality"] = oHREmp.Nationality != null ? oHREmp.Nationality.Description : ""; oRow["PassportNo"] = oHREmp.PassportNo; oRow["BloodGroup"] = oHREmp.BloodGroup.BloodGroupToFriendlyName(); oRow["Religion"] = oHREmp.Religion != null ? oHREmp.Religion.Name : ""; oRow["Gender"] = oHREmp.Gender; oRow["BirthPlace"] = oHREmp.BirthPlace; oRow["TINNo"] = oHREmp.TinNo; oRow["MaritalStatus"] = oHREmp.MaritalStatus.ToString(); List oEmpSpouses = oHREmp.Spouses; EmpSpouse oEmpSpouse = null; if (oEmpSpouses.Count > 0) { oEmpSpouse = oEmpSpouses[0]; if (oEmpSpouse != null) { oRow["SpouseName"] = oEmpSpouse.Name; oRow["SpouseOccupation"] = oEmpSpouse.Occupation != null ? oEmpSpouse.Occupation.Description : ""; oRow["SpouseEducaion"] = oEmpSpouse.EducationLevel != null ? oEmpSpouse.EducationLevel.Description : ""; oRow["SpouseDesignation"] = oEmpSpouse.Designation; oRow["SpouseOrganization"] = oEmpSpouse.Organization; oRow["SpouseFamilyResidence"] = oEmpSpouse.FamilyResidence; oRow["SpouseMarriageDate"] = oEmpSpouse.MarriageDate; oRow["SpouseBirthDate"] = oEmpSpouse.DateOfBirth; oRow["SpouseInstitution"] = oEmpSpouse.InstitutionName; oRow["SpouseMobile"] = oEmpSpouse.ContactNumber; oRow["NoOfFamilyMember"] = oEmpSpouse.NoOfFamilyMember; } } if (oEmployee.Residence == EnumResidence.Own) { oRow["ResidenceOwn"] = "Yes"; //oRow["ResidenceRented"] = "No"; } else if (oEmployee.Residence == EnumResidence.Rented) { oRow["ResidenceRented"] = "Yes"; //oRow["ResidenceOwn"] = "No"; } oRow["HomeDistrict"] = oEmployee.HomeDistrict; oRow["SpecialMark"] = oEmployee.SpecialIdentificationMark; dTable.Rows.Add(oRow); dTable.TableName = "PayrollDataSet_EmployeePersonalInfo"; dSet.Tables.Add(dTable); #endregion #region Education Info dTable = new PayrollDataSet.PayrollDataSet.EmployeeEducationDataTable(); List oEmpAcademics = oHREmp.Academics; if (oEmpAcademics.Count > 0) { foreach (EmpAcademic item in oEmpAcademics) { if (item.DisciplineID != null) { item.Discipline = disciplineService.Get(item.DisciplineID); } if (item.EducationLevelID != null) { item.EducationLevel = educationLevelService.Get(item.EducationLevelID); } if (item.ResultTypeID != null) { item.ResultType = resultTypeService.Get(item.ResultTypeID); } if (item.InstitutionID != null) { item.Institution = institutionService.Get(item.InstitutionID); } oRow = dTable.NewRow(); oRow["DegreeName"] = item.EducationLevel != null ? item.EducationLevel.Description : ""; oRow["Discipline"] = item.Discipline != null ? item.Discipline.Description : ""; oRow["InstituteName"] = item.InstituteName; oRow["Result"] = item.ResultType != null ? item.ResultType.Description : ""; oRow["PassingYear"] = item.PassingYear.ToString(); oRow["BoardName"] = item.Institution != null ? item.Institution.Name : ""; dTable.Rows.Add(oRow); } } dTable.TableName = "PayrollDataSet_EmployeeEducation"; dSet.Tables.Add(dTable); #endregion #region Children Info dTable = new PayrollDataSet.PayrollDataSet.EmployeeChildrenDataTable(); List oEmpChildrens = oHREmp.ChildrenList; if (oEmpChildrens.Count > 0) { foreach (EmpChildren item in oEmpChildrens) { oRow = dTable.NewRow(); oRow["Name"] = item.Name; oRow["Gender"] = item.Gender.ToString(); oRow["DOB"] = item.BirthDate; oRow["Education"] = item.Education; oRow["InstituteName"] = item.InstitutionName; oRow["ClassYear"] = item.ClassYear; oRow["MaritalStatus"] = item.MaritalStatus.ToString(); oRow["Occupation"] = item.Occupation != null ? item.Occupation.Description : ""; oRow["BATBYear"] = item.BATBScholarshipYear; oRow["BATBAmount"] = item.BATBScholarshipAmount; dTable.Rows.Add(oRow); } } dTable.TableName = "PayrollDataSet_EmployeeChildren"; dSet.Tables.Add(dTable); #endregion #region Nominee Info dTable = new PayrollDataSet.PayrollDataSet.EmployeeNomineeDataTable(); List oEmpNominees = oHREmp.Nominees; if (oEmpNominees != null && oEmpNominees.Count > 0) { foreach (EmpNominee item in oEmpNominees) { oRow = dTable.NewRow(); oRow["Name"] = item.Name; oRow["Type"] = item.NominationPurpose != null ? item.NominationPurpose.Description : ""; oRow["DOB"] = item.BirthDate.ToString("dd MMM yyyy"); oRow["Relation"] = item.Relation != null ? item.Relation.Description : ""; oRow["Percentage"] = item.Percentage; oRow["Address"] = item.Address; oRow["Status"] = item.NomineeStatus; oRow["Occupation"] = item.Occupation != null ? item.Occupation.Description : ""; dTable.Rows.Add(oRow); } } dTable.TableName = "PayrollDataSet_EmployeeNominee"; dSet.Tables.Add(dTable); #endregion #region Hobby Info List hobbies = new HobbyService().Get(); List ecas = new ExtraCurricularActivityService().Get(); List otherTalents = new OtherTalentService().Get(); List oEmpHobby = new HREmployeeService().GetEmpHobbys(oHREmp.ID); string hobbyNames = string.Empty; string activityNames = string.Empty; string talentNames = string.Empty; if (hobbies.Count > 0) { foreach (EmpHobby item in oEmpHobby) { Hobby hobby = null; hobby = hobbies.Where(x => x.ID == item.HobbyID).FirstOrDefault(); if (hobby != null) { hobbyNames = hobbyNames + hobby.Description + ","; } } } if (ecas.Count > 0 && oHREmp.CurricularActivities != null && oHREmp.CurricularActivities.Count > 0) { foreach (EmpCurricularActivity item in oHREmp.CurricularActivities) { ExtraCurricularActivity eca = null; eca = ecas.Where(x => x.ID == item.CurricularActivityID).FirstOrDefault(); if (eca != null) { activityNames = activityNames + eca.Description + ","; } } } if (oHREmp.OtherTalents != null) { foreach (EmpOtherTalent item in oHREmp.OtherTalents) { OtherTalent otherTalent = null; otherTalent = otherTalents.Where(x => x.ID == item.OtherTalentID).FirstOrDefault(); if (otherTalent != null) { talentNames = talentNames + otherTalent.Description + ","; } } } dTable = new PayrollDataSet.PayrollDataSet.EmployeeHobbyDataTable(); oRow = dTable.NewRow(); oRow["SpecialSkill"] = talentNames.Trim(','); oRow["Activities"] = activityNames.Trim(','); oRow["Hobby"] = oHREmp.EmpHobby; dTable.Rows.Add(oRow); dTable.TableName = "PayrollDataSet_EmployeeHobby"; dSet.Tables.Add(dTable); #endregion #region Experience Info dTable = new PayrollDataSet.PayrollDataSet.EmployeeExperienceDataTable(); List oEmpExperiences = oHREmp.Experiences; if (oEmpExperiences.Count > 0) { foreach (EmpExperience item in oEmpExperiences) { oRow = dTable.NewRow(); oRow["CompanyName"] = item.Employer; oRow["Address"] = item.Address; oRow["NatureOfBusiness"] = item.JobDescription; oRow["Duration"] = item.FromDate.ToString("dd MMM yyyy") + "-" + item.ToDate.ToString("dd MMM yyyy"); oRow["Designation"] = item.Designation; oRow["ContactPerson"] = item.ContactPerson; dTable.Rows.Add(oRow); } } dTable.TableName = "PayrollDataSet_EmployeeExperience"; dSet.Tables.Add(dTable); #endregion #region Training Info dTable = new PayrollDataSet.PayrollDataSet.EmployeeTrainingDataTable(); List oEmpTrainings = oHREmp.Trainings; if (oEmpTrainings.Count > 0) { foreach (EmpTraining item in oEmpTrainings) { oRow = dTable.NewRow(); oRow["TrainingType"] = item.TrainingType != null ? item.TrainingType.Name : ""; oRow["TrainingName"] = item.Name; oRow["Duration"] = item.FromDate.ToString("dd MMM yyyy") + "-" + item.ToDate.ToString("dd MMM yyyy"); oRow["InstituteName"] = item.Institution != null ? item.Institution.Name : ""; oRow["Result"] = item.Result; dTable.Rows.Add(oRow); } } dTable.TableName = "PayrollDataSet_EmployeeTraining"; dSet.Tables.Add(dTable); #endregion #region Reference Info DataTable dTableInside = new PayrollDataSet.PayrollDataSet.EmployeeReferenceInsideDataTable(); DataTable dTableOutside = new PayrollDataSet.PayrollDataSet.EmployeeReferenceOutsideDataTable(); List oEmpReferences = oHREmp.References; if (oEmpReferences.Count > 0) { foreach (EmpReference item in oEmpReferences) { if (item.EmployeeNo == string.Empty || item.EmployeeNo == null) { oRow = dTableOutside.NewRow(); oRow["ReferenceName"] = item.Name; oRow["Occupation"] = item.Occupation != null ? item.Occupation.Description : ""; oRow["Organization"] = item.Organization; oRow["Designation"] = item.Designation; oRow["Address"] = item.Address; oRow["Mobile"] = item.Telephone; oRow["Relation"] = item.Relation != null ? item.Relation.Description : ""; dTableOutside.Rows.Add(oRow); } else { oRow = dTableInside.NewRow(); oRow["ReferenceName"] = item.Name; oRow["ID"] = item.EmployeeNo; oRow["Designation"] = item.Designation; oRow["Mobile"] = item.Telephone; oRow["Relation"] = item.Relation != null ? item.Relation.Description : ""; dTableInside.Rows.Add(oRow); } } } dTableInside.TableName = "PayrollDataSet_EmployeeReferenceInside"; dSet.Tables.Add(dTableInside); dTableOutside.TableName = "PayrollDataSet_EmployeeReferenceOutside"; dSet.Tables.Add(dTableOutside); #endregion ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.ShowEmpServiceBook(null, dSet, empPic, payrollTypeID); } //public void GetEmpMasterData() //{ // fReportViewer form = new fReportViewer(); // string sEmpID = _selectedParameter.ReportItem.INSQL; // _SalaryMonth = _selectedParameter.FromDate.Value; // DataRow dr = null; // Employee oEmployee = new Employee(); // DataSet oEmpsInfo = Employee.GetEmpMasterData(sEmpID, GlobalFunctions.LastDateOfMonth(_SalaryMonth)); // PayrollDataSet.PayrollDataSet.EmployeeInfoDataTable dTEmpInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeInfoDataTable(); // int payrollTypeID = BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer; // foreach (DataRow oDRow in oEmpsInfo.Tables[0].Rows) // { // dr = dTEmpInfo.NewRow(); // dr["EmployeeNo"] = oDRow["EMPLOYEENO"]; // dr["Name"] = oDRow["NAME"]; // if (payrollTypeID == 3) // { // if (oDRow["Gender"].ToString().Trim().ToUpper() == "M") // { // dr["Gender"] = "Male"; // } // else // { // dr["Gender"] = "Female"; // } // } // else // { // dr["Gender"] = oDRow["Gender"]; // } // dr["CountryCode"] = "BD"; // if (payrollTypeID == 1) // { // dr["ActionCode"] = "NH"; // } // else // { // dr["ActionCode"] = ""; // } // dr["Religion"] = oDRow["RName"]; // if (oDRow["BIRTHDATE"] != DBNull.Value && oDRow["BIRTHDATE"] != null) // dr["DOB"] = oDRow["BIRTHDATE"]; // if (oDRow["JOININGDATE"] != DBNull.Value && oDRow["JOININGDATE"] != null) // dr["DOJ"] = oDRow["JOININGDATE"]; // if (oDRow["DATEOFCONFIRMATION"] != DBNull.Value && oDRow["DATEOFCONFIRMATION"] != null) // dr["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"]; // dr["DOJ_BTFA"] = oDRow["DOJ_BTFA"]; // dr["MaritalStatus"] = oDRow["MaritalStatus"]; // if (payrollTypeID == 1) // { // dr["EntityCode"] = "BD80"; // } // else if (payrollTypeID == 3) // { // dr["EntityCode"] = "L865"; // } // dr["Title"] = oDRow["Title"]; // dr["FirstName"] = oDRow["FIRSTNAME"]; // dr["LastName"] = oDRow["LastName"]; // dr["MiddleName"] = oDRow["MIDDLENAME"]; // dr["PStartDate"] = GlobalFunctions.FirstDateOfMonth(_SalaryMonth).ToString("dd/MM/yyyy"); // dr["PEndDate"] = GlobalFunctions.LastDateOfMonth(_SalaryMonth).ToString("dd/MM/yyyy"); // if (payrollTypeID == 1) // { // dr["ProcessType"] = "R"; // } // else if (payrollTypeID == 3) // { // dr["ProcessType"] = "Active"; // } // else // { // dr["ProcessType"] = ""; // } // dr["Nationality"] = oDRow["Nationality"]; // dr["PositionCode"] = oDRow["PositionCode"]; // dr["Position"] = oDRow["Position"]; // dr["CatCode"] = oDRow["CategoryCode"]; // dr["CatDescription"] = oDRow["Category"]; // dr["GradeCode"] = oDRow["GradeCode"]; // dr["GradeDescription"] = oDRow["Grade"]; // dr["CCCode"] = oDRow["CCCode"]; // dr["CCDescription"] = oDRow["CostCenter"]; // dr["LocationCode"] = oDRow["LocationCode"]; // dr["LocationName"] = oDRow["Location"]; // dr["Email"] = oDRow["EMAILADDRESS"]; // if (oDRow["ENDOFCONTRACTDATE"] != DBNull.Value && oDRow["ENDOFCONTRACTDATE"] != null) // { // DateTime dtTerminate = Convert.ToDateTime(oDRow["ENDOFCONTRACTDATE"]); // dr["TerminationDate"] = dtTerminate.ToString("dd/mm/yyyy"); // } // else // { // dr["TerminationDate"] = ""; // } // if (payrollTypeID == 3) // { // dr["PaymentMode"] = "Bank Transfer"; // } // else if (payrollTypeID == 1) // { // dr["PaymentMode"] = "B"; // } // dr["BankCode"] = oDRow["BankCode"]; // dr["Bank"] = oDRow["BankName"]; // dr["BranchCode"] = oDRow["BranchCode"]; // dr["Branch"] = oDRow["Branch"]; // dr["AccountNo"] = oDRow["ACCOUNTNO"]; // dTEmpInfo.Rows.Add(dr); // } // form.ShowDlgForEmpMasterData(GlobalFunctions.LastDateOfMonth(_SalaryMonth), dTEmpInfo); //} //public void ShowLetterOfAccountIntro() //{ // fReportViewer form = new fReportViewer(); // string sEmpID = _selectedParameter.ReportItem.INSQL; // DateTime month = _selectedParameter.FromDate != null ? _selectedParameter.FromDate.Value.LastDateOfMonth() : Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.FirstDateOfMonth().AddDays(-1); // DataRow dr = null; // List oEmps = Employee.Get(); // Employee oEmployee = null; // if (_selectedParameter.Banks.Count <= 0) // throw new ServiceException("please select a bank"); // DataSet oEmpDetails = Employee.GetEmpForLetterOfIntroDuction(sEmpID, month); // DataTable dTEmpDetail = oEmpDetails.Tables[0].Copy(); // string companyName = Payroll.BO.SystemInformation.CurrentSysInfo.name; // foreach (DataRow item in dTEmpDetail.Rows) // { // item["CompanyName"] = companyName; // } // DataSet dSet = new DataSet(); // dTEmpDetail.TableName = "dsCompany_LetterOfAccountIntro"; // dSet.Tables.Add(dTEmpDetail); // List parameters = new List(); // ReportParameter parameter = new ReportParameter("BankName", _selectedParameter.Banks[0].Name); // parameters.Add(parameter); // //parameter = new ReportParameter("FilterCriteria", SearchCriteria); // //parameters.Add(parameter); // form.CommonReportView(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.rptLetterOfAccountIntro.rdlc", parameters); //} //private string GetDepartmentOrganogramName(List depts, int DepartmentId) //{ // Department dept = null; // Department Divission = null; // Department Department = null; // Department Unit = null; // Department SubUnit = null; // string DeptOrganogram = string.Empty; // dept = depts.SingleOrDefault(x => x.ID.Integer == DepartmentId); // if (dept != null && dept.Tier == 4) // { // SubUnit = dept; // Unit = depts.SingleOrDefault(x => x.ID.Integer == SubUnit.ParentID.Integer); // Department = depts.SingleOrDefault(x => x.ID.Integer == Unit.ParentID.Integer); // Divission = depts.SingleOrDefault(x => x.ID.Integer == Department.ParentID.Integer); // DeptOrganogram = Divission.Name + ", " + Department.Name + ", " + Unit.Name + ", " + SubUnit.Name; // } // else if (dept != null && dept.Tier == 3) // { // Unit = dept; // Department = depts.SingleOrDefault(x => x.ID.Integer == Unit.ParentID.Integer); // Divission = depts.SingleOrDefault(x => x.ID.Integer == Department.ParentID.Integer); // DeptOrganogram = Divission.Name + ", " + Department.Name + ", " + Unit.Name; // } // else if (dept != null && dept.Tier == 2) // { // Department = dept; // Divission = depts.SingleOrDefault(x => x.ID.Integer == Department.ParentID.Integer); // DeptOrganogram = Divission.Name + ", " + Department.Name; // } // else if (dept != null && dept.Tier == 1) // { // Divission = dept; // DeptOrganogram = Divission.Name; // } // else // { // if (dept != null) // { // DeptOrganogram = dept.Name != null ? dept.Name : ""; // } // } // dept = new Department(); // return DeptOrganogram; //} //public void GetActveEmpDetails() //{ // List depts = Department.Get(); // List oLocations = Location.Get(); // List oSubcategories = SubCategory.Get(); // List oDesignations = Designation.Get(EnumStatus.Active); // fReportViewer form = new fReportViewer(); // string sEmpID = _selectedParameter.ReportItem.INSQL; // DataRow dr = null; // int sl = 0; // double totalAge = 0; // double minAge = 100000; // double maxAge = 0; // SubCategory oSubcategory = null; // Location oLocation = null; // Designation oDesignation = null; // DataSet oEmpDetails = Employee.GetActiveEmpDetailsView(sEmpID); // PayrollDataSet.PayrollDataSet.ActiveEmployeeDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.ActiveEmployeeDataTable(); // foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows) // { // oDesignation = oDesignations == null ? null : oDRow["DESIGNATIONID"].ToString() == "" ? null : oDesignations.Where(x => x.ID.Integer == Convert.ToInt32(oDRow["DESIGNATIONID"].ToString())).FirstOrDefault(); // oLocation = oLocations == null ? null : oDRow["LOCATIONID"].ToString() == "" ? null : oLocations.Where(x => x.ID.Integer == Convert.ToInt32(oDRow["LOCATIONID"].ToString())).FirstOrDefault(); // oSubcategory = oSubcategories == null ? null : oDRow["SUBCATEGORYID"].ToString() == "" ? null : oSubcategories.Where(x => x.ID.Integer == Convert.ToInt32(oDRow["SUBCATEGORYID"].ToString())).FirstOrDefault(); // int deptId = 0; // string DeptName = string.Empty; // if (oDRow["deptId"].ToString() != "") // { // deptId = Convert.ToInt32(oDRow["deptId"].ToString()); // Department dept = null; // dept = depts.SingleOrDefault(x => x.ID.Integer == deptId); // DeptName = dept.Name; // } // dr = dTable.NewRow(); // dr["SL"] = ++sl; // dr["EmployeeID"] = oDRow["EMPLOYEENO"]; // dr["Name"] = oDRow["NAME"]; // dr["JoindDate"] = oDRow["JOININGDATE"].ToString() != "" ? Convert.ToDateTime(oDRow["JOININGDATE"]).ToString("dd MMM yyyy") : ""; // //dr["Employeestatus"] = oDRow["EMPLOYEESTATUS"]; // dr["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"].ToString() != "" ? Convert.ToDateTime(oDRow["DATEOFCONFIRMATION"]).ToString("dd MMM yyyy") : ""; // dr["Designation"] = oDRow["DESIGNATION"]; // dr["DIvision"] = "";// oDRow["EMAILADDRESS"] // dr["Unit"] = "";// oDRow["EMAILADDRESS"] // dr["Plant"] = "";// oDRow["EMAILADDRESS"] // dr["Department"] = DeptName;//GetDepartmentOrganogramName(depts, deptId); //oDRow["DEPARTMENT"]; // dr["Section"] = "";//oDRow["EMAILADDRESS"] // dr["Grade"] = oDRow["GRADE"]; // dr["JobLocation"] = oDRow["JobLocation"]; // dr["WorkLocation"] = oLocation == null ? "" : oLocation.Name;//oDRow["WorkLocation"]; // dr["SalaryLocation"] = oDRow["SALARYLOCATION"]; // dr["Gender"] = oDRow["Gender"]; // dr["Education"] = "";//oDRow["EMAILADDRESS"] // dr["Religion"] = oDRow["RELIGION"]; // dr["MaritalStatus"] = oDRow["MARITALSTATUS"]; // dr["EmpCategory"] = oDRow["CATEGORY"]; // dr["EmpType"] = oSubcategory == null ? "" : oSubcategory.Name; // if (oDesignation != null) // { // string generalDesignation = oDesignation.GeneralDesignation.ToString(); // dr["GeneralDesignation"] = generalDesignation == "None" ? "" : generalDesignation; // } // else // dr["GeneralDesignation"] = "";// oDRow["EMAILADDRESS"] // dr["ActiveStatus"] = "Active"; // DateTime birthdate = oDRow["BIRTHDATE"].ToString() != "" ? Convert.ToDateTime(oDRow["BIRTHDATE"]) : DateTime.MinValue; // if (birthdate != DateTime.MinValue) // { // var tmpDt = DateDifferenceInYearsMonthDays.CompareDates(DateTime.Now, birthdate); // dr["BirthDate"] = birthdate.ToString("dd MMM yyyy"); // dr["Age"] = tmpDt.Years + " years & " + tmpDt.Months + " months"; // } // else // { // dr["BirthDate"] = ""; // dr["Age"] = ""; // } // dr["RetireDate"] = "";//oDRow["EMAILADDRESS"] // DateTime joininigDate = oDRow["JOININGDATE"].ToString() != "" ? Convert.ToDateTime(oDRow["JOININGDATE"]) : DateTime.MinValue; // if (joininigDate != DateTime.MinValue) // { // var Dt = DateDifferenceInYearsMonthDays.CompareDates(DateTime.Now, joininigDate); // dr["ServicePeriod"] = Dt.Years + " years & " + Dt.Months + " months"; // } // else // { // dr["ServicePeriod"] = ""; // } // dTable.Rows.Add(dr); // if (minAge > Convert.ToInt32(oDRow["Age"])) // minAge = Convert.ToInt32(oDRow["Age"]); // if (maxAge < Convert.ToInt32(oDRow["Age"])) // maxAge = Convert.ToInt32(oDRow["Age"]); // totalAge = totalAge + Convert.ToInt32(oDRow["Age"]); // } // DataSet dSet = new DataSet(); // dTable.TableName = "PayrollDataSet_ActiveEmployee"; // dSet.Tables.Add(dTable); // List parameters = new List(); // ReportParameter parameter1 = new ReportParameter("MaximumAge", maxAge.ToString()); // parameters.Add(parameter1); // ReportParameter parameter2 = new ReportParameter("MinimumAge", minAge.ToString()); // parameters.Add(parameter2); // ReportParameter parameter3 = new ReportParameter("TotalEmployee", sl.ToString()); // parameters.Add(parameter3); // ReportParameter parameter4 = new ReportParameter("TotalAge", totalAge.ToString()); // parameters.Add(parameter4); // ReportParameter parameter5 = new ReportParameter("AverageAge", (totalAge / sl).ToString()); // parameters.Add(parameter5); // form.CommonReportViewForActiveEmployee(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.ActiveEmployeeDetail.rdlc", parameters); //} //public void ShowEmployeeCV(HREmployee employee) //{ // if (employee == null) // return; // DataRow oRow = null; // DataRow oRow1 = null; // List _department = new List(); // List _nationality = new List(); // Nationality nationality = new Nationality(); // Department department = new Department(); // _nationality = Nationality.Get(); // _department = Department.Get(); // PhotoPath pPath = PhotoPath.Get().FirstOrDefault(); // department = _department.Where(o => o.ID == employee.DepartmentID).FirstOrDefault(); // nationality = _nationality.Where(o => o.ID == employee.NationalityID).FirstOrDefault(); // String RDLC = "Payroll.Report.RDLC.EmployeeCV.rdlc"; // PayrollDataSet.dsCompany.EmployeeQualificationDataTable dEmpQualification = new Payroll.Report.PayrollDataSet.dsCompany.EmployeeQualificationDataTable(); // PayrollDataSet.dsCompany.EmployeePersonalInfoDataTable dEmpInfo = new Payroll.Report.PayrollDataSet.dsCompany.EmployeePersonalInfoDataTable(); // { // oRow = dEmpInfo.NewRow(); // oRow["EmpName"] = employee.Name; // oRow["EmpCode"] = employee.EmployeeNo; // oRow["FatherName"] = employee.FatherName; // oRow["MotherName"] = employee.MotherName; // oRow["VoterID"] = employee.NationalID; // if (nationality != null) // { // oRow["Nationality"] = nationality.Description; // } // oRow["DateofBirth"] = employee.BirthDate.ToString("dd-MMM-yyyy"); // oRow["Gender"] = employee.Gender; // oRow["MartialStatus"] = employee.MaritalStatus; // oRow["Religion"] = employee.Religion.Name; // //oRow["MobileNo"] = employee.perso; // oRow["Email"] = employee.EmailAddress; // oRow["EmpPhotograph"] = pPath.EmployeePhoto + "\\" + employee.PhotoPath; // if (employee.Contacts.Count > 0) // { // oRow["Telephone1"] = employee.Contacts[0].PersonalTelephone; // oRow["Telephone2"] = employee.Contacts[0].PresentTelephone; // oRow["MobileNo"] = employee.Contacts[0].Mobile; // oRow["FaxNumber"] = employee.Contacts[0].Fax; // oRow["VillagePA"] = employee.Contacts[0].ParmanentAddress; // oRow["PostOfficePA"] = ""; // oRow["ThanaPA"] = employee.Contacts[0].ParmanentThana.Name; // oRow["DistrictPA"] = employee.Contacts[0].ParmanentDistrict.Name; // oRow["VillageTA"] = employee.Contacts[0].PresentAddress; // oRow["PostOfficeTA"] = ""; // oRow["ThanaTA"] = employee.Contacts[0].PresentThana.Name; // oRow["DistrictTA"] = employee.Contacts[0].PresentDistrict.Name; // } // if (department.Tier == 1) // { // oRow["Division"] = department.Name; // oRow["Department"] = ""; // oRow["Section"] = ""; // } // else if (department.Tier == 2) // { // oRow["Division"] = ""; // oRow["Department"] = department.Name; // oRow["Section"] = ""; // } // else if (department.Tier == 3) // { // oRow["Division"] = ""; // oRow["Department"] = ""; // oRow["Section"] = department.Parent.Name; // } // else // { // oRow["Division"] = ""; // oRow["Department"] = department.Name; // oRow["Section"] = ""; // } // oRow["Company"] = employee.Company.Name; // //oRow["Division"] = ""; // //oRow["Department"] = employee.Department.Name; // //oRow["Section"] = ""; // //oRow["EmpPhotograph"] = string.IsNullOrEmpty(oRow["EmpPhotograph"].ToString()) ? oRow["EmpPhotograph"].ToString() : pPath.EmployeePhoto + "\\" + oRow["EmpPhotograph"].ToString(); // oRow["Designation"] = employee.Designation.Name; // oRow["Appointment"] = employee.JoiningDate.ToString("dd-MMM-yyyy"); // oRow["Status"] = employee.Status; // oRow["Grade"] = employee.Grade.Name; // } // dEmpInfo.Rows.Add(oRow); // DataSet dSet = new DataSet(); // dEmpInfo.TableName = "dsCompany_EmployeePersonalInfo"; // dSet.Tables.Add(dEmpInfo); // { // foreach (var empQualification in employee.Academics) // { // oRow1 = dEmpQualification.NewRow(); // oRow1["Qualification"] = empQualification.EducationLevel.Description; // oRow1["CompletionDate"] = empQualification.PassingYear.ToString(); // dEmpQualification.Rows.Add(oRow1); // } // dEmpQualification.TableName = "dsCompany_EmployeeQualification"; // dSet.Tables.Add(dEmpQualification); // } // fReportViewer form = new fReportViewer(); // form.ShowDlg(dSet, RDLC); //} //public void ShowEmployeeNewCV(HREmployee employee) //{ // if (employee == null) // return; // DataRow oRow = null; // DataRow oEduCationalInfoRow = null; // DataRow oRow1 = null; // List _department = new List(); // List _empContact = new List(); // DataSet dt = new DataSet(); // List _nationality = new List(); // Nationality nationality = new Nationality(); // Department department = new Department(); // _nationality = Nationality.Get(); // _department = Department.Get(); // _empContact = HREmployee.GetEmpContacts(employee.ID); // PhotoPath pPath = PhotoPath.Get().FirstOrDefault(); // dt = new HREmployee().GetEducationalInf(employee.ID.Integer); // department = _department.Where(o => o.ID == employee.DepartmentID).FirstOrDefault(); // nationality = _nationality.Where(o => o.ID == employee.NationalityID).FirstOrDefault(); // String RDLC = "Payroll.Report.RDLC.EmployeeCVNew.rdlc"; // PayrollDataSet.dsCompany.EducationalInfoDataTable dtEducationalInfoDataTable = new Payroll.Report.PayrollDataSet.dsCompany.EducationalInfoDataTable(); // foreach (DataRow item in dt.Tables[0].Rows) // { // oEduCationalInfoRow = dtEducationalInfoDataTable.NewRow(); // oEduCationalInfoRow["Subject"] = item["Subject"]; // oEduCationalInfoRow["Board"] = item["Board"]; // oEduCationalInfoRow["Examination"] = item["Examination"]; // oEduCationalInfoRow["INSTITUTENAME"] = item["INSTITUTENAME"]; // oEduCationalInfoRow["PASSINGYEAR"] = item["PASSINGYEAR"]; // oEduCationalInfoRow["GPAORMARKS"] = item["GPAORMARKS"].ToString() == "" ? 0 : Convert.ToDouble(item["GPAORMARKS"]); // oEduCationalInfoRow["OUTOF"] = item["OUTOF"].ToString() == "" ? 0 : Convert.ToDouble(item["OUTOF"]); // dtEducationalInfoDataTable.Rows.Add(oEduCationalInfoRow); // } // PayrollDataSet.dsCompany.EmployeeQualificationDataTable dEmpQualification = new Payroll.Report.PayrollDataSet.dsCompany.EmployeeQualificationDataTable(); // PayrollDataSet.dsCompany.EmployeePersonalInfoDataTable dEmpInfo = new Payroll.Report.PayrollDataSet.dsCompany.EmployeePersonalInfoDataTable(); // { // oRow = dEmpInfo.NewRow(); // #region new add for new report // oRow = dEmpInfo.NewRow(); // if (employee.BirthDate != DateTime.MinValue) // { // var tmpDt = DateDifferenceInYearsMonthDays.CompareDates(DateTime.Now, employee.BirthDate); // oRow["Age"] = tmpDt.Years + " years & " + tmpDt.Months + " months"; // } // oRow["JoiningDate"] = employee.JoiningDate.ToString("dd MMM yyyy"); // if (employee.JoiningDate != DateTime.MinValue) // { // var tmpDt = DateDifferenceInYearsMonthDays.CompareDates(DateTime.Now, employee.JoiningDate); // oRow["ExperienceWithThisCompany"] = tmpDt.Years + " years & " + tmpDt.Months + " months"; // } // oRow["BloodGroup"] = employee.BloodGroup.ToString(); // //oRow["Plant"] = employee.NationalID; // if (_empContact.Count > 0) // { // oRow["EmergencyTel"] = _empContact == null ? "" : _empContact[0].EmergencyTelephone; // oRow["ContactPersonPhone"] = _empContact == null ? "" : _empContact[0].EmergencyMobile; // oRow["PresentAddress"] = _empContact == null ? "" : _empContact[0].PresentAddress; // oRow["ParmanentAddress"] = _empContact == null ? "" : _empContact[0].ParmanentAddress; // } // //oRow["HousingStatus"] = employee.EmployeeNo; // //oRow["LivingStatus"] = employee.FatherName; // oRow["PassportNo"] = employee.PassportNo; // oRow["PassportIssueDate"] = employee.PassportIssueDate.ToString("dd MMM yyyy"); // oRow["PassportIssuePlace"] = employee.PassportIssuePlace; // oRow["PassPortExpiryDate"] = employee.PassportExpDate.ToString("dd MMM yyyy"); // //oRow["LastPromotionBefore"] = employee.FatherName; // //oRow["TotalPreviousExperience"] = employee.MotherName; // //oRow["TotalExperience"] = employee.NationalID; // //oRow["HeathCondition"] = employee; // oRow["Height"] = employee.Height; // oRow["Weight"] = employee.Weight; // #endregion // oRow["EmpName"] = employee.Name; // oRow["EmpCode"] = employee.EmployeeNo; // oRow["FatherName"] = employee.FatherName; // oRow["MotherName"] = employee.MotherName; // oRow["VoterID"] = employee.NationalID; // if (nationality != null) // { // oRow["Nationality"] = nationality.Description; // } // oRow["DateofBirth"] = employee.BirthDate.ToString("dd-MMM-yyyy"); // oRow["Gender"] = employee.Gender; // oRow["MartialStatus"] = employee.MaritalStatus; // oRow["Religion"] = employee.Religion.Name; // //oRow["MobileNo"] = employee.perso; // oRow["Email"] = employee.EmailAddress; // oRow["EmpPhotograph"] = pPath.EmployeePhoto + "\\" + employee.PhotoPath; // if (employee.Contacts.Count > 0) // { // oRow["Telephone1"] = employee.Contacts[0].PersonalTelephone; // oRow["Telephone2"] = employee.Contacts[0].PresentTelephone; // oRow["MobileNo"] = employee.Contacts[0].Mobile; // oRow["FaxNumber"] = employee.Contacts[0].Fax; // oRow["VillagePA"] = employee.Contacts[0].ParmanentAddress; // oRow["PostOfficePA"] = ""; // oRow["ThanaPA"] = employee.Contacts[0].ParmanentThana.Name; // oRow["DistrictPA"] = employee.Contacts[0].ParmanentDistrict.Name; // oRow["VillageTA"] = employee.Contacts[0].PresentAddress; // oRow["PostOfficeTA"] = ""; // oRow["ThanaTA"] = employee.Contacts[0].PresentThana.Name; // oRow["DistrictTA"] = employee.Contacts[0].PresentDistrict.Name; // } // if (department.Tier == 1) // { // oRow["Division"] = department.Name; // oRow["Department"] = ""; // oRow["Section"] = ""; // } // else if (department.Tier == 2) // { // oRow["Division"] = ""; // oRow["Department"] = department.Name; // oRow["Section"] = ""; // } // else if (department.Tier == 3) // { // oRow["Division"] = ""; // oRow["Department"] = ""; // oRow["Section"] = department.Parent.Name; // } // else // { // oRow["Division"] = ""; // oRow["Department"] = department.Name; // oRow["Section"] = ""; // } // oRow["Company"] = employee.Company.Name; // //oRow["Division"] = ""; // //oRow["Department"] = employee.Department.Name; // //oRow["Section"] = ""; // //oRow["EmpPhotograph"] = string.IsNullOrEmpty(oRow["EmpPhotograph"].ToString()) ? oRow["EmpPhotograph"].ToString() : pPath.EmployeePhoto + "\\" + oRow["EmpPhotograph"].ToString(); // oRow["Designation"] = employee.Designation.Name; // oRow["Appointment"] = employee.JoiningDate.ToString("dd-MMM-yyyy"); // oRow["Status"] = employee.Status; // oRow["Grade"] = employee.Grade.Name; // } // dEmpInfo.Rows.Add(oRow); // DataSet dSet = new DataSet(); // dEmpInfo.TableName = "dsCompany_EmployeePersonalInfo"; // dSet.Tables.Add(dEmpInfo); // DataSet dSetSub = new DataSet(); // dtEducationalInfoDataTable.TableName = "dsCompany_EducationalInfo"; // dSetSub.Tables.Add(dtEducationalInfoDataTable); // fReportViewer form = new fReportViewer(); // form.ShowDlgForCV(null, dSet, dSetSub); //} public byte[] GetEmpPostings(string sEmpID,int payrollTypeId, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); DataRow dr = null; int count = 1; Employee oEmployee = new Employee(); DataSet oEmpPostings = new EmployeeService().GetEmpPosting(sEmpID); PayrollDataSet.PayrollDataSet.PostingDetailsDataTable dTEmpPosting = new PayrollDataSet.PayrollDataSet.PostingDetailsDataTable(); foreach (DataRow oDRow in oEmpPostings.Tables[0].Rows) { dr = dTEmpPosting.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["CurrentDesignation"] = oDRow["Designation"]; dr["CurrentDepartment"] = oDRow["Department"]; dr["CurrentLocation"] = oDRow["Location"]; dr["EffectDate"] = oDRow["EFFECTIVEDATE"]; dr["prvDesignation"] = ""; dr["prvDepartment"] = ""; dr["prvLocation"] = ""; dr["CommitedBy"] = oDRow["CommitedBy"]; dr["CommitedOn"] = oDRow["CommitedOn"]; ; dTEmpPosting.Rows.Add(dr); count++; } return reportProcessor.ShowDlgForEmpPosting(dTEmpPosting, payrollTypeId, reportType); } //public DataTable GetEmpPostingsNew(DateTime EffectDate) //{ // fReportViewer form = new fReportViewer(); // EmployeePosting oEmpPosting = null; // List oEmployees = Employee.Get(); // DataRow dr = null; // int count = 1; // string sTempEmpNo = string.Empty; // Employee oEmployee = new Employee(); // DataSet oEmpCurrentPostings = EmployeePosting.GetEmpCurrentPosting(EffectDate); // //DataSet oEmpPrvPostings = Employee.GetEmpPrvPosting(EffectDate); // PayrollDataSet.PayrollDataSet.PostingDetailsDataTable dTEmpPosting = // new Payroll.Report.PayrollDataSet.PayrollDataSet.PostingDetailsDataTable(); // sTempEmpNo = ""; // try // { // foreach (DataRow oDRow in oEmpCurrentPostings.Tables[0].Rows) // { // sTempEmpNo = oDRow["EMPLOYEENO"].ToString(); // dr = dTEmpPosting.NewRow(); // dr["SLNo"] = count; // dr["EmpNo"] = oDRow["EMPLOYEENO"]; // dr["Name"] = oDRow["NAME"]; // dr["CurrentDesignation"] = oDRow["CurrentDeg"]; // dr["CurrentDepartment"] = oDRow["CurrentDept"]; // dr["CurrentLocation"] = oDRow["CurrentLoc"]; // dr["EffectDate"] = oDRow["EffectDate"]; // dr["CommitedBy"] = oDRow["CommitedBy"]; // dr["CommitedOn"] = oDRow["CommitedOn"]; // Employee oEmp = // oEmployees.Find( // delegate (Employee oItem) { return oItem.EmployeeNo == sTempEmpNo; }); // if (oEmp == null) // { // oEmp = Employee.Get(sTempEmpNo); // } // if (oEmp != null) // oEmpPosting = EmployeePosting.Get(oEmp.ID, Convert.ToDateTime(oDRow["EffectDate"])); // if (oEmpPosting != null) // { // dr["prvDesignation"] = oEmpPosting.Designation.Name; // dr["prvDepartment"] = oEmpPosting.Department.Name; // dr["prvLocation"] = oEmpPosting.Location.Name; // } // else // { // dr["prvDesignation"] = String.Empty; // dr["prvDepartment"] = String.Empty; // dr["prvLocation"] = String.Empty; // } // dTEmpPosting.Rows.Add(dr); // count++; // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // } // return dTEmpPosting; //} public DataTable GetEmpHistories(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeId) { EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); UserService userService = new UserService(); EmployeeHistoryService employeeHistoryService = new EmployeeHistoryService(); List _lifeCycles = empLifeCycleService.Get(EnumStatus.Regardless, payrollTypeId); List _finalcialDatas = approveFinantialDataService.Get(); List _users = userService.GetAll(); DataRow dr = null; int count = 1; DataSet oEmpHis = employeeHistoryService.GetEmpHistory(dEffectDate, dEffectDate2, payrollTypeId); oEmpHis.Tables[0].Columns.Add("AuthorizedDate"); //DataSet oEmpPostings = Employee.GetEmpPosting(sEmpID); HRM.Report.PayrollDataSet.PayrollDataSet.EmployeeHistoryDataTable dTEmpHistory = new HRM.Report.PayrollDataSet.PayrollDataSet.EmployeeHistoryDataTable(); foreach (DataRow oDRow in oEmpHis.Tables[0].Rows) { dr = dTEmpHistory.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["Designation"] = oDRow["DESIGNATION"]; //dr["CC"] = oDRow["RC"]; dr["Grade"] = oDRow["Grade"]; dr["DOJ"] = oDRow["JOININGDATE"]; dr["DOS"] = oDRow["ENDOFCONTRACTDATE"]; dr["Comments"] = oDRow["Comments"]; dr["CommitedBy"] = oDRow["CommitedBy"]; dr["CommitedDate"] = oDRow["CreationDate"]; dr["StatusDate"] = dEffectDate; switch ((EnumEmployeeStatus)Convert.ToInt32(oDRow["status"])) { case EnumEmployeeStatus.Discontinued: dr["Reason"] = "Inactive"; break; case EnumEmployeeStatus.Secondy: dr["Reason"] = "Secondy"; break; case EnumEmployeeStatus.Suspend: dr["Reason"] = "Suspend"; break; case EnumEmployeeStatus.Withheld: dr["Reason"] = "Withheld"; break; default: dr["Reason"] = "Unknown"; break; } //if (Payroll.BO.SystemInformation.CurrentSysInfo.Code.Contains("007")) //{ int nlifeCycleID = Convert.ToInt32(oDRow["emplifecycleid"]); int nEmployeeid = Convert.ToInt32(oDRow["Employeeid"]); if (nlifeCycleID > 0) { EmpLifeCycle lifeCycle = _lifeCycles.Find(delegate (EmpLifeCycle oItem) { return oItem.ID == nlifeCycleID; }); if (lifeCycle != null) { ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == nEmployeeid && oItem.ObjectID == lifeCycle.ID && oItem.SalaryMonth.Year == Convert.ToDateTime(oDRow["EffectDate"]).Year && oItem.SalaryMonth.Month == Convert.ToDateTime(oDRow["EffectDate"]).Month && oItem.FinantialDataType == EnumApprovalFinancialData.Lifecycle; }); if (finalcialData != null) { User user = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (user != null) dr["AuthorizeBy"] = user.LoginID; dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; // } dTEmpHistory.Rows.Add(dr); count++; } return dTEmpHistory; } public DataTable GetEmpJoining(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeId) { EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); UserService userService = new UserService(); ReligionService religionService = new ReligionService(); EmployeeService employeeService = new EmployeeService(); List _lifeCycles = empLifeCycleService.Get(EnumStatus.Regardless, payrollTypeId); List _finalcialDatas = approveFinantialDataService.Get(); List _users = userService.GetAll(); List oReligions = religionService.Get(); DataRow dr = null; int count = 1; DataSet oEmpJoining = employeeService.GetEmpJoining(dEffectDate, dEffectDate2); oEmpJoining.Tables[0].Columns.Add("AuthorizedDate"); HRM.Report.PayrollDataSet.PayrollDataSet.EmpJoining4NovartisDataTable dTEmpJoining = new HRM.Report.PayrollDataSet.PayrollDataSet.EmpJoining4NovartisDataTable(); foreach (DataRow oDRow in oEmpJoining.Tables[0].Rows) { dr = dTEmpJoining.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["Designation"] = oDRow["DegName"]; dr["Sex"] = "Male"; if (Convert.ToDouble(oDRow["Gender"]) == 1) { dr["Sex"] = "Male"; } else if (Convert.ToDouble(oDRow["Gender"]) == 2) { dr["Sex"] = "Female"; } dr["JoiningDate"] = Convert.ToDateTime(oDRow["JoiningDate"]).ToString("dd MMM yyyy"); dr["Grade"] = oDRow["Description"]; dr["DOB"] = oDRow["BIRTHDATE"]; dr["Gross"] = oDRow["Grosssalary"]; dr["StatusDate"] = dEffectDate; dr["Basic"] = oDRow["basicsalary"]; Religion reli = oReligions.Find(delegate (Religion oItem) { return oItem.ID == Convert.ToInt32(oDRow["religionid"]); }); dr["MaritalStatus"] = (EnumMaritalStatus)Convert.ToInt32(oDRow["maritalstatusid"]); dr["Religion"] = reli == null ? "" : reli.Name; dr["CommitedOn"] = Convert.ToDateTime(oDRow["creationdate"]).ToString("dd MMM yyyy"); //if (oDRow["createduser"] != null) //{ // int nUserID = Convert.ToInt32(oDRow["createduser"]); // User user = _users.Find(delegate(User oItem) // { // return oItem.ID.Integer == nUserID; // }); // if (user != null) // dr["CommitedBy"] = user.Name; //} //else dr["CommitedBy"] = Convert.ToString(oDRow["createduser"]); /*EmpLifeCycle lifeCycle = _lifeCycles.Find(delegate (EmpLifeCycle oItem) { return oItem.EmployeeID == Convert.ToInt32(oDRow["employeeid"]) && oItem.IsContinue == true; });*/ //dr["AuthorizedDate"] = Convert.ToDateTime(oDRow["APPROVEDDATE"]).ToString("dd MMM yyyy hh:mm:ss tt"); //dr["AuthorizeBy"] = Convert.ToString(oDRow["AuthorizeBy"]); EmpLifeCycle lifeCycle = _lifeCycles.Find(delegate (EmpLifeCycle oItem) { return oItem.EmployeeID == Convert.ToInt32(oDRow["employeeid"]); }); if (lifeCycle != null) { ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == Convert.ToInt32(oDRow["employeeid"]) && oItem.ObjectID == lifeCycle.ID && oItem.SalaryMonth.Year == lifeCycle.EffectDate.Year && oItem.SalaryMonth.Month == lifeCycle.EffectDate.Month && oItem.FinantialDataType == EnumApprovalFinancialData.Lifecycle; }); if (finalcialData != null) { User user = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (user != null) dr["AuthorizeBy"] = user.LoginID; dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; //int nlifeCycleID = Convert.ToInt32(oDRow["emplifecycleid"]); //int nEmployeeid = Convert.ToInt32(oDRow["employeeid"]); //if (nlifeCycleID > 0) //{ // EmpLifeCycle lifeCycle = _lifeCycles.Find(delegate(EmpLifeCycle oItem) // { // return oItem.ID.Integer == nlifeCycleID; // }); // if (lifeCycle != null) // { // ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate(ApproveFinantialData oItem) // { // return oItem.EmployeeID.Integer == nEmployeeid && // oItem.ObjectID == lifeCycle.ID.Integer && // oItem.SalaryMonth == Convert.ToDateTime(oDRow["EffectDate"]) && // oItem.FinanatialDataType == EnumApprovalFinancialData.Lifecycle; // }); // if (finalcialData != null) // { // User user = _users.Find(delegate(User oItem) // { // return oItem.ID.Integer == finalcialData.Approvedby; // }); // if (user != null) // dr["AuthorizeBy"] = user.Name; // } // else // dr["AuthorizeBy"] = ""; // } // else // dr["AuthorizeBy"] = ""; //} //else // dr["AuthorizeBy"] = ""; dTEmpJoining.Rows.Add(dr); count++; } return dTEmpJoining; } //public DataTable GetEmpJoining4Novartis(DateTime dEffectDate) //{ // //DataTable dt = new DataTable(); // DataRow dr = null; // string sTempEmpNo = string.Empty; // int count = 1; // DataSet oEmpJoining = Employee.GetEmpJoining4Novartis(dEffectDate); // //PayrollDataSet.PayrollDataSet.EmployeeJoiningDataTable dTEmpJoining = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeJoiningDataTable(); // PayrollDataSet.PayrollDataSet.EmpJoining4NovartisDataTable dTEmpJoining = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpJoining4NovartisDataTable(); // foreach (DataRow oDRow in oEmpJoining.Tables[0].Rows) // { // if (sTempEmpNo == string.Empty || sTempEmpNo != oDRow["EMPLOYEENO"].ToString()) // { // sTempEmpNo = oDRow["EMPLOYEENO"].ToString(); // dr = dTEmpJoining.NewRow(); // dr["SlNo"] = count; // dr["EmpNo"] = oDRow["EMPLOYEENO"]; // dr["Name"] = oDRow["NAME"]; // dr["Designation"] = oDRow["Designation"]; // //dr["CC"] = oDRow["RC"]; // dr["DOJ"] = oDRow["DOJ"]; // dr["Grade"] = oDRow["Grade"]; // dr["Basic"] = oDRow["Basic"]; // dr["DOB"] = oDRow["DOB"]; // if (Convert.ToDouble(oDRow["Sex"]) == 1) // { // dr["Sex"] = "Male"; // } // else if (Convert.ToDouble(oDRow["Sex"]) == 2) // { // dr["Sex"] = "Female"; // } // if (Convert.ToInt32(oDRow["MaritalStatusID"]) == 0) // { // dr["MaritalStatus"] = "None"; // } // else if (Convert.ToInt32(oDRow["MaritalStatusID"]) == 1) // { // dr["MaritalStatus"] = "Married"; // } // else if (Convert.ToInt32(oDRow["MaritalStatusID"]) == 2) // { // dr["MaritalStatus"] = "UnMarried"; // } // dr["Religion"] = oDRow["Religion"]; // dr["CommitedBy"] = oDRow["CommitedBy"]; // dr["CommitedOn"] = oDRow["CommitedOn"]; // dr["StatusDate"] = dEffectDate; // dTEmpJoining.Rows.Add(dr); // count++; // } // else if (sTempEmpNo == oDRow["EMPLOYEENO"].ToString()) // { // dr["CC"] += "," + oDRow["RC"]; // } // #region // // //dr = dTEmpJoining.NewRow(); // //dr["SlNo"] = count; // //dr["EmpNo"] = oDRow["EMPLOYEENO"]; // //dr["Name"] = oDRow["NAME"]; // //dr["Designation"] = oDRow["Designation"]; // //dr["CC"] = oDRow["RC"] ; // //if (dr["EmpNo"].ToString().Equals(oDRow["EMPLOYEENO"].ToString())) // //{ // // dr["CC"] += oDRow["RC"] + " "; // //} // //dr["DOJ"] = oDRow["DOJ"]; // //dr["Grade"] = oDRow["Grade"]; // //dr["Basic"] = oDRow["Basic"]; // //dr["DOB"] = oDRow["DOB"]; // //if (Convert.ToDouble(oDRow["Sex"]) == 1) // //{ // // dr["Sex"] = "Male"; // //} // //else if (Convert.ToDouble(oDRow["Sex"]) == 2) // //{ // // dr["Sex"] = "Female"; // //} // //if (Convert.ToInt32(oDRow["MaritalStatusID"]) == 0) // //{ // // dr["MaritalStatus"] = "None"; // //} // //else if (Convert.ToInt32(oDRow["MaritalStatusID"]) == 1) // //{ // // dr["MaritalStatus"] = "Married"; // //} // //else if (Convert.ToInt32(oDRow["MaritalStatusID"]) == 2) // //{ // // dr["MaritalStatus"] = "UnMarried"; // //} // //dr["Religion"] = oDRow["Religion"]; // //dr["CommitedBy"] = oDRow["CommitedBy"]; // //dr["CommitedOn"] = oDRow["CommitedOn"]; // //dr["StatusDate"] = dEffectDate; // //dTEmpJoining.Rows.Add(dr); // //count++; // #endregion // } // return dTEmpJoining; //} public DataTable GetEmpPromotion(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeId) { EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); UserService userService = new UserService(); EmployeeGradeSalaryService employeeGradeSalaryService = new EmployeeGradeSalaryService(); EmployeeService employeeService = new EmployeeService(); EmployeeGradeSalary oEmpGradeSalary = null; DataRow dr = null; int count = 1; DataSet oEmpBasicGrade = employeeGradeSalaryService.GetEmpPromotion(dEffectDate, dEffectDate2, payrollTypeId); // oEmpBasicGrade.Tables[0].Columns.Add("AuthorizedDate"); //DataSet oEmpPrvBasicGrade = EmployeeGradeSalary.GetEmpPrvBasicGrade(dEffectDate); PayrollDataSet.PayrollDataSet.EmpGradeBasicDataTable dTEmpGBasic = new PayrollDataSet.PayrollDataSet.EmpGradeBasicDataTable(); if (oEmpBasicGrade != null && 0 < oEmpBasicGrade.Tables[0].Rows.Count) { DataTable odesChange = oEmpBasicGrade.Tables[0].AsEnumerable().Where(myRow => Convert.ToDateTime(myRow["EffectDate"].ToString()) >= dEffectDate && Convert.ToDateTime(myRow["EffectDate"].ToString()) <= dEffectDate2).CopyToDataTable(); foreach (DataRow oDRow in odesChange.Rows) { dr = dTEmpGBasic.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["EffectDate"] = oDRow["EFFECTDATE"]; //dr["EnteryDate"] = oDRow["ENTRYDATE"]; dr["PresentGrade"] = oDRow["PresentGrade"]; dr["PresentBasic"] = oDRow["PresentBasic"]; dr["CommitedBy"] = oDRow["CommitedBy"]; dr["CommitedDate"] = oDRow["CreatedDate"]; dr["ChangeType"] = oDRow["ChangeType"]; dr["StatusDate"] = dEffectDate; //dr["ChangedBy"] = ""; DataRow prev = oEmpBasicGrade.Tables[0].AsEnumerable().Where(myRow => myRow["EmployeeID"].ToString() == oDRow["EmployeeID"].ToString()).Skip(1).FirstOrDefault(); if (prev != null) { dr["PreviousGrade"] = prev["PresentGrade"]; dr["PreviousBasic"] = prev["PresentBasic"]; } dr["AuthorizedDate"] = oDRow["APPROVEDDATE"].ToString() != string.Empty ? Convert.ToDateTime(oDRow["APPROVEDDATE"]).ToString("dd MMM yyyy hh:mm:ss tt") : ""; dr["AuthorizeBy"] = Convert.ToString(oDRow["AuthorizeBy"]); dTEmpGBasic.Rows.Add(dr); count++; } } return dTEmpGBasic; } public DataTable GetEmpBasicGrade(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeId) { EmpLifeCycleService empLifeCycleService = new EmpLifeCycleService(); ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); UserService userService = new UserService(); EmployeeGradeSalaryService employeeGradeSalaryService = new EmployeeGradeSalaryService(); EmployeeService employeeService = new EmployeeService(); List _lifeCycles = empLifeCycleService.Get(EnumStatus.Regardless, payrollTypeId); List _finalcialDatas = approveFinantialDataService.Get(); List _users = userService.Get(EnumSystemType.Self_Service); EmployeeGradeSalary oEmpGradeSalary = null; DataRow dr = null; int count = 1; List oEmployees = employeeService.Get(); DataSet oEmpBasicGrade = employeeGradeSalaryService.GetEmpBasicGrade(dEffectDate, dEffectDate2, payrollTypeId); oEmpBasicGrade.Tables[0].Columns.Add("AuthorizedDate"); //DataSet oEmpPrvBasicGrade = EmployeeGradeSalary.GetEmpPrvBasicGrade(dEffectDate); PayrollDataSet.PayrollDataSet.EmpGradeBasicDataTable dTEmpGBasic = new PayrollDataSet.PayrollDataSet.EmpGradeBasicDataTable(); foreach (DataRow oDRow in oEmpBasicGrade.Tables[0].Rows) { dr = dTEmpGBasic.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["EffectDate"] = oDRow["EFFECTDATE"]; //dr["EnteryDate"] = oDRow["ENTRYDATE"]; dr["PresentGrade"] = oDRow["PresentGrade"]; dr["PresentBasic"] = oDRow["PresentBasic"]; dr["CommitedBy"] = oDRow["CommitedBy"]; dr["CommitedDate"] = oDRow["CreatedDate"]; dr["ChangeType"] = oDRow["ChangeType"]; dr["StatusDate"] = dEffectDate; Employee oEmp = oEmployees.Find(delegate (Employee oItem) { return oItem.EmployeeNo == Convert.ToString(oDRow["EMPLOYEENO"]); }); if (oEmp == null) oEmp = employeeService.Get(Convert.ToString(oDRow["EMPLOYEENO"]), payrollTypeId); if (oEmp != null) { oEmpGradeSalary = employeeGradeSalaryService.Get(oEmp.ID, Convert.ToDateTime(oDRow["EffectDate"]), payrollTypeId); if (oEmpGradeSalary != null) { dr["PreviousGrade"] = oEmpGradeSalary.Grade.Name; dr["PreviousBasic"] = oEmpGradeSalary.BasicSalary; } } dr["ChangedBy"] = ""; int nGradeSalaryID = Convert.ToInt32(oDRow["EMPGRADESALARYID"]); if (nGradeSalaryID > 0) { //EmpLifeCycle lifeCycle = null; //foreach (EmpLifeCycle it in _lifeCycles) //{ // if (it.GradeSalaryAssesmentID != null && it.GradeSalaryAssesmentID.IsUnassigned==false) // { // try // { // if (it.EmployeeID == oEmp.ID && // it.GradeSalaryAssesmentID.Integer == nGradeSalaryID && // it.EffectDate == Convert.ToDateTime(oDRow["EffectDate"])) // { // lifeCycle = it; // } // } // catch // { // } // } //} EmpLifeCycle lifeCycle = _lifeCycles.FirstOrDefault(delegate (EmpLifeCycle oItem) { return oItem.EmployeeID == oEmp.ID && oItem.GradeSalaryAssesmentID > 0 && oItem.GradeSalaryAssesmentID == nGradeSalaryID && oItem.SalaryMonth.Year == Convert.ToDateTime(oDRow["EffectDate"]).Year && oItem.SalaryMonth.Month == Convert.ToDateTime(oDRow["EffectDate"]).Month; }); if (lifeCycle != null) { ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == oEmp.ID && oItem.ObjectID == lifeCycle.ID && oItem.SalaryMonth.Year == Convert.ToDateTime(oDRow["EffectDate"]).Year && oItem.SalaryMonth.Month == Convert.ToDateTime(oDRow["EffectDate"]).Month && oItem.FinantialDataType == EnumApprovalFinancialData.Lifecycle; }); if (finalcialData != null) { User user = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (user != null) dr["AuthorizeBy"] = user.LoginID; dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; dTEmpGBasic.Rows.Add(dr); count++; } return dTEmpGBasic; } public DataTable GetEmpAllowDeduct(DateTime dEffectDate, DateTime dEffectDate2, int AllowDeductID, String AllowDeduct, int payrollTypeId) { ApproveFinantialDataService approveFinantialDataService = new ApproveFinantialDataService(); UserService userService = new UserService(); AllowanceDeductionService allowanceDeductionService = new AllowanceDeductionService(); List _finalcialDatas = approveFinantialDataService.Get(); List _users = userService.GetAll(); DataRow dr = null; int count = 1; DataSet oEmpAllowDeduct = allowanceDeductionService.GetEmpAllowDeduc2(dEffectDate, dEffectDate2, AllowDeductID, payrollTypeId); oEmpAllowDeduct.Tables[0].Columns.Add("AuthorizedDate"); PayrollDataSet.PayrollDataSet.EmpAllowDeductDataTable dTEmpGBasic = new PayrollDataSet.PayrollDataSet.EmpAllowDeductDataTable(); foreach (DataRow oDRow in oEmpAllowDeduct.Tables[0].Rows) { dr = dTEmpGBasic.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oDRow["EMPLOYEENO"]; dr["Name"] = oDRow["NAME"]; dr["Grade"] = oDRow["Grade"]; //dr["RC"] = oDRow["RC"]; dr["Designation"] = oDRow["Designation"]; //dr["EntryDate"] = oDRow["ENTRYDATE"]; dr["Amount"] = oDRow["AMOUNT"]; dr["AllowDeduct"] = AllowDeduct; dr["StatusDate"] = dEffectDate; //dr["UserName"] = oDRow["USERNAME"]; User user = _users.Find(delegate (User oItem) { return oItem.ID == Convert.ToInt32(oDRow["modifiedBy"]); }); if (user != null) dr["CommitedBy"] = user.LoginID; dr["CommitedOn"] = Convert.ToDateTime(oDRow["modifiedDate"]).ToString("dd MMM yyyy"); int nAdparameterEmpid = Convert.ToInt32(oDRow["adparameterempid"]); int nEmployeeid = Convert.ToInt32(oDRow["employeeid"]); EnumApprovalFinancialData enmType = AllowDeduct.ToLower().Contains("deduction") ? EnumApprovalFinancialData.Deduction : EnumApprovalFinancialData.Allowance; if (nAdparameterEmpid > 0) { ApproveFinantialData finalcialData = _finalcialDatas.FirstOrDefault(x => x.EmployeeID == nEmployeeid && x.ObjectID == nAdparameterEmpid && x.FinantialDataType == enmType); /* ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate (ApproveFinantialData oItem) { return oItem.EmployeeID == nEmployeeid && oItem.ObjectID == nAdparameterEmpid && oItem.FinantialDataType == enmType; });*/ if (finalcialData != null) { User usr = _users.Find(delegate (User oItem) { return oItem.ID == finalcialData.Approvedby; }); if (usr != null) dr["AuthorizeBy"] = usr.LoginID; dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt"); } else dr["AuthorizeBy"] = ""; } else dr["AuthorizeBy"] = ""; dTEmpGBasic.Rows.Add(dr); count++; } return dTEmpGBasic; } public byte[] GetCostAllocationDetails(DateTime effectMonth, string sEmpID, int payrollTypeID, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); int count = 1; DataRow oDR = null; DataSet oEmpCC1 = new EmployeeCostCenterService().GetEmpCC(GlobalFunctions.LastDateOfMonth(effectMonth), sEmpID); PayrollDataSet.PayrollDataSet.CCWReportDataTable CCWReportDT = new PayrollDataSet.PayrollDataSet.CCWReportDataTable(); foreach (DataRow oRow in oEmpCC1.Tables[1].Rows) { oDR = CCWReportDT.NewRow(); oDR["SLNo"] = count; oDR["CostCenterID"] = Convert.ToInt32(oRow["CostCenterID"]); oDR["Percentage"] = Convert.ToInt32(oRow["Percentage"]); DataRow[] oEmpCC = oEmpCC1.Tables["Employee"].Select("EmployeeID='" + oRow["EmployeeID"].ToString() + "'"); //if (oEmpCC.Length > 1) //{ foreach (DataRow oRow1 in oEmpCC) { if (Convert.ToInt32(oRow["CurrentCC"]) == 1) { oDR["EmpNo"] = oRow1["EMPLOYEENO"]; oDR["Name"] = oRow1["NAME"]; } } CCWReportDT.Rows.Add(oDR); count++; } foreach (DataRow oRow in CCWReportDT.Rows) { if (oRow["CostCenterID"].ToString().Length > 0) { DataRow[] oEmpCC = oEmpCC1.Tables["CRG"].Select("CRGID='" + oRow["CostCenterID"] + "'"); if (oEmpCC.Length > 0) { oRow["CostCenter"] = oEmpCC[0]["Description"]; } else { oRow["CostCenter"] = "Not assigned"; } } } return reportProcessor.ShowDlgForCCWReport(sEmpID,CCWReportDT, payrollTypeID, reportType); } public byte[] ShowCCInformation(DateTime fromDate,string sEmpID, int payrollTypeID, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); DateTime dToDate = fromDate; //string[] sEmps = sEmpID.Split(','); List employees = new EmployeeService().GetByEmpIDs(sEmpID); PayrollDataSet.PayrollDataSet.CCDetailReportDataTable CCReportDT = new PayrollDataSet.PayrollDataSet.CCDetailReportDataTable(); DataRow oDR = null; int count = 1; List costCenters = new EmployeeCostCenterService().Get(); List crgs = new CostcenterService().Get(); List alleployees = new EmployeeService().Get(); // get the object collection of previous month coscenter information ( SalaryEmpCostcenter) foreach (Employee emp in employees) { if (emp == null) continue; oDR = CCReportDT.NewRow(); oDR["SLNo"] = count; oDR["EmpNo"] = emp.EmployeeNo; oDR["Name"] = emp.Name; //loop the salaryempcostcenter and fill the previous costcenter column foreach (EmployeeCostCenter item in costCenters) { if (item.EmployeeID == emp.ID) { oDR["CurCC"] = oDR["CurCC"].ToString() + " " + crgs.Where(x=>x.ID== item.CostCenterID).FirstOrDefault().Name + "(" + item.Percentage.ToString() + ")"; } } oDR["Month"] = dToDate; CCReportDT.Rows.Add(oDR); count++; } return reportProcessor.ShowDlgForCCDetailWReport(sEmpID, CCReportDT, payrollTypeID, reportType); } public byte[] GetUpCommingEmpConfirmationForRekit(string reportType, DateTime fromDate, int dayCount, int payrollTypeID ) { ReportProcessor reportProcessor = new ReportProcessor(); DataRow dr = null; //double dateDiff = 0.0; TimeSpan dDate; int nDay = 0; Int32 count = 1; List _employees = new List(); _employees =new EmployeeService().Get(); List grades = new GradeService().Get(EnumStatus.Regardless, payrollTypeID); List designations = new DesignationService().GetAll(); PayrollDataSet.PayrollDataSet.UpCommingEmpDataTable dTUpCommingEmp = new PayrollDataSet.PayrollDataSet.UpCommingEmpDataTable(); foreach (Employee oEmp in _employees) { dDate = fromDate - oEmp.JoiningDate; nDay = dDate.Days; //dateDiff = GlobalFunctions.Round(GlobalFunctions.GetFraction(oEmp.JoiningDate, dEffectDate)); if (nDay > dayCount && oEmp.IsConfirmed == false && oEmp.Status != EnumEmployeeStatus.Discontinued) { dr = dTUpCommingEmp.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = oEmp.EmployeeNo; dr["Name"] = oEmp.Name; dr["JDate"] = oEmp.JoiningDate; dr["Month"] = Convert.ToInt32(nDay / 30); dr["PMonth"] = fromDate; Grade employeeGrade = grades.FirstOrDefault(x => x.ID == oEmp.GradeID); dr["Grade"] = employeeGrade != null ? employeeGrade.Name : String.Empty; Designation employeeDesignation = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID); dr["Designation"] = employeeDesignation != null ? employeeDesignation.Name : String.Empty; dTUpCommingEmp.Rows.Add(dr); count++; } } return reportProcessor.ShowDlgForUpCommingEmpForRekit(reportType, dTUpCommingEmp, payrollTypeID); } public byte[] CollectDataForBanglaAppointment(HREmployee employee, string report, bool isPhotoNeeded = false) { int payrolltypeid = 1; DataRow oRow = null; PayrollDataSet.dsCompany.EmployeeAppointmentInfoDataTable dEmpInfo = new HRM.Report.PayrollDataSet.dsCompany.EmployeeAppointmentInfoDataTable(); string sempId = Convert.ToString(employee.ID); //PhotoPath pPath = PhotoPath.Get().FirstOrDefault(); DataTable dtEmpBasicInfo = dtEmpBasicInfo = new DataTable(); DataTable dtEmpSalarayIncrementInfo = new DataTable(); dtEmpBasicInfo = new EmployeeService().GetAllEmpBasicInfo(sempId) .Tables[0] .AsEnumerable() .CopyToDataTable(); dtEmpSalarayIncrementInfo = new EmployeeService().GetEmployeeIncrement(sempId) .Tables[0] .AsEnumerable() .CopyToDataTable(); foreach (DataRow drBasic in dtEmpBasicInfo.Rows) { oRow = dEmpInfo.NewRow(); oRow["EmpName"] = drBasic["BanglaName"]; oRow["EmpCode"] = drBasic["EmployeeNo"]; oRow["FatherName"] = drBasic["FATHERNAMEBANGLA"]; oRow["MotherName"] = drBasic["MOTHERNAMEBANGLA"]; oRow["HusbandName"] = string.Empty; oRow["JoiningDate"] = Convert.ToDateTime(drBasic["JoiningDate"].ToString()).ToString("dd'/'MM'/'yyyy"); oRow["ProbationEndDate"] = Convert.ToDateTime(drBasic["JoiningDate"].ToString()).AddDays(90).ToString("dd'/'MM'/'yyyy"); oRow["BirthDate"] = Convert.ToDateTime(drBasic["BIRTHDATE"]).ToString("dd'/'MM'/'yyyy"); oRow["BloodGroup"] = GlobalFunctions.BloodGroupToBangla(((EnumBloodGroup)Convert.ToInt32(drBasic["BLOODGROUP"].ToString()))); //if (isPhotoNeeded && _rImageManager != null) //{ // oRow["EmpPhotograph"] = _rImageManager.GetImage(drBasic["PhotoPath"].ToString()); //} oRow["VillagePA"] = drBasic["PERMANENTADDRESSINBANGLA"]; oRow["PostOfficePA"] = drBasic["ParmanentPOInBangla"]; oRow["ThanaPA"] = drBasic["ParmanentThanaBangla"]; oRow["DistrictPA"] = drBasic["ParmanentDistricBANGLA"]; oRow["VillageTA"] = drBasic["PRESENTADDRESSINBANGLA"]; oRow["PostOfficeTA"] = drBasic["PresentPOInBangla"]; oRow["ThanaTA"] = drBasic["TempThanaBangla"]; oRow["DistrictTA"] = drBasic["TempDistricBANGLA"]; oRow["Department"] = drBasic["DepartmentBangla"]; oRow["Section"] = drBasic["SectionBangla"]; oRow["Floor"] = drBasic["FloorBangla"]; oRow["EducationLevel"] = drBasic["EducationLevel"]; oRow["Designation"] = drBasic["BanglaDesignation"]; oRow["GCode"] = drBasic["GCode"]; oRow["NationalID"] = drBasic["NationalID"]; oRow["Basic"] = employee.BasicSalary; //EmployeeGradeSalary oEmployeeGradeSalary = new EmployeeGradeSalaryService().Get(employee.ID, , payrolltypeid); List adParams = null; List adParamEmps = null; adParams = new ADParameterService().Get(employee.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance, payrolltypeid); foreach (ADParameter item in adParams) { item.AllowanceDeduction = new AllowanceDeductionService().Get(item.AllowDeductID); } if (adParams != null) { foreach (ADParameter adParam in adParams) { double amount = new ADParameterService().GetGradeDefinedAmountLikeDesktop(employee, employee.BasicSalary, employee.GrossSalary,adParam); switch (adParam.AllowanceDeduction.Code.Trim()) { case "001": oRow["AttendenceBonus"] = amount; break; case "002": oRow["ConductBonus"] = amount; break; case "008": oRow["HouseRent"] = amount; break; case "010": oRow["Conveyence"] = amount; break; case "011": oRow["Medical"] = amount; break; case "006": oRow["Food"] = amount; break; default: break; } } } //foreach (DataRow drIncrement in dtEmpSalarayIncrementInfo.Rows) //{ // if (flag == 0) // { // tempBasic = Convert.ToDouble(drIncrement["Amount"]); // flag++; // } // else // { // tempBasic += Convert.ToDouble(drIncrement["Amount"]); // } // oRow["Basic"] = tempBasic; // if (adParams != null) // { // foreach (ADParameter adParam in adParams) // { // double amount = adParam.GetGradeDefinedAmount(employee, tempBasic, employee.GrossSalary); // //double amount = adParam.GetGradeDefinedAmount(employee, employee.BasicSalary, employee.GrossSalary); // switch (adParam.AllowanceDeduction.Code.Trim()) // { // case "001": // oRow["AttendenceBonus"] = amount; // break; // case "002": // oRow["ConductBonus"] = amount; // break; // case "008": // oRow["HouseRent"] = amount; // break; // case "010": // oRow["Conveyence"] = amount; // break; // case "011": // oRow["Medical"] = amount; // break; // case "006": // oRow["Food"] = amount; // break; // default: // break; // } // } // } //} //flag = 0; adParamEmps = new ADParameterEmployeeService().GetByEmployee(employee.ID, EnumAllowOrDeduct.Allowance, EnumADEmpType.AppliedToIndividual); if (adParamEmps != null) { foreach (ADParameterEmployee adEmp in adParamEmps) { switch (adEmp.AllowDeduct.Code.Trim()) { case "001": oRow["AttendenceBonus"] = adEmp.MonthlyAmount; break; case "002": oRow["ConductBonus"] = adEmp.MonthlyAmount; break; case "008": oRow["HouseRent"] = adEmp.MonthlyAmount; break; case "010": oRow["Conveyence"] = adEmp.MonthlyAmount; break; case "011": oRow["Medical"] = adEmp.MonthlyAmount; break; case "006": oRow["Food"] = adEmp.MonthlyAmount; break; default: break; } } } if (employee.PFMemberType != EnumPFMembershipType.NotYetLive) { double epf = 0, cpf = 0; double pfPercent = (new SystemInformation().CurrentSysInfo.pFContriCompany / 100); epf = cpf = employee.BasicSalary * pfPercent; List oPfExceptions = new PFExceptionService().Get(); PFException oEmpPFException = oPfExceptions.FirstOrDefault(x => x.EmployeeID == employee.ID); if (oEmpPFException != null) // && oEmpPFException.StartDate <= salary.SalaryMonth) { epf = oEmpPFException.EPFPercent == 0 ? oEmpPFException.EPFAmount : GlobalFunctions.Round(employee.BasicSalary * (oEmpPFException.EPFPercent / 100)); cpf = oEmpPFException.EPFPercent == 0 ? oEmpPFException.CPFAmount : GlobalFunctions.Round(employee.BasicSalary * (oEmpPFException.CPFPercent / 100)); } oRow["EPF"] = epf; oRow["CPF"] = cpf; } dEmpInfo.Rows.Add(oRow); } //return dEmpInfo; string RDLC; dEmpInfo.TableName = "dsCompany_EmployeeAppointmentInfo"; DataSet dSet = new DataSet(); //string RDLCName = "HRM.Report.RDLC.LeaveApplication.rdlc"; if(report == "for Staff") { RDLC = "HRM.Report.RDLC.ApointmentLetterForStuff.rdlc"; } else { RDLC = "HRM.Report.RDLC.ApointmentLetterForWorker.rdlc"; } dSet.Tables.Add(dEmpInfo); return new ReportProcessor().CommonReportView(null, RDLC, dSet, null, null, true, payrolltypeid, "PDF"); } public byte[] EmployeeWiseCardInfo(int payrollTypeId, string sEmpID, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); DataSet dsCardInfo =new CardOperationService().GetEmployeeWiseCardOperations(sEmpID); if (dsCardInfo.Tables.Count > 0) dsCardInfo.Tables[0].TableName = "dsCardInformation_EmployeeWiseCardInfo"; return new ReportProcessor().CommonReportView(null, "HRM.Report.RDLC.CardInfo.rdlc", dsCardInfo, null, null, true, payrollTypeId, reportType); } } }