794 lines
39 KiB
C#
794 lines
39 KiB
C#
using DocumentFormat.OpenXml.Drawing.Charts;
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
|
using HRM.BO;
|
|
using HRM.DA;
|
|
using HRM.Report;
|
|
using iTextSharp.text.pdf.parser.clipper;
|
|
using Microsoft.Reporting.NETCore;
|
|
using NPOI.SS.Formula.Functions;
|
|
using NPOI.SS.UserModel;
|
|
using Payroll.BO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
namespace Payroll.Report
|
|
{
|
|
public class rptPmp
|
|
{
|
|
//private ObjectsTemplate<PMPRating> allRatings = PMPRating.Get(EnumStatus.Active);
|
|
//private string GetRatingName(ID selfRating)
|
|
//{
|
|
// string des = String.Empty;
|
|
// if (selfRating != null)
|
|
// {
|
|
// if (!selfRating.IsUnassigned)
|
|
// {
|
|
// var sRating = allRatings.Where(ob => ob.ID.Integer == selfRating.Integer);
|
|
// if (sRating.Count() == 1) des = sRating.First().RatingValue;
|
|
// }
|
|
// }
|
|
// return des;
|
|
//}
|
|
//public DataTable GetEmployeePMPObjectives(ID empid, ID pmpProcessid)
|
|
//{
|
|
// PayrollDataSet.PayrollDataSet.PmpobjectivesDataTable dTEmpPMPobjectiveData = new PayrollDataSet.PayrollDataSet.PmpobjectivesDataTable();
|
|
// ObjectsTemplate<PMPTargetSetting> allTargets = PMPProcess.GetPMPTargetSettingsByEmployeeIdAndPMPProcessID(empid, pmpProcessid);
|
|
// foreach (PMPTargetSetting obTarget in allTargets)
|
|
// {
|
|
// DataRow dr = dTEmpPMPobjectiveData.NewRow();
|
|
// dr["Objectives"] = obTarget.Objective;
|
|
// dr["EvaluationCriteria"] = obTarget.EvaluationCriteria;
|
|
// dr["TargetDate"] = obTarget.TargetDate;
|
|
// dr["Priority"] = obTarget.ObjectivePercent.ToString() + "%";
|
|
// dr["SelfComments"] = obTarget.SelfComments;
|
|
// dr["SelfRating"] = GetRatingName(obTarget.SelfRatingID);
|
|
// dr["ManagerComments"] = obTarget.ApprovarComments;
|
|
// dr["ManagerRating"] = GetRatingName(obTarget.ApprovarRatingID);
|
|
// dTEmpPMPobjectiveData.Rows.Add(dr);
|
|
// }
|
|
// dTEmpPMPobjectiveData.TableName = "PayrollDataSet_Pmpobjectives";
|
|
// return dTEmpPMPobjectiveData;
|
|
//}
|
|
//public DataTable GetBasicPMPDataForEmployee(ID empId, ID pmpProcessID)
|
|
//{
|
|
// PayrollDataSet.PayrollDataSet.PmpbasicDataTable oDtPmpBasicEmp = new Payroll.Report.PayrollDataSet.PayrollDataSet.PmpbasicDataTable();
|
|
// ObjectsTemplate<OrganogramEmployee> obOrEmp = OrganogramEmployee.GetByEmp(empId);
|
|
// PMPEmployeeRating obEmpRating = PMPProcess.GetPmpEmployeeRatingByEmployeeIdAndPmpProcessId(empId, pmpProcessID);
|
|
// DataRow dr;
|
|
// dr = oDtPmpBasicEmp.NewRow();
|
|
// ObjectsTemplate<Employee> oEmp = Employee.GetByEmpIDs(empId.Integer.ToString());
|
|
// string managerName = String.Empty;
|
|
// string managerPosition = String.Empty;
|
|
// if (obEmpRating != null)
|
|
// {
|
|
// Employee ObEm = Employee.Get(obEmpRating.ApprovarID);
|
|
// ObjectsTemplate<OrganogramEmployee> ObManagerOragn = OrganogramEmployee.GetByEmp(ObEm.ID);
|
|
// if (ObManagerOragn.Count == 1)
|
|
// {
|
|
// OrganogramBasic ObOrganManagerBasic = OrganogramBasic.Get(ObManagerOragn[0].NodeID);
|
|
// managerPosition = ObOrganManagerBasic.PositionName;
|
|
// }
|
|
// if (ObEm != null)
|
|
// {
|
|
// managerName = ObEm.Name;
|
|
// }
|
|
// }
|
|
// dr["NameOfManager"] = managerName;
|
|
// dr["ManagerPosition"] = managerPosition;
|
|
// string dpt = String.Empty;
|
|
// if (oEmp.Count == 1)
|
|
// {
|
|
// dr["AssociateName"] = oEmp[0].Name;
|
|
// try
|
|
// {
|
|
// if (!oEmp[0].DepartmentID.IsUnassigned)
|
|
// {
|
|
// dpt = Department.Get(oEmp[0].DepartmentID).Name;
|
|
// }
|
|
// if (oEmp[0].JoiningDate != null && oEmp[0].JoiningDate != DateTime.MinValue)
|
|
// {
|
|
// dr["JoiningDate"] = oEmp[0].JoiningDate.ToString("yyyy");
|
|
// }
|
|
// dr["Country"] = "Bangladesh";
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// }
|
|
// }
|
|
// dr["BusinessUnit"] = dpt;
|
|
// string prPos = String.Empty;
|
|
// string nextLevelEmpName = String.Empty;
|
|
// string nextLevelEmpPos = String.Empty;
|
|
// if (obOrEmp.Count >= 1)
|
|
// {
|
|
// OrganogramBasic obOrganBasic = OrganogramBasic.Get(obOrEmp[0].NodeID);
|
|
// if (obOrganBasic != null)
|
|
// {
|
|
// prPos = obOrganBasic.PositionName;
|
|
// }
|
|
// try
|
|
// {
|
|
// if (!obOrganBasic.ParentID.IsUnassigned)
|
|
// {
|
|
// OrganogramBasic obParentEmp = obOrganBasic.Parent;
|
|
// if (obParentEmp.EmployeeAssigned)
|
|
// {
|
|
// Employee obParEmp = obParentEmp.GetAssignedEmployee();
|
|
// nextLevelEmpName = obParEmp.Name;
|
|
// nextLevelEmpPos = obParentEmp.PositionName;
|
|
// }
|
|
// }
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// }
|
|
// }
|
|
// dr["PresentPosition"] = prPos;
|
|
// dr["NameOfNextLevelManager"] = nextLevelEmpName;
|
|
// dr["PositionOfNextLevelManager"] = nextLevelEmpPos;
|
|
// oDtPmpBasicEmp.Rows.Add(dr);
|
|
// oDtPmpBasicEmp.TableName = "PayrollDataSet_Pmpbasic";
|
|
// return oDtPmpBasicEmp;
|
|
//}
|
|
//public DataTable GetPmpEmpValueBehaviorRatings(ID empID, ID pmpProcessId)
|
|
//{
|
|
// PayrollDataSet.PayrollDataSet.PmpEmpValueBehaviorRatingsDataTable oDtPmpempBehaviorratings = new Payroll.Report.PayrollDataSet.PayrollDataSet.PmpEmpValueBehaviorRatingsDataTable();
|
|
// ObjectsTemplate<PMPValueBehavior> allBehaviors = PMPValueBehavior.Get(EnumStatus.Active);
|
|
// ObjectsTemplate<PMPValueBehaviorRating> allVelueBehaviors = PMPProcess.GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(empID, pmpProcessId);
|
|
// if (allVelueBehaviors.Count >= 1)
|
|
// {
|
|
// foreach (PMPValueBehaviorRating obrRatings in allVelueBehaviors)
|
|
// {
|
|
// DataRow dr = oDtPmpempBehaviorratings.NewRow();
|
|
// var source = allBehaviors.Where(ob => ob.ID.Integer == obrRatings.PMPValueBehaviorID.Integer);
|
|
// string des = String.Empty;
|
|
// if (source.Count() == 1)
|
|
// {
|
|
// des = source.First().Name;
|
|
// }
|
|
// dr["ValueBehavior"] = des;
|
|
// dr["SelfRating"] = GetRatingName(obrRatings.SelfRatingID);
|
|
// dr["ManagerRating"] = GetRatingName(obrRatings.ApprovarRatingID);
|
|
// dr["SelfComments"] = obrRatings.SelfComments;
|
|
// dr["ManagerComments"] = obrRatings.ApprovarComments;
|
|
// oDtPmpempBehaviorratings.Rows.Add(dr);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// DataRow dr = oDtPmpempBehaviorratings.NewRow();
|
|
// dr["ValueBehavior"] = String.Empty;
|
|
// dr["SelfRating"] = String.Empty;
|
|
// dr["ManagerRating"] = String.Empty;
|
|
// dr["SelfComments"] = String.Empty;
|
|
// dr["ManagerComments"] = String.Empty;
|
|
// oDtPmpempBehaviorratings.Rows.Add(dr);
|
|
// }
|
|
// oDtPmpempBehaviorratings.TableName = "PayrollDataSet_PmpEmpValueBehaviorRatings";
|
|
// return oDtPmpempBehaviorratings;
|
|
//}
|
|
|
|
public byte[] getIDPReportData(int EmpID, string reportType, int? pmpYearID, int payrollTypeId, int objectiveSetID)
|
|
{
|
|
DataRow dr = null;
|
|
DataRow dr2 = null;
|
|
int count = 0;
|
|
|
|
Employee oEmployee = new EmployeeService().Get(EmpID);
|
|
List<Department> oDepartments = new DepartmentService().GetAll();
|
|
List<Designation> oDesignations = new DesignationService().GetAll();
|
|
List<Grade> oGrades = new GradeService().GetAll();
|
|
Location oLocation = new LocationService().GetByEmployeeID(EmpID);
|
|
PMPProcess oPMPProcess;
|
|
List<TrainingNeedAnalysis> oTrainings = new TrainingNeedAnalysisService().GetTrainingNeedAnalysisByEmployeeObjectiveSet(EmpID, objectiveSetID);
|
|
ObjectiveSet objectiveSet = new ObjectiveSetService().Get(objectiveSetID);
|
|
if (pmpYearID != null)
|
|
{
|
|
oPMPProcess = new PMPProcessService().GetByPMPProcessID(pmpYearID.Value);
|
|
}
|
|
else
|
|
{
|
|
oPMPProcess = new PMPProcessService().GetByPMPProcessID(objectiveSet.PMPYearID);
|
|
|
|
}
|
|
|
|
|
|
|
|
System.Data.DataTable employeeInformation = CreateIDPEmployeeInfoTable();
|
|
System.Data.DataTable idpTrainings = CreateIDPTrainingsTable();
|
|
|
|
dr = employeeInformation.NewRow();
|
|
dr["Name"] = oEmployee?.Name;
|
|
dr["Department"] = oDepartments.Find(x => x.ID == oEmployee.DepartmentID)?.Name;
|
|
dr["Designation"] = oDesignations.Find(x => x.ID == oEmployee.DesignationID)?.Name;
|
|
dr["Grade"] = oGrades.Find(x => x.ID == oEmployee.GradeID)?.Name;
|
|
dr["Location"] = oLocation?.Name;
|
|
dr["Period"] = oPMPProcess?.Description;
|
|
dr["ID"] = oEmployee?.EmployeeNo;
|
|
dr["Date"] = DateTime.Now.ToString("dd MMM yyyy");
|
|
dr["CareerExpectation"] = objectiveSet.CareerExpectations;
|
|
employeeInformation.Rows.Add(dr);
|
|
|
|
foreach (TrainingNeedAnalysis oTraining in oTrainings)
|
|
{
|
|
count++;
|
|
dr2 = idpTrainings.NewRow();
|
|
dr2["SLNO"] = count.ToString();
|
|
dr2["Objectives"] = string.Empty;
|
|
dr2["Weightage"] = GetNeedTypeDisplayName((EnumNeedType)oTraining.NeedType);
|
|
dr2["Learnings"] = oTraining.Name;
|
|
dr2["Resources"] = oTraining.Description;
|
|
dr2["ReviewDate"] = oTraining.ExpectedDate;
|
|
dr2["ExpectedResults"] = oTraining.ExpectedResults;
|
|
idpTrainings.Rows.Add(dr2);
|
|
}
|
|
DataSet dSet = new DataSet();
|
|
employeeInformation.TableName = "PayrollDataSet_IDPEmployeeInfo";
|
|
idpTrainings.TableName = "PayrollDataSet_IDPTrainings";
|
|
dSet.Tables.Add(employeeInformation);
|
|
dSet.Tables.Add(idpTrainings);
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "IDPReport.rdlc";
|
|
return reportProcessor.CommonReportViewForReports(null, dSet, null, rdlcName, null, true, payrollTypeId, reportType);
|
|
}
|
|
private string GetNeedTypeDisplayName(EnumNeedType needType)
|
|
{
|
|
switch (needType)
|
|
{
|
|
case EnumNeedType.OnTheJob:
|
|
return "Job Related Learning / Experience Experiential Learning (70)";
|
|
case EnumNeedType.CoachingOrMentoring:
|
|
return "Coaching (20)";
|
|
case EnumNeedType.FormalLearning:
|
|
return "Training / Formal Classroom Session (10)";
|
|
default:
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
#region getPmsKpiAssessmentReport
|
|
|
|
public byte[] getPmsKpiAssessmentReport(int EmpID, int pmpYearID, string reportType, int payrollTypeId, string reportName)
|
|
{
|
|
Employee oEmployee = new EmployeeService().Get(EmpID);
|
|
List<Department> oDepartments = new DepartmentService().GetAll();
|
|
List<Designation> oDesignations = new DesignationService().GetAll();
|
|
List<Grade> oGrades = new GradeService().GetAll();
|
|
Location oLocation = new LocationService().GetByEmployeeID(EmpID);
|
|
PMPProcess oPMPProcess = new PMPProcessService().GetByPMPProcessID(pmpYearID);
|
|
Designation oDesignation = new Designation();
|
|
Department oDepartment = new Department();
|
|
Grade oGrade = new Grade();
|
|
Employee oLineManager = null;
|
|
|
|
if (oEmployee != null && oEmployee.LineManagerID != null && oEmployee.LineManagerID != 0)
|
|
{
|
|
oLineManager = new EmployeeService().Get(oEmployee.LineManagerID.Value);
|
|
}
|
|
|
|
string lineManagerName = oLineManager?.Name ?? string.Empty;
|
|
string lineManagerDesignation = string.Empty;
|
|
|
|
if (oLineManager?.DesignationID != null)
|
|
{
|
|
Designation lmDesignation = oDesignations
|
|
.Find(x => x.ID == oLineManager.DesignationID);
|
|
|
|
lineManagerDesignation = lmDesignation?.Name ?? string.Empty;
|
|
}
|
|
|
|
Employee oSecondLineManager = null;
|
|
|
|
if (oLineManager != null && oLineManager.LineManagerID != null && oLineManager.LineManagerID != 0)
|
|
{
|
|
oSecondLineManager = new EmployeeService()
|
|
.Get(oLineManager.LineManagerID.Value);
|
|
}
|
|
|
|
string secondLineManagerName = oSecondLineManager?.Name ?? string.Empty;
|
|
|
|
string secondLineManagerDesignation = string.Empty;
|
|
|
|
if (oSecondLineManager?.DesignationID != null)
|
|
{
|
|
Designation secondLMDesignation = oDesignations
|
|
.Find(x => x.ID == oSecondLineManager.DesignationID);
|
|
|
|
secondLineManagerDesignation = secondLMDesignation?.Name ?? string.Empty;
|
|
}
|
|
|
|
|
|
if (oEmployee.DesignationID != null)
|
|
oDesignation = oDesignations.Find(x => x.ID == oEmployee.DesignationID) ?? new Designation();
|
|
if (oEmployee.DepartmentID != null)
|
|
oDepartment = oDepartments.Find(x => x.ID == oEmployee.DepartmentID) ?? new Department();
|
|
if (oEmployee.GradeID != null)
|
|
oGrade = oGrades.Find(x => x.ID == oEmployee.GradeID) ?? new Grade();
|
|
|
|
ObjectiveSet oObjectiveSet = new ObjectiveSetService().GetObjectiveSetWithChild(EmpID, pmpYearID, false);
|
|
if (oObjectiveSet == null)
|
|
throw new Exception("Selected employee not available in Objective Set");
|
|
|
|
List<ObjectiveType> oObjectiveTypes = new ObjectiveTypeService().Get(EnumStatus.Regardless, payrollTypeId);
|
|
List<PMPRating> oObjectiveRatings = new PMPRatingService().GetPMPRatingByTypeAndYear(EnumPMPRatingType.Objective, pmpYearID);
|
|
|
|
|
|
|
|
DataSet dSet = new DataSet();
|
|
string rdlcName = "";
|
|
List<ReportParameter> _parameters = new List<ReportParameter>();
|
|
|
|
ReportParameter parameter = new ReportParameter("Name", oEmployee?.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("ID", oEmployee?.EmployeeNo);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Designation", oDesignation.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Department", oDepartment.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Location", oLocation?.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Grade", oGrade.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Date", DateTime.Now.ToString("dd MMM yyyy"));
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("PeriodOrYear", oPMPProcess?.Description);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("CompanyInfo", "SQUARE Food & Beverage Limited");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("LineManagerName", lineManagerName);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("LMDesignation", lineManagerDesignation);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("SLMName", secondLineManagerName);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("SLMDesignation", secondLineManagerDesignation);
|
|
_parameters.Add(parameter);
|
|
string commentsofAppraisee = string.Empty;
|
|
string commentsOfAppraiseeLM = string.Empty;
|
|
string commentsOfAppraiseeSLM = string.Empty;
|
|
|
|
commentsofAppraisee = oObjectiveSet?.ObjectiveSetRemarks?.YearEndEmpReviewOne;
|
|
commentsOfAppraiseeLM = oObjectiveSet.ObjectiveSetRemarks?.YearEndLMReviewOne;
|
|
commentsOfAppraiseeSLM = oObjectiveSet?.ObjectiveSetRemarks?.YearEndSecondLMReviewOne;
|
|
|
|
if (reportName == "Evaluation")
|
|
{
|
|
HRM.Report.PayrollDataSet.PMPDataSet.dtEmployeeEvaluationKPIDataTable evaluationKPI =
|
|
new HRM.Report.PayrollDataSet.PMPDataSet.dtEmployeeEvaluationKPIDataTable();
|
|
|
|
List<Objective> oObjectives = oObjectiveSet.Objectives
|
|
.Where(o => o.KPIType == EnumObjectiveType.KPI)
|
|
.ToList();
|
|
|
|
int cnt = 1;
|
|
|
|
|
|
foreach (Objective oObjective in oObjectives)
|
|
{
|
|
DataRow drKpi = evaluationKPI.NewRow();
|
|
Console.WriteLine(evaluationKPI);
|
|
|
|
ObjectiveType oObjectiveType = oObjectiveTypes.Find(x => x.ID == oObjective.ObjectiveType);
|
|
|
|
drKpi["Sl_No"] = cnt++;
|
|
drKpi["Area"] = oObjectiveType?.Name;
|
|
drKpi["KeyStatement"] = oObjective.Title;
|
|
drKpi["TargetMeasurable"] = oObjective.MeasuresOfSuccess;
|
|
|
|
if (oObjective.StartDate != DateTime.MinValue && oObjective.EndDate != DateTime.MinValue)
|
|
drKpi["TimeFrame"] = oObjective.StartDate.ToString("dd MMM yyyy") + " - " + oObjective.EndDate.ToString("dd MMM yyyy");
|
|
else
|
|
drKpi["TimeFrame"] = string.Empty;
|
|
|
|
drKpi["Weightage"] = oObjective.Weightages;
|
|
drKpi["Explanation"] = oObjective.YEEmployeeComments;
|
|
drKpi["SelfAchieve"] = oObjective.YEEmpMark;
|
|
drKpi["N1Achieve"] = oObjective.YELMMark;
|
|
drKpi["N2Achieve"] = oObjective.YESecondLMMark;
|
|
evaluationKPI.Rows.Add(drKpi);
|
|
}
|
|
double kpiWeightageTotal = oObjectives.Sum(o => o.Weightages);
|
|
double KpiSelfAchieveTotal = oObjectives.Sum(o => o.YEEmpMark);
|
|
double KpiN1AchieveTotal = oObjectives.Sum(o => o.YELMMark);
|
|
double KpiN2AchieveTotal = oObjectives.Sum(o => o.YESecondLMMark);
|
|
|
|
|
|
|
|
evaluationKPI.TableName = "dtEmployeeEvaluationKPI_PMPDataSet";
|
|
dSet.Tables.Add(evaluationKPI);
|
|
rdlcName = "PmsReport.rdlc";
|
|
|
|
parameter = new ReportParameter("TotalWeightage", kpiWeightageTotal.ToString() + " %");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("TotalSelfAchieve", KpiSelfAchieveTotal.ToString() + " %");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("TotalN1Achieve", KpiN1AchieveTotal.ToString() + " %");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("TotalN2Achieve", KpiN2AchieveTotal.ToString() + " %");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("ReportName", "Evaluation Form (Functional)");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("EmployeeComments", commentsofAppraisee);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("LMComments", commentsOfAppraiseeLM);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("SLMComments", commentsOfAppraiseeSLM);
|
|
_parameters.Add(parameter);
|
|
}
|
|
else
|
|
{
|
|
HRM.Report.PayrollDataSet.PMPDataSet.dtKpiSettingFormDataTable kpiSetting =
|
|
new HRM.Report.PayrollDataSet.PMPDataSet.dtKpiSettingFormDataTable();
|
|
|
|
List<Objective> oObjectives = oObjectiveSet.Objectives
|
|
.Where(o => o.KPIType == EnumObjectiveType.KPI)
|
|
.ToList();
|
|
|
|
int cnt = 1;
|
|
|
|
foreach (Objective oObjective in oObjectives)
|
|
{
|
|
DataRow drKpi = kpiSetting.NewRow();
|
|
|
|
ObjectiveType oObjectiveType = oObjectiveTypes.Find(x => x.ID == oObjective.ObjectiveType);
|
|
|
|
drKpi["Sl_No"] = cnt++;
|
|
drKpi["Area"] = oObjectiveType?.Name;
|
|
drKpi["KeyStatement"] = oObjective.Description;
|
|
drKpi["Target"] = oObjective.MeasuresOfSuccess;
|
|
|
|
if (oObjective.EndDate != DateTime.MinValue)
|
|
drKpi["TimeFrame"] = oObjective.EndDate.ToString("MMM yyyy");
|
|
else
|
|
drKpi["TimeFrame"] = string.Empty;
|
|
|
|
drKpi["Weightage"] = oObjective.Weightages;
|
|
|
|
kpiSetting.Rows.Add(drKpi);
|
|
}
|
|
double kpiWeightageTotal = oObjectives.Sum(o => o.Weightages);
|
|
|
|
kpiSetting.TableName = "dtKpiSettingForm";
|
|
dSet.Tables.Add(kpiSetting);
|
|
rdlcName = "PmsKpiSettingFormReport.rdlc";
|
|
|
|
parameter = new ReportParameter("TotalWeightage", kpiWeightageTotal.ToString() + " %");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("ReportName", "KPI Setting Form (Functional)");
|
|
_parameters.Add(parameter);
|
|
}
|
|
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
return reportProcessor.CommonReportViewForPmsReports(null, dSet, null, rdlcName, _parameters, true, payrollTypeId, reportType);
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region getPmsAssessmentForm
|
|
|
|
public byte[] getPmsAssessmentForm(int EmpID, int pmpYearID, string reportType, int payrollTypeId)
|
|
{
|
|
Employee oEmployee = new EmployeeService().Get(EmpID);
|
|
List<Department> oDepartments = new DepartmentService().GetAll();
|
|
List<Designation> oDesignations = new DesignationService().GetAll();
|
|
List<Grade> oGrades = new GradeService().GetAll();
|
|
Location oLocation = new LocationService().GetByEmployeeID(EmpID);
|
|
PMPProcess oPMPProcess = new PMPProcessService().GetByPMPProcessID(pmpYearID);
|
|
Designation oDesignation = new Designation();
|
|
Department oDepartment = new Department();
|
|
Grade oGrade = new Grade();
|
|
|
|
if (oEmployee.DesignationID != null)
|
|
oDesignation = oDesignations.Find(x => x.ID == oEmployee.DesignationID) ?? new Designation();
|
|
if (oEmployee.DepartmentID != null)
|
|
oDepartment = oDepartments.Find(x => x.ID == oEmployee.DepartmentID) ?? new Department();
|
|
if (oEmployee.GradeID != null)
|
|
oGrade = oGrades.Find(x => x.ID == oEmployee.GradeID) ?? new Grade();
|
|
|
|
ObjectiveSet oObjectiveSet = new ObjectiveSetService().GetObjectiveSetWithChild(EmpID, pmpYearID, false);
|
|
if (oObjectiveSet == null)
|
|
throw new Exception("Selected employee not available in Objective Set");
|
|
|
|
List<ObjectiveType> oObjectiveTypes = new ObjectiveTypeService().Get(EnumStatus.Regardless, payrollTypeId);
|
|
List<PMPRating> oObjectiveRatings = new PMPRatingService().GetPMPRatingByTypeAndYear(EnumPMPRatingType.Objective, pmpYearID);
|
|
|
|
HRM.Report.PayrollDataSet.PMPDataSet.dtAssessmentCriteriaFormDataTable assessmentCriteria =
|
|
new HRM.Report.PayrollDataSet.PMPDataSet.dtAssessmentCriteriaFormDataTable();
|
|
|
|
HRM.Report.PayrollDataSet.PMPDataSet.dtAssessmentCriteriaResultDataTable assessmetCriteriaResult =
|
|
new HRM.Report.PayrollDataSet.PMPDataSet.dtAssessmentCriteriaResultDataTable();
|
|
|
|
foreach (var item in oObjectiveRatings.AsEnumerable().Reverse())
|
|
{
|
|
DataRow drAC = assessmentCriteria.NewRow();
|
|
drAC["PerformanceStandard"] = item.Description;
|
|
drAC["MarkingSystem"] = item.FromPercent.ToString() + " - " + item.ToPercent.ToString();
|
|
drAC["PerformanceRating"] = item.Name;
|
|
assessmentCriteria.Rows.Add(drAC);
|
|
}
|
|
|
|
List<Objective> oKpiObjectives = oObjectiveSet.Objectives
|
|
.Where(o => o.KPIType == EnumObjectiveType.KPI)
|
|
.ToList();
|
|
|
|
List<Objective> oLeadershipObjectives = oObjectiveSet.Objectives
|
|
.Where(o => o.KPIType == EnumObjectiveType.Leadership)
|
|
.ToList();
|
|
|
|
double kpiWeightagePercent = Math.Round(oKpiObjectives.Sum(o => o.Weightages), 2);
|
|
double leadershipWeightagePercent = Math.Round(oLeadershipObjectives.Sum(o => o.Weightages), 2);
|
|
double kpiWeightagePoints = oObjectiveSet.EMPObjAchive;
|
|
double leadershipWeightagePoints = oObjectiveSet.LMObjAchive;
|
|
|
|
DataRow drKpi = assessmetCriteriaResult.NewRow();
|
|
drKpi["MarkingCriteria"] = "KPI (Functional)";
|
|
drKpi["Weightage"] = kpiWeightagePercent;
|
|
drKpi["SelfAchieve"] = Math.Round(oKpiObjectives.Sum(o => o.YEEmpMark), 3);
|
|
drKpi["N1Achieve"] = Math.Round(oKpiObjectives.Sum(o => o.YELMMark), 3);
|
|
drKpi["N2Achieve"] = Math.Round(oKpiObjectives.Sum(o => o.YESecondLMMark), 3);
|
|
double totalValue = (oKpiObjectives.Sum(o => o.YEEmpMark) + oKpiObjectives.Sum(o => o.YELMMark) + oKpiObjectives.Sum(o => o.YESecondLMMark));
|
|
drKpi["WeightagePoints"] = Math.Round((totalValue / 3), 2);
|
|
assessmetCriteriaResult.Rows.Add(drKpi);
|
|
|
|
DataRow drLeadership = assessmetCriteriaResult.NewRow();
|
|
drLeadership["MarkingCriteria"] = "Leadership Assessment";
|
|
drLeadership["Weightage"] = leadershipWeightagePercent;
|
|
drLeadership["SelfAchieve"] = Math.Round(oLeadershipObjectives.Sum(o => o.YEEmpMark), 3);
|
|
drLeadership["N1Achieve"] = Math.Round(oLeadershipObjectives.Sum(o => o.YELMMark), 3);
|
|
drLeadership["N2Achieve"] = Math.Round(oLeadershipObjectives.Sum(o => o.YESecondLMMark), 3);
|
|
double totalValueForLeadership = (oLeadershipObjectives.Sum(o => o.YEEmpMark) + oLeadershipObjectives.Sum(o => o.YELMMark) + oLeadershipObjectives.Sum(o => o.YESecondLMMark));
|
|
drLeadership["WeightagePoints"] = Math.Round((totalValueForLeadership / 3), 2);
|
|
assessmetCriteriaResult.Rows.Add(drLeadership);
|
|
|
|
DataSet dSet = new DataSet();
|
|
assessmentCriteria.TableName = "dtAssessmentCriteriaForm";
|
|
dSet.Tables.Add(assessmentCriteria);
|
|
|
|
assessmetCriteriaResult.TableName = "dtAssessmentCriteriaResult";
|
|
dSet.Tables.Add(assessmetCriteriaResult);
|
|
|
|
|
|
double totalRating = Math.Round(((totalValue / 3) + (totalValueForLeadership / 3)),2);
|
|
|
|
string gradeComment = string.Empty;
|
|
string gradeLetter = string.Empty;
|
|
PMPRating oMatchedRating = oObjectiveRatings.Find(r =>
|
|
totalRating >= r.FromPercent && totalRating <= r.ToPercent);
|
|
if (oMatchedRating != null)
|
|
{
|
|
gradeComment = oMatchedRating.Description;
|
|
gradeLetter = oMatchedRating.Name;
|
|
}
|
|
|
|
List<ReportParameter> _parameters = new List<ReportParameter>();
|
|
|
|
ReportParameter parameter = new ReportParameter("Name", oEmployee?.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("ID", oEmployee?.EmployeeNo);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Designation", oDesignation.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Department", oDepartment.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Location", oLocation?.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Grade", oGrade.Name);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Date", DateTime.Now.ToString("dd MMM yyyy"));
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("PeriodOrYear", oPMPProcess?.Description);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("RatingTotal", totalRating.ToString());
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("Comment", gradeComment);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("RatingGrade", gradeLetter);
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("CompanyInfo", "SQUARE Food & Beverage Limited");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("ReportName", "Assessment Form");
|
|
_parameters.Add(parameter);
|
|
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "PmsAssessmentReport.rdlc";
|
|
return reportProcessor.CommonReportViewForPmsReports(null, dSet, null, rdlcName, _parameters, true, payrollTypeId, reportType);
|
|
}
|
|
#endregion
|
|
|
|
#region getPmsDevelopmentPlanForm
|
|
|
|
public byte[] getPmsDevelopmentPlanReport(int EmpID, string reportType, int? pmpYearID, int payrollTypeId, int objectiveSetID)
|
|
{
|
|
DataRow dr = null;
|
|
DataRow dr2 = null;
|
|
int count = 0;
|
|
|
|
Employee oEmployee = new EmployeeService().Get(EmpID);
|
|
List<Department> oDepartments = new DepartmentService().GetAll();
|
|
List<Designation> oDesignations = new DesignationService().GetAll();
|
|
List<Grade> oGrades = new GradeService().GetAll();
|
|
Location oLocation = new LocationService().GetByEmployeeID(EmpID);
|
|
PMPProcess oPMPProcess;
|
|
List<TrainingNeedAnalysis> oTrainings = new TrainingNeedAnalysisService().GetTrainingNeedAnalysisByEmployeeObjectiveSet(EmpID, objectiveSetID);
|
|
ObjectiveSet objectiveSet = new ObjectiveSetService().Get(objectiveSetID);
|
|
if (pmpYearID != null)
|
|
{
|
|
oPMPProcess = new PMPProcessService().GetByPMPProcessID(pmpYearID.Value);
|
|
}
|
|
else
|
|
{
|
|
oPMPProcess = new PMPProcessService().GetByPMPProcessID(objectiveSet.PMPYearID);
|
|
|
|
}
|
|
|
|
|
|
|
|
System.Data.DataTable employeeInformation = CreateIDPEmployeeInfoTable();
|
|
System.Data.DataTable idpTrainings = CreateIDPTrainingsTable();
|
|
|
|
dr = employeeInformation.NewRow();
|
|
dr["Name"] = oEmployee?.Name;
|
|
dr["Department"] = oDepartments.Find(x => x.ID == oEmployee.DepartmentID)?.Name;
|
|
dr["Designation"] = oDesignations.Find(x => x.ID == oEmployee.DesignationID)?.Name;
|
|
dr["Grade"] = oGrades.Find(x => x.ID == oEmployee.GradeID)?.Name;
|
|
dr["Location"] = oLocation?.Name;
|
|
dr["Period"] = oPMPProcess?.Description;
|
|
dr["ID"] = oEmployee?.EmployeeNo;
|
|
dr["Date"] = DateTime.Now.ToString("dd MMM yyyy");
|
|
dr["CareerExpectation"] = objectiveSet.CareerExpectations;
|
|
employeeInformation.Rows.Add(dr);
|
|
|
|
foreach (TrainingNeedAnalysis oTraining in oTrainings)
|
|
{
|
|
count++;
|
|
dr2 = idpTrainings.NewRow();
|
|
dr2["SLNO"] = count.ToString();
|
|
dr2["Objectives"] = string.Empty;
|
|
dr2["Weightage"] = GetTypeDisplayName((EnumNeedType)oTraining.NeedType);
|
|
dr2["Learnings"] = oTraining.Name;
|
|
dr2["Resources"] = oTraining.Description;
|
|
dr2["ReviewDate"] = oTraining.ExpectedDate;
|
|
dr2["ExpectedResults"] = oTraining.ExpectedResults;
|
|
idpTrainings.Rows.Add(dr2);
|
|
}
|
|
DataSet dSet = new DataSet();
|
|
employeeInformation.TableName = "PayrollDataSet_IDPEmployeeInfo";
|
|
idpTrainings.TableName = "PayrollDataSet_IDPTrainings";
|
|
dSet.Tables.Add(employeeInformation);
|
|
dSet.Tables.Add(idpTrainings);
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "PmsDevelopmentPlanFormNew.rdlc";
|
|
return reportProcessor.CommonReportViewForReports(null, dSet, null, rdlcName, null, true, payrollTypeId, reportType);
|
|
}
|
|
#endregion
|
|
|
|
private string GetTypeDisplayName(EnumNeedType needType)
|
|
{
|
|
switch (needType)
|
|
{
|
|
case EnumNeedType.OnTheJob:
|
|
return "Job Related Learning / Experience Experiential Learning (70)";
|
|
case EnumNeedType.CoachingOrMentoring:
|
|
return "Coaching (20)";
|
|
case EnumNeedType.FormalLearning:
|
|
return "Training / Formal Classroom Session (10)";
|
|
default:
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#region getPmsKpiSettingGuidelineReport
|
|
|
|
public byte[] getPmsKpiSettingGuidelineReport(int EmpID, int pmpYearID, string reportType, int payrollTypeId)
|
|
{
|
|
Employee oEmployee = new EmployeeService().Get(EmpID);
|
|
List<Department> oDepartments = new DepartmentService().GetAll();
|
|
List<Designation> oDesignations = new DesignationService().GetAll();
|
|
List<Grade> oGrades = new GradeService().GetAll();
|
|
Location oLocation = new LocationService().GetByEmployeeID(EmpID);
|
|
PMPProcess oPMPProcess = new PMPProcessService().GetByPMPProcessID(pmpYearID);
|
|
Designation oDesignation = new Designation();
|
|
Department oDepartment = new Department();
|
|
Grade oGrade = new Grade();
|
|
|
|
if (oEmployee.DesignationID != null)
|
|
oDesignation = oDesignations.Find(x => x.ID == oEmployee.DesignationID) ?? new Designation();
|
|
if (oEmployee.DepartmentID != null)
|
|
oDepartment = oDepartments.Find(x => x.ID == oEmployee.DepartmentID) ?? new Department();
|
|
if (oEmployee.GradeID != null)
|
|
oGrade = oGrades.Find(x => x.ID == oEmployee.GradeID) ?? new Grade();
|
|
|
|
ObjectiveSet oObjectiveSet = new ObjectiveSetService().GetObjectiveSetWithChild(EmpID, pmpYearID, false);
|
|
if (oObjectiveSet == null)
|
|
throw new Exception("Selected employee not available in Objective Set");
|
|
|
|
List<ObjectiveType> oObjectiveTypes = new ObjectiveTypeService().Get(EnumStatus.Regardless, payrollTypeId);
|
|
List<PMPRating> oObjectiveRatings = new PMPRatingService().GetPMPRatingByTypeAndYear(EnumPMPRatingType.Objective, pmpYearID);
|
|
|
|
|
|
DataSet dSet = new DataSet();
|
|
List<ReportParameter> _parameters = new List<ReportParameter>();
|
|
ReportParameter parameter = new ReportParameter("CompanyInfo", "SQUARE Food & Beverage Limited");
|
|
_parameters.Add(parameter);
|
|
parameter = new ReportParameter("ReportName", "KPI Setting Form: Guidelines (Functional)");
|
|
_parameters.Add(parameter);
|
|
|
|
HRM.Report.PayrollDataSet.PMPDataSet.dtKpiSettingGuidelineDataTable kpiSettingGuideline =
|
|
new HRM.Report.PayrollDataSet.PMPDataSet.dtKpiSettingGuidelineDataTable();
|
|
|
|
|
|
List<Objective> oObjectives = oObjectiveSet.Objectives
|
|
.Where(o => o.KPIType == EnumObjectiveType.KPI)
|
|
.ToList();
|
|
|
|
int cnt = 1;
|
|
|
|
foreach (Objective oObjective in oObjectives)
|
|
{
|
|
DataRow drKpi = kpiSettingGuideline.NewRow();
|
|
|
|
ObjectiveType oObjectiveType = oObjectiveTypes.Find(x => x.ID == oObjective.ObjectiveType);
|
|
|
|
drKpi["Sl_No"] = cnt++;
|
|
drKpi["Area"] = oObjectiveType?.Name;
|
|
drKpi["KeyStatement"] = oObjective.Description;
|
|
drKpi["Target"] = oObjective.MeasuresOfSuccess;
|
|
|
|
if (oObjective.EndDate != DateTime.MinValue)
|
|
drKpi["TimeFrame"] = oObjective.EndDate.ToString("MMM yyyy");
|
|
else
|
|
drKpi["TimeFrame"] = string.Empty;
|
|
|
|
drKpi["Weightage"] = oObjective.Weightages;
|
|
|
|
kpiSettingGuideline.Rows.Add(drKpi);
|
|
}
|
|
double kpiWeightageTotal = oObjectives.Sum(o => o.Weightages);
|
|
|
|
kpiSettingGuideline.TableName = "dtKpiSettingGuideline";
|
|
dSet.Tables.Add(kpiSettingGuideline);
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "PmsKpiSettingGuidelineReport.rdlc";
|
|
return reportProcessor.CommonReportViewForPmsReports(null, dSet, null, rdlcName, _parameters, true, payrollTypeId, reportType);
|
|
}
|
|
#endregion
|
|
|
|
|
|
// The IDP report tables were typed DataTables on PayrollDataSet in Square. That typed
|
|
// dataset is shared by every report in this product and is not aligned with Square's, so
|
|
// the two IDP tables are built as plain DataTables instead. Column names and the
|
|
// PayrollDataSet_* table names are what the RDLC binds to, so the reports are unaffected.
|
|
private static System.Data.DataTable CreateIDPEmployeeInfoTable()
|
|
{
|
|
System.Data.DataTable dt = new System.Data.DataTable("PayrollDataSet_IDPEmployeeInfo");
|
|
foreach (string col in new[] { "Name", "Department", "Designation", "Grade", "Location",
|
|
"Period", "ID", "Date", "CareerExpectation" })
|
|
dt.Columns.Add(col, typeof(string));
|
|
return dt;
|
|
}
|
|
|
|
private static System.Data.DataTable CreateIDPTrainingsTable()
|
|
{
|
|
System.Data.DataTable dt = new System.Data.DataTable("PayrollDataSet_IDPTrainings");
|
|
foreach (string col in new[] { "SLNO", "Objectives", "Weightage", "Learnings",
|
|
"Resources", "ReviewDate", "ExpectedResults" })
|
|
dt.Columns.Add(col, typeof(string));
|
|
return dt;
|
|
}
|
|
}
|
|
}
|