456 lines
13 KiB
C#
456 lines
13 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
|
|||
|
{
|
|||
|
#region FSTran
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class FSTran : AuditTrailBase
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(FSTran));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Declarations
|
|||
|
|
|||
|
private double _changeTaxAmount;
|
|||
|
private DateTime _discontinueDate;
|
|||
|
private ID _employeeID;
|
|||
|
private DateTime _lastSalaryPaidMonth;
|
|||
|
private double _netAmount;
|
|||
|
private DateTime _noticeDate;
|
|||
|
private string _remarks;
|
|||
|
private DateTime _settlementDate;
|
|||
|
private double _taxAmount;
|
|||
|
private bool _isMaximumInvestment;
|
|||
|
private int _shortNoticePeriod;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
|
|||
|
public FSTran()
|
|||
|
{
|
|||
|
_changeTaxAmount = 0.0;
|
|||
|
_discontinueDate = DateTime.MinValue;
|
|||
|
_employeeID = null;
|
|||
|
_lastSalaryPaidMonth = DateTime.MinValue;
|
|||
|
_netAmount = 0.0;
|
|||
|
_noticeDate = DateTime.MinValue;
|
|||
|
_remarks = "";
|
|||
|
_settlementDate = DateTime.MinValue;
|
|||
|
_taxAmount = 0.0;
|
|||
|
_isMaximumInvestment = false;
|
|||
|
_shortNoticePeriod = 0;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
#region ShortNoticePeriod : int
|
|||
|
public int ShortNoticePeriod
|
|||
|
{
|
|||
|
get { return _shortNoticePeriod; }
|
|||
|
set { _shortNoticePeriod = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ChangeTaxAmount : double
|
|||
|
public double ChangeTaxAmount
|
|||
|
{
|
|||
|
get { return _changeTaxAmount; }
|
|||
|
set {_changeTaxAmount = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region DiscontinueDate : DateTime
|
|||
|
public DateTime DiscontinueDate
|
|||
|
{
|
|||
|
get { return _discontinueDate; }
|
|||
|
set { _discontinueDate = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeID
|
|||
|
public ID EmployeeID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _employeeID;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
|
|||
|
_employeeID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region LastSalaryPaidMonth : DateTime
|
|||
|
public DateTime LastSalaryPaidMonth
|
|||
|
{
|
|||
|
get { return _lastSalaryPaidMonth; }
|
|||
|
set { _lastSalaryPaidMonth = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region NoticeDate : DateTime
|
|||
|
public DateTime NoticeDate
|
|||
|
{
|
|||
|
get { return _noticeDate; }
|
|||
|
set { _noticeDate = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region SettlementDate : DateTime
|
|||
|
public DateTime SettlementDate
|
|||
|
{
|
|||
|
get { return _settlementDate; }
|
|||
|
set { _settlementDate = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Remarks : string
|
|||
|
public string Remarks
|
|||
|
{
|
|||
|
get { return _remarks; }
|
|||
|
set { _remarks = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region NetAmount : double
|
|||
|
public double NetAmount
|
|||
|
{
|
|||
|
get { return _netAmount; }
|
|||
|
set { _netAmount = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region TaxAmount : double
|
|||
|
public double TaxAmount
|
|||
|
{
|
|||
|
get { return _taxAmount; }
|
|||
|
set { _taxAmount = value; }
|
|||
|
}
|
|||
|
|
|||
|
private ObjectsTemplate<IncomeTax> _incomeTax = null;
|
|||
|
public ObjectsTemplate<IncomeTax> IncomeTaxcoll
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _incomeTax;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_incomeTax = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IsMaximumInvestment : bool
|
|||
|
public bool IsMaximumInvestment
|
|||
|
{
|
|||
|
get { return _isMaximumInvestment; }
|
|||
|
set { _isMaximumInvestment = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public string BatchNumber { get; set; }
|
|||
|
|
|||
|
#region Tran Detail : Tran Detail
|
|||
|
|
|||
|
private ObjectsTemplate<FSTranDetail> _details;
|
|||
|
public ObjectsTemplate<FSTranDetail> Details
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
// _details = new ObjectsTemplate<FSTranDetail>();
|
|||
|
if (_details == null)
|
|||
|
{
|
|||
|
_details = new ObjectsTemplate<FSTranDetail>();
|
|||
|
_details = FSTranDetail.GetDetail(this.ID);
|
|||
|
}
|
|||
|
return _details;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_details = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory IFSTranService : IFSTranService
|
|||
|
|
|||
|
internal static IFSTranService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IFSTranService>(typeof(IFSTranService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static FSTran Get(ID nID)
|
|||
|
{
|
|||
|
FSTran oFSTran = null;
|
|||
|
#region Cache Header
|
|||
|
oFSTran = (FSTran)_cache["Get", nID];
|
|||
|
if (oFSTran != null)
|
|||
|
return oFSTran;
|
|||
|
#endregion
|
|||
|
oFSTran = FSTran.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oFSTran, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oFSTran;
|
|||
|
}
|
|||
|
public static FSTran Get(int nEmpID)
|
|||
|
{
|
|||
|
FSTran oFSTran = null;
|
|||
|
#region Cache Header
|
|||
|
oFSTran = (FSTran)_cache["Get", nEmpID];
|
|||
|
if (oFSTran != null)
|
|||
|
return oFSTran;
|
|||
|
#endregion
|
|||
|
oFSTran = FSTran.Service.Get(nEmpID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oFSTran, "Get", nEmpID);
|
|||
|
#endregion
|
|||
|
return oFSTran;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<FSTran> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<FSTran> FSTrans = _cache["Get"] as ObjectsTemplate<FSTran>;
|
|||
|
if (FSTrans != null)
|
|||
|
return FSTrans;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
FSTrans = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(FSTrans, "Get");
|
|||
|
#endregion
|
|||
|
return FSTrans;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<FSTran> Get(DateTime dFromDate, DateTime dToDate)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<FSTran> FSTrans = _cache["Get", dFromDate, dToDate] as ObjectsTemplate<FSTran>;
|
|||
|
if (FSTrans != null)
|
|||
|
return FSTrans;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
FSTrans = Service.Get(dFromDate, dToDate);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(FSTrans, "Get", dFromDate, dToDate);
|
|||
|
#endregion
|
|||
|
return FSTrans;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<FSTran> Get(DateTime dFromDate, DateTime dToDate, int nType, string sBatchNumber)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<FSTran> FSTrans = _cache["Get", dFromDate, dToDate] as ObjectsTemplate<FSTran>;
|
|||
|
if (FSTrans != null)
|
|||
|
return FSTrans;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
FSTrans = Service.Get(dFromDate, dToDate,nType, sBatchNumber);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(FSTrans, "Get", dFromDate, dToDate);
|
|||
|
#endregion
|
|||
|
return FSTrans;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<FSTran> Get(EnumStatus status)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<FSTran> FSTrans = _cache["Get", status] as ObjectsTemplate<FSTran>;
|
|||
|
if (FSTrans != null)
|
|||
|
return FSTrans;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
FSTrans = Service.Get(status);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(FSTrans, "Get", status);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return FSTrans;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<FSTran> Get(string sEmpIDs)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<FSTran> FSTrans = _cache["Get", sEmpIDs] as ObjectsTemplate<FSTran>;
|
|||
|
if (FSTrans != null)
|
|||
|
return FSTrans;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
FSTrans = Service.Get(sEmpIDs);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(FSTrans, "Get", sEmpIDs);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return FSTrans;
|
|||
|
}
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return FSTran.Service.Save(this);
|
|||
|
}
|
|||
|
|
|||
|
public double GetAmount(EnumFSItemCode fsCode)
|
|||
|
{
|
|||
|
double nAmount=0;
|
|||
|
foreach (FSTranDetail odetail in this.Details)
|
|||
|
{
|
|||
|
if (odetail.ItemCode == fsCode)
|
|||
|
{
|
|||
|
if(odetail.Side == EnumSide.Add)
|
|||
|
nAmount = nAmount + odetail.Amount;
|
|||
|
else
|
|||
|
nAmount = nAmount - odetail.Amount;
|
|||
|
}
|
|||
|
}
|
|||
|
return nAmount;
|
|||
|
}
|
|||
|
|
|||
|
public double GetAmount(EnumFSItemCode fsCode, int nItemID)
|
|||
|
{
|
|||
|
double nAmount = 0;
|
|||
|
foreach (FSTranDetail odetail in this.Details)
|
|||
|
{
|
|||
|
if (odetail.ItemCode == fsCode && nItemID== odetail.ItemID)
|
|||
|
{
|
|||
|
if (odetail.AmountType == EnumValueType.Amount)
|
|||
|
{
|
|||
|
if (odetail.Side == EnumSide.Add)
|
|||
|
nAmount = nAmount + odetail.Amount;
|
|||
|
else
|
|||
|
nAmount = nAmount - odetail.Amount;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return nAmount;
|
|||
|
}
|
|||
|
public double GetLeaveAmount(EnumFSItemCode fsCode)
|
|||
|
{
|
|||
|
double nAmount = 0;
|
|||
|
foreach (FSTranDetail odetail in this.Details)
|
|||
|
{
|
|||
|
if (odetail.ItemCode == fsCode)
|
|||
|
{
|
|||
|
if (odetail.AmountType == EnumValueType.Amount)
|
|||
|
{
|
|||
|
if (odetail.Side == EnumSide.Add)
|
|||
|
nAmount = nAmount + odetail.ChangedValue;
|
|||
|
else
|
|||
|
nAmount = nAmount - odetail.ChangedValue;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return nAmount;
|
|||
|
}
|
|||
|
public double GetLFAAmount(EnumFSItemCode fsCode, int nItemID)
|
|||
|
{
|
|||
|
double nAmount = 0;
|
|||
|
foreach (FSTranDetail odetail in this.Details)
|
|||
|
{
|
|||
|
if (odetail.ItemCode == fsCode)
|
|||
|
{
|
|||
|
if (odetail.AmountType == EnumValueType.Amount)
|
|||
|
{
|
|||
|
if (odetail.Side == EnumSide.Add)
|
|||
|
nAmount = nAmount + odetail.ChangedValue;
|
|||
|
else
|
|||
|
nAmount = nAmount - odetail.ChangedValue;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return nAmount;
|
|||
|
}
|
|||
|
|
|||
|
public void Delete(ID id)
|
|||
|
{
|
|||
|
FSTran.Service.Delete(id);
|
|||
|
}
|
|||
|
|
|||
|
public static double GetPFAmount(string sEmployeeNo)
|
|||
|
{
|
|||
|
return Service.GetPFAmount(sEmployeeNo);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IFSTran Service
|
|||
|
|
|||
|
public interface IFSTranService
|
|||
|
{
|
|||
|
FSTran Get(ID id);
|
|||
|
FSTran Get(int nEmpID);
|
|||
|
ObjectsTemplate<FSTran> Get();
|
|||
|
ObjectsTemplate<FSTran> Get(EnumStatus status);
|
|||
|
ObjectsTemplate<FSTran> Get(DateTime dFromDate, DateTime dToDate);
|
|||
|
ObjectsTemplate<FSTran> Get(DateTime dFromDate, DateTime dToDate, int nType, string sBatchNumber);
|
|||
|
ObjectsTemplate<FSTran> Get(string sEmpIDs);
|
|||
|
ID Save(FSTran item);
|
|||
|
void Delete(ID id);
|
|||
|
double GetPFAmount(string sEmployeeNo);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|