240 lines
9.4 KiB
C#
240 lines
9.4 KiB
C#
|
|
using Ease.Core.Model;
|
|
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.BO
|
|
{
|
|
public class RewardStatement : BasicBaseObject
|
|
{
|
|
#region Constructor
|
|
public RewardStatement()
|
|
{
|
|
description = "";
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region Name : string
|
|
private string name;
|
|
|
|
public string Name
|
|
{
|
|
get { return name; }
|
|
set { name = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region RewardStatementType : EnumRewardStatement
|
|
private EnumRewardStatement rewardStatementType;
|
|
|
|
public EnumRewardStatement RewardStatementType
|
|
{
|
|
get { return rewardStatementType; }
|
|
set { rewardStatementType = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region ComponentType : EnumComponentType
|
|
private enumPayrollComponentType? componentType;
|
|
|
|
public enumPayrollComponentType? ComponentType
|
|
{
|
|
get { return componentType; }
|
|
set { componentType = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region ComponentID : ID
|
|
private int componentID;
|
|
|
|
public int ComponentID
|
|
{
|
|
get { return componentID; }
|
|
set { componentID = value; }
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Amount : Amount
|
|
private double _amount;
|
|
|
|
public double Amount
|
|
{
|
|
get { return _amount; }
|
|
set { _amount = value; }
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Description
|
|
private string description;
|
|
|
|
public string Description
|
|
{
|
|
get { return description; }
|
|
set { description = value; }
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
//#region Service Factory
|
|
//internal static IRewardStatementService Service
|
|
//{
|
|
// get { return Services.Factory.CreateService<IRewardStatementService>(typeof(IRewardStatementService)); }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region Functions
|
|
|
|
//public static List<RewardStatement> Get()
|
|
//{
|
|
// List<RewardStatement> rewardStatements = null;
|
|
|
|
// rewardStatements = RewardStatement.Service.Get();
|
|
|
|
// return rewardStatements;
|
|
//}
|
|
|
|
//public static RewardStatement Get(int rewardStatementID)
|
|
//{
|
|
// RewardStatement rewardStatement = null;
|
|
// rewardStatement = RewardStatement.Service.Get(rewardStatementID);
|
|
// return rewardStatement;
|
|
//}
|
|
|
|
//public static List<RewardStatement> Get(Employee employee)
|
|
//{
|
|
|
|
// List<RewardStatement> rewardStatements = RewardStatement.Get();
|
|
// List<ADParameter> adparameters = ADParameter.Get(EnumStatus.Regardless);
|
|
// List<OpiParameter> opiparameters = OpiParameter.Get(EnumStatus.Regardless);
|
|
// List<RewardStatementParameter> rewardparameters = RewardStatementParameter.Get();
|
|
// List<BonusParameter> bonusParamters = BonusParameter.Get(EnumStatus.Regardless);
|
|
// List<RewardStatement> applicableRewards = new List<RewardStatement>();
|
|
|
|
// foreach (RewardStatement item in rewardStatements)
|
|
// {
|
|
// if (rewardparameters.Any(r => r.RewardStatementID.Integer == item.ID.Integer))
|
|
// {
|
|
// List<RewardStatementParameter> rparams = rewardparameters.FindAll(x => x.RewardStatementID.Integer == item.ID.Integer).ToList();
|
|
// foreach (RewardStatementParameter param in rparams)
|
|
// {
|
|
// if (param.IsIndividual && param.RewardStatementParameterIndividuals.Exists(x => x.EmployeeID.Integer == employee.ID.Integer))
|
|
// {
|
|
// RewardStatementParameterIndividual individual = param.RewardStatementParameterIndividuals.Where(e => e.EmployeeID.Integer == employee.ID.Integer).FirstOrDefault();
|
|
// if (individual.FlatAmount > 0) item.Amount = individual.FlatAmount;
|
|
// if (individual.BasicAmount > 0) item.Amount = employee.BasicSalary * individual.BasicAmount / 100;
|
|
// if (individual.GCAmount > 0)
|
|
// {
|
|
// GrossDefination odefination = new GrossDefination();
|
|
// item.Amount = GrossDefination.GetGross(employee) * individual.GCAmount / 100;
|
|
// }
|
|
// applicableRewards.Add(item);
|
|
// break;
|
|
// }
|
|
// else
|
|
// {
|
|
// if ((param.RewardStatementParameterDetails.Exists(x => x.GradeLocationType == EnumGradeLocationType.Grade && x.GradeLocationID == employee.GradeID) == true) && (param.RewardStatementParameterDetails.Exists(x => x.GradeLocationType == EnumGradeLocationType.Location && x.GradeLocationID == employee.LocationID) == true) && (param.Gender == EnumGender.None || param.Gender == employee.Gender))
|
|
// {
|
|
// if (param.FlatAmount > 0) item.Amount = param.FlatAmount;
|
|
// if (param.BasicAmount > 0) item.Amount = employee.BasicSalary * param.BasicAmount / 100;
|
|
// if (param.GCAmount > 0)
|
|
// {
|
|
// GrossDefination odefination = new GrossDefination();
|
|
// item.Amount = ((GrossDefination.GetGross(employee) / 12) * param.GCAmount / 100);
|
|
// }
|
|
|
|
// applicableRewards.Add(item);
|
|
// break;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// if (item.rewardStatementType == EnumRewardStatement.Cash_Component || item.rewardStatementType == EnumRewardStatement.Benefit_Component)
|
|
// {
|
|
// #region
|
|
// switch ((enumPayrollComponentType)item.componentType)
|
|
// {
|
|
// case enumPayrollComponentType.Allowance:
|
|
// case enumPayrollComponentType.Deduction:
|
|
// ADParameter oparam = ADParameter.GetApplicableParameter(employee, employee.GradeID, adparameters, item.componentID);
|
|
// if (oparam != null) item.Amount = oparam.GetAmount(employee);
|
|
// break;
|
|
// case enumPayrollComponentType.Bonus:
|
|
// BonusParameter bparamter = BonusParameter.ApplicableParameters(bonusParamters, employee, item.ComponentID);
|
|
// if (bparamter != null)
|
|
// item.Amount = bparamter.GeneralAmount(employee.BasicSalary, employee.GrossSalary);
|
|
// break;
|
|
// case enumPayrollComponentType.PF:
|
|
// case enumPayrollComponentType.CPF:
|
|
// item.Amount = employee.BasicSalary * .1;
|
|
// break;
|
|
// case enumPayrollComponentType.Gratuity:
|
|
// break;
|
|
// case enumPayrollComponentType.OPI:
|
|
// List<OpiParameter> opiParams = OpiParameter.GetApplicableParameters(employee, employee.GradeID, opiparameters);
|
|
// if (opiParams != null)
|
|
// {
|
|
// OpiParameter opiParam = opiParams.FirstOrDefault(x => x.OpiItemID.Integer == item.componentID.Integer);
|
|
// if (opiParam != null)
|
|
// item.Amount = opiParam.GetAmount(employee);
|
|
// }
|
|
// break;
|
|
// case enumPayrollComponentType.Basic_salary:
|
|
// item.Amount = employee.BasicSalary;
|
|
// break;
|
|
// default:
|
|
// break;
|
|
// }
|
|
// #endregion
|
|
// if (item.Amount > 0)
|
|
// applicableRewards.Add(item);
|
|
// }
|
|
// }
|
|
// }
|
|
// return applicableRewards;
|
|
//}
|
|
|
|
|
|
//public static List<RewardStatement> Get(EnumRewardStatement rewardStatementType)
|
|
//{
|
|
// List<RewardStatement> rewardStatements = null;
|
|
|
|
// rewardStatements = RewardStatement.Service.Get(rewardStatementType);
|
|
|
|
// return rewardStatements;
|
|
//}
|
|
|
|
//public void Save()
|
|
//{
|
|
// this.SetAuditTrailProperties();
|
|
// RewardStatement.Service.Save(this);
|
|
//}
|
|
|
|
//public void Delete(int id)
|
|
//{
|
|
// RewardStatement.Service.Delete(id);
|
|
//}
|
|
|
|
//#endregion
|
|
}
|
|
public interface IRewardStatementService
|
|
{
|
|
List<RewardStatement> Get();
|
|
RewardStatement Get(int rewardStatementID);
|
|
List<RewardStatement> Get(EnumRewardStatement rewardStatementType);
|
|
void Save(RewardStatement rewardStatement);
|
|
void Delete(int id);
|
|
}
|
|
|
|
}
|