using System; using System.Linq; using System.Data; using System.Collections.Generic; namespace HRM.BO { public class InvestmentInfo : AuditTrailBase { #region Constructor public InvestmentInfo() : base() { AccountNo = string.Empty; BankID = 0; BranchID =0; CategoryID = 0; GLTranID = 0; ProjectID = 0; CertificateNo = string.Empty; CurrentStatus = 0; Description = string.Empty; Amount = 0; TotalProAccruedAmount = 0; LastProAccruedDate = DateTime.MinValue; MatureDate = DateTime.MinValue; RefID = 0; IssueDate = DateTime.MinValue; Tenure = 0; EncashmentDate = DateTime.MinValue; RenewalDate = DateTime.MinValue; UserRecordID = 0; InvestmentCategoryObj = null; BankName = string.Empty; BranchName = string.Empty; InvestmentCategoryCode = string.Empty; InvestmentCategoryName = string.Empty; TenureType = 0; RenewalInterest = 0; RenewalGLCode = string.Empty; } #endregion Constructor #region Properties #region Property AccountNo : string public string AccountNo { get;set; } #endregion Property AccountNo : string #region Property BankID : ID public int BankID { get; set; } #endregion Property BankID : ID #region Property BankName : string public string BankName { get; set; } #endregion Property BankName : string #region Property BranchID : ID public int BranchID { get; set; } #endregion Property BranchID : ID #region Property GLTranID : ID public int GLTranID { get; set; } #endregion Property GLTranID : ID #region Property BranchObj : Branch //public Ease.PPIC.BO.Branch BranchObj //{ // get; set; //} #endregion Property BranchObj : Branch #region Property BranchName : string public string BranchName { get; set; } #endregion Property BranchName : string #region Property CategoryID : ID public int CategoryID { get; set; } #endregion Property CategoryID : ID #region Property InvestmentCategoryObj : InvestmentCategory public InvestmentCategory InvestmentCategoryObj { get; set; } #endregion Property InvestmentCategoryObj : InvestmentCategory #region Property InvestmentCategoryCode : string public string InvestmentCategoryCode { get; set; } #endregion Property InvestmentCategoryCode : string #region Property InvestmentCategoryName : string public string InvestmentCategoryName { get; set; } #endregion Property InvestmentCategoryName : string #region Property RenewalGLCode : string public string RenewalGLCode { get; set; } #endregion Property RenewalGLCode : string #region Property ProjectID : ID public int ProjectID { get; set; } #endregion Property ProjectID : ID #region Property CertificateNo : string public string CertificateNo { get; set; } #endregion Property CertificateNo : string #region Property CurrentStatus : int public int CurrentStatus { get; set; } #endregion Property CurrentStatus : int #region Property Description : string public string Description { get; set; } #endregion Property Description : string #region Property Amount : double public double Amount { get; set; } #endregion Property Amount : double #region Property RenewalInterest : double public double RenewalInterest { get; set; } #endregion Property RenewalInterest : double #region Property TotalProAccruedAmount : double public double TotalProAccruedAmount { get; set; } #endregion Property TotalProAccruedAmount : double #region Property LastProAccruedDate : DateTime public DateTime LastProAccruedDate { get; set; } #endregion Property LastProAccruedDate : DateTime #region Property MatureDate : DateTime public DateTime MatureDate { get; set; } #endregion Property MatureDate : DateTime #region Property RefID : ID public int RefID { get; set; } #endregion Property RefID : ID #region Property IssueDate : DateTime public DateTime IssueDate { get; set; } #endregion Property IssueDate : DateTime #region Property Tenure : int public int Tenure { get; set; } #endregion Property Tenure : int #region Property CalculationBase : int public int CalculationBase { get; set; } #endregion Property TenureType : int #region Property TenureType : int public int TenureType { get; set; } #endregion Property TenureType : int #region Property EncashmentDate : DateTime public DateTime? EncashmentDate { get; set; } #endregion Property EncashmentDate : DateTime #region Property RenewalDate : DateTime public DateTime? RenewalDate { get; set; } #endregion Property RenewalDate : DateTime #region Property UserRecordID : ID public int UserRecordID { get; set; } #endregion Property UserRecordID : ID #region Property InvestmentSchedulesCollection : InvestmentSchedules public InvestmentSchedules InvestmentSchedulesCollection { get; set; } #endregion Property InvestmentSchedulesCollection : InvestmentSchedules #region Property InvestmentSignatorysCollection : InvestmentSignatorys public InvestmentSignatorys InvestmentSignatorysCollection { get; set; } #endregion Property InvestmentSignatorysCollection : InvestmentSignatorys #region Property InvestmentLogCollection : InvestmentLogs public InvestmentLogs InvestmentLogCollection { get; set; } #endregion Property InvestmentLogCollection : InvestmentLogs #region Property InvestmentTranCollection : InvestmentTrans public InvestmentTrans InvestmentTranCollection { get; set; } #endregion Property InvestmentTranCollection : InvestmentTrans #region Property Implementation of IFASTranObject and FASUserObject public int iFASTranObject_ProcessID { get; } public int iFASTranObject_ActivityID { get; } public int iFASTranObject_SystemTranType { get; } public int iFASTranObject_ActivityRelated { get; } //public ProjectProcess iFASTranObject_ProjectProcess //{ // get; //} //public List iFASTranObject_ProcessActivity //{ // get; //} //public List iFASTranObject_voucherSetups //{ // get; //} #endregion #endregion Properties //#region Private Function //public double GetMonthlyInterestAmount(InvestmentInfo investmentInfo, DateTime dLastDateOfProcessMonth) //{ // double interestAmount = 0; // int daysOfMonth = 0; // DateTime dPayrollFirstDateOfMonth = Global.PayrollFirstDateOfMonth(dLastDateOfProcessMonth); // DateTime dPayrollLastDateOfMonth = Global.PayrollLastDateOfMonth(dLastDateOfProcessMonth); // daysOfMonth = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, dPayrollLastDateOfMonth) + 1; // int basement360 = Convert.ToInt32(FM.BO.Common.EnumCalculationBase.ThreeSixty); // int basement365 = Convert.ToInt32(FM.BO.Common.EnumCalculationBase.ThreeSixtyFive); // int indexNumber = 0; // foreach (InvestmentSchedule investmentSchedule in investmentInfo.InvestmentSchedulesCollection) // { // if (investmentSchedule.FromDate <= dLastDateOfProcessMonth && investmentSchedule.TillDate >= dPayrollFirstDateOfMonth) // { // if (investmentInfo.TenureType == (int)EnumTenureType.Day) // { // if (investmentInfo.IssueDate.Month == dLastDateOfProcessMonth.Month) // { // int days = Ease.Core.Global.DateDiff("D", investmentInfo.IssueDate, dLastDateOfProcessMonth) + 1; // if (investmentInfo.CalculationBase == basement360) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); // } // else if (investmentInfo.CalculationBase == basement365) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); // } // } // else if (investmentInfo.MatureDate.Month == dLastDateOfProcessMonth.Month) // { // int days = 0; // if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentSchedule.FromDate, investmentSchedule.TillDate) + 1; // } // else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, investmentInfo.MatureDate); // } // if (investmentInfo.CalculationBase == basement360) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); // } // else if (investmentInfo.CalculationBase == basement365) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); // } // } // else // { // int days = 0; // if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentSchedule.FromDate, dLastDateOfProcessMonth) + 1; // } // else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, dLastDateOfProcessMonth); // } // if (investmentInfo.CalculationBase == basement360) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); // } // else if (investmentInfo.CalculationBase == basement365) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); // } // } // } // else if (investmentInfo.TenureType == (int)EnumTenureType.Month) // { // if (investmentInfo.IssueDate.Month == dLastDateOfProcessMonth.Month && investmentInfo.IssueDate.Year == dPayrollLastDateOfMonth.Year) // { // int days = Ease.Core.Global.DateDiff("D", investmentInfo.IssueDate, dLastDateOfProcessMonth) + 1; // if (investmentInfo.CalculationBase == basement360) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); // } // else if (investmentInfo.CalculationBase == basement365) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); // } // } // else if (investmentInfo.MatureDate.Month == dLastDateOfProcessMonth.Month && investmentInfo.MatureDate.Year == dPayrollLastDateOfMonth.Year) // { // int days = 0; // if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentSchedule.FromDate, investmentSchedule.TillDate) + 1; // } // else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, investmentInfo.MatureDate); // } // if (investmentInfo.CalculationBase == basement360) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); // } // else if (investmentInfo.CalculationBase == basement365) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); // } // } // else // { // int days = 0; // if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentSchedule.FromDate, dLastDateOfProcessMonth) + 1; // } // else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) // { // days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, dLastDateOfProcessMonth); // } // if (investmentInfo.CalculationBase == basement360) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); // } // else if (investmentInfo.CalculationBase == basement365) // { // interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); // } // } // } // } // indexNumber++; // } // return interestAmount; //} ////For IDLC Only ////Please Change After Consult with Shamim Vai ////public double GetMonthlyInterestAmount(InvestmentInfo investmentInfo, DateTime dLastDateOfProcessMonth) ////{ //// double interestAmount = 0; //// int daysOfMonth = 0; //// DateTime dPayrollFirstDateOfMonth = Global.PayrollFirstDateOfMonth(dLastDateOfProcessMonth); //// DateTime dPayrollLastDateOfMonth = Global.PayrollLastDateOfMonth(dLastDateOfProcessMonth); //// daysOfMonth = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, dPayrollLastDateOfMonth) + 1; //// int basement360 = Convert.ToInt32(FM.BO.Common.EnumCalculationBase.ThreeSixty); //// int basement365 = Convert.ToInt32(FM.BO.Common.EnumCalculationBase.ThreeSixtyFive); //// int indexNumber = 0; //// foreach (InvestmentSchedule investmentSchedule in investmentInfo.InvestmentSchedulesCollection) //// { //// if (investmentSchedule.FromDate <= dLastDateOfProcessMonth && investmentSchedule.TillDate >= dPayrollFirstDateOfMonth) //// { //// if (investmentInfo.TenureType == (int)EnumTenureType.Day) //// { //// if (investmentInfo.IssueDate.Month == dLastDateOfProcessMonth.Month && investmentInfo.IssueDate.Year == dPayrollLastDateOfMonth.Year) //// { //// int days = Ease.Core.Global.DateDiff("D", investmentInfo.IssueDate, dLastDateOfProcessMonth) + 1; //// if (investmentInfo.CalculationBase == basement360) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); //// } //// else if (investmentInfo.CalculationBase == basement365) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); //// } //// } //// else if (investmentInfo.MatureDate.Month == dLastDateOfProcessMonth.Month && investmentInfo.MatureDate.Year == dPayrollLastDateOfMonth.Year) //// { //// int days = 0; //// if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, investmentSchedule.TillDate) ; //// } //// else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) //// { //// DateTime dtLastProcess = investmentInfo.LastProAccruedDate.AddMonths(1); //// if (dtLastProcess.Month == investmentInfo.MatureDate.Month) //// { //// days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, investmentInfo.MatureDate) - 1; //// } //// else //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, investmentSchedule.TillDate) - 1; //// } //// } //// if (investmentInfo.CalculationBase == basement360) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); //// } //// else if (investmentInfo.CalculationBase == basement365) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); //// } //// } //// else //// { //// int days = 0; //// if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, dLastDateOfProcessMonth) + 1; //// } //// else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) //// { //// DateTime dtLastProcess = investmentInfo.LastProAccruedDate.AddMonths(1); //// if (dtLastProcess.Month == dLastDateOfProcessMonth.Month) //// { //// days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, dLastDateOfProcessMonth); //// } //// else //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, dLastDateOfProcessMonth) + 1; //// } //// } //// if (investmentInfo.CalculationBase == basement360) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); //// } //// else if (investmentInfo.CalculationBase == basement365) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); //// } //// } //// } //// else if (investmentInfo.TenureType == (int)EnumTenureType.Month) //// { //// if (investmentInfo.IssueDate.Month == dLastDateOfProcessMonth.Month && investmentInfo.IssueDate.Year == dPayrollLastDateOfMonth.Year) //// { //// int days = Ease.Core.Global.DateDiff("D", investmentInfo.IssueDate, dLastDateOfProcessMonth) + 1; //// if (investmentInfo.CalculationBase == basement360) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); //// } //// else if (investmentInfo.CalculationBase == basement365) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); //// } //// } //// else if (investmentInfo.MatureDate.Month == dLastDateOfProcessMonth.Month && investmentInfo.MatureDate.Year == dPayrollLastDateOfMonth.Year) //// { //// int days = 0; //// if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, investmentSchedule.TillDate) - 1; //// } //// else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) //// { //// DateTime dtLastProcess = investmentInfo.LastProAccruedDate.AddMonths(1); //// if (dtLastProcess.Month == investmentInfo.MatureDate.Month) //// { //// days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, investmentInfo.MatureDate) - 1; //// } //// else //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, investmentSchedule.TillDate) - 1; //// } //// } //// if (investmentInfo.CalculationBase == basement360) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); //// } //// else if (investmentInfo.CalculationBase == basement365) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); //// } //// } //// else //// { //// int days = 0; //// if (investmentInfo.LastProAccruedDate == null || investmentInfo.LastProAccruedDate == DateTime.MinValue) //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, dLastDateOfProcessMonth) + 1; //// } //// else if (investmentInfo.LastProAccruedDate != null && investmentInfo.LastProAccruedDate != DateTime.MinValue) //// { //// DateTime dtLastProcess = investmentInfo.LastProAccruedDate.AddMonths(1); //// if (dtLastProcess.Month == dLastDateOfProcessMonth.Month) //// { //// days = Ease.Core.Global.DateDiff("D", investmentInfo.LastProAccruedDate, dLastDateOfProcessMonth); //// } //// else //// { //// days = Ease.Core.Global.DateDiff("D", dPayrollFirstDateOfMonth, dLastDateOfProcessMonth) + 1; //// } //// } //// if (investmentInfo.CalculationBase == basement360) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement360 * 100); //// } //// else if (investmentInfo.CalculationBase == basement365) //// { //// interestAmount = (investmentInfo.Amount * investmentInfo.InvestmentSchedulesCollection[indexNumber].Percentage * days) / (basement365 * 100); //// } //// } //// } //// } //// indexNumber++; //// } //// return interestAmount; ////} //private InvestmentSchedule GetInvestmentSchedule(InvestmentInfo investmentInfo, DateTime dLastDateOfProcessMonth) //{ // InvestmentSchedule investmentScheduleNull = null; // foreach (InvestmentSchedule investmentSchedule in investmentInfo.InvestmentSchedulesCollection) // { // if (investmentSchedule.FromDate <= dLastDateOfProcessMonth && investmentSchedule.TillDate.Date >= dLastDateOfProcessMonth) // { // return investmentSchedule; // } // } // return investmentScheduleNull; //} //#endregion Private Function //public static DataTable GetInvestmentBSP(DateTime Fromdate, DateTime toDate) //{ // try // { // return Service.GetInvestmentBSP(Fromdate, toDate); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} } public class InvestmentSignatory : AuditTrailBase { public InvestmentSignatory() { TrustyID = 0; InvestmentID = 0; ProjectID = 0; } #region Property TrustyID : ID public int TrustyID { get;set; } #endregion Property TrustyID : ID #region Property InvestmentID : ID public int InvestmentID { get; set; } #endregion Property InvestmentID : ID #region Property ProjectID : ID public int ProjectID { get;set; } #endregion Property ProjectID : ID } #region Class InvestmentSignatorys public class InvestmentSignatorys : List { #region Constructor public InvestmentSignatorys() { } #endregion } #endregion public interface IInvestmentService { void Save(InvestmentInfo investment); void UpdateAccruedAndStatus(InvestmentInfo investment); void UpdateAccruedAndStatus(List _objTemInvestments); void UpdateAccruedAndMaturity(List _objTemInvestments); void ReschduleInterestRate(InvestmentInfo investment, bool isCollectionModified); void Renewal(List investmentCollection); void Delete(int investmentID); //void DeleteInvestment(int investmentID, Ease.Core.Framework.ID glTranID); InvestmentInfo Get(int investmentID); bool GetIsUsedUserObjectName(InvestmentCategory investmentCategory); //DataTable GetTable(); List Get(); List GetBySearch(string sSearch, DateTime fromDate, DateTime toDate); decimal GetAmountBySearch(string sSearch); DataTable GetPFInvestment(DateTime Fromdate, DateTime toDate); DataSet GetStatementInvestment(string ssta1glID, DateTime dtFirst, DateTime dtLast); DataTable GetInvestmentBSP(DateTime Fromdate, DateTime toDate); List GetBySearch(string sSearch); } }