CEL_Payroll/Payroll.Report/Class/rptEmployee.cs

2903 lines
128 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Payroll.BO;
using Ease.CoreV35;
using Ease.CoreV35.Model;
using Ease.CoreV35.Utility;
using Microsoft.Reporting.WinForms;
using System.Reflection;
namespace Payroll.Report
{
public class rptEmployee
{
private ReportSetup _selectedParameter;
private DateTime _SalaryMonth;
string tempEmpID = string.Empty;
ObjectsTemplate<Department> _departments = null;
ObjectsTemplate<HREmployee> _hrEmployees = null;
int count = 1;
public ReportSetup SelectedParameter
{
set
{
_selectedParameter = value;
}
}
public rptEmployee()
{
_departments = new ObjectsTemplate<Department>();
_hrEmployees = new ObjectsTemplate<HREmployee>();
_departments = Department.Get();
_hrEmployees = HREmployee.Get();
}
public void GetEmpBasicInfo()
{
fReportViewer form = new fReportViewer();
string sEmpID = _selectedParameter.ReportItem.INSQL;
DataRow dr = null;
Employee oEmployee = new Employee();
DataSet oEmpsInfo = Employee.GetEmpBasicInfo(sEmpID);
PayrollDataSet.PayrollDataSet.EmployeeInfoDataTable dTEmpInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeInfoDataTable();
DataTable dtDFSL = Employee.GetDFSL();
foreach (DataRow oDRow in oEmpsInfo.Tables[0].Rows)
{
string[] sDes = GlobalFunctions.GetDFSL(dtDFSL, oDRow["DepartmentID"].ToString());
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";
}
if (sDes.Length == 5)
{
dr["Division"] = sDes[0];
dr["Department"] = sDes[1];
dr["Floor"] = sDes[2];
dr["Section"] = sDes[3];
dr["Line"] = sDes[4];
}
else if (sDes.Length == 4)
{
dr["Division"] = sDes[0];
dr["Department"] = sDes[1];
dr["Floor"] = sDes[2];
dr["Section"] = sDes[3];
}
else if (sDes.Length == 3)
{
dr["Division"] = sDes[0];
dr["Department"] = sDes[1];
dr["Floor"] = sDes[2];
}
else if (sDes.Length == 2)
{
dr["Division"] = sDes[0];
dr["Department"] = sDes[1];
}
else if (sDes.Length == 1)
{
dr["Division"] = sDes[0];
}
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);
}
form.ShowDlgForEmpBasic(_selectedParameter.ReportItem, 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<Employee> 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<ReportParameter> parameters = new List<ReportParameter>();
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);
}
public DataSet GetEmpDetails2(string sEmpIDs)
{
//fReportViewer form = new fReportViewer();
string sEmpID = sEmpIDs;
DataRow dr = null;
List<Employee> oEmps = Employee.GetByEmpIDs(sEmpID);
ObjectsTemplate<Department> oDepartments = Department.Get();
Employee oEmployee = null;
DataSet oEmpDetails = Employee.GetEmpDetails(sEmpID);
DataTable dtDFSL = Employee.GetDFSL();
PayrollDataSet.PayrollDataSet.EmployeeDetailExcelDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeDetailExcelDataTable();
bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic);
int count = 1;
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
oEmployee = oEmps.Where(o => o.EmployeeNo.ToUpper().Trim() == oDRow["EMPLOYEENO"].ToString().ToUpper().Trim())
.SingleOrDefault();
dr = dTEmpDetail.NewRow();
dr["SL"] = count;
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["Name"] = oDRow["NAME"];
dr["TINNO"] = oDRow["TINNO"];
if (isDesigFromEmp && oEmployee != null)
dr["Designation"] = oEmployee.DescriptionText;
else
dr["Designation"] = oDRow["DegName"];
Department dep = oDepartments.Find(x => x.ID.Integer == Convert.ToInt16(oDRow["DepartmentID"].ToString()));
string[] sDes = GlobalFunctions.FindDivisionDeparmentUnit(dep, oDepartments);
dr["Division"] = sDes[0];
dr["Department"] = sDes[1];
dr["Section"] = sDes[2];
dr["SubSection"] = sDes[3];
dr["Unit"] = sDes[4];
dr["SubUnit"] = sDes[5];
dr["RCCode"] = GlobalFunctions.FindRCCode2(dep, oDepartments);
dr["Grade"] = oDRow["GDDes"];
dr["BasicSalary"] = oDRow["BASICSALARY"];
dr["DOB"] = oDRow["BIRTHDATE"];
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"] = "Both";
}
dr["Religion"] = oDRow["RegName"];
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"];
dr["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"];
// dr["TaxAmount"] = oDRow["TAXAMOUNT"];
dr["LocDes"] = oDRow["LocDes"];
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"] = "UnMarried";
}
dr["MobileNo"] = oDRow["MOBILENO"];
// dr["MailAdd"] = oDRow["EMAILADDRESS"];
//dr["RFID"] = oDRow["CardNo"];
dr["Nationality"] = oDRow["Nationality"];
dr["FathersName"] = oDRow["FATHERNAME"];
dr["MothersName"] = oDRow["MOTHERNAME"];
#region Unused Code
//string sEducationLevel = string.Empty;
//HREmployee ohrEmp = _hrEmployees.Find(delegate(HREmployee hEmp) { return hEmp.EmployeeNo == oEmployee.EmployeeNo; });
//if (ohrEmp != null)
//{
// foreach (EmpAcademic eAcademic in ohrEmp.Academics)
// {
// if (sEducationLevel == "")
// {
// sEducationLevel = sEducationLevel + eAcademic.EducationLevel.Description;
// }
// else if (sEducationLevel != "")
// {
// sEducationLevel = sEducationLevel + "," + eAcademic.EducationLevel.Description;
// }
// }
//}
//dr["Qualification"] = sEducationLevel;
//dr["VotterID"] = oDRow["NationalID"];
//dr["TempVill"] = oDRow["TempVillage"];
//dr["TempPS"] = oDRow["TempThana"];
//dr["TempDist"] = oDRow["TempDist"];
//dr["PerVill"] = oDRow["PerVillage"];
//dr["PerPS"] = oDRow["PerThana"];
//dr["PerDist"] = oDRow["PerDist"];
//if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ABPos)
//{
// dr["BloodGroup"] = "AB+";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ABNeg)
//{
// dr["BloodGroup"] = "AB-";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ANeg)
//{
// dr["BloodGroup"] = "A-";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.APos)
//{
// dr["BloodGroup"] = "A+";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.BNeg)
//{
// dr["BloodGroup"] = "B-";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.BPos)
//{
// dr["BloodGroup"] = "B+";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ONeg)
//{
// dr["BloodGroup"] = "O-";
//}
//else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.OPos)
//{
// dr["BloodGroup"] = "O+";
//}
#endregion
count++;
dTEmpDetail.Rows.Add(dr);
}
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "PayrollDataSet_EmployeeDetailExcel";
dSet.Tables.Add(dTEmpDetail);
return dSet;
#region Unsued Code
//bool isOPISeparateAcountApplicable = ConfigurationManager.GetBoolValue("opi", "opiexist", EnumConfigurationType.Logic);
//if (isOPISeparateAcountApplicable)
//{
// form.CommonReportView(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.EmployeeDetailWithOPI.rdlc", null);
//}
//else
//{
// //form.ShowDlgForEmpDetails(_selectedParameter.ReportItem, dTEmpDetail);
// form.CommonReportView(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.EmployeeDetail.rdlc", null);
//}
#endregion
}
public DataTable GetReport(DateTime dMonth, ID nRepID, string sEmpIDs)
{
fReportViewer form = new fReportViewer();
DataTable dtEmployee = SalaryMonthly.GetCustomDataTable("Select Employeeid,gradeid,name,BasicSalary from employee");
_SalaryMonth = dMonth;
ID nReportID = nRepID;
string sEmpID = sEmpIDs;
DataRow oDR = null;
DataSet oSalarySheets = null;
ObjectsTemplate<SalaryMonthly> sMonthly = SalaryMonthly.Get(sEmpID, _SalaryMonth);
oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
#region Loop Start
//foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
//{
// if (source["ITEMGROUP"].ToString() != "2")
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyNonMngtForGross(oDR, source);
// if (source["ITEMGROUP"].ToString() == "1")
// {
// DataRow dr = this.GetItem2(oSalarySheets.Tables["GrossItem"], source["EMPLOYEENO"].ToString(), EnumSalaryGroup.UnauthLeave, (EnumSalaryItemCode)Convert.ToInt16(source["ITEMCODE"]), Convert.ToInt16(source["ITEMID"]));
// if (dr != null)
// {
// oDR["Amount"] = Convert.ToDouble(oDR["Amount"]) - Convert.ToDouble(dr["Amount"]);
// }
// }
// dTSalarySheet.Rows.Add(oDR);
// }
//}
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyNonManagement(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyNonMngtForDeduct(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyNonManagement(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyNonManagement(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
#endregion
Pivot pvt = new Pivot(dTSalarySheet);
DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
DataColumnCollection columns = ddt.Columns;
List<string> sList = new List<string>();
List<AllowanceDeduction> oallow = AllowanceDeduction.GetAllowance(EnumStatus.Regardless);
sList.Add("EmpNo");
sList.Add("EmpName");
sList.Add("Grade");
sList.Add("Actual Basic");
sList.Add("Basic");
foreach (AllowanceDeduction ad in oallow)
{
if (columns.Contains(ad.Name))
{
sList.Add(ad.Name);
}
}
List<Bonus> oBonus = Bonus.Get(EnumStatus.Regardless);
foreach (Bonus oB in oBonus)
{
if (columns.Contains(oB.Name))
{
sList.Add(oB.Name);
}
}
sList.Add("OT Amount");
sList.Add("Unauthorized Leave");
sList.Add("Total Gross");
sList.Add("Income Tax");
List<AllowanceDeduction> oDeductions = AllowanceDeduction.GetDeduction(EnumStatus.Regardless);
foreach (AllowanceDeduction oD in oDeductions)
{
if (columns.Contains(oD.Name))
{
sList.Add(oD.Name);
}
}
sList.Add("PF");
sList.Add("Total Deduction");
sList.Add("Net Pay");
DataTable convertedDT = new DataTable();
List<string> uniqueList = sList.Distinct().ToList();
foreach (var item in uniqueList)
{
if (item.ToString().ToLower() == "empno" || item.ToString().ToLower() == "empname" || item.ToString().ToLower() == "grade")
convertedDT.Columns.Add(item, typeof(string));
else
convertedDT.Columns.Add(item, typeof(double));
}
DataRow odr = null;
ObjectsTemplate<Grade> oGrades = Grade.Get(EnumStatus.Regardless);
foreach (DataRow dr in ddt.Rows)
{
odr = convertedDT.NewRow();
//Employee oEmp = oEmps.Where(x => ddt.AsEnumerable().Any(y => y.Field<string>("EmpNo").Equals(x.EmployeeNo))).FirstOrDefault();
//Employee oEmp = oEmps.Where(x =>x.EmployeeNo==dr["EmpNo"].ToString()).FirstOrDefault();
DataRow drEmp = this.GetEmployee(dtEmployee, dr["EmpNo"].ToString());
Employee oEmp = new Employee();
if (drEmp != null)
{
oEmp.GradeID = ID.FromInteger(Convert.ToInt16(drEmp["gradeid"]));
oEmp.Name = drEmp["name"].ToString();
oEmp.BasicSalary = Convert.ToDouble(drEmp["BasicSalary"].ToString());
}
Grade grd = oGrades.Find(x => oEmp.GradeID == x.ID);
foreach (DataColumn dc in dr.Table.Columns)
{
var myColumn = odr.Table.Columns.Cast<DataColumn>().SingleOrDefault(col => col.ColumnName == dc.ColumnName);
if (myColumn != null)
{
if (myColumn.ColumnName.ToLower() == "empno")
odr[myColumn.ColumnName] = dr[dc.ColumnName];
else
odr[myColumn.ColumnName] = Convert.ToDouble(dr[dc.ColumnName].ToString() == "" ? "0" : dr[dc.ColumnName].ToString());
}
}
odr["EmpName"] = oEmp.Name;
odr["Grade"] = grd.Name;
odr["Actual Basic"] = oEmp.BasicSalary;
convertedDT.Rows.Add(odr);
}
return convertedDT;
}
private DataRow GetEmployee(DataTable Source, string sEmpID)
{
foreach (DataRow odRow in Source.Rows)
{
if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpID)
{
return odRow;
}
}
return null;
}
private DataRow GetItem2(DataTable Source, string sEmpNo, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID)
{
foreach (DataRow odRow in Source.Rows)
{
if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpNo && Convert.ToInt32(odRow["ITEMGROUP"]) == (int)groupCode &&
Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID)
{
return odRow;
}
}
return null;
}
public DataSet ChangedReportExcel(DateTime fromDate, DateTime todate, string selection)
{
DateTime fDate = GlobalFunctions.FirstDateOfMonth(fromDate);
DateTime tDate = GlobalFunctions.LastDateOfMonth(todate);
int count = 1;
DataSet ds = Employee.GetEmpGradeSalaryChangeInfo(fDate, tDate, selection);
DataRow oDR = null;
PayrollDataSet.PayrollDataSet.ChangedSalaryDesigDataTable dTChangeEmfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.ChangedSalaryDesigDataTable();
foreach (DataRow dr in ds.Tables[0].Rows)
{
oDR = dTChangeEmfo.NewRow();
oDR["SLNO"] = count;
oDR["EmployeeNo"] = dr["EMPLOYEENO"];
oDR["Name"] = dr["NAME"];
oDR["EffectFrom"] = dr["EFFECTDATE"];
oDR["EntryDate"] = dr["EntryDate"];
oDR["Grade"] = dr["Grade"];
oDR["Basic"] = Convert.ToDouble(dr["BASICSALARY"]);
oDR["UserName"] = dr["USERNAME"];
oDR["Remarks"] = dr["Remarks"];
dTChangeEmfo.Rows.Add(oDR);
count++;
}
DataSet dSet = new DataSet();
dTChangeEmfo.TableName = "PayrollDataSet_EmployeeDetailExcel";
dSet.Tables.Add(dTChangeEmfo);
return dSet;
}
public void ChangedReport(DateTime fromDate, DateTime todate, string selection)
{
fReportViewer form = new fReportViewer();
DateTime fDate = GlobalFunctions.FirstDateOfMonth(fromDate);
DateTime tDate = GlobalFunctions.LastDateOfMonth(todate);
DataSet ds = Employee.GetEmpGradeSalaryChangeInfo(fDate, tDate, selection);
DataRow oDR = null;
PayrollDataSet.PayrollDataSet.ChangedSalaryDesigDataTable dTChangeEmfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.ChangedSalaryDesigDataTable();
foreach (DataRow dr in ds.Tables[0].Rows)
{
oDR = dTChangeEmfo.NewRow();
oDR["EmployeeNo"] = dr["EMPLOYEENO"];
oDR["Name"] = dr["NAME"];
oDR["EffectFrom"] = dr["EFFECTDATE"];
oDR["EntryDate"] = dr["EntryDate"];
oDR["Grade"] = dr["Grade"];
oDR["Basic"] = Convert.ToDouble(dr["BASICSALARY"]);
oDR["UserName"] = dr["USERNAME"];
oDR["Remarks"] = dr["Remarks"];
dTChangeEmfo.Rows.Add(oDR);
}
form.ShowChangedReport(dTChangeEmfo, fDate, tDate);
}
public void GetEmpDetails()
{
fReportViewer form = new fReportViewer();
string sEmpID = _selectedParameter.ReportItem.INSQL;
DataRow dr = null;
List<Employee> oEmps = Employee.GetByEmpIDs(sEmpID);
ObjectsTemplate<Department> oDepartments = Department.Get();
Employee oEmployee = null;
DataSet oEmpDetails = Employee.GetEmpDetails(sEmpID);
DataTable dtDFSL = Employee.GetDFSL();
PayrollDataSet.PayrollDataSet.EmployeeDetailDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeDetailDataTable();
bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic);
int nCount = 0;
try
{
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
nCount++;
//if (nCount == 189)
// nCount = 189;
Department dep = null;
string[] sDes =new string[6];
if (oDRow["DepartmentID"].ToString() != "")
{
dep = oDepartments.Find(x => x.ID.Integer == Convert.ToInt16(oDRow["DepartmentID"].ToString()));
sDes = GlobalFunctions.FindDivisionDeparmentUnit(dep, oDepartments);
}
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"];
dr["TINNO"] = oDRow["TINNO"];
if (isDesigFromEmp && oEmployee != null)
dr["Designation"] = oEmployee.DescriptionText;
else
dr["Designation"] = oDRow["DegName"];
dr["Division"] = sDes[0];
dr["Department"] = sDes[1];
dr["Section"] = sDes[2];
dr["SubSection"] = sDes[3];
dr["Unit"] = sDes[4];
dr["SubUnit"] = sDes[5];
try
{
dr["RCCode"] = GlobalFunctions.FindRCCode(dep, oDepartments);
}
catch
{
dr["RCCode"] = "";
}
dr["Grade"] = oDRow["GDDes"];
dr["BasicSalary"] = oDRow["BASICSALARY"];
dr["DOB"] = oDRow["BIRTHDATE"];
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"] = "Both";
}
dr["Religion"] = oDRow["RegName"];
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"];
dr["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"];
dr["TaxAmount"] = oDRow["TAXAMOUNT"];
dr["LocDes"] = oDRow["LocDes"];
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"] = "UnMarried";
}
dr["MobileNo"] = oDRow["MOBILENO"];
dr["MailAdd"] = oDRow["EMAILADDRESS"];
dr["RFID"] = oDRow["CardNo"];
dr["Nationality"] = oDRow["Nationality"];
dr["FathersName"] = oDRow["FATHERNAME"];
dr["MothersName"] = oDRow["MOTHERNAME"];
string sEducationLevel = string.Empty;
HREmployee ohrEmp = _hrEmployees.Find(delegate(HREmployee hEmp) { return hEmp.EmployeeNo == oEmployee.EmployeeNo; });
if (ohrEmp != null)
{
foreach (EmpAcademic eAcademic in ohrEmp.Academics)
{
if (sEducationLevel == "")
{
sEducationLevel = sEducationLevel + eAcademic.EducationLevel.Description;
}
else if (sEducationLevel != "")
{
sEducationLevel = sEducationLevel + "," + eAcademic.EducationLevel.Description;
}
}
}
dr["Qualification"] = sEducationLevel;
dr["VotterID"] = oDRow["NationalID"];
dr["TempVill"] = oDRow["TempVillage"];
dr["TempPS"] = oDRow["TempThana"];
dr["TempDist"] = oDRow["TempDist"];
dr["PerVill"] = oDRow["PerVillage"];
dr["PerPS"] = oDRow["PerThana"];
dr["PerDist"] = oDRow["PerDist"];
if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ABPos)
{
dr["BloodGroup"] = "AB+";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ABNeg)
{
dr["BloodGroup"] = "AB-";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ANeg)
{
dr["BloodGroup"] = "A-";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.APos)
{
dr["BloodGroup"] = "A+";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.BNeg)
{
dr["BloodGroup"] = "B-";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.BPos)
{
dr["BloodGroup"] = "B+";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.ONeg)
{
dr["BloodGroup"] = "O-";
}
else if (Convert.ToInt32(oDRow["BLOODGROUP"]) == (int)EnumBloodGroup.OPos)
{
dr["BloodGroup"] = "O+";
}
dTEmpDetail.Rows.Add(dr);
}
}
catch
{
nCount = 450;
}
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "PayrollDataSet_EmployeeDetail";
dSet.Tables.Add(dTEmpDetail);
bool isOPISeparateAcountApplicable = ConfigurationManager.GetBoolValue("opi", "opiexist", EnumConfigurationType.Logic);
if (isOPISeparateAcountApplicable)
{
form.CommonReportView(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.EmployeeDetailWithOPI.rdlc", null);
}
else
{
//form.ShowDlgForEmpDetails(_selectedParameter.ReportItem, dTEmpDetail);
form.CommonReportView(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.EmployeeDetail.rdlc", null);
}
}
public void ShowEmployeeCV(HREmployee employee)
{
if (employee == null)
return;
DataRow oRow = null;
DataRow oRow1 = null;
List<Department> _department = new List<Department>();
List<Nationality> _nationality = new List<Nationality>();
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 GetEmpPostings()
{
fReportViewer form = new fReportViewer();
string sEmpID = _selectedParameter.ReportItem.INSQL;
DataRow dr = null;
int count = 1;
Employee oEmployee = new Employee();
DataSet oEmpPostings = Employee.GetEmpPosting(sEmpID);
PayrollDataSet.PayrollDataSet.PostingDetailsDataTable dTEmpPosting = new Payroll.Report.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["Designation"] = oDRow["DesgName"];
dr["Department"] = oDRow["Description"];
dTEmpPosting.Rows.Add(dr);
count++;
}
form.ShowDlgForEmpPosting(_selectedParameter.ReportItem, dTEmpPosting);
}
public DataTable GetEmpPostingsNew(DateTime EffectDate)
{
fReportViewer form = new fReportViewer();
EmployeePosting oEmpPosting = null;
ObjectsTemplate<Employee> 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)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
DataRow dr = null;
int count = 1;
DataSet oEmpHis = EmployeeHistory.GetEmpHistory(dEffectDate, dEffectDate2);
oEmpHis.Tables[0].Columns.Add("AuthorizedDate");
//DataSet oEmpPostings = Employee.GetEmpPosting(sEmpID);
PayrollDataSet.PayrollDataSet.EmployeeHistoryDataTable dTEmpHistory = new Payroll.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"] = "Discontinued";
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.ToInt16(oDRow["emplifecycleid"]);
int nEmployeeid = Convert.ToInt16(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.Year == Convert.ToDateTime(oDRow["EffectDate"]).Year &&
oItem.SalaryMonth.Month == Convert.ToDateTime(oDRow["EffectDate"]).Month &&
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;
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)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
List<Religion> oReligions = Religion.Get();
DataRow dr = null;
int count = 1;
DataSet oEmpJoining = Employee.GetEmpJoining(dEffectDate, dEffectDate2);
oEmpJoining.Tables[0].Columns.Add("AuthorizedDate");
PayrollDataSet.PayrollDataSet.EmpJoining4NovartisDataTable dTEmpJoining = new Payroll.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.Integer == Convert.ToInt16(oDRow["religionid"]);
});
dr["MaritalStatus"] = (EnumMaritalStatus)Convert.ToInt16(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.ToInt16(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.Integer == Convert.ToInt16(oDRow["employeeid"]) && oItem.IsContinue == true;
});
if (lifeCycle != null)
{
ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate(ApproveFinantialData oItem)
{
return oItem.EmployeeID.Integer == Convert.ToInt16(oDRow["employeeid"]) &&
oItem.ObjectID == lifeCycle.ID.Integer &&
oItem.SalaryMonth.Year == lifeCycle.EffectDate.Year &&
oItem.SalaryMonth.Month == lifeCycle.EffectDate.Month &&
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;
dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt");
}
else
dr["AuthorizeBy"] = "";
}
else
dr["AuthorizeBy"] = "";
//int nlifeCycleID = Convert.ToInt16(oDRow["emplifecycleid"]);
//int nEmployeeid = Convert.ToInt16(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 GetEmpBasicGrade(DateTime dEffectDate, DateTime dEffectDate2)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
EmployeeGradeSalary oEmpGradeSalary = null;
DataRow dr = null;
int count = 1;
ObjectsTemplate<Employee> oEmployees = Employee.Get();
DataSet oEmpBasicGrade = EmployeeGradeSalary.GetEmpBasicGrade(dEffectDate, dEffectDate2);
oEmpBasicGrade.Tables[0].Columns.Add("AuthorizedDate");
//DataSet oEmpPrvBasicGrade = EmployeeGradeSalary.GetEmpPrvBasicGrade(dEffectDate);
PayrollDataSet.PayrollDataSet.EmpGradeBasicDataTable dTEmpGBasic = new Payroll.Report.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 = Employee.Get(Convert.ToString(oDRow["EMPLOYEENO"]));
if (oEmp != null)
{
oEmpGradeSalary = EmployeeGradeSalary.Get(oEmp.ID, Convert.ToDateTime(oDRow["EffectDate"]));
if (oEmpGradeSalary != null)
{
dr["PreviousGrade"] = oEmpGradeSalary.Grade.Name;
dr["PreviousBasic"] = oEmpGradeSalary.BasicSalary;
}
}
if (Payroll.BO.SystemInformation.CurrentSysInfo.Code.Contains("007"))
{
dr["ChangedBy"] = "";
int nGradeSalaryID = Convert.ToInt16(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.IsUnassigned == false &&
oItem.GradeSalaryAssesmentID.Integer == 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.Integer &&
oItem.SalaryMonth.Year == Convert.ToDateTime(oDRow["EffectDate"]).Year &&
oItem.SalaryMonth.Month == Convert.ToDateTime(oDRow["EffectDate"]).Month &&
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;
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, ID AllowDeductID, String AllowDeduct)
{
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
DataRow dr = null;
int count = 1;
DataSet oEmpAllowDeduct = AllowanceDeduction.GetEmpAllowDeduc2(dEffectDate, dEffectDate2, AllowDeductID);
oEmpAllowDeduct.Tables[0].Columns.Add("AuthorizedDate");
PayrollDataSet.PayrollDataSet.EmpAllowDeductDataTable dTEmpGBasic = new Payroll.Report.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.FirstOrDefault(o => o.ID.Integer == (!oDRow.IsNull("modifiedBy") ? Convert.ToInt32(oDRow["modifiedBy"]) : 0));
//User user = _users.Find(delegate(User oItem)
//{
// return oItem.ID.Integer =(oDRow["modifiedBy"]!=string.Empty? Convert.ToInt32(oDRow["modifiedBy"]):0);
//});
if (user != null)
dr["CommitedBy"] = user.Name;
dr["CommitedOn"] = (!oDRow.IsNull("modifiedDate") ? Convert.ToDateTime(oDRow["modifiedDate"]).ToString("dd MMM yyyy") : string.Empty);
int nAdparameterEmpid = (!oDRow.IsNull("adparameterempid") ? Convert.ToInt16(oDRow["adparameterempid"]) : 0);
int nEmployeeid = Convert.ToInt16(oDRow["employeeid"]);
EnumApprovalFinancialData enmType = AllowDeduct.ToLower().Contains("deduction") ? EnumApprovalFinancialData.Deduction : EnumApprovalFinancialData.Allowance;
if (nAdparameterEmpid > 0)
{
ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate(ApproveFinantialData oItem)
{
return oItem.EmployeeID.Integer == nEmployeeid &&
oItem.ObjectID == nAdparameterEmpid &&
oItem.FinanatialDataType == enmType;
});
if (finalcialData != null)
{
User usr = _users.Find(delegate(User oItem)
{
return oItem.ID.Integer == finalcialData.Approvedby;
});
if (usr != null)
dr["AuthorizeBy"] = usr.Name;
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 DataTable GetEmpBankHistory(DateTime dEffectDate, DateTime dEffectDate2)
{
DateTime dFromtDate = dEffectDate;
DateTime dToDate = dEffectDate2;
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
//bool prvNotFound = false;
DataRow dr = null;
int count = 1;
ObjectsTemplate<Employee> oEmployees = Employee.Get();
EmployeeBankAccount oEmpBankAccount = null;
DataSet oEmpBankHis = EmployeeBankAccount.GetEmpBankHistory(dEffectDate, dEffectDate2);
List<EmployeeBankAccount> oAccountHists = EmployeeBankAccount.GetByDate(dFromtDate, dToDate, "");
oEmpBankHis.Tables[0].Columns.Add("AuthorizeBy");
oEmpBankHis.Tables[0].Columns.Add("AuthorizedDate");
//DataSet oEmpPrvBankHis = EmployeeBankAccount.GetEmpPrvBankHistory(dEffectDate);
PayrollDataSet.PayrollDataSet.EmpBankHistoryDataTable dTEmpGBasic = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpBankHistoryDataTable();
try
{
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;
//Employee oEmp =
// oEmployees.Find(
// delegate(Employee oItem)
// { return oItem.ID.Integer == Convert.ToInt32(oDRow["ID"]); });
//oEmpBankAccount = EmployeeBankAccount.Get(ID.FromInteger(Convert.ToInt32(oDRow["ID"])), Convert.ToDateTime(oDRow["CHANGEDATE"]));
oEmpBankAccount = oAccountHists.Find(delegate(EmployeeBankAccount his) { return his.ID.Integer == Convert.ToInt32(oDRow["AccountID"]); });
if (oEmpBankAccount != null)
{
dr["PBankName"] = oEmpBankAccount.Branch.Bank.Name;
dr["PAccount"] = oEmpBankAccount.AccountNo;
dr["PBranch"] = oEmpBankAccount.Branch.Name;
}
if (oEmpBankAccount.ID.Integer > 0)
{
ApproveFinantialData finalcialData = _finalcialDatas.Find(delegate(ApproveFinantialData oItem)
{
return oItem.EmployeeID == oEmpBankAccount.EmployeeID &&
oItem.ObjectID == oEmpBankAccount.ID.Integer &&
oItem.FinanatialDataType == EnumApprovalFinancialData.BankAccountHistory;
});
if (finalcialData != null)
{
User usr = _users.Find(delegate(User oItem)
{
return oItem.ID.Integer == finalcialData.Approvedby;
});
if (usr != null)
dr["AuthorizeBy"] = usr.Name;
dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt");
}
else
dr["AuthorizeBy"] = "";
}
else
dr["AuthorizeBy"] = "";
//else
//{
// dr["PBankName"] = String.Empty;
// dr["PAccount"] = String.Empty;
// dr["PBranch"] = String.Empty;
//}
//if (oEmpPrvBankHis != null)
//{
// if (oEmpPrvBankHis.Tables[0].Rows.Count > 0)
// {
// foreach (DataRow oDDRow in oEmpPrvBankHis.Tables[0].Rows)
// {
// if (dr["EmpNo"].ToString().Equals(oDDRow["EMPLOYEENO"].ToString()))
// {
// dr["PBankName"] += oDDRow["PBank"] + " ";
// dr["PAccount"] += oDDRow["PACCOUNTNO"] + " ";
// dr["PBranch"] += oDDRow["PBranch"] + " ";
// }
// }
// }
//}
//else
//{
// prvNotFound = true;
//}
dTEmpGBasic.Rows.Add(dr);
count++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return dTEmpGBasic;
}
public DataTable GetEmpConfirmation(DateTime dEffectDate, DateTime dEffectDate2)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
DataRow dr = null;
int count = 1;
DataSet oEmpConfirm = Employee.GetEmpConfirmHis(dEffectDate, dEffectDate);
oEmpConfirm.Tables[0].Columns.Add("AuthorizedDate");
PayrollDataSet.PayrollDataSet.EmpConfirmHisDataTable dTEmpCHistory = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpConfirmHisDataTable();
foreach (DataRow oDRow in oEmpConfirm.Tables[0].Rows)
{
dr = dTEmpCHistory.NewRow();
dr["SLNo"] = count;
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["Name"] = oDRow["NAME"];
dr["Designation"] = oDRow["Designation"];
dr["Grade"] = oDRow["Grade"];
dr["DOJ"] = oDRow["JOININGDATE"];
dr["CDate"] = oDRow["DATEOFCONFIRMATION"];
//dr["RC"] = oDRow["CostCenter"];
dr["CommitedBy"] = oDRow["CommitedBy"];
dr["CommitedDate"] = oDRow["CreationDate"];
dr["StatusDate"] = dEffectDate;
if (Payroll.BO.SystemInformation.CurrentSysInfo.Code.Contains("007"))
{
int nlifeCycleID = Convert.ToInt16(oDRow["emplifecycleid"]);
int nEmployeeid = Convert.ToInt16(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.Year == Convert.ToDateTime(oDRow["EffectDate"]).Year &&
oItem.SalaryMonth.Month == Convert.ToDateTime(oDRow["EffectDate"]).Month &&
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;
dr["AuthorizedDate"] = finalcialData.ApprovedDate.ToString("dd MMM yyyy hh:mm:ss tt");
}
else
dr["AuthorizeBy"] = "";
}
else
dr["AuthorizeBy"] = "";
}
else
dr["AuthorizeBy"] = "";
}
dTEmpCHistory.Rows.Add(dr);
count++;
}
return dTEmpCHistory;
}
public DataTable GetUpCommingEmpConfirmation(DateTime dEffectDate, double dayCount)
{
DataRow dr = null;
//double dateDiff = 0.0;
TimeSpan dDate;
int nDay = 0;
Int32 count = 1;
ObjectsTemplate<Employee> _employees = new ObjectsTemplate<Employee>();
_employees = Employee.Get();
PayrollDataSet.PayrollDataSet.UpCommingEmpDataTable dTUpCommingEmp = new Payroll.Report.PayrollDataSet.PayrollDataSet.UpCommingEmpDataTable();
foreach (Employee oEmp in _employees)
{
dDate = dEffectDate - 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"] = dEffectDate;
dr["Grade"] = oEmp.Grade.Name;
dr["Designation"] = oEmp.DescriptionText;
dTUpCommingEmp.Rows.Add(dr);
count++;
}
}
return dTUpCommingEmp;
}
public DataTable GetEmpLFAData(DateTime dStartDate, DateTime dEndDate)
{
DataRow dr = null;
int count = 1;
ObjectsTemplate<ADParameterEmployee> oADParameterEmployees = ADParameterEmployee.Get(ID.FromInteger(14), GlobalFunctions.FirstDateOfMonth(dStartDate), GlobalFunctions.LastDateOfMonth(dEndDate));
PayrollDataSet.PayrollDataSet.EmployeeLFADataDataTable dTEmpLFAData = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeLFADataDataTable();
foreach (ADParameterEmployee oADParamEmp in oADParameterEmployees)
{
dr = dTEmpLFAData.NewRow();
dr["SLNo"] = count;
dr["EmpNo"] = oADParamEmp.Employee.EmployeeNo;
dr["Name"] = oADParamEmp.Employee.Name;
dr["Month"] = oADParamEmp.FormDate.ToString("dd MMM yyyy");
dr["Amount"] = oADParamEmp.MonthlyAmount;
dTEmpLFAData.Rows.Add(dr);
count++;
}
return dTEmpLFAData;
}
public ObjectsTemplate<ADParameterEmployee> GetALlLFAData(DateTime dStartDate, DateTime dEndDate)
{
ObjectsTemplate<ADParameterEmployee> oADParameterEmployees = ADParameterEmployee.Get(ID.FromInteger(14), GlobalFunctions.FirstDateOfMonth(dStartDate), GlobalFunctions.LastDateOfMonth(dEndDate));
return oADParameterEmployees;
}
public DataTable GetEmpPFHistory(DateTime dEffectDate)
{
DataRow dr = null;
int count = 1;
DataSet oEmpPF = Employee.GetEmpPFHis(dEffectDate);
PayrollDataSet.PayrollDataSet.EmpPFHisDataTable dTEmpPFHistory = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpPFHisDataTable();
foreach (DataRow oDRow in oEmpPF.Tables[0].Rows)
{
dr = dTEmpPFHistory.NewRow();
dr["SLNo"] = count;
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["Name"] = oDRow["NAME"];
dr["Grade"] = oDRow["DESCRIPTION"];
dr["PFMDate"] = oDRow["PFMEMBERSHIPDT"];
dr["CommitedBy"] = oDRow["UserName"];
dr["CommitedDate"] = oDRow["CreationDate"];
dr["StatusDate"] = dEffectDate;
dTEmpPFHistory.Rows.Add(dr);
count++;
}
return dTEmpPFHistory;
}
//public DataTable GetAllInfoForLAFForAllEmployees()
//{
// DateTime fiscalStartDate = Payroll.BO.SystemInformation.CurrentSysInfo.TaxYearEndDate.AddDays(1);
// DateTime fiscalEndDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.TaxYearEndDate.AddDays(1).AddMonths(11));
// ObjectsTemplate<ADParameterEmployee> oADParameterEmployees = ADParameterEmployee.GetByAllow(ID.FromInteger(14));
// ObjectsTemplate<Employee> allEmployees = Employee.Get();
// var rslt = oADParameterEmployees.Where(o => (o.FormDate >= fiscalStartDate && o.TillDate <= fiscalEndDate));
// var finalrslt = from lafemp in rslt join empls in allEmployees on lafemp.EmployeeID.Integer equals empls.ID.Integer select new { empNo = empls.EmployeeNo, empName = empls.Name, month = lafemp.FormDate.Month, Amount = lafemp.MonthlyAmount };
// PayrollDataSet.PayrollDataSet.LFAIndividualEmployeeDataTable oDt = new Payroll.Report.PayrollDataSet.PayrollDataSet.LFAIndividualEmployeeDataTable();
// int count = 0;
// foreach (var undefinedObj in finalrslt)
// {
// count++;
// DataRow odr = oDt.NewRow();
// odr["SnNo"] = count;
// odr["EmployeeNo"] = undefinedObj.empNo;
// odr["EmployeeName"] = undefinedObj.empName;
// odr["Month"] = ((EnumMonths)undefinedObj.month).ToString();
// odr["Amount"] = undefinedObj.Amount;
// oDt.Rows.Add(odr);
// }
// return oDt;
//}
public DataTable GetAllTransferData(DateTime tDate)
{
DataTable ds = null;
//TransferTPToPR.GetByMonthStartMonthEnd(GlobalFunctions.FirstDateOfMonth(tDate),
// GlobalFunctions.LastDateOfMonth(tDate));
//PayrollDataSet.PayrollDataSet.dtTransferTPToPRDataTable oDt =
// new PayrollDataSet.PayrollDataSet.dtTransferTPToPRDataTable();
//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["TransferDate"] = dr["TransferDate"];
// ndr["UserIDWhoChanged"] = dr["UserIDWhoChanged"];
// ndr["ChangedDate"] = dr["ChangedDate"];
// oDt.Rows.Add(ndr);
// }
//}
return ds;
}
public DataTable GetAllTransferDataForContinueFromDiscontinue(DateTime tDate, DateTime tDate2)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
List<ApproveFinantialData> _finalcialDatas = ApproveFinantialData.Get();
List<User> _users = User.Get(EnumSystemType.Desktop);
DataSet ds = Employee.GetByMonthStartMonthEndForContinueFromDiscontinue(tDate,
tDate2);
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 (Payroll.BO.SystemInformation.CurrentSysInfo.Code.Contains("007"))
{
int nlifeCycleID = Convert.ToInt16(dr["emplifecycleid"]);
int nEmployeeid = Convert.ToInt16(dr["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.Year == Convert.ToDateTime(dr["ContinueDate"]).Year &&
oItem.SalaryMonth.Month == Convert.ToDateTime(dr["ContinueDate"]).Month &&
oItem.FinanatialDataType == EnumApprovalFinancialData.Lifecycle;
});
if (finalcialData != null)
{
User user = _users.Find(delegate(User oItem)
{
return oItem.ID.Integer == finalcialData.Approvedby;
});
if (user != null)
ndr["AuthorizeBy"] = user.Name;
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);
}
}
return oDt;
}
//public DataTable GetITAndBasic(DateTime targetDate)
//{
// DateTime startDate = GlobalFunctions.FirstDateOfMonth(targetDate);
// DateTime endDate = GlobalFunctions.LastDateOfMonth(targetDate);
// DataSet ds = Employee.GetITAndBasic(startDate, endDate);
// PayrollDataSet.PayrollDataSet.EmpITInfoAndBasicInfoDataTable oDt =
// new PayrollDataSet.PayrollDataSet.EmpITInfoAndBasicInfoDataTable();
// DataRow ndr = null;
// int sl = 0;
// if (ds.Tables.Count != 0)
// {
// foreach (DataRow dr in ds.Tables[0].Rows)
// {
// ndr = oDt.NewRow();
// sl++;
// ndr["SNL"] = sl;
// ndr["Name"] = dr["Name"];
// ndr["EmpNo"] = dr["EmpNo"];
// ndr["Designation"] = dr["Designation"];
// ndr["Grade"] = dr["Grade"];
// ndr["Amount"] = dr["Amount"];
// if (Convert.ToInt32(dr["Gander"]) == 1)
// ndr["Gander"] = "Male";
// else ndr["Gander"] = "Female";
// oDt.Rows.Add(ndr);
// }
// }
// return oDt;
//}
public void ShowEmployeeRetirement()
{
string sEmpID = _selectedParameter.ReportItem.INSQL;
ObjectsTemplate<Employee> allEmps = Employee.GetByEmpIDs(sEmpID);
PayrollDataSet.PayrollDataSet.EmployeeRetirementDataTable empRetirement = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeRetirementDataTable();
DataRow ndr = null;
if (allEmps != null && allEmps.Count >= 0)
{
int srl = 0;
foreach (Employee obemp in allEmps)
{
srl++;
ndr = empRetirement.NewRow();
ndr["SLNo"] = srl;
ndr["EmpName"] = obemp.Name;
ndr["EmpNo"] = obemp.EmployeeNo;
ndr["DateOfBirth"] = obemp.BirthDate;
double dbt = Convert.ToDouble(Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", obemp.BirthDate, DateTime.Now));
double dt = dbt / 365.0;
decimal tdm = Convert.ToDecimal(dt);
double rslt = Math.Ceiling(dt);
decimal age = Math.Round(tdm);
ndr["Age"] = age;
ndr["JoiningDate"] = obemp.JoiningDate;
DateTime retDate;
if (obemp.PayrollTypeID.Integer == 2)
{
retDate = obemp.BirthDate.AddYears(56);
}
else
{
retDate = obemp.BirthDate.AddYears(58);
}
ndr["RetirementDate"] = retDate;
string gndr = String.Empty;
if (obemp.Gender == EnumGender.Male)
{
gndr = "Male";
}
else if (obemp.Gender == EnumGender.Female)
{
gndr = "Female";
}
//else if (obemp.Gender == EnumGender.Other)
//{
// gndr = "Other";
//}
else if (obemp.Gender == EnumGender.None)
{
gndr = "None";
}
ndr["Gender"] = gndr;
empRetirement.Rows.Add(ndr);
}
}
fReportViewer form = new fReportViewer();
form.ShowRetirement(empRetirement);
}
public DataTable GetUpCommingEmpConfirmationForRekit(DateTime dEffectDate, double dayCount)
{
DataRow dr = null;
//double dateDiff = 0.0;
TimeSpan dDate;
int nDay = 0;
Int32 count = 1;
ObjectsTemplate<Employee> _employees = new ObjectsTemplate<Employee>();
_employees = Employee.Get();
PayrollDataSet.PayrollDataSet.UpCommingEmpDataTable dTUpCommingEmp = new Payroll.Report.PayrollDataSet.PayrollDataSet.UpCommingEmpDataTable();
foreach (Employee oEmp in _employees)
{
dDate = dEffectDate - 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"] = dEffectDate;
dr["Grade"] = oEmp.Grade.Name == String.Empty ? String.Empty : oEmp.Grade.Name;
dr["Designation"] = oEmp.DescriptionText == String.Empty ? String.Empty : oEmp.DescriptionText;
dTUpCommingEmp.Rows.Add(dr);
count++;
}
}
return dTUpCommingEmp;
}
public void PrintEmpEnvelop()
{
fReportViewer form = new fReportViewer();
string sEmpID = _selectedParameter.ReportItem.INSQL;
DataRow dr = null;
DataSet dEmployee = null;
dEmployee = MiscellaneousDataset.PrintEnvelop(sEmpID);
PayrollDataSet.PayrollDataSet.EmpLifeCycleDataTable dEmpEnvelop = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpLifeCycleDataTable();
foreach (DataRow oDR in dEmployee.Tables[0].Rows)
{
dr = dEmpEnvelop.NewRow();
dr["EmpNo"] = oDR["EmployeeNo"];
dr["Name"] = oDR["Name"];
dr["Designation"] = oDR["Designation"];
dr["Department"] = oDR["Department"];
dEmpEnvelop.Rows.Add(dr);
}
form.PrintEnvelop(_selectedParameter.ReportItem, dEmpEnvelop);
}
public void ShowCashAdvice()
{
List<AuthorizedPerson> Authorizations = new List<AuthorizedPerson>();
Authorizations = AuthorizedPerson.GetByReportID(ID.FromInteger(54));
string[] AuthorizedNames = new string[] { "", "", "", "" };
string[] AuthorizedDesigs = new string[] { "", "", "", "" };
for (int i = 0; i < Authorizations.Count; i++)
{
if (i == 4)
break;
AuthorizedNames[i] = Authorizations[i].Name;
AuthorizedDesigs[i] = Authorizations[i].Designation;
}
string sEmpID = _selectedParameter.ReportItem.INSQL;
DateTime dt = GlobalFunctions.LastDateOfMonth(_selectedParameter.FromDate.Value);
string dSalDate = dt.ToString("dd MMM yyyy");
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet oDeptDetails = Employee.GetCashAdvice(sEmpID, dSalDate);
List<SerialNumber> oSerialNumbers = SetSerialNumber();
PayrollDataSet.dsCompany.dtCashAdviceDataTable dtPayrollDetails = new Payroll.Report.PayrollDataSet.dsCompany.dtCashAdviceDataTable();
PayrollDataSet.dsCompany.dtCashAdviceDataTable dtNewPayrollDetails = new Payroll.Report.PayrollDataSet.dsCompany.dtCashAdviceDataTable();
PayrollDataSet.dsCompany.dtCashAdviceDataTable dtSortedPayrollDetails = new Payroll.Report.PayrollDataSet.dsCompany.dtCashAdviceDataTable();
#region Old Code
#endregion
foreach (DataRow orr in oDeptDetails.Tables[0].Rows)
{
dr = dtPayrollDetails.NewRow();
dr["EmployeeID"] = orr["Employeeno"].ToString();
dr["EmployeeName"] = orr["name"].ToString();
dr["Location"] = orr["location"].ToString();
dr["CostCenter"] = orr["CostCenter"].ToString();
dr["Item"] = orr["description"].ToString();
dr["ItemAmount"] = orr["Amount"].ToString();
if (orr["description"].ToString() == "Gross")
{
dr["SequenceNo"] = 1;
}
else if (orr["description"].ToString() == "Net Pay")
{
dr["SequenceNo"] = 4;
}
else if (orr["description"].ToString() == "PF")
{
dr["SequenceNo"] = 2;
}
else if (orr["description"].ToString() == "Without Pay")
{
dr["SequenceNo"] = 3;
}
dtPayrollDetails.Rows.Add(dr);
}
var sortedData = from DataRow drr in dtPayrollDetails.Rows orderby drr["SequenceNo"] select drr;
foreach (DataRow dr1 in sortedData)
{
DataRow nDr = dtSortedPayrollDetails.NewRow();
nDr.ItemArray = dr1.ItemArray;
dtSortedPayrollDetails.Rows.Add(nDr);
}
DataSet dSet = new DataSet();
dtSortedPayrollDetails.TableName = "dsCompany_dtCashAdvice";
dSet.Tables.Add(dtSortedPayrollDetails);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("salarymonth", dt.ToString("MMM yyyy"));
parameters.Add(parameter);
DataView view2 = new DataView(dtSortedPayrollDetails);
DataTable distinctEmps = view2.ToTable(true, "Employeeid");
parameter = new ReportParameter("EmpCount", "Total Employee :" + distinctEmps.Rows.Count.ToString());
parameters.Add(parameter);
for (int i = 0; i < 4; i++)
{
parameter = new ReportParameter("AuthorizeName" + (i + 1), AuthorizedNames[i]);
parameters.Add(parameter);
parameter = new ReportParameter("AuthorizeDesig" + (i + 1), AuthorizedDesigs[i]);
parameters.Add(parameter);
}
form.CommonReportViewShow(_selectedParameter.ReportItem, dSet, "Payroll.Report.RDLC.CashAdviseReport.rdlc", parameters);
}
public List<SerialNumber> SetSerialNumber()
{
List<SerialNumber> oGetSerialNumber = new List<SerialNumber>();
int nCount = 1;
SerialNumber oItem = new SerialNumber();
oItem.ItemName = "Gross";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "PF";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Income Tax";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
ObjectsTemplate<AllowanceDeduction> oDeducts = AllowanceDeduction.GetDeduction(EnumStatus.Active);
foreach (AllowanceDeduction deuct in oDeducts)
{
oItem = new SerialNumber();
oItem.ItemName = deuct.Name;
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
}
ObjectsTemplate<Loan> oLoans = Loan.Get(EnumStatus.Active);
foreach (Loan deuct in oLoans)
{
oItem = new SerialNumber();
oItem.ItemName = deuct.Name + " EMI";// +" interest";
//oItem.ItemName = deuct.Name + " interest";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
}
oItem = new SerialNumber();
oItem.ItemName = "Total Deduction";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Bank";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Cash";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Net Payable";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Bank";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Cash";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
oItem = new SerialNumber();
oItem.ItemName = "Signature";
oItem.SerialNo = nCount;
oGetSerialNumber.Add(oItem);
nCount++;
return oGetSerialNumber;
}
public int GetSerialNumber(List<SerialNumber> oSerialNumbers, string sItemName)
{
int nSerialNo = 0;
foreach (SerialNumber deuct in oSerialNumbers)
{
if (sItemName == deuct.ItemName)
{
nSerialNo = deuct.SerialNo;
}
}
return nSerialNo;
}
public void EmployeesMasterData()
{
fReportViewer oviewer = new fReportViewer();
_SalaryMonth = _selectedParameter.FromDate.Value;
string sEmpID = _selectedParameter.ReportItem.INSQL;
DataRow dr = null;
DataSet ods = new DataSet();
ods = MiscellaneousDataset.GetEmployeesMasterData(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
PayrollDataSet.dsCompany.EmployeeMasterDataDataTable dtMaster = new Payroll.Report.PayrollDataSet.dsCompany.EmployeeMasterDataDataTable();
foreach (DataRow source in ods.Tables[0].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
foreach (DataRow source in ods.Tables[1].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
foreach (DataRow source in ods.Tables[2].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
foreach (DataRow source in ods.Tables[3].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
foreach (DataRow source in ods.Tables[4].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
foreach (DataRow source in ods.Tables[5].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
foreach (DataRow source in ods.Tables[6].Rows)
{
dr = dtMaster.NewRow();
this.Copy(dr, source);
dtMaster.Rows.Add(dr);
}
if (dtMaster.Rows.Count > 0)
{
oviewer.ShowEmployeesMasterData(dtMaster, _SalaryMonth);
}
}
private void CopyNonMngtForGross(DataRow source, DataRow destination)
{
if (tempEmpID == string.Empty)
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
}
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
}
source["EmpNo"] = destination["EMPLOYEENO"];
source["EmpName"] = destination["Name"];
source["Grade"] = destination["GName"];
source["THISMONTHBASIC"] = destination["THISMONTHBASIC"];
source["Department"] = destination["DName"];
if ((Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Over_Time_Amount)))
{
source["Description"] = "OT Amount";
source["Amount"] = destination["Amount"];
}
else
{
source["Description"] = destination["Description"];
if (Convert.ToInt32(destination["Amount"]) != 0)
{
source["Amount"] = destination["Amount"];
}
else
{
source["Amount"] = 0.0;
}
}
// source["SalaryMonth"] = _SalaryMonth;
//source["JoiningDate"] = destination["JoiningDate"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
private void CopyNonMngtForDeduct(DataRow source, DataRow destination)
{
double OtallownceAmount = 0.0;
if (tempEmpID == string.Empty)
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
OtallownceAmount = 0.0;
}
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
OtallownceAmount = 0.0;
}
source["EmpNo"] = destination["EMPLOYEENO"];
source["EmpName"] = destination["Name"];
source["Grade"] = destination["GName"];
source["THISMONTHBASIC"] = destination["THISMONTHBASIC"];
source["Department"] = destination["DName"];
if ((Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Over_Time_Amount)))
{
OtallownceAmount = OtallownceAmount + Convert.ToDouble(destination["Amount"]);
source["Description"] = "OT Amount";
source["Amount"] = OtallownceAmount;
}
else
{
source["Description"] = destination["Description"];
if (Convert.ToInt32(destination["Amount"]) != 0)
{
source["Amount"] = destination["Amount"];
}
else
{
source["Amount"] = 0.0;
}
}
source["SalaryMonth"] = _SalaryMonth;
source["JoiningDate"] = destination["JoiningDate"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
private void CopyNonManagement(DataRow source, DataRow destination)
{
if (tempEmpID == string.Empty)
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
}
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
}
source["EmpNo"] = destination["EMPLOYEENO"];
source["EmpName"] = destination["Name"];
source["Grade"] = destination["GName"];
source["THISMONTHBASIC"] = destination["THISMONTHBASIC"];
// source["Department"] = destination["DName"];
//if ((Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Over_Time_Amount) && Convert.ToInt16(destination["ITEMGROUP"]) == Convert.ToInt16(EnumSalaryGroup.Gross)) || (Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Over_Time_Hours) && Convert.ToInt16(destination["ITEMGROUP"]) == Convert.ToInt16(EnumSalaryGroup.Miscellaneous)))
//{
// OtallownceAmount = OtallownceAmount + Convert.ToDouble(destination["Amount"]);
// source["Description"] = "OT Amount";
// source["Amount"] = OtallownceAmount;
//}
//else
//{
source["Description"] = destination["Description"];
if (Convert.ToInt32(destination["Amount"]) > 0)
{
source["Amount"] = destination["Amount"];
}
else
{
source["Amount"] = 0.0;
}
//}
// source["SalaryMonth"] = _SalaryMonth;
//source["JoiningDate"] = destination["JoiningDate"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
private void Copy(DataRow source, DataRow destination)
{
if (tempEmpID == string.Empty)
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
}
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
{
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
source["SLNo"] = count;
count++;
}
//Department odepartment = _departments.Find(delegate(Department odep) { return odep.ID.Integer == Convert.ToInt32(destination["ParentID"].ToString()); });
source["EmpNo"] = destination["EMPLOYEENO"];
source["EmpName"] = destination["NAME"];
source["Grade"] = destination["Grade"];
source["Department"] = destination["Department"];
//source["DeptCode"] = destination["Code"];
//if(odepartment != null)
//{
// source["Unit"] = odepartment.Code +" : "+odepartment.Name;
//}
source["Unit"] = destination["Unit"];
source["Designation"] = destination["Designation"];
DateTime dtBirthDate = Convert.ToDateTime(destination["BIRTHDATE"].ToString());
source["BirthDate"] = dtBirthDate.ToString("dd MMM yyyy");
DateTime dtJoining = Convert.ToDateTime(destination["JOININGDATE"].ToString());
source["JoiningDate"] = dtJoining.ToString("dd MMM yyyy");
if (destination["DATEOFCONFIRMATION"].ToString() != "")
{
DateTime dtConfim = Convert.ToDateTime(destination["DATEOFCONFIRMATION"].ToString());
source["ConfirmDate"] = dtConfim.ToString("dd MMM yyyy");
}
else
{
source["ConfirmDate"] = "";
}
source["ConfirmationPending"] = "";
source["NoOfPromotion"] = 0;
source["LastPromotionDate"] = "";
if ((int)EnumGender.Male == Convert.ToInt32(destination["GENDER"].ToString()))
{
source["Gender"] = "Male";
}
else if ((int)EnumGender.Female == Convert.ToInt32(destination["GENDER"].ToString()))
{
source["Gender"] = "FeMale";
}
else if ((int)EnumGender.Other == Convert.ToInt32(destination["GENDER"].ToString()))
{
source["Gender"] = "Other";
}
else
{
source["Gender"] = "None";
}
if (destination["ENDOFCONTRACTDATE"].ToString() != "")
{
DateTime dtRetire = Convert.ToDateTime(destination["ENDOFCONTRACTDATE"].ToString());
source["RetirementDate"] = dtRetire.ToString("dd MMM yyyy");
}
else
{
source["RetirementDate"] = "";
}
source["PastExperience"] = "";
source["LastAcademicDegree"] = "";
source["LastAcademicSpecialization"] = "";
source["ProfessionalDegree"] = "";
source["Nominee1"] = destination["NomineeName1"];
source["Nominee1NaID"] = "";
source["Nominee2"] = destination["NomineeName2"];
source["Nominee2NaID"] = "";
source["Email"] = destination["EMAILADDRESS"];
source["ContactNo"] = destination["PRESENTMOBILE"];
source["EmargencyConNo"] = destination["EMERGENCYTELEPHONE"];
source["ParmanentAddress"] = destination["PARMANENTADDRESS"];
source["PresentAddress"] = destination["PRESENTADDRESS"];
source["FathersName"] = destination["FATHERNAME"];
source["MothersName"] = destination["MOTHERNAME"];
source["SpouseName"] = destination["SpouseName"];
source["NationalID"] = destination["NationalID"];
source["WorkPlaceAndTRCode"] = "";
source["LastIssueDateofMobile"] = "";
source["BankAccNo1"] = destination["ACCOUNTNO"];
source["BankAccNo2"] = "";
source["ItemDescription"] = destination["Description"];
source["ItemAmount"] = Convert.ToDouble(destination["Amount"].ToString());
source["GroupDescription"] = destination["GroupDescription"];
}
public void ShowStuffListWithoutSalary()
{
fReportViewer oviewer = new fReportViewer();
DataSet dsStuffList = new DataSet();
DataRow orow = null;
int nCount = 0;
_SalaryMonth = _selectedParameter.FromDate.Value;
string sEmpID = _selectedParameter.ReportItem.INSQL;
dsStuffList = MiscellaneousDataset.GetStuffListWithoutSalary(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
PayrollDataSet.dsCompany.StuffListWithoutSalaryDataTable dtStuffList = new Payroll.Report.PayrollDataSet.dsCompany.StuffListWithoutSalaryDataTable();
if (dsStuffList.Tables.Count > 0)
{
foreach (DataRow orr in dsStuffList.Tables[0].Rows)
{
orow = dtStuffList.NewRow();
nCount++;
orow["EmpNo"] = orr["EmployeeNo"].ToString();
orow["Name"] = orr["NAME"].ToString();
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
orow["DOJ"] = dtJoin.ToString("dd MMM yyyy");
orow["Department"] = orr["Department"].ToString();
orow["Designation"] = orr["Designation"].ToString();
orow["AccountNo"] = orr["AccountNo"].ToString();
orow["CostCenter"] = orr["CostCenter"].ToString();
dtStuffList.Rows.Add(orow);
}
if (dtStuffList.Rows.Count > 0)
{
oviewer.ShowStuffList(_SalaryMonth, dtStuffList, nCount.ToString());
}
}
}
public void ShowStuffAccountWithoutSalary()
{
}
internal void PrepareExperienceCertificate(Employee searchEmployee)
{
fReportViewer oviewer = new fReportViewer();
DataSet dsExperience = new DataSet();
DataRow orow = null;
dsExperience = MiscellaneousDataset.GetEmpExperience(searchEmployee.ID.Integer);
PayrollDataSet.dsCompany.ExperienceCertificateDataTable dtExperience = new Payroll.Report.PayrollDataSet.dsCompany.ExperienceCertificateDataTable();
foreach (DataRow orr in dsExperience.Tables[0].Rows)
{
orow = dtExperience.NewRow();
orow["Name"] = orr["NAME"].ToString();
if (orr["FATHERNAME"].ToString() != "")
{
orow["FathersName"] = orr["FATHERNAME"].ToString();
}
else
{
orow["FathersName"] = "";
}
if (orr["MOTHERNAME"].ToString() != "")
{
orow["MothersName"] = orr["MOTHERNAME"].ToString();
}
else
{
orow["MothersName"] = "";
}
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
orow["DOJ"] = dtJoin.ToString("dd MMM yyyy");
if (orr["ENDOFCONTRACTDATE"].ToString() != "")
{
DateTime dtDOL = Convert.ToDateTime(orr["ENDOFCONTRACTDATE"].ToString());
orow["DOL"] = dtDOL.ToString("dd MMM yyyy");
}
else
{
orow["DOL"] = "";
}
orow["Designation"] = orr["Designation"].ToString();
orow["Department"] = orr["Department"].ToString();
if (Convert.ToInt32(orr["Gender"].ToString()) == (int)EnumGender.Male)
{
orow["Gender"] = "his";
orow["SurName"] = "Mr.";
}
else if (Convert.ToInt32(orr["Gender"].ToString()) == (int)EnumGender.Female)
{
orow["Gender"] = "her";
orow["SurName"] = "Ms.";
}
dtExperience.Rows.Add(orow);
}
if (dtExperience.Rows.Count > 0)
{
oviewer.ShowExperienceReport(dtExperience);
}
}
public DataTable GetDesignationChange(DateTime dEffectDate, DateTime dEffectDate2)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
PayrollDataSet.PayrollDataSet.EmpDesCatChangeDataTable dTEmpGBasic = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpDesCatChangeDataTable();
if (_lifeCycles != null || 0 > _lifeCycles.Count)
{
List<EmpLifeCycle> odesChange = _lifeCycles.Where(o => o.StatusDetailID.Integer == 16 && o.EffectDate >= dEffectDate && o.EffectDate <= dEffectDate2).ToList();
List<Designation> oDesignation = Designation.Get(EnumStatus.Regardless);
List<User> _users = User.Get(EnumSystemType.Desktop);
DataRow dr = null;
int count = 1;
ObjectsTemplate<Employee> oEmployees = Employee.Get();
//DataSet oEmpBasicGrade = EmployeeGradeSalary.GetEmpBasicGrade(dEffectDate, dEffectDate2);
//oEmpBasicGrade.Tables[0].Columns.Add("AuthorizedDate");
//DataSet oEmpPrvBasicGrade = EmployeeGradeSalary.GetEmpPrvBasicGrade(dEffectDate);
foreach (EmpLifeCycle oDRow in odesChange)
{
Employee emp = oEmployees.FirstOrDefault(o => o.ID == oDRow.EmployeeID);
dr = dTEmpGBasic.NewRow();
dr["SLNo"] = count;
dr["EmpNo"] = emp.EmployeeNo;
dr["Name"] = emp.Name;
dr["EffectDate"] = oDRow.EffectDate;
//dr["EnteryDate"] = oDRow["ENTRYDATE"];
dr["PresentDesignation"] = oDesignation.FirstOrDefault(o => o.ID == oDRow.DesignationID).Name;
dr["PresentCategory"] = "";
dr["CommitedBy"] = _users.FirstOrDefault(o => o.ID == oDRow.CreatedBy).Name;
dr["CommitedDate"] = oDRow.CreatedDate.ToString("dd MMM yyyy");
dr["ChangeType"] = "";
dr["StatusDate"] = oDRow.EffectDate.ToString("dd MMM yyyy");
EmpLifeCycle prev = _lifeCycles.Where(o => o.StatusDetailID.Integer == 10 && o.DesignationID != null && o.EmployeeID == oDRow.EmployeeID && o.EffectDate < dEffectDate).ToList().OrderByDescending(x => x.Sequence).FirstOrDefault(); //.FirstOrDefault(o => o.StatusDetailID.Integer == 10 );
if (prev != null)
{
dr["PreviousDesignation"] = oDesignation.FirstOrDefault(o => o.ID == prev.DesignationID).Name;
}
dTEmpGBasic.Rows.Add(dr);
count++;
}
}
return dTEmpGBasic;
}
public DataTable GetCategoryChange(DateTime dEffectDate, DateTime dEffectDate2)
{
List<EmpLifeCycle> _lifeCycles = EmpLifeCycle.Get(EnumStatus.Regardless);
PayrollDataSet.PayrollDataSet.EmpDesCatChangeDataTable dTEmpGBasic = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpDesCatChangeDataTable();
if (_lifeCycles != null || 0 > _lifeCycles.Count)
{
List<EmpLifeCycle> odesChange = _lifeCycles.Where(o => o.StatusDetailID.Integer == 17 && o.EffectDate >= dEffectDate && o.EffectDate <= dEffectDate2).ToList();
List<Category> oCategory = Category.Get(EnumStatus.Regardless);
List<User> _users = User.Get(EnumSystemType.Desktop);
DataRow dr = null;
int count = 1;
ObjectsTemplate<Employee> oEmployees = Employee.Get();
//DataSet oEmpBasicGrade = EmployeeGradeSalary.GetEmpBasicGrade(dEffectDate, dEffectDate2);
//oEmpBasicGrade.Tables[0].Columns.Add("AuthorizedDate");
//DataSet oEmpPrvBasicGrade = EmployeeGradeSalary.GetEmpPrvBasicGrade(dEffectDate);
foreach (EmpLifeCycle oDRow in odesChange)
{
Employee emp = oEmployees.FirstOrDefault(o => o.ID == oDRow.EmployeeID);
dr = dTEmpGBasic.NewRow();
dr["SLNo"] = count;
dr["EmpNo"] = emp.EmployeeNo;
dr["Name"] = emp.Name;
dr["EffectDate"] = oDRow.EffectDate;
//dr["EnteryDate"] = oDRow["ENTRYDATE"];
dr["PresentDesignation"] = "";
dr["PresentCategory"] = oCategory.FirstOrDefault(o => o.ID == oDRow.CategoryID).Name; ;
dr["CommitedBy"] = _users.FirstOrDefault(o => o.ID == oDRow.CreatedBy).Name;
dr["CommitedDate"] = oDRow.CreatedDate.ToString("dd MMM yyyy");
dr["ChangeType"] = "";
dr["StatusDate"] = oDRow.EffectDate.ToString("dd MMM yyyy");
EmpLifeCycle prev = _lifeCycles.Where(o => o.StatusDetailID.Integer == 19 && o.EffectDate < dEffectDate).ToList().OrderByDescending(x => x.Sequence).FirstOrDefault(); //.FirstOrDefault(o => o.StatusDetailID.Integer == 10 );
if (prev != null)
{
dr["PreviousCategory"] = oCategory.FirstOrDefault(o => o.ID == prev.CategoryID).Name;
}
dTEmpGBasic.Rows.Add(dr);
count++;
}
}
return dTEmpGBasic;
}
public DataTable GetEmployeeConfirmations(DateTime dConfirmationMonth)
{
bool isDesignationFromDescriptionText = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic);
ObjectsTemplate<EmployeeConfirmation> oEmpConfirms = EmployeeConfirmation.GetByDateRange(GlobalFunctions.FirstDateOfMonth(dConfirmationMonth), GlobalFunctions.LastDateOfMonth(dConfirmationMonth));
ObjectsTemplate<Employee> oAllEmployees = Employee.GetAllEmps();
DataRow oDR = null;
PayrollDataSet.PayrollDataSet.EmployeeConfirmationDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeeConfirmationDataTable();
if (oEmpConfirms == null) return dTable;
foreach (EmployeeConfirmation oConfirm in oEmpConfirms)
{
Employee oEmployee = oAllEmployees.Where(obj => obj.ID == oConfirm.EmployeeID).SingleOrDefault();
oDR = dTable.NewRow();
oDR["EmployeeNo"] = oEmployee.EmployeeNo;
oDR["Name"] = oEmployee.Name;
oDR["JoiningDate"] = oEmployee.JoiningDate.ToString("dd MMM yyyy");
oDR["ConfirmationDate"] = oConfirm.ConfirmDate.ToString("dd MMM yyyy");
oDR["Designation"] = isDesignationFromDescriptionText ? oEmployee.DescriptionText.Trim() : (oEmployee.Designation != null ? oEmployee.Designation.Name : string.Empty);
oDR["Department"] = oEmployee.Department != null ? oEmployee.Department.Name : string.Empty;
dTable.Rows.Add(oDR);
}
//**** 6 Month Auto Confirm Logic***************
//List<Employee> 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 void EmployeeConfirmationReport(DateTime dConfirmationMonth)
{
DataTable oDTable = null;
DataSet dSet = new DataSet();
oDTable = GetEmployeeConfirmations(dConfirmationMonth);
fReportViewer form = new fReportViewer();
oDTable.TableName = "PayrollDataSet_EmployeeConfirmation";
string RDLC = "Payroll.Report.RDLC.EmployeeConfirmation.rdlc";
dSet.Tables.Add(oDTable);
form.ShowDlgForEmployeeConfirmation(dSet, RDLC, dConfirmationMonth);
}
internal void ShowEmpRCAssigned()
{
fReportViewer form = new fReportViewer();
DataSet dSet = new DataSet();
dSet.Tables.Add(ExportEmpRCAssignedInfo());
//List<ReportParameter> parameters = new List<ReportParameter>();
//parameters.Add(new ReportParameter("BankName", _selectedParameter.Banks[0].Name));
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.rptRCAssignedEmp.rdlc", null);
}
internal DataTable ExportEmpRCAssignedInfo()
{
DataSet oEmpNomineeDetails = Employee.GetRCAssignedEmp();
oEmpNomineeDetails.Tables[0].TableName = "dsCompany_dtRCAssignedEmp";
return oEmpNomineeDetails.Tables[0].Copy();
}
internal void ShowEmpRCNotAssigned()
{
fReportViewer form = new fReportViewer();
DataSet dSet = new DataSet();
dSet.Tables.Add(ExportEmpRCNotAssignedInfo());
//List<ReportParameter> parameters = new List<ReportParameter>();
//parameters.Add(new ReportParameter("BankName", _selectedParameter.Banks[0].Name));
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.rptRCNotAssignedEmp.rdlc", null);
}
internal void ShowDeptWiseHeadCount(EnumHeadCount enumHeadCount)
{
fReportViewer form = new fReportViewer();
DataSet dSet = new DataSet();
ObjectsTemplate<Employee> oEmployees = new ObjectsTemplate<Employee>();
oEmployees = Employee.Get().Where(x => x.Status == EnumEmployeeStatus.Live).ToObjectsTemplate();
ObjectsTemplate<Department> oDepartments = new ObjectsTemplate<Department>();
oDepartments = Department.Get();
List<string> strs = new List<string>();
int nCo = 1;
foreach (Employee oEmp in oEmployees)
{
Department oDept = null;
oDept = oDepartments.Where(x => x.ID == oEmp.DepartmentID).FirstOrDefault();
if (oDept != null)
{
string[] depts = GlobalFunctions.FindDivisionDeparmentUnit(oDept, oDepartments);
strs.Add(depts[(int)enumHeadCount]);
}
nCo++;
}
var query = strs.GroupBy(s => s).Select(grp => new { Name = grp.Key, Count = grp.Count() });
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Count", typeof(int));
DataRow dr = null;
foreach (var item in query)
{
if ((enumHeadCount == EnumHeadCount.DepartmentWise && !string.IsNullOrEmpty(item.Name))
|| enumHeadCount == EnumHeadCount.DivisionWise)
{
dr = dt.NewRow();
dr["Name"] = item.Name;
dr["Count"] = item.Count;
dt.Rows.Add(dr);
}
}
//List<ReportParameter> parameters = new List<ReportParameter>();
//parameters.Add(new ReportParameter("BankName", _selectedParameter.Banks[0].Name));
dt.TableName = "PayrollDataSet_DeptwiseEmpCount";
dSet.Tables.Add(dt);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.DeptwiseEmpCount.rdlc", null);
}
internal DataTable ExportEmpRCNotAssignedInfo()
{
DataSet oEmpNomineeDetails = Employee.GetRCNotAssignedEmp();
oEmpNomineeDetails.Tables[0].TableName = "dsCompany_dtRCNotAssignedEmp";
return oEmpNomineeDetails.Tables[0].Copy();
}
}
public class SerialNumber
{
public int SerialNo { get; set; }
public string ItemName { get; set; }
}
}