EchoTex_Payroll/HRM.BO/JV/JVSetupDetail.cs
2024-10-14 10:01:49 +06:00

358 lines
13 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core;
using Ease.Core.Model;
namespace HRM.BO
{
#region JVSetupDetail
public class JVSetupDetail : BasicBaseObject
{
#region Constructor
public JVSetupDetail()
{
ItemID = 0;
JVItemType = enumPayrollComponentType.Basic_salary;
JVSetupID = 0;
Name = string.Empty;
}
#endregion
#region Properties
public int ItemID { get; set; }
public enumPayrollComponentType JVItemType { get; set; }
public int JVSetupID { get; set; }
public JVSetup JVSetup { get; set; }
//#region jvSetup : JVSetup
//private JVSetup _jvSetup;
//public JVSetup JVSetup
//{
// get
// {
// if (JVSetupID > 0 && _jvSetup == null)
// {
// _jvSetup = new JVSetup();
// _jvSetup = JVSetupDA.Get(JVSetupID);
// }
// return this._jvSetup;
// }
// set
// {
// _jvSetup = value;
// }
//}
//#endregion
public string Name { get; set; }
#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 List<JVSetupDetail> Get()
//{
// #region Cache Header
// List<JVSetupDetail> jvsetupdetails = _cache["Get"] as List<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 List<JVSetupDetail> GetByJVSetup(ID nJVSetupID)
//{
// #region Cache Header
// List<JVSetupDetail> jvsetupdetails = _cache["GetByJVSetup", nJVSetupID] as List<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);
// List<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);
// }
// List<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);
// }
// List<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);
// }
// List<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);
// }
// List<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);
// List<Branch> netpays = Branch.Get(EnumStatus.Active);
// List<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);
// }
// List<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)
// {
// List<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);
// List<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);
// }
// List<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);
// }
// List<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(int id);
List<JVSetupDetail> Get();
List<JVSetupDetail> GetByJVSetup(int nJVSetupID);
int Save(JVSetupDetail oJVSetupDetail);
void Delete(int id);
}
#endregion
}