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

329 lines
8.9 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 LoanSchedule
public class LoanSchedule:AuditTrailBase
{
#region Constructor
public LoanSchedule()
{
//_loanIssueID = null;
//_employeeID = null;
//_scheduleNo = 0;
//_openingBalance = 0;
//_installmentPrincipal = 0;
//_installmentInterest = 0;
//_dueInstallmentDate = DateTime.MinValue;
//_paymentDate = null;
//_days = 0;
//_calculatedDate = DateTime.MinValue;
//_actualInterest = 0;
//_closingBalance = 0;
//_loanIssue = null;
//_isPaid = false;
//_interestRate = 0;
}
#endregion
#region Properties
public int LoanIssueID { get; set; }
public int EmployeeID { get; set; }
public int ScheduleNo { get; set; }
public bool Paid { get { return (PaymentDate != null); } }
public double OpeningBalance { get; set; }
public double Installment { get; set; }
public double InstallmentPrincipal { get; set; }
public double InstallmentInterest { get; set; }
public DateTime DueInstallmentDate { get; set; }
public DateTime? PaymentDate { get; set; }
public EnumLoanPaymentMode PaymentMode { get; set; }
public int Days { get; set; }
public DateTime CalculatedDate { get; set; }
public double ActualInterest { get; set; }
public double ClosingBalance { get; set; }
public LoanIssue LoanIssue { get; set; }
//#region loanIssue : LoanIssue
//private LoanIssue _loanIssue;
//public LoanIssue LoanIssue
//{
// get
// {
// if (_loanIssueID.Integer > 0 && _loanIssue == null)
// {
// _loanIssue = new LoanIssue();
// _loanIssue = LoanIssue.Get(_loanIssueID);
// }
// return this._loanIssue;
// }
// set
// {
// _loanIssue = value;
// }
//}
//#endregion
public bool IsPaid { get; set; }
public double InterestRate { get; set; }
//#region Service Factory ILoanScheduleService : ILoanScheduleService
//internal static ILoanScheduleService Service
//{
// get { return Services.Factory.CreateService<ILoanScheduleService>(typeof(ILoanScheduleService)); }
//}
//#endregion
#endregion
//#region Functions
//public static LoanSchedule Get(ID nID)
//{
// LoanSchedule oLoanSchedule = null;
// #region Cache Header
// oLoanSchedule = (LoanSchedule)_cache["Get", nID];
// if (oLoanSchedule != null)
// return oLoanSchedule;
// #endregion
// oLoanSchedule = LoanSchedule.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oLoanSchedule, "Get", nID);
// #endregion
// return oLoanSchedule;
//}
//public static DataSet GetByEmpIDANDLoanID(int EmpID, int LoanID)
//{
// DataSet ds = null;
// try
// {
// ds = Service.GetByEmpIDANDLoanID(EmpID, LoanID);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
// return ds;
//}
//public static List<LoanSchedule> Get()
//{
// #region Cache Header
// List<LoanSchedule> loanSchedules = _cache["Get"] as List<LoanSchedule>;
// if (loanSchedules != null)
// return loanSchedules;
// #endregion
// try
// {
// loanSchedules = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(loanSchedules, "Get");
// #endregion
// return loanSchedules;
//}
//public void setId(ID newId)
//{
// this.SetID(newId);
//}
//public static List<LoanSchedule> GetByIssueIDAndMonth(ID nIssueID, DateTime dateTime)
//{
// #region Cache Header
// List<LoanSchedule> loanSchedules = _cache["GetByIssueIDAndMonth", nIssueID, dateTime] as List<LoanSchedule>;
// if (loanSchedules != null)
// return loanSchedules;
// #endregion
// try
// {
// loanSchedules = Service.GetByIssueIDAndMonth(nIssueID, dateTime);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(loanSchedules, "GetByIssueIDAndMonth", nIssueID, dateTime);
// #endregion
// return loanSchedules;
//}
//public static DataSet GetLoanPaymentDue(DateTime dFromDate, DateTime dToDate)
//{
// DataSet loanSchedules = null;
// try
// {
// loanSchedules = Service.GetLoanPaymentDue(dFromDate, dToDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return loanSchedules;
//}
//public static DataSet GetAllActiveLoan(string sEmps)
//{
// DataSet loanSchedules = null;
// try
// {
// loanSchedules = Service.GetAllActiveLoan(sEmps,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return loanSchedules;
//}
//public static DataSet GetCurrentMonthDueLoan(string sEmps, ID loanID)
//{
// DataSet loanSchedules = null;
// try
// {
// loanSchedules = Service.GetCurrentMonthDueLoan(sEmps, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer, loanID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return loanSchedules;
//}
//public static List<LoanSchedule> GetByIssueID(ID nIssueID)
//{
// #region Cache Header
// List<LoanSchedule> loanSchedules = _cache["GetByIssueID", nIssueID] as List<LoanSchedule>;
// if (loanSchedules != null)
// return loanSchedules;
// #endregion
// try
// {
// loanSchedules = Service.GetByIssueID(nIssueID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(loanSchedules, "GetByIssueID", nIssueID);
// #endregion
// return loanSchedules;
//}
//public static DataSet GetScheduleForSalary(DateTime monthDate)
//{
// try
// {
// return Service.GetScheduleForSalary(monthDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
//}
//public ID Save()
//{
// return LoanSchedule.Service.Save(this);
//}
//public void Delete()
//{
// LoanSchedule.Service.Delete(ID);
//}
//#endregion
}
#endregion
#region ILoanSchedule Service
public interface ILoanScheduleService
{
LoanSchedule Get(int id);
DataSet GetByEmpIDANDLoanID(int EmpID, int LoanID);
List<LoanSchedule> Get();
int Save(LoanSchedule item);
void SaveList(List<LoanSchedule> items);
void Delete(int id);
List<LoanSchedule> GetByIssueID(int nIssueID);
List<LoanSchedule> GetByIssueIDAndMonth(int nIssueID, DateTime dateTime);
DataSet GetLoanPaymentDue(DateTime dFromDate, DateTime dToDate, int payrollTypeID);
List<LoanSchedule> GetUnpaidSechedule(DateTime monthDate);
DataSet GetScheduleForSalary(DateTime monthDate, int payrollTypeID);
DataSet GetAllActiveLoan(string sEmps, int payrollTypeID);
DataSet GetCurrentMonthDueLoan(string sEmps, int payrollTypeID, int loanID);
}
#endregion
}