444 lines
19 KiB
C#
444 lines
19 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using Ease.Core.Model;
|
|||
|
using Ease.Core.Utility;
|
|||
|
using Ease.CoreV35.DataAccess;
|
|||
|
using HRM.BO;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
[Serializable]
|
|||
|
public class PayrollComponentListService : IPayrollComponentListService
|
|||
|
{
|
|||
|
#region Functions
|
|||
|
public List<PayrollComponentList> Get(int payrollTypeId)
|
|||
|
{
|
|||
|
List<PayrollComponentList> allItems = new List<PayrollComponentList>();
|
|||
|
|
|||
|
PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
obasic.ComponentType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
obasic.Name = "Basic Salary";
|
|||
|
obasic.ItemID = (int)enumPayrollComponentType.Ordinary_Hour;
|
|||
|
allItems.Add(obasic);
|
|||
|
|
|||
|
List<AllowanceDeduction> allowances = new AllowanceDeductionService().GetAllowance(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (AllowanceDeduction item in allowances)
|
|||
|
{
|
|||
|
PayrollComponentList oallance = new PayrollComponentList();
|
|||
|
oallance.ComponentType = enumPayrollComponentType.Allowance;
|
|||
|
oallance.Name = item.Name;
|
|||
|
oallance.ItemID = item.ID;
|
|||
|
allItems.Add(oallance);
|
|||
|
}
|
|||
|
|
|||
|
List<AllowanceDeduction> deductions = new AllowanceDeductionService().GetDeduction(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (AllowanceDeduction item in deductions)
|
|||
|
{
|
|||
|
PayrollComponentList odeduction = new PayrollComponentList();
|
|||
|
odeduction.ComponentType = enumPayrollComponentType.Deduction;
|
|||
|
odeduction.Name = item.Name;
|
|||
|
odeduction.ItemID = item.ID;
|
|||
|
allItems.Add(odeduction);
|
|||
|
}
|
|||
|
|
|||
|
List<Term> terms = new TermService().Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (Term item in terms)
|
|||
|
{
|
|||
|
PayrollComponentList oterm = new PayrollComponentList();
|
|||
|
oterm.ComponentType = enumPayrollComponentType.Over_Time;
|
|||
|
oterm.Name = item.Name;
|
|||
|
oterm.ItemID = item.ID;
|
|||
|
allItems.Add(oterm);
|
|||
|
}
|
|||
|
|
|||
|
List<Bonus> bonuss = new BonusService().Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (Bonus item in bonuss)
|
|||
|
{
|
|||
|
PayrollComponentList obonus = new PayrollComponentList();
|
|||
|
obonus.ComponentType = enumPayrollComponentType.Bonus;
|
|||
|
obonus.Name = item.Name;
|
|||
|
obonus.ItemID = item.ID;
|
|||
|
allItems.Add(obonus);
|
|||
|
}
|
|||
|
|
|||
|
List<Loan> loans = new LoanService().Get(EnumStatus.Regardless);
|
|||
|
foreach (Loan item in loans)
|
|||
|
{
|
|||
|
PayrollComponentList oloan = new PayrollComponentList();
|
|||
|
oloan.ComponentType = enumPayrollComponentType.Loan;
|
|||
|
oloan.Name = item.Name;
|
|||
|
oloan.ItemID = item.ID;
|
|||
|
allItems.Add(oloan);
|
|||
|
|
|||
|
PayrollComponentList oloanInterest = new PayrollComponentList();
|
|||
|
oloanInterest.ComponentType = enumPayrollComponentType.LoanInterest;
|
|||
|
oloanInterest.Name = item.Name + "-Interest";
|
|||
|
oloanInterest.ItemID = item.ID;
|
|||
|
allItems.Add(oloanInterest);
|
|||
|
}
|
|||
|
|
|||
|
PayrollComponentList opf = new PayrollComponentList();
|
|||
|
opf.ComponentType = enumPayrollComponentType.PF;
|
|||
|
opf.Name = "PF";
|
|||
|
opf.ItemID = (int)enumPayrollComponentType.PF;
|
|||
|
allItems.Add(opf);
|
|||
|
|
|||
|
PayrollComponentList ocpf = new PayrollComponentList();
|
|||
|
ocpf.ComponentType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = (int)enumPayrollComponentType.CPF;
|
|||
|
allItems.Add(ocpf);
|
|||
|
|
|||
|
PayrollComponentList ogratuity = new PayrollComponentList();
|
|||
|
ogratuity.ComponentType = enumPayrollComponentType.Gratuity;
|
|||
|
ogratuity.Name = "Gratuity";
|
|||
|
ogratuity.ItemID = (int)enumPayrollComponentType.Gratuity;
|
|||
|
allItems.Add(ogratuity);
|
|||
|
|
|||
|
PayrollComponentList oincometax = new PayrollComponentList();
|
|||
|
oincometax.ComponentType = enumPayrollComponentType.IncomeTax;
|
|||
|
oincometax.Name = "Income Tax";
|
|||
|
oincometax.ItemID = (int)enumPayrollComponentType.IncomeTax;
|
|||
|
allItems.Add(oincometax);
|
|||
|
|
|||
|
List<Branch> netpays = new BranchService().Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (Branch item in netpays)
|
|||
|
{
|
|||
|
PayrollComponentList onetpay = new PayrollComponentList();
|
|||
|
onetpay.ComponentType = enumPayrollComponentType.Net_pay;
|
|||
|
onetpay.Name = item.Name;
|
|||
|
onetpay.ItemID = item.ID;
|
|||
|
allItems.Add(onetpay);
|
|||
|
}
|
|||
|
|
|||
|
bool hasOPI = ConfigurationManager.GetBoolValue("jv", "hasopi", EnumConfigurationType.Logic);
|
|||
|
if (hasOPI)
|
|||
|
{
|
|||
|
List<OpiItem> opiItems = new OpiItemService().Get(EnumStatus.Active);
|
|||
|
foreach (OpiItem item in opiItems)
|
|||
|
{
|
|||
|
PayrollComponentList opiItem = new PayrollComponentList();
|
|||
|
opiItem.ComponentType = enumPayrollComponentType.OPI;
|
|||
|
opiItem.Name = item.Name;
|
|||
|
opiItem.ItemID = item.ID;
|
|||
|
allItems.Add(opiItem);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return allItems;
|
|||
|
}
|
|||
|
public List<PayrollComponentList> Get(List<enumPayrollComponentType> componentTypes, int payrollTypeId)
|
|||
|
{
|
|||
|
List<PayrollComponentList> allItems = new List<PayrollComponentList>();
|
|||
|
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Basic_salary))
|
|||
|
{
|
|||
|
PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
obasic.ComponentType = enumPayrollComponentType.Basic_salary;
|
|||
|
obasic.Name = "Basic Salary";
|
|||
|
obasic.ItemID = (int)enumPayrollComponentType.Basic_salary;
|
|||
|
allItems.Add(obasic);
|
|||
|
}
|
|||
|
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Ordinary_Hour))
|
|||
|
{
|
|||
|
PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
obasic.ComponentType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
obasic.Name = "Ordinary Hour";
|
|||
|
obasic.ItemID = (int)enumPayrollComponentType.Ordinary_Hour;
|
|||
|
allItems.Add(obasic);
|
|||
|
}
|
|||
|
|
|||
|
//if (componentTypes.Contains(enumPayrollComponentType.Ordinary_Hour_Extra))
|
|||
|
//{
|
|||
|
// PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
// obasic.ComponentType = enumPayrollComponentType.Ordinary_Hour_Extra;
|
|||
|
// obasic.Name = "Ordinary Hour Extra";
|
|||
|
// obasic.ItemID = (int)enumPayrollComponentType.Ordinary_Hour_Extra;
|
|||
|
// allItems.Add(obasic);
|
|||
|
//}
|
|||
|
|
|||
|
//if (componentTypes.Contains(enumPayrollComponentType.Badli_Shift_Allowance))
|
|||
|
//{
|
|||
|
// PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
// obasic.ComponentType = enumPayrollComponentType.Badli_Shift_Allowance;
|
|||
|
// obasic.Name = "Badli Shift Allowance";
|
|||
|
// obasic.ItemID = (int)enumPayrollComponentType.Badli_Shift_Allowance;
|
|||
|
// allItems.Add(obasic);
|
|||
|
//}
|
|||
|
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Allowance))
|
|||
|
{
|
|||
|
List<AllowanceDeduction> allowances = new AllowanceDeductionService().GetAllowance(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (AllowanceDeduction item in allowances)
|
|||
|
{
|
|||
|
PayrollComponentList oallance = new PayrollComponentList();
|
|||
|
oallance.ComponentType = enumPayrollComponentType.Allowance;
|
|||
|
oallance.Name = item.Name;
|
|||
|
oallance.ItemID = item.ID;
|
|||
|
allItems.Add(oallance);
|
|||
|
}
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Deduction))
|
|||
|
{
|
|||
|
|
|||
|
List<AllowanceDeduction> deductions = new AllowanceDeductionService().GetDeduction(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (AllowanceDeduction item in deductions)
|
|||
|
{
|
|||
|
PayrollComponentList odeduction = new PayrollComponentList();
|
|||
|
odeduction.ComponentType = enumPayrollComponentType.Deduction;
|
|||
|
odeduction.Name = item.Name;
|
|||
|
odeduction.ItemID = item.ID;
|
|||
|
allItems.Add(odeduction);
|
|||
|
}
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Over_Time))
|
|||
|
{
|
|||
|
|
|||
|
List<Term> terms = new TermService().Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (Term item in terms)
|
|||
|
{
|
|||
|
PayrollComponentList oterm = new PayrollComponentList();
|
|||
|
oterm.ComponentType = enumPayrollComponentType.Over_Time;
|
|||
|
oterm.Name = item.Name;
|
|||
|
oterm.ItemID = item.ID;
|
|||
|
allItems.Add(oterm);
|
|||
|
}
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Bonus))
|
|||
|
{
|
|||
|
|
|||
|
List<Bonus> bonuss = new BonusService().Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (Bonus item in bonuss)
|
|||
|
{
|
|||
|
PayrollComponentList obonus = new PayrollComponentList();
|
|||
|
obonus.ComponentType = enumPayrollComponentType.Bonus;
|
|||
|
obonus.Name = item.Name;
|
|||
|
obonus.ItemID = item.ID;
|
|||
|
allItems.Add(obonus);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//if (componentTypes.Contains(enumPayrollComponentType.BonusAdjustment))
|
|||
|
//{
|
|||
|
|
|||
|
// List<BonusAdjustItem> bonusAdjustments = new BonusAdjustItemService().Get(EnumStatus.Regardless);
|
|||
|
// foreach (BonusAdjustItem item in bonusAdjustments)
|
|||
|
// {
|
|||
|
// PayrollComponentList obonusAdj = new PayrollComponentList();
|
|||
|
// obonusAdj.ComponentType = enumPayrollComponentType.BonusAdjustment;
|
|||
|
// obonusAdj.Name = item.Name;
|
|||
|
// obonusAdj.ItemID = item.ID;
|
|||
|
// allItems.Add(obonusAdj);
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Loan))
|
|||
|
{
|
|||
|
|
|||
|
List<Loan> loans = new LoanService().Get(EnumStatus.Regardless);
|
|||
|
foreach (Loan item in loans)
|
|||
|
{
|
|||
|
PayrollComponentList oloan = new PayrollComponentList();
|
|||
|
oloan.ComponentType = enumPayrollComponentType.Loan;
|
|||
|
oloan.Name = item.Name;
|
|||
|
oloan.ItemID = item.ID;
|
|||
|
allItems.Add(oloan);
|
|||
|
|
|||
|
PayrollComponentList oloanInterest = new PayrollComponentList();
|
|||
|
oloanInterest.ComponentType = enumPayrollComponentType.LoanInterest;
|
|||
|
oloanInterest.Name = item.Name + "-Interest";
|
|||
|
oloanInterest.ItemID = item.ID;
|
|||
|
allItems.Add(oloanInterest);
|
|||
|
}
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.PF))
|
|||
|
{
|
|||
|
|
|||
|
PayrollComponentList opf = new PayrollComponentList();
|
|||
|
opf.ComponentType = enumPayrollComponentType.PF;
|
|||
|
opf.Name = "PF";
|
|||
|
opf.ItemID = (int)enumPayrollComponentType.PF;
|
|||
|
allItems.Add(opf);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.CPF))
|
|||
|
{
|
|||
|
|
|||
|
PayrollComponentList ocpf = new PayrollComponentList();
|
|||
|
ocpf.ComponentType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = (int)enumPayrollComponentType.CPF;
|
|||
|
allItems.Add(ocpf);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Gratuity))
|
|||
|
{
|
|||
|
|
|||
|
PayrollComponentList ogratuity = new PayrollComponentList();
|
|||
|
ogratuity.ComponentType = enumPayrollComponentType.Gratuity;
|
|||
|
ogratuity.Name = "Gratuity";
|
|||
|
ogratuity.ItemID = (int)enumPayrollComponentType.Gratuity;
|
|||
|
allItems.Add(ogratuity);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.IncomeTax))
|
|||
|
{
|
|||
|
|
|||
|
PayrollComponentList oincometax = new PayrollComponentList();
|
|||
|
oincometax.ComponentType = enumPayrollComponentType.IncomeTax;
|
|||
|
oincometax.Name = "Income Tax";
|
|||
|
oincometax.ItemID = (int)enumPayrollComponentType.IncomeTax;
|
|||
|
allItems.Add(oincometax);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Net_pay))
|
|||
|
{
|
|||
|
|
|||
|
List<Branch> netpays = new BranchService().Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (Branch item in netpays)
|
|||
|
{
|
|||
|
PayrollComponentList onetpay = new PayrollComponentList();
|
|||
|
onetpay.ComponentType = enumPayrollComponentType.Net_pay;
|
|||
|
onetpay.Name = item.Name;
|
|||
|
onetpay.ItemID = item.ID;
|
|||
|
allItems.Add(onetpay);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.OPI))
|
|||
|
{
|
|||
|
|
|||
|
List<OpiItem> opiItems = new OpiItemService().Get(EnumStatus.Active);
|
|||
|
foreach (OpiItem item in opiItems)
|
|||
|
{
|
|||
|
PayrollComponentList opiItem = new PayrollComponentList();
|
|||
|
opiItem.ComponentType = enumPayrollComponentType.OPI;
|
|||
|
opiItem.Name = item.Name;
|
|||
|
opiItem.ItemID = item.ID;
|
|||
|
allItems.Add(opiItem);
|
|||
|
}
|
|||
|
}
|
|||
|
return allItems;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public List<PayrollComponentList> ConstantItemsForSalary(int payrollTypeId)
|
|||
|
{
|
|||
|
List<PayrollComponentList> allItems = new List<PayrollComponentList>();
|
|||
|
int pkid = 0;
|
|||
|
PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
obasic.ComponentType = enumPayrollComponentType.Basic_salary;
|
|||
|
obasic.Name = "Basic Salary";
|
|||
|
obasic.ItemID = (int)enumPayrollComponentType.Basic_salary;
|
|||
|
pkid++;
|
|||
|
obasic.PKID = pkid;
|
|||
|
allItems.Add(obasic);
|
|||
|
|
|||
|
PayrollComponentList oOrdinary = new PayrollComponentList();
|
|||
|
oOrdinary.ComponentType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
oOrdinary.Name = "Ordinary Hour";
|
|||
|
oOrdinary.ItemID = (int)enumPayrollComponentType.Ordinary_Hour;
|
|||
|
pkid++;
|
|||
|
oOrdinary.PKID = pkid;
|
|||
|
allItems.Add(oOrdinary);
|
|||
|
|
|||
|
List<AllowanceDeduction> allowances = new AllowanceDeductionService().GetAllowance(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (AllowanceDeduction item in allowances)
|
|||
|
{
|
|||
|
PayrollComponentList oallance = new PayrollComponentList();
|
|||
|
oallance.ComponentType = enumPayrollComponentType.Allowance;
|
|||
|
oallance.Name = item.Name;
|
|||
|
oallance.ItemID = item.ID;
|
|||
|
pkid++;
|
|||
|
oallance.PKID = pkid;
|
|||
|
allItems.Add(oallance);
|
|||
|
}
|
|||
|
|
|||
|
List<AllowanceDeduction> deductions = new AllowanceDeductionService().GetDeduction(EnumStatus.Regardless, payrollTypeId);
|
|||
|
foreach (AllowanceDeduction item in deductions)
|
|||
|
{
|
|||
|
PayrollComponentList odeduction = new PayrollComponentList();
|
|||
|
odeduction.ComponentType = enumPayrollComponentType.Deduction;
|
|||
|
odeduction.Name = item.Name;
|
|||
|
odeduction.ItemID = item.ID;
|
|||
|
pkid++;
|
|||
|
odeduction.PKID = pkid;
|
|||
|
allItems.Add(odeduction);
|
|||
|
}
|
|||
|
|
|||
|
List<Loan> loans = new LoanService().Get(EnumStatus.Regardless);
|
|||
|
foreach (Loan item in loans)
|
|||
|
{
|
|||
|
PayrollComponentList oloan = new PayrollComponentList();
|
|||
|
oloan.ComponentType = enumPayrollComponentType.Loan;
|
|||
|
oloan.Name = item.Name + " Principle";
|
|||
|
oloan.ItemID = item.ID;
|
|||
|
pkid++;
|
|||
|
oloan.PKID = pkid;
|
|||
|
allItems.Add(oloan);
|
|||
|
|
|||
|
PayrollComponentList oloanInterest = new PayrollComponentList();
|
|||
|
oloanInterest.ComponentType = enumPayrollComponentType.LoanInterest;
|
|||
|
oloanInterest.Name = item.Name + " Interest";
|
|||
|
oloanInterest.ItemID = item.ID;
|
|||
|
pkid++;
|
|||
|
oloanInterest.PKID = pkid;
|
|||
|
allItems.Add(oloanInterest);
|
|||
|
}
|
|||
|
|
|||
|
PayrollComponentList oterm = new PayrollComponentList();
|
|||
|
oterm.ComponentType = enumPayrollComponentType.Over_Time;
|
|||
|
oterm.Name = "Overtime";
|
|||
|
oterm.ItemID = (int)enumPayrollComponentType.Over_Time;
|
|||
|
pkid++;
|
|||
|
oterm.PKID = pkid;
|
|||
|
allItems.Add(oterm);
|
|||
|
|
|||
|
PayrollComponentList opf = new PayrollComponentList();
|
|||
|
opf.ComponentType = enumPayrollComponentType.PF;
|
|||
|
opf.Name = "PF";
|
|||
|
opf.ItemID = (int)enumPayrollComponentType.PF;
|
|||
|
pkid++;
|
|||
|
opf.PKID = pkid;
|
|||
|
allItems.Add(opf);
|
|||
|
|
|||
|
PayrollComponentList ocpf = new PayrollComponentList();
|
|||
|
ocpf.ComponentType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = (int)enumPayrollComponentType.CPF;
|
|||
|
pkid++;
|
|||
|
ocpf.PKID = pkid;
|
|||
|
allItems.Add(ocpf);
|
|||
|
|
|||
|
PayrollComponentList oincometax = new PayrollComponentList();
|
|||
|
oincometax.ComponentType = enumPayrollComponentType.IncomeTax;
|
|||
|
oincometax.Name = "Income Tax";
|
|||
|
oincometax.ItemID = (int)enumPayrollComponentType.IncomeTax;
|
|||
|
pkid++;
|
|||
|
oincometax.PKID = pkid;
|
|||
|
allItems.Add(oincometax);
|
|||
|
|
|||
|
PayrollComponentList onetpay = new PayrollComponentList();
|
|||
|
onetpay.ComponentType = enumPayrollComponentType.Net_pay;
|
|||
|
onetpay.Name = "Net Payable";
|
|||
|
onetpay.ItemID = (int)enumPayrollComponentType.Net_pay;
|
|||
|
pkid++;
|
|||
|
onetpay.PKID = pkid;
|
|||
|
allItems.Add(onetpay);
|
|||
|
|
|||
|
//PayrollComponentList oLTA = new PayrollComponentList();
|
|||
|
//oLTA.ComponentType = enumPayrollComponentType.LTA;
|
|||
|
//oLTA.Name = "LTA";
|
|||
|
//oLTA.ItemID = (int)enumPayrollComponentType.LTA;
|
|||
|
//pkid++;
|
|||
|
//obasic.PKID = pkid;
|
|||
|
//allItems.Add(oLTA);
|
|||
|
|
|||
|
return allItems;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|