292 lines
9.3 KiB
C#
292 lines
9.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.Core;
|
|
using Ease.Core.Model;
|
|
using System.Data;
|
|
|
|
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region TaxMergeMaster
|
|
public class TaxMergeMaster : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
|
|
public TaxMergeMaster()
|
|
{
|
|
TaxParameterID = 0;
|
|
ItemGroup = EnumIncomeTaxItemGroup.Basic_Salary;
|
|
Description = string.Empty;
|
|
Position = 0;
|
|
ItemID = 0;
|
|
Type = EnumTaxMergeType.Allowance;
|
|
//#### PayrollTypeID = SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public int TaxParameterID { get; set; }
|
|
public EnumIncomeTaxItemGroup ItemGroup { get; set; }
|
|
public int PayrollTypeID { get; set; }
|
|
public int ItemID { get; set; }
|
|
public string Description { get; set; }
|
|
public int Position { get; set; }
|
|
public EnumTaxMergeType Type { get; set; }
|
|
public List<TaxMergeDetail> TaxMergeDetails { get; set; }
|
|
|
|
|
|
|
|
//#region TaxMergeDetail : TaxMergeDetail
|
|
|
|
//private List<TaxMergeDetail> _TaxMergeDetails = null;
|
|
//public List<TaxMergeDetail> TaxMergeDetails
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_taxParameterID == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// TaxMergeMaster ms = TaxMergeMaster.Get(this.ID);
|
|
// _TaxMergeDetails = ms.TaxMergeDetails;
|
|
// }
|
|
// return this._TaxMergeDetails;
|
|
// }
|
|
// set
|
|
// {
|
|
// _TaxMergeDetails = value;
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region Service Factory ITaxMergeMasterService : ITaxMergeMasterService
|
|
|
|
//internal static ITaxMergeMasterService Service
|
|
//{
|
|
// get { return Services.Factory.CreateService<ITaxMergeMasterService>(typeof(ITaxMergeMasterService)); }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
#endregion
|
|
|
|
// #region Functions
|
|
|
|
// public static TaxMergeMaster Get(int nID)
|
|
// {
|
|
// TaxMergeMaster oTaxMergeMaster = null;
|
|
// #region Cache Header
|
|
// oTaxMergeMaster = (TaxMergeMaster)_cache["Get", nID];
|
|
// if (oTaxMergeMaster != null)
|
|
// return oTaxMergeMaster;
|
|
// #endregion
|
|
// oTaxMergeMaster = TaxMergeMaster.Service.Get(nID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
// #region Cache Footer
|
|
// _cache.Add(oTaxMergeMaster, "Get", nID);
|
|
// #endregion
|
|
// return oTaxMergeMaster;
|
|
// }
|
|
|
|
// public static List<TaxMergeMaster> GetbyTaxParameter(int TaxParameterID)
|
|
// {
|
|
// #region Cache Header
|
|
|
|
// List<TaxMergeMaster> taxMergeMasters = _cache["Get"] as List<TaxMergeMaster>;
|
|
// if (taxMergeMasters != null)
|
|
// return taxMergeMasters;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// taxMergeMasters = Service.GetbyTaxParameter(TaxParameterID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(taxMergeMasters, "Get");
|
|
|
|
// #endregion
|
|
|
|
// return taxMergeMasters;
|
|
// }
|
|
public static IncomeTax Extract(List<TaxMergeMaster> mergeItems,
|
|
EnumTaxMergeType type, int itemID)
|
|
{
|
|
IncomeTax tax = null;
|
|
foreach (TaxMergeMaster master in mergeItems)
|
|
{
|
|
foreach (TaxMergeMaster.TaxMergeDetail detail in master.TaxMergeDetails)
|
|
{
|
|
if (detail.Type == type && detail.ItemID == itemID)
|
|
{
|
|
tax = new IncomeTax();
|
|
tax.ItemGroup = master.ItemGroup; ;
|
|
tax.ItemID = master.ItemID;
|
|
tax.Description = master.Description;
|
|
//tax.Position = master.Position;
|
|
return tax;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static IncomeTax Extract(List<TaxMergeMaster> mergeItems,
|
|
EnumIncomeTaxItemGroup groupcode)
|
|
{
|
|
IncomeTax tax = null;
|
|
foreach (TaxMergeMaster master in mergeItems)
|
|
{
|
|
foreach (TaxMergeMaster.TaxMergeDetail detail in master.TaxMergeDetails)
|
|
{
|
|
if (detail.ItemGroup == groupcode && detail.Type == EnumTaxMergeType.NONE)
|
|
{
|
|
tax = new IncomeTax();
|
|
tax.ItemGroup = master.ItemGroup; ;
|
|
tax.ItemID = master.ItemID;
|
|
tax.Description = master.Description;
|
|
tax.Position = master.Position;
|
|
return tax;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// public static IncomeTax Get(List<TaxMergeMaster> mergeItems,
|
|
//EnumIncomeTaxItemGroup groupcode)
|
|
// {
|
|
// IncomeTax tax = null;
|
|
// foreach (TaxMergeMaster master in mergeItems)
|
|
// {
|
|
// foreach (TaxMergeMaster.TaxMergeDetail detail in master.TaxMergeDetails)
|
|
// {
|
|
// if (detail.ItemGroup == groupcode)
|
|
// {
|
|
// tax = new IncomeTax();
|
|
// tax.ItemGroup = master.ItemGroup; ;
|
|
// tax.ItemID = master.ItemID;
|
|
// tax.Description = master.Description;
|
|
// tax.Position = master.Position;
|
|
// return tax;
|
|
// }
|
|
// }
|
|
// }
|
|
// return null;
|
|
// }
|
|
// //public static List<TaxMergeMaster> Get()
|
|
// //{
|
|
// // #region Cache Header
|
|
|
|
// // List<TaxMergeMaster> taxMergeMasters = _cache["Get"] as List<TaxMergeMaster>;
|
|
// // if (taxMergeMasters != null)
|
|
// // return taxMergeMasters;
|
|
|
|
// // #endregion
|
|
|
|
// // try
|
|
// // {
|
|
// // taxMergeMasters = Service.Get();
|
|
// // }
|
|
// // catch (ServiceException e)
|
|
// // {
|
|
// // throw new Exception(e.Message, e);
|
|
// // }
|
|
|
|
// // #region Cache Footer
|
|
|
|
// // _cache.Add(taxMergeMasters, "Get");
|
|
|
|
// // #endregion
|
|
|
|
// // return taxMergeMasters;
|
|
// //}
|
|
|
|
// public static bool IsExist(List<TaxMergeMaster> masters, EnumTaxMergeType ntype, int nItemId)
|
|
// {
|
|
// foreach (TaxMergeMaster masterItem in masters)
|
|
// {
|
|
// foreach (TaxMergeDetail item in masterItem.TaxMergeDetails)
|
|
// {
|
|
// if (item.Type == ntype && item.ItemID == nItemId)
|
|
// {
|
|
// return true;
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// return false;
|
|
// }
|
|
// public int Save()
|
|
// {
|
|
// this.SetAuditTrailProperties();
|
|
// return TaxMergeMaster.Service.Save(this);
|
|
// }
|
|
// public void Delete()
|
|
// {
|
|
// TaxMergeMaster.Service.Delete(ID);
|
|
// }
|
|
// #endregion
|
|
|
|
#endregion
|
|
|
|
|
|
#region TaxMergeDetail
|
|
|
|
public class TaxMergeDetail : ObjectTemplate
|
|
{
|
|
|
|
#region Constructor
|
|
|
|
public TaxMergeDetail()
|
|
{
|
|
TaxMergeID = 0;
|
|
TaxParameterID = 0;
|
|
ItemGroup = EnumIncomeTaxItemGroup.Tax_Deducted;
|
|
ItemID = 0;
|
|
Type = EnumTaxMergeType.Allowance;
|
|
Description = "";
|
|
//#### PayrollTypeID =SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public int TaxMergeID { get; set; }
|
|
public int TaxParameterID { get; set; }
|
|
public EnumIncomeTaxItemGroup ItemGroup { get; set; }
|
|
public int PayrollTypeID { get; set; }
|
|
public int MyProperty { get; set; }
|
|
public string Description { get; set; }
|
|
public int ItemID { get; set; }
|
|
public EnumTaxMergeType Type { get; set; }
|
|
#endregion
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
#region ITaxMergeMaster Service
|
|
|
|
public interface ITaxMergeMasterService
|
|
{
|
|
TaxMergeMaster Get(int id, int payrollTypeID);
|
|
TaxMergeMaster Get(int payrolltypeid, int taxParamid, EnumTaxMergeType type, int itemid);
|
|
|
|
List<TaxMergeMaster> GetbyTaxParameter(int TaxParameterID, int payrollTypeID);
|
|
//List<TaxMergeMaster> Get();
|
|
int Save(TaxMergeMaster item);
|
|
void Delete(int id);
|
|
}
|
|
|
|
#endregion
|
|
}
|