CEL_Payroll/Payroll.BO/Salary/SalaryMonthly.cs

2464 lines
79 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Text;
using Ease.CoreV35;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
using System.Data.Linq.Mapping;
using Ease.CoreV35.Utility;
namespace Payroll.BO
{
#region SalaryMonthly
[Serializable]
public class SalaryMonthly : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(SalaryMonthly));
#endregion
#region Constructor
public SalaryMonthly()
{
_salaryMonth = DateTime.MinValue; //22
_employeeID = null;//7
_categoryID = null;//3
_departmentID = null;//4
_designationID = null;//5
_locationID = null;//13
_gradeID = null;//GetLastPaidSalaryMonth9
_isFinalized = false;//12
_paymentDate = DateTime.MinValue;//16
_employeeNo = string.Empty;
_name = string.Empty;
_prevMonthBasic = 0;//19
_thisMonthBasic = 0;//24
_arrearEmpID = 0;
_isConfirmed = false; //10
_isEligibleOT = false;//11
_religionID = null;//20
_payrollTypeID = null;//17
_outPayBranchID = null;//14
_outPayAccountNo = "";//15
_remarks = string.Empty;//21
_accountNo = string.Empty; //1
_branchID = null; //2
_designationText = string.Empty;//6
_salaryProcessID = null;//23
_pFMembershipType = EnumPFMembershipType.NotYetLive;//18
_gender = EnumGender.None;//8
}
#endregion
#region Properties
#region Salary Month : DateTime
private DateTime _salaryMonth;
public DateTime SalaryMonth
{
get { return _salaryMonth; }
set
{
base.OnPropertyChange<DateTime>("SalaryMonth", _salaryMonth, value);
_salaryMonth = value;
}
}
#endregion
#region employeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("employeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region categoryID : ID
private ID _categoryID;
public ID CategoryID
{
get { return _categoryID; }
set
{
base.OnPropertyChange<ID>("categoryID", _categoryID, value);
_categoryID = value;
}
}
#endregion
#region departmentID : ID
private ID _departmentID;
public ID DepartmentID
{
get { return _departmentID; }
set
{
base.OnPropertyChange<ID>("departmentID", _departmentID, value);
_departmentID = value;
}
}
#endregion
#region designationID : ID
private ID _designationID;
public ID DesignationID
{
get { return _designationID; }
set
{
base.OnPropertyChange<ID>("designationID", _designationID, value);
_designationID = value;
}
}
#endregion
#region locationID : ID
private ID _locationID;
public ID LocationID
{
get { return _locationID; }
set
{
base.OnPropertyChange<ID>("locationID", _locationID, value);
_locationID = value;
}
}
#endregion
#region gradeID : ID
private ID _gradeID;
public ID GradeID
{
get { return _gradeID; }
set
{
base.OnPropertyChange<ID>("gradeID", _gradeID, value);
_gradeID = value;
}
}
#endregion
#region isFinalized : bool
private bool _isFinalized;
public bool IsFinalized
{
get { return _isFinalized; }
set
{
base.OnPropertyChange<bool>("isFinalized", _isFinalized, value);
_isFinalized = value;
}
}
#endregion
#region paymentDate : DateTime
private DateTime? _paymentDate;
public DateTime? PaymentDate
{
get { return _paymentDate; }
set
{
base.OnPropertyChange<DateTime>("paymentDate", _paymentDate, value);
_paymentDate = value;
}
}
#endregion
#region employeeNo: string
private string _employeeNo;
public string EmployeeNo
{
get { return _employeeNo; }
set
{
_employeeNo = value;
}
}
#endregion
#region Employee Name : string
private string _name;
public string Name
{
get { return _name; }
set
{
_name = value;
}
}
#endregion
#region prevMonthBasic : double
private double _prevMonthBasic;
public double PrevMonthBasic
{
get { return _prevMonthBasic; }
set
{
base.OnPropertyChange<double>("prevMonthBasic", _prevMonthBasic, value);
_prevMonthBasic = value;
}
}
#endregion
#region thisMonthBasic : double
private double _thisMonthBasic;
public double ThisMonthBasic
{
get { return _thisMonthBasic; }
set
{
base.OnPropertyChange<double>("thisMonthBasic", _thisMonthBasic, value);
_thisMonthBasic = value;
}
}
#endregion
#region thisMonthGross : double
private double _thisMonthGross;
public double ThisMonthGross
{
get { return _thisMonthGross; }
set
{
base.OnPropertyChange<double>("thisMonthGross", _thisMonthGross, value);
_thisMonthGross = value;
}
}
#endregion
#region arrearEmpID: int
private int _arrearEmpID;
public int ArrearEmpID
{
get { return _arrearEmpID; }
set
{
base.OnPropertyChange<int>("arrearEmpID", _arrearEmpID, value);
_arrearEmpID = value;
}
}
#endregion
#region isConfirmed : bool
private bool _isConfirmed;
public bool IsConfirmed
{
get { return _isConfirmed; }
set
{
base.OnPropertyChange<bool>("isConfirmed", _isConfirmed, value);
_isConfirmed = value;
}
}
#endregion
#region isEligibleOT : bool
private bool _isEligibleOT;
public bool IsEligibleOT
{
get { return _isEligibleOT; }
set
{
base.OnPropertyChange<bool>("isEligibleOT", _isEligibleOT, value);
_isEligibleOT = value;
}
}
#endregion
#region religionID : ID
private ID _religionID;
public ID ReligionID
{
get { return _religionID; }
set
{
base.OnPropertyChange<ID>("religionID", _religionID, value);
_religionID = value;
}
}
#endregion
#region payrollTypeID : int
private ID _payrollTypeID;
public ID PayrollTypeID
{
get { return _payrollTypeID; }
set
{
base.OnPropertyChange<ID>("payrollTypeID", _payrollTypeID, value);
_payrollTypeID = value;
}
}
#endregion
#region outPayBranchID : int
private ID _outPayBranchID;
public ID OutPayBranchID
{
get { return _outPayBranchID; }
set
{
base.OnPropertyChange<ID>("outPayBranchID", _outPayBranchID, value);
_outPayBranchID = value;
}
}
#endregion
#region outPayAccountNo : long
private string _outPayAccountNo;
public string OutPayAccountNo
{
get { return _outPayAccountNo; }
set
{
base.OnPropertyChange<string>("outPayAccountNo", _outPayAccountNo, value);
_outPayAccountNo = value;
}
}
#endregion
#region remarks : string
private string _remarks;
public string Remarks
{
get { return _remarks; }
set
{
base.OnPropertyChange<string>("remarks", _remarks, value);
_remarks = value;
}
}
#endregion
#region accountNo : string
private string _accountNo;
public string AccountNo
{
get { return _accountNo; }
set
{
base.OnPropertyChange<string>("accountNo", _accountNo, value);
_accountNo = value;
}
}
#endregion
#region branchID : ID
private ID _branchID;
public ID BranchID
{
get { return _branchID; }
set
{
base.OnPropertyChange<ID>("branchID", _branchID, value);
_branchID = value;
}
}
#endregion
#region designationText : string
private string _designationText;
public string DesignationText
{
get { return _designationText; }
set
{
base.OnPropertyChange<string>("designationText", _designationText, value);
_designationText = value;
}
}
#endregion
#region hoursOrDaysNDF : double
private double _hoursOrDaysNDF;
public double HoursOrDaysNDF
{
get { return _hoursOrDaysNDF; }
set
{
base.OnPropertyChange<double>("hoursOrDaysNDF", _hoursOrDaysNDF, value);
_hoursOrDaysNDF = value;
}
}
#endregion
#region salaryProcessID : ID
private ID _salaryProcessID;
public ID SalaryProcessID
{
get { return _salaryProcessID; }
set
{
base.OnPropertyChange<ID>("salaryProcessID", _salaryProcessID, value);
_salaryProcessID = value;
}
}
#endregion
#region pFMembershipType : EnumPFMembershipType
private EnumPFMembershipType _pFMembershipType;
public EnumPFMembershipType PFMembershipType
{
get { return _pFMembershipType; }
set
{
base.OnPropertyChange<short>("pFMembershipType", (short)_pFMembershipType, (short)value);
_pFMembershipType = value;
}
}
#endregion
#region rccode : string
private string _rccode;
public string RCCode
{
get { return _rccode; }
set
{
base.OnPropertyChange<string>("RCCode", _rccode, value);
_rccode = value;
}
}
#endregion
private List<TempUnAuthorized> _unAuthorizedLeaves;
public List<TempUnAuthorized> UnAuthorizedLeaves
{
get
{
if (_unAuthorizedLeaves == null) _unAuthorizedLeaves = new List<TempUnAuthorized>();
return _unAuthorizedLeaves;
}
set
{
_unAuthorizedLeaves = value;
}
}
#region Salary Detail : Salary Detail
private ObjectsTemplate<SalaryMonthlyDetail> _details;
public ObjectsTemplate<SalaryMonthlyDetail> Details
{
get
{
// do not change this property,
// This property is always populated from Map object with parents.
if (_details == null) _details = new ObjectsTemplate<SalaryMonthlyDetail>();
return _details;
}
set
{
_details = value;
}
}
public ObjectsTemplate<SalaryMonthlyDetail> GetSalaryDetail(ID nID)
{
ObjectsTemplate<SalaryMonthlyDetail> oSalaryMonthlyDetail = null;
#region Cache Header
oSalaryMonthlyDetail = (ObjectsTemplate<SalaryMonthlyDetail>)_cache["GetSalaryDetail", nID];
if (oSalaryMonthlyDetail != null)
return oSalaryMonthlyDetail;
#endregion
oSalaryMonthlyDetail = SalaryMonthly.Service.GetSalaryDetail(nID);
#region Cache Footer
_cache.Add(oSalaryMonthlyDetail, "GetSalaryDetail", nID);
#endregion
return oSalaryMonthlyDetail;
}
#endregion
#region Salary EmpCostCenter : SalaryEmpCotCenter
private ObjectsTemplate<SalaryEmpCostCenter> _salaryEmpCostCenters;
public ObjectsTemplate<SalaryEmpCostCenter> CostCentersInvolments
{
get
{
if (_salaryEmpCostCenters == null)
{
_salaryEmpCostCenters = SalaryEmpCostCenter.Service.GetForCC(this.ID);
//_salaryEmpCostCenters = new ObjectsTemplate<SalaryEmpCostCenter>();
}
return _salaryEmpCostCenters;
}
set
{
_salaryEmpCostCenters = value;
}
}
#endregion
#region gender : EnumGender
private EnumGender _gender;
public EnumGender Gender
{
get { return _gender; }
set
{
base.OnPropertyChange<short>("gender", (short)_gender, (short)value);
_gender = value;
}
}
#endregion
#region Service Factory ISalaryMonthlyService : ISalaryMonthlyService
internal static ISalaryMonthlyService Service
{
get { return Services.Factory.CreateService<ISalaryMonthlyService>(typeof(ISalaryMonthlyService)); }
}
#endregion
#region Employee : Employee
private Employee _employee;
public Employee Employee
{
get
{
if (_employeeID.Integer > 0 && _employee == null)
{
_employee = new Employee();
_employee = Payroll.BO.Employee.Get(_employeeID);
}
return this._employee;
}
set
{
_employee = value;
}
}
#endregion
#region Grade Salaries : Grade And Salary
private ObjectsTemplate<EmployeeGradeSalary> _gradeSalaries;
public ObjectsTemplate<EmployeeGradeSalary> GradeSalaries
{
get
{
if (_gradeSalaries == null)
{
throw new ServiceException("Grade Salary not yet set for the employee:" + this.Employee.EmployeeNo);
}
return _gradeSalaries;
}
set
{
_gradeSalaries = value;
}
}
#endregion
#region Arrear Grade Salaries : Grade And Salary
private ObjectsTemplate<EmployeeGradeSalary> _arreargradeSalaries;
public ObjectsTemplate<EmployeeGradeSalary> ArrearGradeSalaries
{
get
{
if (_arreargradeSalaries == null)
{
// throw new ServiceException("Arrear Grade Salary not yet set");
_arreargradeSalaries = new ObjectsTemplate<EmployeeGradeSalary>();
}
return _arreargradeSalaries;
}
set
{
_arreargradeSalaries = value;
}
}
#endregion
#region Grade Salaries : Grade And Salary
private ObjectsTemplate<IncomeTax> _incometaxes;
public ObjectsTemplate<IncomeTax> Incometaxes
{
get
{
if (_incometaxes == null)
{
throw new ServiceException("Income Tax not yet set");
}
return _incometaxes;
}
set
{
_incometaxes = value;
}
}
#endregion
#region Arrear Paid Grade Salaries : Grade And Salary
private ObjectsTemplate<EmployeeGradeSalary> _arrearPaidgradeSalaries;
public ObjectsTemplate<EmployeeGradeSalary> ArrearPaidGradeSalaries
{
get
{
if (_arrearPaidgradeSalaries == null)
{
//throw new ServiceException("Arrear Paid Grade Salary not yet set");
_arrearPaidgradeSalaries = new ObjectsTemplate<EmployeeGradeSalary>();
}
return _arrearPaidgradeSalaries;
}
set
{
_arrearPaidgradeSalaries = value;
}
}
#endregion
#region Total Gross : double
private double _totalGross;
public double TotalGross
{
get
{
return _totalGross;
}
}
#endregion
#region Total Unauthorized Deduct : double
private double _totalUADeduct;
public double TotalUADeduct
{
get
{
return _totalUADeduct;
}
}
#endregion
#region Total Deduct : double
private double _totalDeduct;
public double TotalDeduct
{
get
{
return _totalDeduct;
}
}
#endregion
#region Total Arrear : double
private double _totalArrear;
public double TotalArrear
{
get
{
return _totalArrear;
}
}
#endregion
#region NetPay : double
private double _NetPay;
public double NetPay
{
get
{
return _NetPay;
}
}
#endregion
private Category _category;
public Category Category
{
get
{
if (_category != null && _category.ID.Integer > 0 && _employee == null)
{
_category = new Category();
_category = Category.Get(_categoryID);
}
return this._category;
}
set
{
_category = value;
}
}
#endregion
#region Functions
public static SalaryMonthly Get(ID nID)
{
SalaryMonthly oSalaryMonthly = null;
#region Cache Header
oSalaryMonthly = (SalaryMonthly)_cache["Get", nID];
if (oSalaryMonthly != null)
return oSalaryMonthly;
#endregion
oSalaryMonthly = SalaryMonthly.Service.Get(nID);
#region Cache Footer
_cache.Add(oSalaryMonthly, "Get", nID);
#endregion
return oSalaryMonthly;
}
public static SalaryMonthly GetLastSalaryMonthDetails(ID empID)
{
SalaryMonthly oSalaryMonthly = null;
oSalaryMonthly = SalaryMonthly.Service.GetLastSalaryMonthDetails(empID);
return oSalaryMonthly;
}
public static DateTime? GetLastPaidSalaryMonth(int nEmpID)
{
return SalaryMonthly.Service.GetLastPaidSalaryMonth(nEmpID);
}
public static bool IsSalaryProcessed(ID employeeId, DateTime salaryMonth)
{
bool Isprocessed = false;
Isprocessed = Service.IsSalaryProcessed(employeeId, salaryMonth);
return Isprocessed;
}
public static bool IsSalaryProcessedWeb(DateTime salaryMonth)
{
bool Isprocessed = false;
Isprocessed = Service.IsSalaryProcessedWeb(salaryMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
return Isprocessed;
}
public static bool IsPermanentEmp(ID employeeId, DateTime salaryMonth)
{
bool IsPermanent = false;
IsPermanent = Service.IsPermanentEmp(employeeId, salaryMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
return IsPermanent;
}
public static bool IsPermanentEmpOld(ID employeeId, DateTime salaryMonth)
{
bool IsPermanent = false;
IsPermanent = Service.IsPermanentEmpOld(employeeId, salaryMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
return IsPermanent;
}
public static int GetTotalEmp(ID SProcessID)
{
int nTotalEmp = 0;
nTotalEmp = Service.GetTotalEmp(SProcessID);
return nTotalEmp;
}
public static ObjectsTemplate<SalaryMonthly> Get(DateTime salaryMonth)
{
ObjectsTemplate<SalaryMonthly> oSalaryMonthly = null;
oSalaryMonthly = Service.Get(salaryMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
return oSalaryMonthly;
}
public static ObjectsTemplate<SalaryMonthly> GetForJV(DateTime salaryMonth)
{
ObjectsTemplate<SalaryMonthly> oSalaryMonthly = null;
oSalaryMonthly = Service.GetForJV(salaryMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
return oSalaryMonthly;
}
//public static ObjectsTemplate<SalaryMonthly> Get(DateTime salaryMonth)
//{
// ObjectsTemplate<SalaryMonthly> oSalaryMonthly = null;
// oSalaryMonthly = Service.Get(salaryMonth);
// return oSalaryMonthly;
//}
public static ObjectsTemplate<SalaryMonthly> Get(string sEmpID, DateTime salaryMonth)
{
ObjectsTemplate<SalaryMonthly> oSalaryMonthly = null;
oSalaryMonthly = Service.Get(sEmpID, salaryMonth);
return oSalaryMonthly;
}
public static ObjectsTemplate<SalaryMonthlyDetail> GetHead(int index, DateTime salaryMonth)
{
ObjectsTemplate<SalaryMonthlyDetail> oSalaryMonthlies = null;
oSalaryMonthlies = Service.GetHead(index, salaryMonth);
return oSalaryMonthlies;
}
public static ObjectsTemplate<SalaryMonthly> GetForWTP(string sEmpID, DateTime salaryMonth)
{
ObjectsTemplate<SalaryMonthly> oSalaryMonthly = null;
oSalaryMonthly = Service.GetForWTP(sEmpID, salaryMonth);
return oSalaryMonthly;
}
public static ObjectsTemplate<SalaryEmpCostCenter> GetCostCenter(DateTime salaryMonth)
{
ObjectsTemplate<SalaryEmpCostCenter> oSalaryMonthly = null;
oSalaryMonthly = Service.GetCostCenter(salaryMonth);
return oSalaryMonthly;
}
public static ObjectsTemplate<SalaryEmpCostCenter> GetForCC(ID salaryMonthID)
{
ObjectsTemplate<SalaryEmpCostCenter> oSalaryEmpCC = null;
oSalaryEmpCC = Service.GetForCC(salaryMonthID);
return oSalaryEmpCC;
}
public static SalaryMonthly Get(ID nEmpID, DateTime sMonthDate)
{
SalaryMonthly oSalaryMonthly = null;
#region Cache Header
oSalaryMonthly = (SalaryMonthly)_cache["Get", nEmpID, sMonthDate];
if (oSalaryMonthly != null)
return oSalaryMonthly;
#endregion
oSalaryMonthly = SalaryMonthly.Service.Get(nEmpID, sMonthDate);
#region Cache Footer
_cache.Add(oSalaryMonthly, "Get", nEmpID, sMonthDate);
#endregion
return oSalaryMonthly;
}
//public ID Save()
//{
// return SalaryMonthly.Service.Save(this);
//}
public static void Save(SalaryProcess process, ObjectsTemplate<SalaryMonthly> monthlys)
{
process.SetAuditTraiProperty();
SalaryMonthly.Service.Save(process, monthlys);
}
public static void BulkSave(SalaryProcess process, ObjectsTemplate<SalaryMonthly> monthlys)
{
process.SetAuditTraiProperty();
SalaryMonthly.Service.BulkSave(process, monthlys);
}
public static void BulkSave(DataTable dt)
{
SalaryMonthly.Service.BulkSave(dt);
}
public void WPPFClaimSave(DataTable dt)
{
SalaryMonthly.Service.WPPFClaimSave(dt);
}
public void WPPFSave(DataTable dt)
{
SalaryMonthly.Service.WPPFSave(dt);
}
public void WWFSave(DataTable dt)
{
SalaryMonthly.Service.WWFSave(dt);
}
public void Update()
{
this.SetAuditTrailProperties();
SalaryMonthly.Service.Update(this);
}
public void UpdateSalaryDetail(ObjectsTemplate<SalaryMonthlyDetail> oItems, ObjectsTemplate<IncomeTax> oIncomeTaxs)
{
SalaryMonthly.Service.UpdateDetail(oItems, oIncomeTaxs);
}
public void Delete()
{
SalaryMonthly.Service.Delete(ID);
}
#endregion
public SalaryMonthlyDetail GetDetail(EnumSalaryGroup groupCode,
EnumSalaryItemCode itemcode, int itemId)
{
return this.Details.Find(delegate(SalaryMonthlyDetail item)
{
return item.itemGroupCode == groupCode && item.ItemCode == itemcode
&& item.ItemID == itemId;
});
}
public SalaryMonthlyDetail GetDetail5(EnumSalaryGroup groupCode,
EnumSalaryItemCode itemcode, int itemId,string sDes)
{
return this.Details.Find(delegate(SalaryMonthlyDetail item)
{
return item.itemGroupCode == groupCode && item.ItemCode == itemcode
&& item.ItemID == itemId && item.Description.Trim()==sDes;
});
}
public double GetGrossAmount(EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.ItemCode == itemCode && item.ItemID == itemId)
{
if (item.itemGroupCode == EnumSalaryGroup.Gross || item.itemGroupCode == EnumSalaryGroup.Arrear)
amount = amount + item.ChangedAmount;//Math.Round(
else if (item.itemGroupCode == EnumSalaryGroup.UnauthLeave)
amount = amount - item.ChangedAmount;//Math.Round(
}
}
return amount;
}
public double GetGrossAmount2(EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.ItemCode == itemCode && item.ItemID == itemId)
{
if (item.itemGroupCode == EnumSalaryGroup.Gross )
amount = amount + item.ChangedAmount;
//else if (item.itemGroupCode == EnumSalaryGroup.UnauthLeave)
// amount = amount - item.ChangedAmount;
}
}
return amount;
}
public double GetGrossAmount(EnumSalaryItemCode itemCode, SalaryMonthly oSMonthly, int itemId)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in oSMonthly.Details)
{
if (item.ItemCode == itemCode && item.ItemID == itemId)
{
if (item.itemGroupCode == EnumSalaryGroup.Gross || item.itemGroupCode == EnumSalaryGroup.Arrear)
amount = amount + item.ChangedAmount;//Math.Round(
else if (item.itemGroupCode == EnumSalaryGroup.UnauthLeave)
amount = amount - item.ChangedAmount;//Math.Round(
}
}
return amount;
}
public double GetAmount(EnumSalaryGroup groupcode, EnumSalaryItemCode itemCode)
{
return this.Details
.Where(item => item.ItemCode == itemCode &&
item.itemGroupCode == groupcode)
.Sum(item => item.ChangedAmount);//Math.Round(
}
public double GetAmount(EnumSalaryGroup groupcode, EnumSalaryItemCode itemCode, int itemId)
{
return this.Details
.Where(item => item.ItemCode == itemCode &&
item.itemGroupCode == groupcode &&
item.ItemID == itemId)
.Sum(item => Math.Round(item.ChangedAmount,0));//, MidpointRounding.AwayFromZero
}
public double GetAmount(EnumSalaryGroup groupcode, EnumSalaryItemCode itemCode, SalaryMonthly oSM, int itemId)
{
return this.Details
.Where(item => item.ItemCode == itemCode && item.ItemID == itemId &&
(item.itemGroupCode == groupcode || item.itemGroupCode == EnumSalaryGroup.Arrear)
)
.Sum(item => item.ChangedAmount);//Math.Round(
//double amount = 0;
//foreach (SalaryMonthlyDetail item in this.Details)
//{
// if (item.ItemCode == itemCode && item.ItemID == itemId)
// {
// if (item.itemGroupCode == groupcode || item.itemGroupCode == EnumSalaryGroup.Arrear)
// amount = amount + item.ChangedAmount;
// }
// //if (item.ItemCode == itemCode && item.itemGroupCode == groupcode && item.ItemID == itemId)
// // amount = amount + item.ChangedAmount;
//}
//return amount;
}
public double GetOPIAmount(EnumSalaryGroup groupcode, EnumSalaryItemCode itemCode, int itemId, ObjectsTemplate<OPIProcessDetail> oOPIProcessDetails, SalaryMonthly oSMonthly)
{
double amount = 0;
OPIProcessDetail oOPIPDetail = oOPIProcessDetails.Find(delegate(OPIProcessDetail item)
{
return item.EmployeeID == oSMonthly.EmployeeID;
});
if (oOPIPDetail != null)
{
foreach (OPIProcessDetailItem oItem in oOPIPDetail.OPIProcessDetailItems)
{
if (oItem.OPIItemID.Integer == itemId && oItem.OPIProcessDetailID.Integer == oOPIPDetail.ID.Integer)
amount = amount + oItem.NetAmount;
}
}
return amount;
}
public double GetBonusAmount(EnumSalaryGroup groupcode, EnumSalaryItemCode itemCode)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.ItemCode == itemCode && item.itemGroupCode == groupcode)
amount = amount + item.ChangedAmount;
}
return amount;
}
public double GetUnAmount(EnumSalaryGroup groupID)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.itemGroupCode == groupID)
amount = amount + item.ChangedAmount;
}
return amount;
}
public double GetUnAmountForWartSila(EnumSalaryGroup groupID, ID SalaryMonthlyID)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.itemGroupCode == groupID && item.SalaryMonthlyID == SalaryMonthlyID)
amount = amount + item.ChangedAmount;
}
return amount;
}
public double GetUnAmountForBasic(EnumSalaryGroup groupID)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.itemGroupCode == groupID && item.ItemCode == EnumSalaryItemCode.Basic_Salary)
amount = amount + item.ChangedAmount;
}
return amount;
}
public static DataSet GetEmpPaySlipGrossForOthers(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipGrossForOthers(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipGrossForOthersOld(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipGrossForOthersOld(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetOldPaySlip(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetOldPaySlip(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalaryReconciliationSummary(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalaryReconciliationSummary(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalarySheet(DateTime dSMonthDate, DateTime dEMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheet(dSMonthDate, dEMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipDeductForOthers(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipDeductForOthers(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipDeductForOthersOld(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipDeductForOthersOld(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipDeductForCitiOthers(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipDeductForCitiOthers(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipDeductForLR(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipDeductForLR(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipDeductForLROld(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipDeductForLROld(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipIncomeTaxAmountForOthers(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipIncomeTaxAmountForOthers(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipIncomeTaxAmountForOthersOld(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipIncomeTaxAmountForOthersOld(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public double GetDeductAmount(EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in this.Details)
{
if (item.ItemCode == itemCode && item.ItemID == itemId)
{
if (item.itemGroupCode == EnumSalaryGroup.Deductions)
amount = amount + item.ChangedAmount;//Math.Round(
else if (item.itemGroupCode == EnumSalaryGroup.UnauthLeave)
amount = amount - item.ChangedAmount;//Math.Round(
}
}
return amount;
}
public double GetDeductAmount(EnumSalaryItemCode itemCode, SalaryMonthly oSM, int itemId)
{
double amount = 0;
foreach (SalaryMonthlyDetail item in oSM.Details)
{
if (item.ItemCode == itemCode && item.ItemID == itemId)
{
if (item.itemGroupCode == EnumSalaryGroup.Deductions)
amount = amount + item.ChangedAmount;
else if (item.itemGroupCode == EnumSalaryGroup.UnauthLeave)
amount = amount - item.ChangedAmount;
}
}
return amount;
}
public static DataSet GetEmpPaySlipGross(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipGross(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpOverAllSummaryGross(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpOverAllSummaryGross(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpOverAllSummaryDeduct(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpOverAllSummaryDeduct(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpReconciliationSalarySheet(DateTime PrevDate,DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpReconciliationSalarySheet(PrevDate,dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
//New SalarySheet From Old Tables
public static DataSet GetEmpSalarySheetOld(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheetOld(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalarySheet2(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheet2(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpEuroSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpEuroSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetExpatSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetExpatSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetCasualSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetCasualSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPrevDataForSRecon(DateTime dSMonthDate)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPrevDataForSRecon(dSMonthDate);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalaryReconForNovertis(DateTime dSMonthDate)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalaryReconForNovertis(dSMonthDate);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalarySheetForNovertis(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheetForNovertis(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalaryReconForCurrMonth(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalaryReconForCurrMonth(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalarySheetByCC(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheetByCC(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetSGSSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetSGSSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetExtendedSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetExtendedSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipDeduct(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipDeduct(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetPrvMonthNetSalary(DateTime dSMonthDate, string sEmpID, bool IsNetSum)
{
DataSet ds = null;
try
{
ds = Service.GetPrvMonthNetSalary(dSMonthDate, sEmpID, IsNetSum);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPaySlipIncomeTaxAmount(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPaySlipIncomeTaxAmount(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSalaryProcessedData(DateTime dSMonthDate, string employeeno)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalaryProcessedData(dSMonthDate, employeeno);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpSSSummaryByDept(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSSSummaryByDept(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetCCWiseSalarySheet(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetCCWiseSalarySheet(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetCCWiseSalarySummary(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetCCWiseSalarySummary(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public void CalculateTotal()
{
_totalArrear = 0;
_totalDeduct = 0;
_totalGross = 0;
_totalUADeduct = 0;
if (this.Details == null) return;
foreach (SalaryMonthlyDetail detail in this.Details)
{
if (detail.IsNew)
{
detail.ChangedAmount = detail.CalculatedAmount;
}
switch (detail.itemGroupCode)
{
case EnumSalaryGroup.Gross:
_totalGross += GlobalFunctions.Round(detail.ChangedAmount);
break;
case EnumSalaryGroup.Deductions:
_totalDeduct += GlobalFunctions.Round(detail.ChangedAmount);
break;
case EnumSalaryGroup.Arrear:
_totalArrear += GlobalFunctions.Round(detail.ChangedAmount);
break;
case EnumSalaryGroup.UnauthLeave:
_totalUADeduct += GlobalFunctions.Round(detail.ChangedAmount);
break;
}
}
_NetPay = _totalGross + _totalArrear - _totalDeduct - _totalUADeduct;
}
public double GetAmountOnRange(Employee employee, DateTime fromDate, DateTime toDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId, int supportid)
{
if (fromDate != Global.DateFunctions.FirstDateOfMonth(fromDate))
{
EmployeeGradeSalary oge = null;
oge = EmployeeGradeSalary.Get(employee.ID, fromDate, EnumArrearType.NotPresent);
if (oge != null)
{
if (itemCode == EnumSalaryItemCode.Allowance || itemCode == EnumSalaryItemCode.Deduction)
{
ADParameter op = null;
op = ADParameter.Get(ID.FromInteger(supportid));
return this.GetAmountOnRange(employee, fromDate, toDate, groupCode, itemCode, itemId, supportid, oge, op);
}
else return this.GetAmountOnRange(employee, fromDate, toDate, groupCode, itemCode, itemId, supportid, oge, null);
} return this.GetAmountOnRange(employee, fromDate, toDate, groupCode, itemCode, itemId, supportid, null, null);
}
else return this.GetAmountOnRange(employee, fromDate, toDate, groupCode, itemCode, itemId, supportid, null, null);
}
public double GetAmountOnRange(Employee employee, DateTime fromDate, DateTime toDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId, int supportid, EmployeeGradeSalary gradeSalary, ADParameter apraram)
{
double fractionMonthAmount = 0;
double amount = 0;
if (Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m", GlobalFunctions.FirstDateOfMonth(fromDate), GlobalFunctions.LastDateOfMonth(toDate)) >=2)
{
amount = SalaryMonthly.Service.GetSumOnRange(employee.ID,
GlobalFunctions.FirstDateOfMonth(fromDate.AddMonths(1)), GlobalFunctions.LastDateOfMonth(toDate.AddMonths(-1)),
groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
bool dataNotFound = false;
if (Global.DateFunctions.FirstDateOfMonth(fromDate) != Global.DateFunctions.FirstDateOfMonth(fromDate))
{
// EmployeeGradeSalary oge = EmployeeGradeSalary.Get(employee.ID, fromDate, EnumArrearType.NotPresent);
if (gradeSalary != null)
{
switch (itemCode)
{
case EnumSalaryItemCode.Basic_Salary:
fractionMonthAmount = gradeSalary.BasicSalary * GlobalFunctions.GetFractinalOfMonth(fromDate);
dataNotFound = true;
break;
case EnumSalaryItemCode.Allowance:
case EnumSalaryItemCode.Deduction:
//ADParameter op = ADParameter.Get(ID.FromInteger(supportid));
if (apraram != null)
{
if (apraram.EntitleType == EnumEntitleType.Grade)
{
fractionMonthAmount = apraram.GetGradeDefinedAmount(employee, gradeSalary.BasicSalary, gradeSalary.GrossSalary, gradeSalary);
fractionMonthAmount = fractionMonthAmount * GlobalFunctions.GetFractinalOfMonth(fromDate);
dataNotFound = true;
}
else dataNotFound = false;
}
break;
default:
break;
}
}
}
if (dataNotFound == false)
{
fractionMonthAmount = SalaryMonthly.Service.GetSumOnRange(employee.ID,
GlobalFunctions.FirstDateOfMonth(fromDate), GlobalFunctions.LastDateOfMonth(fromDate),
groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID) * GlobalFunctions.GetFractinalOfMonth(fromDate);
}
// if (Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m", fromDate, toDate) > 0)
if (Global.DateFunctions.FirstDateOfMonth(fromDate) != GlobalFunctions.FirstDateOfMonth(toDate)) // if cross two month
{
fractionMonthAmount = fractionMonthAmount + SalaryMonthly.Service.GetSumOnRange(employee.ID,
GlobalFunctions.FirstDateOfMonth(toDate), GlobalFunctions.LastDateOfMonth(toDate),
groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID) * GlobalFunctions.GetFractinalOfTillDate(toDate);
}
return amount = amount + fractionMonthAmount;
}
// public double GetAmountOnRange(Employee employee, DateTime fromDate, DateTime toDate,
// EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId, int supportid)
// {
// double fractionMonthAmount = 0;
// double amount = 0;
// if (Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m", GlobalFunctions.FirstDateOfMonth(fromDate), GlobalFunctions.LastDateOfMonth(toDate).AddDays(1)) > 2)
// {
// amount = SalaryMonthly.Service.GetSumOnRange(employee.ID,
// GlobalFunctions.FirstDateOfMonth(fromDate.AddMonths(1)), GlobalFunctions.LastDateOfMonth(toDate.AddMonths(-1)),
// groupCode, itemCode, itemId);
// }
// bool dataNotFound = false;
// if (fromDate != Global.DateFunctions.FirstDateOfMonth(fromDate))
// {
// EmployeeGradeSalary oge = EmployeeGradeSalary.Get(employee.ID, fromDate, EnumArrearType.NotPresent);
// if (oge != null)
// {
// switch (itemCode)
// {
// case EnumSalaryItemCode.Basic_Salary:
// fractionMonthAmount = oge.BasicSalary * GlobalFunctions.GetFractinalOfMonth(fromDate);
// dataNotFound = true;
// break;
// case EnumSalaryItemCode.Allowance:
// case EnumSalaryItemCode.Deduction:
// ADParameter op = ADParameter.Get(ID.FromInteger(supportid));
// if (op != null)
// {
// if (op.EntitleType == EnumEntitleType.Grade)
// {
// fractionMonthAmount = op.GetGradeDefinedAmount(employee, oge.BasicSalary, oge.GrossSalary, oge);
// fractionMonthAmount = fractionMonthAmount * GlobalFunctions.GetFractinalOfMonth(fromDate);
// dataNotFound = true;
// }
// else dataNotFound = false;
// }
// break;
// default:
// break;
// }
// }
// }
// if (dataNotFound == false)
// {
// fractionMonthAmount = SalaryMonthly.Service.GetSumOnRange(employee.ID,
// GlobalFunctions.FirstDateOfMonth(fromDate), GlobalFunctions.LastDateOfMonth(fromDate),
// groupCode, itemCode, itemId) * GlobalFunctions.GetFractinalOfMonth(fromDate);
// }
//// if (Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m", fromDate, toDate) > 0)
// if (Global.DateFunctions.FirstDateOfMonth( fromDate) != GlobalFunctions.FirstDateOfMonth( toDate) ) // if cross two month
// {
// fractionMonthAmount = fractionMonthAmount + SalaryMonthly.Service.GetSumOnRange(employee.ID,
// GlobalFunctions.FirstDateOfMonth(toDate), GlobalFunctions.LastDateOfMonth(toDate),
// groupCode, itemCode, itemId) * GlobalFunctions.GetFractinalOfTillDate(toDate);
// }
// return amount = amount + fractionMonthAmount;
// }
public double GetUnAuthorizeAmount(double nAmount, Employee employee, DateTime fromdate, DateTime toDate,
EnumSalaryItemCode itemCode, int itemId)
{
double uPaid = 0, uPayable = 0, totalUpayable = 0;
DateTime StartDate = GlobalFunctions.LastDateOfMonth(fromdate);
DateTime EndDate = GlobalFunctions.LastDateOfMonth(toDate);
double MonDays = 0;
int leaveDays = 0;
while (StartDate <= EndDate)
{
MonDays = (double)StartDate.Day;
leaveDays = SalaryMonthly.Service.GetUnAuthorizeDays(employee.ID, GlobalFunctions.LastDateOfMonth(StartDate));
if (leaveDays > 0)
{
uPaid = SalaryMonthly.Service.GetSumOnRange(employee.ID,
GlobalFunctions.FirstDateOfMonth(StartDate), GlobalFunctions.LastDateOfMonth(StartDate),
EnumSalaryGroup.UnauthLeave, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID);
uPayable = (nAmount / MonDays) * leaveDays;
totalUpayable = totalUpayable + (uPayable - uPaid);
}
StartDate = GlobalFunctions.LastDateOfMonth(StartDate.AddDays(1));
}
return totalUpayable;
}
public double GetAmountForYear(Employee employee, DateTime firstDateOfYear, DateTime lastDateOfYear,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
amount = SalaryMonthly.Service.GetSumOnRange(employee.ID, firstDateOfYear, lastDateOfYear, groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID);
return amount;
}
public double GetUnAuthorizeAmountOnDateRange(ID employeeId, DateTime fromDate, DateTime toDate, EnumSalaryGroup groupCode)
{
double TotalUnAmount = 0.0;
TotalUnAmount = SalaryMonthly.Service.GetUnAuthorizeAmountOnDateRange(employeeId, fromDate, toDate, groupCode);
return TotalUnAmount;
}
public double GetUnAuthorizeAmountOnDateRange(ID employeeId, DateTime fromDate, DateTime toDate, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode)
{
double TotalUnAmount = 0.0;
TotalUnAmount = SalaryMonthly.Service.GetUnAuthorizeAmountOnDateRange(employeeId, fromDate, toDate, groupCode, itemCode);
return TotalUnAmount;
}
public double GetAmountOnDateDiff(ID employeeID, DateTime dFromDate, DateTime dToDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
amount = SalaryMonthly.Service.GetAmountOnDateDiff(employeeID, dFromDate, dToDate, groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID);
return amount;
}
public double GetThisMonthBasicOnDateDiff(ID employeeID, DateTime dFromDate, DateTime dToDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
amount = SalaryMonthly.Service.GetThisMonthBasicOnDateDiff(employeeID, dFromDate, dToDate, groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID);
return amount;
}
public double GetAmountOnDateDiffForOverTime(ID employeeID, DateTime dFromDate, DateTime dToDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId)
{
double amount = 0;
amount = SalaryMonthly.Service.GetAmountOnDateDiffForOverTime(employeeID, dFromDate, dToDate, groupCode, itemCode, itemId, SystemInformation.CurrentSysInfo.PayrollTypeID);
return amount;
}
public static DataSet GetSalaryStracture(string SempIds)
{
return SalaryMonthly.Service.GetSalaryStracture(SempIds);
}
public static DataSet GetEmpSalarySheetByYear(DateTime dSalaryMonth, string sEmpID)
{
return SalaryMonthly.Service.GetEmpSalarySheetByYear(dSalaryMonth, sEmpID);
}
public static DataSet GetEmpStartDateAndEndDate(DateTime fstDate, DateTime endDate, string sEmpID)
{
return SalaryMonthly.Service.GetEmpStartDateAndEndDate(fstDate, endDate, sEmpID);
}
public static DataSet GetSalaryForTax(DateTime fstDate, DateTime endDate)
{
return SalaryMonthly.Service.GetSalaryForTax(fstDate, endDate);
}
public static ObjectsTemplate<SalaryMonthly> GetByDateRange(DateTime startDate, DateTime endDate)
{
return SalaryMonthly.Service.GetByDateRange(startDate, endDate, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
public static ObjectsTemplate<SalaryMonthly> GetByDateRange(ID nEmpID, DateTime startDate, DateTime endDate)
{
return SalaryMonthly.Service.GetByDateRange(nEmpID, startDate, endDate, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
public double GetAmountOnDateDiffForAll(ID employeeID, DateTime dFromDate, DateTime dToDate)
{
double amount = 0;
amount = SalaryMonthly.Service.GetAmountOnDateDiffForAll(employeeID, dFromDate, dToDate, SystemInformation.CurrentSysInfo.PayrollTypeID);
return amount;
}
public double GetPrvTaxAmount(EnumIncomeTaxDataFrom dataFrom, ID employeeID, DateTime dFromDate, DateTime dToDate)
{
double amount = 0;
amount = SalaryMonthly.Service.GetPrvTaxAmount(dataFrom, employeeID, dFromDate, dToDate);
return amount;
}
public static DataSet GetEmpSalarySheetForIDLC(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheetForIDLC(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetEmpPNL(DateTime dateTime, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetEmpPNL(dateTime, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetNewCCWiseSalarySummary(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetNewCCWiseSalarySummary(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static ObjectsTemplate<SalaryMonthly> Get(string sEmpID, DateTime fromdate, DateTime toDate)
{
ObjectsTemplate<SalaryMonthly> oSalaryMonthly = null;
oSalaryMonthly = Service.Get(sEmpID, fromdate, toDate);
return oSalaryMonthly;
}
public static DataSet GetEmpSalarySheetForManagement(DateTime sdMonth, string empId)
{
DataSet ds = null;
try
{
ds = Service.GetEmpSalarySheetForManagement(sdMonth, empId);
}
catch (Exception ex)
{
throw new ServiceException(ex.Message);
}
return ds;
}
public static DataSet GetCCWiseSalarySheetDetail(DateTime dSMonthDate, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetCCWiseSalarySheetDetail(dSMonthDate, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet CostCenterCount(DateTime dSMonthDate)
{
DataSet ds = null;
try
{
ds = Service.CostCenterCount(dSMonthDate);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetWPPFByGrade(int nYear)
{
DataSet ds = null;
try
{
ds = Service.GetWPPFByGrade(nYear);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetWPPF(int empID)
{
DataSet ds = null;
try
{
ds = Service.GetWPPF(empID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetWPPFFromEmployee(int nYear)
{
DataSet ds = null;
try
{
ds = Service.GetWPPFFormEmployee(nYear);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetBasic()
{
DataSet ds = null;
try
{
ds = Service.GetBasic();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataTable GetGrade()
{
DataTable dt = null;
try
{
dt = Service.GetGrade();
}
catch (Exception e)
{
throw e;
}
return dt;
}
public static DataTable GetCustomDataTable(string sQuery)
{
DataTable dt = null;
try
{
dt = Service.GetCustomDataTable(sQuery);
}
catch (Exception e)
{
throw e;
}
return dt;
}
public static DataSet GetRewardStatementReportData(EnumAllowOrDeduct allowOrDeduct, ID empID, EnumADEmpType adEmpType,
int previousYear, int currentYear, ID gradeID, string bonusIDs, EnmSetupManagerTranType setupManagerType)
{
return Service.GetRewardStatementReportData(SystemInformation.CurrentSysInfo.PayrollTypeID,
allowOrDeduct, empID, adEmpType, previousYear, currentYear, gradeID, bonusIDs, setupManagerType);
}
public static void SalaryProcess(ObjectsTemplate<BO.Employee> _employees, DateTime dateTime)
{
Service.SalaryProcess(_employees, dateTime);
}
public static DataSet GetSMAndBPForRewardYear(string employeeID, DateTime currentYearFromDate, DateTime currentYearToDate, DateTime previousYearFromDate, DateTime previousYearToDate)
{
DataSet ds = null;
try
{
ds = Service.GetSMAndBPForRewardYear(employeeID, currentYearFromDate, currentYearToDate, previousYearFromDate, previousYearToDate);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataTable GetGradeWPPF(int previousYear, int currentYear, int gradeID)
{
DataTable dtGradeWPPF = null;
try
{
dtGradeWPPF = Service.GetGradeWPPF(previousYear, currentYear, gradeID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return dtGradeWPPF;
}
public static DataTable GetCalCulatedAmountByAllowDeductID(ID empID, ID allowDeductID, DateTime salaryMonth)
{
return Service.GetCalCulatedAmountByAllowDeductID(empID, allowDeductID, salaryMonth);
}
}
#endregion
#region ISalaryMonthly Service
public interface ISalaryMonthlyService
{
DataSet GetSalaryStracture(string SempIds);
SalaryMonthly Get(ID id);
SalaryMonthly GetLastSalaryMonthDetails(ID empID);
DateTime? GetLastPaidSalaryMonth(int nEmpID);
void Update(SalaryMonthly item);
//void UpdateSalaryDetail(SalaryMonthlyDetail item);
void UpdateDetail(ObjectsTemplate<SalaryMonthlyDetail> oSMontlyDetails, ObjectsTemplate<IncomeTax> otaxDeduc);
void Save(SalaryProcess process, ObjectsTemplate<SalaryMonthly> items);
void BulkSave(SalaryProcess process, ObjectsTemplate<SalaryMonthly> items);
void BulkSave(DataTable dt);
void WPPFClaimSave(DataTable dt);
void WPPFSave(DataTable dt);
void WWFSave(DataTable dt);
void Delete(ID id);
SalaryMonthlyDetail GetDetail(ID employeeId, DateTime SalaryMonth, EnumSalaryGroup groupCode,
EnumSalaryItemCode itemCode, int itemId);
double GetSumOnRange(ID employeeId, DateTime fromDate, DateTime toDate, EnumSalaryGroup groupCode,
EnumSalaryItemCode itemCode, int itemId, ID payrollTypeID);
//double GetGrossOnRange(ID employeeId, DateTime fromDate, DateTime toDate, EnumSalaryItemCode itemCode, int itemId);
SalaryMonthly Get(ID nEmpID, DateTime dateTime);
ObjectsTemplate<SalaryMonthly> Get(DateTime salaryMonth, ID payrollTypeID);
ObjectsTemplate<SalaryMonthly> GetForJV(DateTime salaryMonth, ID payrollTypeID);
//ObjectsTemplate<SalaryMonthly> Get(ID nEmpID);
ObjectsTemplate<SalaryMonthly> Get(string sEmpID, DateTime salaryMonth);
ObjectsTemplate<SalaryMonthly> GetForWTP(string sEmpID, DateTime salaryMonth);
ObjectsTemplate<SalaryEmpCostCenter> GetForCC(ID SalaryMonthID);
ObjectsTemplate<SalaryEmpCostCenter> GetCostCenter(DateTime salaryMonth);
DataSet GetEmpPaySlipGrossForOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipGrossForOthersOld(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetOldPaySlip(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeductForOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeductForOthersOld(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeductForCitiOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpSalarySheetForManagement(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpPaySlipDeductForLR(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeductForLROld(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipIncomeTaxAmountForOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipIncomeTaxAmountForOthersOld(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipGross(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpOverAllSummaryGross(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpOverAllSummaryDeduct(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeduct(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipIncomeTaxAmount(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpSalaryProcessedData(DateTime dSalaryMonthDate, string employeeno);
DataSet GetEmpSalarySheetByCC(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpSalarySheet(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpSalarySheetOld(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpSalarySheet2(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpSalarySheetForIDLC(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpPrevDataForSRecon(DateTime dSalaryMonth);
DataSet GetEmpSalarySheetForNovertis(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpSalaryReconForCurrMonth(DateTime dSalaryMonth, string sEmpID);
DataSet GetSGSSalarySheet(DateTime dSalaryMonth, string sEmpID);
DataSet GetExtendedSalarySheet(DateTime dSalaryMonth, string sEmpID);
DataSet GetPrvMonthNetSalary(DateTime dSalaryMonth, string sEmpID, bool IsNetSum);
DataSet GetEmpSSSummaryByDept(DateTime dSalaryMonth, string sEmpID);
DataSet GetCCWiseSalarySheet(DateTime dSalaryMonth, string sEmpID);
DataSet GetNewCCWiseSalarySummary(DateTime dSMonthDate, string sEmpID);
DataSet GetCCWiseSalarySummary(DateTime dSalaryMonth, string sEmpID);
double GetUnAuthorizeAmountOnDateRange(ID employeeId, DateTime fromDate, DateTime toDate, EnumSalaryGroup groupCode);
double GetUnAuthorizeAmountOnDateRange(ID employeeId, DateTime fromDate, DateTime toDate, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode);
bool IsSalaryProcessed(ID employeeID, DateTime SalaryMonth);
bool IsSalaryProcessedWeb(DateTime SalaryMonth, ID payrollTypeID);
bool IsPermanentEmp(ID employeeID, DateTime SalaryMonth, ID payrollTypeID);
bool IsPermanentEmpOld(ID employeeID, DateTime SalaryMonth, ID payrollTypeID);
void IsSalaryProcessedAndFinalized(ID employeeID, DateTime SalaryMonth, ref bool isprocessed, ref bool isfinalized);
int GetUnAuthorizeDays(ID employeeid, DateTime salaryMonth);
ObjectsTemplate<SalaryMonthlyDetail> GetSalaryDetail(ID salaryMonthlyID);
int GetTotalEmp(ID SalaryProcessID);
DataSet GetEmpSalaryReconForNovertis(DateTime dSalaryMonth);
double GetAmountOnDateDiff(ID employeeID, DateTime fromDate, DateTime toDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId, ID payrollTypeID);
double GetThisMonthBasicOnDateDiff(ID employeeID, DateTime fromDate, DateTime toDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId, ID payrollTypeID);
double GetAmountOnDateDiffForOverTime(ID employeeID, DateTime fromDate, DateTime toDate,
EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int itemId, ID payrollTypeID);
double GetAmountOnDateDiffForAll(ID employeeID, DateTime fromDate, DateTime toDate, ID payrollTypeID);
double GetPrvTaxAmount(EnumIncomeTaxDataFrom dataFrom, ID employeeID, DateTime fromDate, DateTime toDate);
DataSet GetEmpSalarySheetByYear(DateTime dSalaryMonth, string sEmpID);
DataSet GetEmpStartDateAndEndDate(DateTime fstDate, DateTime endDate, string sEmpID);
DataSet GetSalaryForTax(DateTime fstDate, DateTime endDate);
ObjectsTemplate<SalaryMonthly> GetByDateRange(DateTime startDate, DateTime endDate, ID payrollTypeID);
ObjectsTemplate<SalaryMonthly> GetByDateRange(ID nEmpID, DateTime startDate, DateTime endDate, ID payrollTypeID);
DataSet GetEmpSalaryReconciliationSummary(DateTime dSMonthDate, string sEmpID);
ObjectsTemplate<SalaryMonthlyDetail> GetHead(int index, DateTime salaryMonth);
ObjectsTemplate<SalaryMonthly> Get(string sEmpID, DateTime fromdate, DateTime toDate);
DataSet GetCCWiseSalarySheetDetail(DateTime dSMonthDate, string sEmpID);
DataSet CostCenterCount(DateTime dSMonthDate);
DataSet GetCasualSalarySheet(DateTime dSMonthDate, string sEmpID);
DataSet GetEmpSalarySheet(DateTime dSMonthDate, DateTime dEMonthDate, string sEmpID);
DataSet GetEmpPNL(DateTime dateTime, string sEmpID);
DataSet GetEmpEuroSalarySheet(DateTime dSMonthDate, string sEmpID);
DataSet GetExpatSalarySheet(DateTime dSMonthDate, string sEmpID);
void SalaryProcess(ObjectsTemplate<Employee> _employees, DateTime dateTime);
DataSet GetSMAndBPForRewardYear(string employeeID, DateTime currentYearFromDate, DateTime currentYearToDate, DateTime previousYearFromDate, DateTime previousYearToDate);
DataSet GetWPPFByGrade(int nYear);
DataSet GetWPPFFormEmployee(int nYear);
DataSet GetWPPF(int empID);
DataSet GetBasic();
DataSet GetRewardStatementReportData(ID payrollTypeID, EnumAllowOrDeduct allowOrDeduct, ID empID, EnumADEmpType adEmpType,
int previousYear, int currentYear, ID gradeID, string bonusIDs, EnmSetupManagerTranType setupManagerType);
DataTable GetGrade();
DataTable GetCustomDataTable(string sQuery);
DataTable GetGradeWPPF(int previousYear, int currentYear, int gradeID);
DataTable GetCalCulatedAmountByAllowDeductID(ID empID, ID allowDeductID, DateTime salaryMonth);
DataSet GetEmpReconciliationSalarySheet(DateTime PrevDate, DateTime dSMonthDate, string sEmpID);
}
#endregion
public class TempUnAuthorized
{
public int EmpID { get; set; }
public int TotalUnAuthorizedDays { get; set; }
public int BasicPaidDays { get; set; }
public int OtherPaidDays { get; set; }
public int LeaveID { get; set; }
public int BasicUnpaidDays { get; set; }
public int OtherUnpaidDays { get; set; }
public int BasicCurrentDeduct { get; set; }
public int OtherCurrentDeduct { get; set; }
public int UnPaidLeaveYear { get; set; }
}
}