166 lines
6.4 KiB
C#
166 lines
6.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using HRM.BO;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public class payrollPaymentComponentService : IPayrollPaymentComponent
|
|
{
|
|
public payrollPaymentComponentService()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<PayrollPaymentComponent> get(int payrolltypeid)
|
|
{
|
|
List<PayrollPaymentComponent> allItems = new List<PayrollPaymentComponent>();
|
|
|
|
PayrollPaymentComponent obasic = new PayrollPaymentComponent();
|
|
obasic.type = enumPayrollComponentType.Basic_salary;
|
|
obasic.name = "Basic Salary";
|
|
obasic.itemID = (int)enumPayrollComponentType.Basic_salary;
|
|
allItems.Add(obasic);
|
|
|
|
List<AllowanceDeduction> allowances = new AllowanceDeductionService().Get(EnumStatus.Active, EnumAllowOrDeduct.Allowance, payrolltypeid);
|
|
foreach (AllowanceDeduction item in allowances)
|
|
{
|
|
PayrollPaymentComponent oallance = new PayrollPaymentComponent();
|
|
oallance.type = enumPayrollComponentType.Allowance;
|
|
oallance.name = item.Name;
|
|
oallance.itemID = item.ID;
|
|
allItems.Add(oallance);
|
|
}
|
|
|
|
List<AllowanceDeduction> deductions = new AllowanceDeductionService().Get(EnumStatus.Active, EnumAllowOrDeduct.Deduction, payrolltypeid);
|
|
foreach (AllowanceDeduction item in deductions)
|
|
{
|
|
PayrollPaymentComponent odeduction = new PayrollPaymentComponent();
|
|
odeduction.type = enumPayrollComponentType.Deduction;
|
|
odeduction.name = item.Name;
|
|
odeduction.itemID = item.ID;
|
|
allItems.Add(odeduction);
|
|
}
|
|
|
|
List<Term> terms = new TermService().Get(EnumStatus.Active, payrolltypeid);
|
|
foreach (Term item in terms)
|
|
{
|
|
PayrollPaymentComponent oterm = new PayrollPaymentComponent();
|
|
oterm.type = enumPayrollComponentType.Over_Time;
|
|
oterm.name = item.Name;
|
|
oterm.itemID = item.ID;
|
|
allItems.Add(oterm);
|
|
}
|
|
|
|
List<Bonus> bonuss = new BonusService().Get(EnumStatus.Active, payrolltypeid);
|
|
foreach (Bonus item in bonuss)
|
|
{
|
|
PayrollPaymentComponent obonus = new PayrollPaymentComponent();
|
|
obonus.type = enumPayrollComponentType.Bonus;
|
|
obonus.name = item.Name;
|
|
obonus.itemID = item.ID;
|
|
allItems.Add(obonus);
|
|
}
|
|
|
|
List<Loan> loans = new LoanService().Get(EnumStatus.Active);
|
|
foreach (Loan item in loans)
|
|
{
|
|
PayrollPaymentComponent oloan = new PayrollPaymentComponent();
|
|
oloan.type = enumPayrollComponentType.Loan;
|
|
oloan.name = item.Name;
|
|
oloan.itemID = item.ID;
|
|
allItems.Add(oloan);
|
|
|
|
PayrollPaymentComponent oloanInterest = new PayrollPaymentComponent();
|
|
oloanInterest.type = enumPayrollComponentType.LoanInterest;
|
|
oloanInterest.name = item.Name + "-Interest";
|
|
oloanInterest.itemID = item.ID;
|
|
allItems.Add(oloanInterest);
|
|
}
|
|
|
|
PayrollPaymentComponent opf = new PayrollPaymentComponent();
|
|
opf.type = enumPayrollComponentType.PF;
|
|
opf.name = "PF";
|
|
opf.itemID = (int)enumPayrollComponentType.PF;
|
|
allItems.Add(opf);
|
|
|
|
PayrollPaymentComponent ocpf = new PayrollPaymentComponent();
|
|
ocpf.type = enumPayrollComponentType.CPF;
|
|
ocpf.name = "CPF";
|
|
ocpf.itemID = (int)enumPayrollComponentType.CPF;
|
|
allItems.Add(ocpf);
|
|
|
|
PayrollPaymentComponent ogratuity = new PayrollPaymentComponent();
|
|
ogratuity.type = enumPayrollComponentType.Gratuity;
|
|
ogratuity.name = "Gratuity";
|
|
ogratuity.itemID = (int)enumPayrollComponentType.Gratuity;
|
|
allItems.Add(ogratuity);
|
|
|
|
PayrollPaymentComponent oincometax = new PayrollPaymentComponent();
|
|
oincometax.type = enumPayrollComponentType.IncomeTax;
|
|
oincometax.name = "Income Tax";
|
|
oincometax.itemID = (int)enumPayrollComponentType.IncomeTax;
|
|
allItems.Add(oincometax);
|
|
|
|
List<Branch> netpays = new BranchService().Get(EnumStatus.Active, payrolltypeid);
|
|
|
|
List<Bank> oBanks =new BankService().Get(EnumStatus.Active,payrolltypeid);
|
|
Bank oBank = null;
|
|
foreach (Branch item in netpays)
|
|
{
|
|
PayrollPaymentComponent onetpay = new PayrollPaymentComponent();
|
|
onetpay.type = enumPayrollComponentType.Net_pay;
|
|
oBank = oBanks.FirstOrDefault(o => o.ID == item.BankID);
|
|
if (oBank != null)
|
|
{
|
|
onetpay.name = item.Name + " [" + oBank.Name + "]";
|
|
}
|
|
else
|
|
{
|
|
onetpay.name = item.Name;
|
|
}
|
|
onetpay.itemID = item.ID;
|
|
allItems.Add(onetpay);
|
|
}
|
|
|
|
//List<FSHead> fSHeads = new FSHeadService().Get(EnumStatus.Active);
|
|
//foreach (FSHead item in fSHeads)
|
|
//{
|
|
// PayrollPaymentComponent fSHead = new PayrollPaymentComponent();
|
|
// fSHead.type = enumPayrollComponentType.Final_settlement;
|
|
// fSHead.name = item.Name;
|
|
// fSHead.itemID = item.ID;
|
|
// allItems.Add(fSHead);
|
|
//}
|
|
|
|
|
|
bool hasOPI =new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic,"jv", "hasopi");
|
|
if (hasOPI)
|
|
{
|
|
List<OpiItem> opiItems = new OpiItemService().Get(EnumStatus.Active);
|
|
foreach (OpiItem item in opiItems)
|
|
{
|
|
PayrollPaymentComponent opiItem = new PayrollPaymentComponent();
|
|
opiItem.type = enumPayrollComponentType.OPI;
|
|
opiItem.name = item.Name;
|
|
opiItem.itemID = item.ID;
|
|
allItems.Add(opiItem);
|
|
}
|
|
}
|
|
int newid = 0;
|
|
allItems.ForEach(x => {
|
|
newid = newid + 1;
|
|
x.id = newid;
|
|
});
|
|
|
|
|
|
return allItems;
|
|
}
|
|
|
|
}
|
|
}
|