750 lines
28 KiB
C#
750 lines
28 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
|
|||
|
public class PayrollComponentList
|
|||
|
{
|
|||
|
public string Code {get;set;}
|
|||
|
public string Name { get; set; }
|
|||
|
public enumPayrollComponentType ComponentType { get; set; }
|
|||
|
public ID ItemID { get; set; }
|
|||
|
public PayrollComponentList()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static List<PayrollComponentList> Get()
|
|||
|
{
|
|||
|
List<PayrollComponentList> allItems = new List<PayrollComponentList>();
|
|||
|
|
|||
|
PayrollComponentList obasic = new PayrollComponentList();
|
|||
|
obasic.ComponentType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
obasic.Name = "Basic Salary";
|
|||
|
obasic.ItemID = ID.FromInteger((int)enumPayrollComponentType.Ordinary_Hour);
|
|||
|
allItems.Add(obasic);
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> allowances = AllowanceDeduction.GetAllowance(EnumStatus.Regardless);
|
|||
|
foreach (AllowanceDeduction item in allowances)
|
|||
|
{
|
|||
|
PayrollComponentList oallance = new PayrollComponentList();
|
|||
|
oallance.ComponentType = enumPayrollComponentType.Allowance;
|
|||
|
oallance.Name = item.Name;
|
|||
|
oallance.ItemID = item.ID;
|
|||
|
allItems.Add(oallance);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> deductions = AllowanceDeduction.GetDeduction(EnumStatus.Regardless);
|
|||
|
foreach (AllowanceDeduction item in deductions)
|
|||
|
{
|
|||
|
PayrollComponentList odeduction = new PayrollComponentList();
|
|||
|
odeduction.ComponentType = enumPayrollComponentType.Deduction;
|
|||
|
odeduction.Name = item.Name;
|
|||
|
odeduction.ItemID = item.ID;
|
|||
|
allItems.Add(odeduction);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Term> terms = Term.Get(EnumStatus.Regardless);
|
|||
|
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);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Bonus> bonuss = Bonus.Get(EnumStatus.Regardless);
|
|||
|
foreach (Bonus item in bonuss)
|
|||
|
{
|
|||
|
PayrollComponentList obonus = new PayrollComponentList();
|
|||
|
obonus.ComponentType = enumPayrollComponentType.Bonus;
|
|||
|
obonus.Name = item.Name;
|
|||
|
obonus.ItemID = item.ID;
|
|||
|
allItems.Add(obonus);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Loan> loans = Loan.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 = ID.FromInteger((int)enumPayrollComponentType.PF);
|
|||
|
allItems.Add(opf);
|
|||
|
|
|||
|
PayrollComponentList ocpf = new PayrollComponentList();
|
|||
|
ocpf.ComponentType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = ID.FromInteger((int)enumPayrollComponentType.CPF);
|
|||
|
allItems.Add(ocpf);
|
|||
|
|
|||
|
PayrollComponentList ogratuity = new PayrollComponentList();
|
|||
|
ogratuity.ComponentType = enumPayrollComponentType.Gratuity;
|
|||
|
ogratuity.Name = "Gratuity";
|
|||
|
ogratuity.ItemID = ID.FromInteger((int)enumPayrollComponentType.Gratuity);
|
|||
|
allItems.Add(ogratuity);
|
|||
|
|
|||
|
PayrollComponentList oincometax = new PayrollComponentList();
|
|||
|
oincometax.ComponentType = enumPayrollComponentType.IncomeTax;
|
|||
|
oincometax.Name = "Income Tax";
|
|||
|
oincometax.ItemID = ID.FromInteger((int)enumPayrollComponentType.IncomeTax);
|
|||
|
allItems.Add(oincometax);
|
|||
|
|
|||
|
ObjectsTemplate<Branch> netpays = Branch.Get(EnumStatus.Regardless);
|
|||
|
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)
|
|||
|
{
|
|||
|
ObjectsTemplate<OpiItem> opiItems = OpiItem.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 static List<PayrollComponentList> Get(List<enumPayrollComponentType> componentTypes)
|
|||
|
{
|
|||
|
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 = ID.FromInteger((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 = ID.FromInteger((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 = ID.FromInteger((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 = ID.FromInteger((int)enumPayrollComponentType.Badli_Shift_Allowance);
|
|||
|
allItems.Add(obasic);
|
|||
|
}
|
|||
|
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Allowance))
|
|||
|
{
|
|||
|
ObjectsTemplate<AllowanceDeduction> allowances = AllowanceDeduction.GetAllowance(EnumStatus.Regardless);
|
|||
|
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))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> deductions = AllowanceDeduction.GetDeduction(EnumStatus.Regardless);
|
|||
|
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))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<Term> terms = Term.Get(EnumStatus.Regardless);
|
|||
|
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))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<Bonus> bonuss = Bonus.Get(EnumStatus.Regardless);
|
|||
|
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))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<BonusAdjustItem> bonusAdjustments = BonusAdjustItem.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))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<Loan> loans = Loan.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 = ID.FromInteger((int)enumPayrollComponentType.PF);
|
|||
|
allItems.Add(opf);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.CPF))
|
|||
|
{
|
|||
|
|
|||
|
PayrollComponentList ocpf = new PayrollComponentList();
|
|||
|
ocpf.ComponentType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = ID.FromInteger((int)enumPayrollComponentType.CPF);
|
|||
|
allItems.Add(ocpf);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Gratuity))
|
|||
|
{
|
|||
|
|
|||
|
PayrollComponentList ogratuity = new PayrollComponentList();
|
|||
|
ogratuity.ComponentType = enumPayrollComponentType.Gratuity;
|
|||
|
ogratuity.Name = "Gratuity";
|
|||
|
ogratuity.ItemID = ID.FromInteger((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 = ID.FromInteger((int)enumPayrollComponentType.IncomeTax);
|
|||
|
allItems.Add(oincometax);
|
|||
|
}
|
|||
|
if (componentTypes.Contains(enumPayrollComponentType.Net_pay))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<Branch> netpays = Branch.Get(EnumStatus.Regardless);
|
|||
|
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))
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<OpiItem> opiItems = OpiItem.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;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#region JVSetupDetail
|
|||
|
[Serializable]
|
|||
|
public class JVSetupDetail : BasicBaseObject
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
private static Cache _cache = new Cache(typeof(JVSetupDetail));
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
public JVSetupDetail()
|
|||
|
{
|
|||
|
_itemID = null;
|
|||
|
_jvItemType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
_jvSetupID = null;
|
|||
|
_name = string.Empty;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region ItemID
|
|||
|
private ID _itemID;
|
|||
|
public ID ItemID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _itemID;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("itemID", _itemID, value);
|
|||
|
_itemID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region JVItemType
|
|||
|
private enumPayrollComponentType _jvItemType;
|
|||
|
public enumPayrollComponentType JVItemType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _jvItemType;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short>("jvitemtype", (short)_jvItemType, (short)value);
|
|||
|
_jvItemType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region JVSetupID
|
|||
|
private ID _jvSetupID;
|
|||
|
public ID JVSetupID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _jvSetupID;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("jvSetupID", _jvSetupID, value);
|
|||
|
_jvSetupID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region jvSetup : JVSetup
|
|||
|
|
|||
|
private JVSetup _jvSetup;
|
|||
|
public JVSetup JVSetup
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_jvSetupID.Integer > 0 && _jvSetup == null)
|
|||
|
{
|
|||
|
_jvSetup = new JVSetup();
|
|||
|
_jvSetup = JVSetup.Get(JVSetupID);
|
|||
|
}
|
|||
|
return this._jvSetup;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_jvSetup = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Name
|
|||
|
private string _name;
|
|||
|
public string Name
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _name;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("name", _name, value);
|
|||
|
_name = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
public JVSetupDetail Get(ID nJVSetupDetailID)
|
|||
|
{
|
|||
|
JVSetupDetail oJVSetupDetail = null;
|
|||
|
#region Cache Header
|
|||
|
oJVSetupDetail = (JVSetupDetail)_cache["Get", nJVSetupDetailID];
|
|||
|
if (oJVSetupDetail != null)
|
|||
|
return oJVSetupDetail;
|
|||
|
#endregion
|
|||
|
oJVSetupDetail = JVSetupDetail.Service.Get(nJVSetupDetailID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oJVSetupDetail, "Get", nJVSetupDetailID);
|
|||
|
#endregion
|
|||
|
return oJVSetupDetail;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<JVSetupDetail> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<JVSetupDetail> jvsetupdetails = _cache["Get"] as ObjectsTemplate<JVSetupDetail>;
|
|||
|
if (jvsetupdetails != null)
|
|||
|
return jvsetupdetails;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
jvsetupdetails = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(jvsetupdetails, "Get");
|
|||
|
#endregion
|
|||
|
return jvsetupdetails;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<JVSetupDetail> GetByJVSetup(ID nJVSetupID)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<JVSetupDetail> jvsetupdetails = _cache["GetByJVSetup", nJVSetupID] as ObjectsTemplate<JVSetupDetail>;
|
|||
|
if (jvsetupdetails != null)
|
|||
|
return jvsetupdetails;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
jvsetupdetails = Service.GetByJVSetup(nJVSetupID);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(jvsetupdetails, "GetByJVSetup", nJVSetupID);
|
|||
|
#endregion
|
|||
|
return jvsetupdetails;
|
|||
|
}
|
|||
|
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return JVSetupDetail.Service.Save(this);
|
|||
|
}
|
|||
|
public static List<JVSetupDetail> ConstantItems()
|
|||
|
{
|
|||
|
List<JVSetupDetail> allItems = new List<JVSetupDetail>();
|
|||
|
|
|||
|
JVSetupDetail obasic = new JVSetupDetail();
|
|||
|
obasic.JVItemType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
obasic.Name = "Basic Salary";
|
|||
|
obasic.ItemID = ID.FromInteger((int)enumPayrollComponentType.Ordinary_Hour);
|
|||
|
allItems.Add(obasic);
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> allowances = AllowanceDeduction.GetAllowance(EnumStatus.Active);
|
|||
|
foreach (AllowanceDeduction item in allowances)
|
|||
|
{
|
|||
|
JVSetupDetail oallance = new JVSetupDetail();
|
|||
|
oallance.JVItemType = enumPayrollComponentType.Allowance;
|
|||
|
oallance.Name = item.Name;
|
|||
|
oallance.ItemID = item.ID ;
|
|||
|
allItems.Add(oallance);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> deductions = AllowanceDeduction.GetDeduction(EnumStatus.Active);
|
|||
|
foreach (AllowanceDeduction item in deductions)
|
|||
|
{
|
|||
|
JVSetupDetail odeduction = new JVSetupDetail();
|
|||
|
odeduction.JVItemType = enumPayrollComponentType.Deduction;
|
|||
|
odeduction.Name = item.Name;
|
|||
|
odeduction.ItemID = item.ID;
|
|||
|
allItems.Add(odeduction);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Term> terms = Term.Get(EnumStatus.Active);
|
|||
|
foreach (Term item in terms)
|
|||
|
{
|
|||
|
JVSetupDetail oterm = new JVSetupDetail();
|
|||
|
oterm.JVItemType = enumPayrollComponentType.Over_Time;
|
|||
|
oterm.Name = item.Name;
|
|||
|
oterm.ItemID = item.ID;
|
|||
|
allItems.Add(oterm);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Bonus> bonuss = Bonus.Get(EnumStatus.Active);
|
|||
|
foreach (Bonus item in bonuss)
|
|||
|
{ JVSetupDetail obonus = new JVSetupDetail();
|
|||
|
obonus.JVItemType = enumPayrollComponentType.Bonus;
|
|||
|
obonus.Name = item.Name;
|
|||
|
obonus.ItemID = item.ID;
|
|||
|
allItems.Add(obonus);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Loan> loans = Loan.Get(EnumStatus.Active);
|
|||
|
foreach (Loan item in loans)
|
|||
|
{
|
|||
|
JVSetupDetail oloan = new JVSetupDetail();
|
|||
|
oloan.JVItemType = enumPayrollComponentType.Loan;
|
|||
|
oloan.Name = item.Name;
|
|||
|
oloan.ItemID = item.ID;
|
|||
|
allItems.Add(oloan);
|
|||
|
|
|||
|
JVSetupDetail oloanInterest = new JVSetupDetail();
|
|||
|
oloanInterest.JVItemType = enumPayrollComponentType.LoanInterest;
|
|||
|
oloanInterest.Name = item.Name + "-Interest";
|
|||
|
oloanInterest.ItemID = item.ID;
|
|||
|
allItems.Add(oloanInterest);
|
|||
|
}
|
|||
|
|
|||
|
JVSetupDetail opf = new JVSetupDetail();
|
|||
|
opf.JVItemType = enumPayrollComponentType.PF;
|
|||
|
opf.Name = "PF";
|
|||
|
opf.ItemID = ID.FromInteger((int)enumPayrollComponentType.PF);
|
|||
|
allItems.Add(opf);
|
|||
|
|
|||
|
JVSetupDetail ocpf = new JVSetupDetail();
|
|||
|
ocpf.JVItemType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = ID.FromInteger((int)enumPayrollComponentType.CPF);
|
|||
|
allItems.Add(ocpf);
|
|||
|
|
|||
|
JVSetupDetail ogratuity = new JVSetupDetail();
|
|||
|
ogratuity.JVItemType = enumPayrollComponentType.Gratuity;
|
|||
|
ogratuity.Name = "Gratuity";
|
|||
|
ogratuity.ItemID = ID.FromInteger((int)enumPayrollComponentType.Gratuity);
|
|||
|
allItems.Add(ogratuity);
|
|||
|
|
|||
|
JVSetupDetail oincometax = new JVSetupDetail();
|
|||
|
oincometax.JVItemType = enumPayrollComponentType.IncomeTax;
|
|||
|
oincometax.Name = "Income Tax";
|
|||
|
oincometax.ItemID = ID.FromInteger((int)enumPayrollComponentType.IncomeTax);
|
|||
|
allItems.Add(oincometax);
|
|||
|
|
|||
|
ObjectsTemplate<Branch> netpays = Branch.Get(EnumStatus.Active);
|
|||
|
ObjectsTemplate<Bank> oBanks = Bank.Get(EnumStatus.Active);
|
|||
|
Bank oBank = null;
|
|||
|
foreach (Branch item in netpays)
|
|||
|
{
|
|||
|
JVSetupDetail onetpay = new JVSetupDetail();
|
|||
|
onetpay.JVItemType = 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);
|
|||
|
}
|
|||
|
|
|||
|
JVSetupDetail cash = new JVSetupDetail();
|
|||
|
cash.JVItemType = enumPayrollComponentType.Net_pay_Cash;
|
|||
|
cash.Name = "Cash/Cheque";
|
|||
|
cash.ItemID =ID.FromInteger(0);
|
|||
|
allItems.Add(cash);
|
|||
|
|
|||
|
ObjectsTemplate<FSHead> fSHeads = FSHead.Get(EnumStatus.Active);
|
|||
|
foreach (FSHead item in fSHeads)
|
|||
|
{
|
|||
|
JVSetupDetail fSHead = new JVSetupDetail();
|
|||
|
fSHead.JVItemType = enumPayrollComponentType.Final_settlement;
|
|||
|
fSHead.Name = item.Name;
|
|||
|
fSHead.ItemID = item.ID;
|
|||
|
allItems.Add(fSHead);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
bool hasOPI = ConfigurationManager.GetBoolValue("jv", "hasopi", EnumConfigurationType.Logic);
|
|||
|
if (hasOPI)
|
|||
|
{
|
|||
|
ObjectsTemplate<OpiItem> opiItems = OpiItem.Get(EnumStatus.Active);
|
|||
|
foreach (OpiItem item in opiItems)
|
|||
|
{
|
|||
|
JVSetupDetail opiItem = new JVSetupDetail();
|
|||
|
opiItem.JVItemType = enumPayrollComponentType.OPI;
|
|||
|
opiItem.Name = item.Name;
|
|||
|
opiItem.ItemID = item.ID;
|
|||
|
allItems.Add(opiItem);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return allItems;
|
|||
|
}
|
|||
|
|
|||
|
public static List<JVSetupDetail> ConstantItemsForSalary()
|
|||
|
{
|
|||
|
|
|||
|
List<JVSetupDetail> allItems = new List<JVSetupDetail>();
|
|||
|
|
|||
|
JVSetupDetail obasic = new JVSetupDetail();
|
|||
|
obasic.JVItemType = enumPayrollComponentType.Ordinary_Hour;
|
|||
|
obasic.Name = "Basic Salary";
|
|||
|
obasic.ItemID = ID.FromInteger((int)enumPayrollComponentType.Ordinary_Hour);
|
|||
|
allItems.Add(obasic);
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> allowances = AllowanceDeduction.GetAllowance(EnumStatus.Regardless);
|
|||
|
foreach (AllowanceDeduction item in allowances)
|
|||
|
{
|
|||
|
JVSetupDetail oallance = new JVSetupDetail();
|
|||
|
oallance.JVItemType = enumPayrollComponentType.Allowance;
|
|||
|
oallance.Name = item.Name;
|
|||
|
oallance.ItemID = item.ID;
|
|||
|
allItems.Add(oallance);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<AllowanceDeduction> deductions = AllowanceDeduction.GetDeduction(EnumStatus.Regardless);
|
|||
|
foreach (AllowanceDeduction item in deductions)
|
|||
|
{
|
|||
|
JVSetupDetail odeduction = new JVSetupDetail();
|
|||
|
odeduction.JVItemType = enumPayrollComponentType.Deduction;
|
|||
|
odeduction.Name = item.Name;
|
|||
|
odeduction.ItemID = item.ID;
|
|||
|
allItems.Add(odeduction);
|
|||
|
}
|
|||
|
|
|||
|
ObjectsTemplate<Loan> loans = Loan.Get(EnumStatus.Regardless);
|
|||
|
foreach (Loan item in loans)
|
|||
|
{
|
|||
|
JVSetupDetail oloan = new JVSetupDetail();
|
|||
|
oloan.JVItemType = enumPayrollComponentType.Loan;
|
|||
|
oloan.Name = item.Name;
|
|||
|
oloan.ItemID = item.ID;
|
|||
|
allItems.Add(oloan);
|
|||
|
|
|||
|
JVSetupDetail oloanInterest = new JVSetupDetail();
|
|||
|
oloanInterest.JVItemType = enumPayrollComponentType.LoanInterest;
|
|||
|
oloanInterest.Name = item.Name + "-Interest";
|
|||
|
oloanInterest.ItemID = item.ID;
|
|||
|
allItems.Add(oloanInterest);
|
|||
|
}
|
|||
|
|
|||
|
JVSetupDetail opf = new JVSetupDetail();
|
|||
|
opf.JVItemType = enumPayrollComponentType.PF;
|
|||
|
opf.Name = "PF";
|
|||
|
opf.ItemID = ID.FromInteger((int)enumPayrollComponentType.PF);
|
|||
|
allItems.Add(opf);
|
|||
|
|
|||
|
JVSetupDetail ocpf = new JVSetupDetail();
|
|||
|
ocpf.JVItemType = enumPayrollComponentType.CPF;
|
|||
|
ocpf.Name = "CPF";
|
|||
|
ocpf.ItemID = ID.FromInteger((int)enumPayrollComponentType.CPF);
|
|||
|
allItems.Add(ocpf);
|
|||
|
|
|||
|
JVSetupDetail oincometax = new JVSetupDetail();
|
|||
|
oincometax.JVItemType = enumPayrollComponentType.IncomeTax;
|
|||
|
oincometax.Name = "Income Tax";
|
|||
|
oincometax.ItemID = ID.FromInteger((int)enumPayrollComponentType.IncomeTax);
|
|||
|
allItems.Add(oincometax);
|
|||
|
|
|||
|
JVSetupDetail onetpay = new JVSetupDetail();
|
|||
|
onetpay.JVItemType = enumPayrollComponentType.Net_pay;
|
|||
|
onetpay.Name = "Net Payable";
|
|||
|
onetpay.ItemID = ID.FromInteger((int)enumPayrollComponentType.Net_pay);
|
|||
|
allItems.Add(onetpay);
|
|||
|
|
|||
|
return allItems;
|
|||
|
}
|
|||
|
|
|||
|
public void Delete(ID id)
|
|||
|
{
|
|||
|
JVSetupDetail.Service.Delete(id);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory
|
|||
|
internal static IJVSetupDetailService Service
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Services.Factory.CreateService<IJVSetupDetailService>(typeof(IJVSetupDetailService));
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IJVSetupDetail Service
|
|||
|
public interface IJVSetupDetailService
|
|||
|
{
|
|||
|
JVSetupDetail Get(ID id);
|
|||
|
ObjectsTemplate<JVSetupDetail> Get();
|
|||
|
ObjectsTemplate<JVSetupDetail> GetByJVSetup(ID nJVSetupID);
|
|||
|
ID Save(JVSetupDetail oJVSetupDetail);
|
|||
|
void Delete(ID id);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|