1835 lines
67 KiB
C#
1835 lines
67 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Data;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region Class Loan
|
|
[Serializable]
|
|
public class FmLoan : BasicBaseObject //,AuditTrailBaseForVoucher, IFASTranObject, IFASUserObject
|
|
{
|
|
#region Constructor
|
|
public FmLoan()
|
|
{
|
|
ActivityID = 0;
|
|
CustomerID = 0;
|
|
MemberID = 0;
|
|
Version = 0;
|
|
ProjectID = 0; //Ease.CoreV35.Model.ID.FromInteger(FM.BO.Common.User.CurrentMasterParam.ID.Integer);
|
|
IssueDate = DateTime.MinValue;
|
|
StartPayBackMonth = DateTime.MinValue;
|
|
Description = string.Empty;
|
|
InstallmentNo = 0;
|
|
InterestRate = 0.0;
|
|
LoanCategoryID = 0;
|
|
LoanNo = string.Empty;
|
|
PrincipalAmount = 0.0;
|
|
LoanAccNo = string.Empty;
|
|
TransferLogIDinInt = 0;
|
|
// GlTranID = 0;
|
|
Remarks = string.Empty;
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region Property ActivityID : ID
|
|
public int ActivityID { get; set; }
|
|
//private ID _activityID;
|
|
//public ID ActivityID
|
|
//{
|
|
// get { return _activityID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("ActivityID", _activityID, value);
|
|
// _activityID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ActivityID : ID
|
|
|
|
#region Property CustomerID : ID
|
|
public int CustomerID { get; set; }
|
|
//private ID _customerID;
|
|
//public ID CustomerID
|
|
//{
|
|
// get { return _customerID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("CustomerID", _customerID, value);
|
|
// _customerID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property CustomerID : ID
|
|
|
|
#region Property LoanCustomer : LoanCustomer
|
|
|
|
//private LoanCustomer _loanCustomer;
|
|
//public LoanCustomer LoanCustomer
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_loanCustomer == null && !_customerID.IsUnassigned && _customerID.Integer > 0)
|
|
// {
|
|
// if (this.Member != null)
|
|
// {
|
|
// _loanCustomer = new LoanCustomer(this.Member);
|
|
// }
|
|
// else
|
|
// {
|
|
// _loanCustomer = new LoanCustomer();
|
|
// }
|
|
// _loanCustomer = _loanCustomer.Get(_customerID);
|
|
// }
|
|
|
|
// return _loanCustomer;
|
|
// }
|
|
// set
|
|
// {
|
|
// _loanCustomer = value;
|
|
// _customerID = (_customerID == null ? null : _loanCustomer.ID);
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanCustomer : LoanCustomer
|
|
|
|
#region Property Description : string
|
|
public string Description { get; set; }
|
|
//private string _description;
|
|
//public string Description
|
|
//{
|
|
// get { return _description; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<string>("Description", _description, value);
|
|
// _description = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Description : string
|
|
|
|
#region Property InstallmentNo : int
|
|
public int InstallmentNo { get; set; }
|
|
//private int _installmentNo;
|
|
//public int InstallmentNo
|
|
//{
|
|
// get { return _installmentNo; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<int>("InstallmentNo", _installmentNo, value);
|
|
// _installmentNo = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property InstallmentNo : int
|
|
|
|
#region Property InterestRate : double
|
|
public double InterestRate { get; set; }
|
|
//private double _interestRate;
|
|
//public double InterestRate
|
|
//{
|
|
// get { return _interestRate; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("InterestRate", _interestRate, value);
|
|
// _interestRate = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property InterestRate : double
|
|
|
|
#region Property IssueDate : DateTime
|
|
public DateTime IssueDate { get; set; }
|
|
//private DateTime _issueDate;
|
|
//public DateTime IssueDate
|
|
//{
|
|
// get { return _issueDate; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<DateTime>("IssueDate", _issueDate, value);
|
|
// _issueDate = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property IssueDate : DateTime
|
|
|
|
#region Property LoanCategoryID : ID
|
|
public int LoanCategoryID { get; set; }
|
|
//private ID _loanCategoryID;
|
|
//public ID LoanCategoryID
|
|
//{
|
|
// get { return _loanCategoryID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("LoanCategoryID", _loanCategoryID, value);
|
|
// _loanCategoryID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanCategoryID : ID
|
|
|
|
#region Property LoanCategory : LoanCategory
|
|
public LoanCategory LoanCategory { get; set; }
|
|
//private LoanCategory _loanCategory;
|
|
//public LoanCategory LoanCategory
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_loanCategory == null && !_loanCategoryID.IsUnassigned && _loanCategoryID.Integer > 0)
|
|
// {
|
|
// _loanCategory = new LoanCategory();
|
|
// _loanCategory = _loanCategory.Get(_loanCategoryID, false);
|
|
// }
|
|
|
|
// return _loanCategory;
|
|
// }
|
|
// set
|
|
// {
|
|
// _loanCategory = value;
|
|
// _loanCategoryID = (_loanCategoryID == null ? null : _loanCategory.ID);
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanCategory : LoanCategory
|
|
|
|
#region Property LoanNo : string
|
|
public string LoanNo { get; set; }
|
|
//private string _loanNo;
|
|
//public string LoanNo
|
|
//{
|
|
// get { return _loanNo; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<string>("LoanNo", _loanNo, value);
|
|
// _loanNo = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanNo : string
|
|
|
|
#region Property Remarks : string
|
|
public string Remarks { get; set; }
|
|
//private string _remarks;
|
|
//public string Remarks
|
|
//{
|
|
// get { return _remarks; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<string>("Remarks", _remarks, value);
|
|
// _remarks = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanNo : string
|
|
|
|
#region Property LoanAccNo : string
|
|
public string LoanAccNo { get; set; }
|
|
//private string _loanAccNo;
|
|
//public string LoanAccNo
|
|
//{
|
|
// get { return _loanAccNo; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<string>("LoanAccNo", _loanAccNo, value);
|
|
// _loanAccNo = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanAccNo : string
|
|
|
|
#region Property MemberID : ID
|
|
public int MemberID { get; set; }
|
|
//private ID _memberID;
|
|
//public ID MemberID
|
|
//{
|
|
// get { return _memberID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("MemberID", _memberID, value);
|
|
// _memberID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property MemberID : ID
|
|
|
|
#region Property Member : Member
|
|
//public Member Member { get;set }
|
|
|
|
//private Member _member;
|
|
//public Member Member
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_member == null && !_memberID.IsUnassigned && _memberID.Integer > 0)
|
|
// {
|
|
// _member = new Member();
|
|
// _member = Member.Get(_memberID);
|
|
// }
|
|
|
|
// return _member;
|
|
// }
|
|
// set
|
|
// {
|
|
// _member = value;
|
|
// _memberID = (_memberID == null ? null : _member.ID);
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Member : Member
|
|
|
|
#region Property PrincipalAmount : double
|
|
public double PrincipalAmount { get; set; }
|
|
//private double _principalAmount;
|
|
//public double PrincipalAmount
|
|
//{
|
|
// get { return _principalAmount; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("PrincipalAmount", _principalAmount, value);
|
|
// _principalAmount = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property PrincipalAmount : double
|
|
|
|
#region Property Status : EnumLoanStatus
|
|
public EnumLoanStatus Status { get; set; }
|
|
//private EnumLoanStatus _status;
|
|
//public EnumLoanStatus Status
|
|
//{
|
|
// get { return _status; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<short>("Status", (short)_status, (short)value);
|
|
// _status = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Status : EnumLoanStatus
|
|
|
|
#region Property Status : EnumLoanIssueStatus
|
|
public EnumLoanIssueStatus LoanIssueStatus { get; set; }
|
|
//private EnumLoanIssueStatus _loanIssueStatus;
|
|
//public EnumLoanIssueStatus LoanIssueStatus
|
|
//{
|
|
// get { return _loanIssueStatus; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<short>("LoanIssueStatus", (short)_loanIssueStatus, (short)value);
|
|
// _loanIssueStatus = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Status : EnumLoanIssueStatus
|
|
|
|
#region Property Version : int
|
|
public int Version { get; set; }
|
|
//private int _version;
|
|
//public int Version
|
|
//{
|
|
// get { return _version; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<int>("Version", _version, value);
|
|
// _version = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Version : int
|
|
|
|
#region Property ProjectID : ID
|
|
public int ProjectID { get; set; }
|
|
//private ID _projectID;
|
|
//public ID ProjectID
|
|
//{
|
|
// get { return _projectID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("ProjectID", _projectID, value);
|
|
// _projectID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ProjectID : ID
|
|
|
|
#region Property StartPayBackMonth : DateTime
|
|
public DateTime StartPayBackMonth { get; set; }
|
|
//private DateTime _startPayBackMonth;
|
|
//public DateTime StartPayBackMonth
|
|
//{
|
|
// get { return _startPayBackMonth; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<DateTime>("StartPayBackMonth", _startPayBackMonth, value);
|
|
// _startPayBackMonth = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property StartPayBackMonth : DateTime
|
|
|
|
#region Property Activity : EnumLoanActivity
|
|
public EnumLoanActivity Activity { get; set; }
|
|
//private EnumLoanActivity _activity;
|
|
//public EnumLoanActivity Activity
|
|
//{
|
|
// get { return _activity; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<short>("Activity", (short)_activity, (short)value);
|
|
// _activity = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Activity : EnumLoanActivity
|
|
|
|
#region Property LoanSchedules : ObjectsTemplate<LoanSchedule>
|
|
public List<FmLoanSchedule> LoanSchedules { get; set; }
|
|
//private ObjectsTemplate<LoanSchedule> _loanSchedules;
|
|
//public ObjectsTemplate<LoanSchedule> LoanSchedules
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_loanSchedules == null)
|
|
// _loanSchedules = new ObjectsTemplate<LoanSchedule>();
|
|
|
|
// return _loanSchedules;
|
|
// }
|
|
|
|
//}
|
|
|
|
#endregion Property LoanSchedules : ObjectsTemplate<LoanSchedule>
|
|
|
|
#region Property ToBeTotalPrincipal : double
|
|
public double ToBeTotalPrincipal { get; set; }
|
|
//public double ToBeTotalPrincipal
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// return _loanSchedules.Sum(item => item.InstallmentPrincipal);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ToBeTotalPrincipal : double
|
|
|
|
#region Property ToBeToatalInterest : double
|
|
public double ToBeToatalInterest { get; set; }
|
|
//public double ToBeToatalInterest
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// return _loanSchedules.Sum(item => item.InstallmentInterest);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ToBeToatalInterest : double
|
|
|
|
#region Property ToBeTotal : double
|
|
public double ToBeTotal { get; set; }
|
|
//public double ToBeTotal
|
|
//{
|
|
// get
|
|
// {
|
|
// return (_loanSchedules.Sum(item => item.InstallmentPrincipal) + _loanSchedules.Sum(item => item.InstallmentInterest)) ;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ToBeTotal : double
|
|
|
|
#region Property TotalPaidPrincipal : double
|
|
public double TotalPaidPrincipal { get; set; }
|
|
//public double TotalPaidPrincipal
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate != null
|
|
// select item;
|
|
// return filteredSchedule.Sum(item => item.InstallmentPrincipal);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalPaidPrincipal : double
|
|
|
|
#region Property TotalPaidInterest : double
|
|
public double TotalPaidInterest { get; set; }
|
|
//public double TotalPaidInterest
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate != null
|
|
// select item;
|
|
|
|
// return filteredSchedule.Sum(item => item.InstallmentInterest);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalPaidInterest : double
|
|
|
|
#region Property TotalPaid : double
|
|
public double TotalPaid { get; set; }
|
|
//public double TotalPaid
|
|
//{
|
|
// get
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate != null
|
|
// select item;
|
|
|
|
// return (_loanSchedules.Sum(item => item.InstallmentPrincipal) + _loanSchedules.Sum(item => item.InstallmentInterest));
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalPaid : double
|
|
|
|
#region Property TotalOutstandingPrincipal : double
|
|
public double TotalOutstandingPrincipal { get; set; }
|
|
//public double TotalOutstandingPrincipal
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate == null
|
|
// select item;
|
|
// return filteredSchedule.Sum(item => item.InstallmentPrincipal);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalOutstandingPrincipal : double
|
|
|
|
#region Property TotalOutstandingInterest : double
|
|
public double TotalOutstandingInterest { get; set; }
|
|
//public double TotalOutstandingInterest
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate == null
|
|
// select item;
|
|
// return filteredSchedule.Sum(item => item.InstallmentInterest);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalOutstandingAmount : double
|
|
|
|
#region Property TotalOutstanding : double
|
|
public double TotalOutstanding { get; set; }
|
|
//public double TotalOutstanding
|
|
//{
|
|
// get
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate == null
|
|
// select item;
|
|
// return (_loanSchedules.Sum(item => item.InstallmentPrincipal) + _loanSchedules.Sum(item => item.InstallmentInterest));
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalOutstanding : double
|
|
|
|
#region Property TotalPaidInstallment : int
|
|
public int TotalPaidInstallment { get; set; }
|
|
//public int TotalPaidInstallment
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate != null
|
|
// select item;
|
|
// return filteredSchedule.Count();
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalPaidInstallment : int
|
|
|
|
#region Property TotalNonpaidInstallment : int
|
|
public int TotalNonpaidInstallment { get; set; }
|
|
//private int _totalNonpaidInstallment;
|
|
//public int TotalNonpaidInstallment
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<LoanSchedule> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate == null
|
|
// select item;
|
|
// return filteredSchedule.Count();
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TotalNonpaidInstallment : int
|
|
|
|
#region Property NextSchedulePayDate : DateTime
|
|
public DateTime NextSchedulePayDate { get; set; }
|
|
//public DateTime NextSchedulePayDate
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return DateTime.MinValue;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<DateTime> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate == null
|
|
// select item.ScheduledPayDate;
|
|
// return filteredSchedule.Min();
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property NextSchedulePayDate : DateTime
|
|
|
|
#region Property LastSchedulePayDate : DateTime
|
|
public DateTime LastSchedulePayDate { get; set; }
|
|
//public DateTime LastSchedulePayDate
|
|
//{
|
|
// get
|
|
// {
|
|
// if ((_loanSchedules.Count == 0) || (_loanSchedules == null))
|
|
// {
|
|
// return DateTime.MinValue;
|
|
// }
|
|
// else
|
|
// {
|
|
// IEnumerable<DateTime> filteredSchedule = from item in _loanSchedules
|
|
// where item.PayDate == null
|
|
// select item.ScheduledPayDate;
|
|
// return filteredSchedule.Max();
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LastSchedulePayDate : DateTime
|
|
|
|
#region Property TransferLogIDinInt : int
|
|
public int TransferLogIDinInt { get; set; }
|
|
//private int _transferLogIDinInt;
|
|
//public int TransferLogIDinInt
|
|
//{
|
|
// get { return _transferLogIDinInt; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<int>("TransferLogIDinInt", _transferLogIDinInt, value);
|
|
// _transferLogIDinInt = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property TransferLogIDinInt : int
|
|
|
|
#region Property GLTranID : ID
|
|
public int GLTranID { get; set; }
|
|
//private ID _glTranID;
|
|
//public ID GLTranID
|
|
//{
|
|
// get { return _glTranID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("GLTranID", _glTranID, value);
|
|
// _glTranID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property GLTranID : ID
|
|
|
|
#region Property Implementation of IFASTranObject
|
|
//public int iFASTranObject_ProcessID
|
|
//{
|
|
// get { return this.forVoucher_ProcessID; }
|
|
//}
|
|
|
|
//public int iFASTranObject_ActivityID
|
|
//{
|
|
|
|
// get { return this.forVoucher_ActivityID; }
|
|
//}
|
|
|
|
//public int iFASTranObject_SystemTranType
|
|
//{
|
|
// get { return this.forVoucher_SystemTranType; }
|
|
//}
|
|
|
|
//public int iFASTranObject_ActivityRelated
|
|
//{
|
|
// get { return this.forVoucher_ActivityRelated; }
|
|
//}
|
|
|
|
//public ProjectProcess iFASTranObject_ProjectProcess
|
|
//{
|
|
// get { return this.forVoucher_ProjectProcess; }
|
|
//}
|
|
|
|
//public List<ProcessActivity> iFASTranObject_ProcessActivity
|
|
//{
|
|
// get { return this.forVoucher_ProcessActivity; }
|
|
//}
|
|
|
|
//public List<ActivityVoucherSetup> iFASTranObject_voucherSetups
|
|
//{
|
|
// get { return this.forVoucher_voucherSetups; }
|
|
//}
|
|
|
|
//public EaseFAS.BO.GLTrans iFASTranObject_glTrans
|
|
//{
|
|
// set { this.forVoucher_glTrans = value; }
|
|
// get { return this.forVoucher_glTrans; }
|
|
//}
|
|
|
|
//public EaseFAS.BO.GLTranDetails iFASTranObject_glTranDetails
|
|
//{
|
|
// set { this.forVoucher_glTranDetails = value; }
|
|
// get { return this.forVoucher_glTranDetails; }
|
|
//}
|
|
|
|
//public EaseFAS.BO.GLTranUserRecords iFASTranObject_glTranURs
|
|
//{
|
|
// set { this.forVoucher_glTranURs = value; }
|
|
// get { return this.forVoucher_glTranURs; }
|
|
//}
|
|
|
|
//public List<HelperForSubsidiaryUpload> iFASUserObject_helperForSubsidiarysUpload
|
|
//{
|
|
// get
|
|
// {
|
|
// if (this.forVourcher_ihelperForSubsidiarysUpload == null)
|
|
// this.forVourcher_ihelperForSubsidiarysUpload = new ObjectsTemplate<HelperForSubsidiaryUpload>();
|
|
// return this.forVourcher_ihelperForSubsidiarysUpload;
|
|
// }
|
|
|
|
// set
|
|
// {
|
|
// if (this.forVourcher_ihelperForSubsidiarysUpload == null)
|
|
// this.forVourcher_ihelperForSubsidiarysUpload = new ObjectsTemplate<HelperForSubsidiaryUpload>();
|
|
// this.forVourcher_ihelperForSubsidiarysUpload = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#endregion Properties
|
|
|
|
|
|
#region Function
|
|
|
|
//public void Save(int noOfMonth, DateTime fromMonth, double rate)
|
|
//{
|
|
// try
|
|
// {
|
|
// base.SetAuditTrailProperties(GlobalFunctions.GetServerDate().Date, User.CurrentUser.ID); ///
|
|
// Service.Save(this, noOfMonth, fromMonth, rate);
|
|
|
|
// //Clear Cache
|
|
// CacheInfo.ClearCache(typeof(FmLoan).FullName);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public void Save()
|
|
//{
|
|
// try
|
|
// {
|
|
// Service.Save(this);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static void SetLoanStatus()
|
|
//{
|
|
// try
|
|
// {
|
|
// Service.SetLoanStatus();
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public void SaveEarlySettlement(FmLoan loan, LoanLog loanLog)
|
|
//{
|
|
// try
|
|
// {
|
|
|
|
// Service.SaveEarlySettlement(loan, loanLog);
|
|
|
|
// //Clear Cache
|
|
// CacheInfo.ClearCache(typeof(FmLoan).FullName);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public FmLoan Get(ID id, bool isGetSchedule, bool isGetCategory, bool isGetCustomer)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// FmLoan loan = _cache["Get", id, isGetSchedule, isGetCategory, isGetCustomer] as FmLoan;
|
|
|
|
// if (loan != null)
|
|
// return loan;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// loan = Service.Get(id, isGetSchedule, isGetCategory, isGetCustomer);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(loan, "Get", id, isGetSchedule, isGetCategory, isGetCustomer);
|
|
|
|
// #endregion
|
|
|
|
// return loan;
|
|
//}
|
|
|
|
//public static FmLoan Get(string LoanNo)
|
|
//{
|
|
// FmLoan oloan = null;
|
|
// try
|
|
// {
|
|
// oloan = Service.Get(LoanNo);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// return oloan;
|
|
//}
|
|
|
|
//public static bool GetIsUsedUserObjectName(LoanCategory ioanCategory)
|
|
//{
|
|
// bool isUsed = false;
|
|
// try
|
|
// {
|
|
// isUsed = Service.GetIsUsedUserObjectName(ioanCategory);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
// return isUsed;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<FmLoan> Get(int runningLoan, bool isWithSchedule)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// ObjectsTemplate<FmLoan> loans = _cache["Get"] as ObjectsTemplate<FmLoan>;
|
|
// if (loans != null)
|
|
// return loans;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// loans = Service.Get(runningLoan, isWithSchedule);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(loans, "Get");
|
|
|
|
// #endregion
|
|
|
|
// return loans;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<FmLoan> Get( )
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// ObjectsTemplate<FmLoan> loans = _cache["Get"] as ObjectsTemplate<FmLoan>;
|
|
// if (loans != null)
|
|
// return loans;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// loans = Service.Get();
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(loans, "Get");
|
|
|
|
// #endregion
|
|
|
|
// return loans;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<FmLoan> GetNotSendLoan(int runningLoan, bool isWithSchedule)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// ObjectsTemplate<FmLoan> loans = _cache["Get"] as ObjectsTemplate<FmLoan>;
|
|
// if (loans != null)
|
|
// return loans;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// loans = Service.GetNotSendLoan(runningLoan, isWithSchedule);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(loans, "Get");
|
|
|
|
// #endregion
|
|
|
|
// return loans;
|
|
//}
|
|
|
|
//public static DataTable GetTable(DateTime fromDate, DateTime toDate)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetTable(fromDate, toDate);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static DataTable GetLoanInfoByMonth(DateTime scheduleMonth)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetLoanInfoByMonth(scheduleMonth);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static DataTable GetTable(string smemberId, DateTime fromDate, DateTime toDate)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetTable(smemberId,fromDate, toDate);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static DataTable GetLoanList(EnumLoanStatus status, ID memberID)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetLoanList(status, memberID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
// 1 2 3 4 5 6 7 8 9
|
|
//public static DataTable GetLoanList(ID loanCategoryID, string issueOperator, DateTime issueFromDate, DateTime issueToDate, string collectionOperator, DateTime collectionFromDate, DateTime collectionToDate, EnumLoanIssueStatus status, ID memberID)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetLoanList(loanCategoryID, issueOperator, issueFromDate, issueToDate, collectionOperator, collectionFromDate, collectionToDate, status, memberID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
|
|
//public static DataTable GetLoanList(ID loanCategoryID, string issueOperator, DateTime issueFromDate, DateTime issueToDate, string collectionOperator, DateTime collectionFromDate, DateTime collectionToDate, EnumLoanStatus status, ID memberID)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetLoanList(loanCategoryID, issueOperator, issueFromDate, issueToDate, collectionOperator, collectionFromDate, collectionToDate, status, memberID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static DataTable GetLoanMember(ID loanCategoryID, string issueOperator, DateTime issueFromDate, DateTime issueToDate, string collectionOperator, DateTime collectionFromDate, DateTime collectionToDate, EnumLoanStatus status, ID memberID, int custID)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetLoanMember(loanCategoryID, issueOperator, issueFromDate, issueToDate, collectionOperator, collectionFromDate, collectionToDate, status, memberID, custID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static ObjectsTemplate<Loan> GetLoanMember(string sSearch)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetBySearch(sSearch);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public void Delete(ID loanID)
|
|
//{
|
|
// try
|
|
// {
|
|
// Service.Delete(loanID);
|
|
|
|
// //Clear Cache
|
|
// CacheInfo.ClearCache(typeof(FmLoan).FullName);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public bool ISValidMonth(DateTime dt)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.ISValidMonth(this, dt);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
#region Validation Function
|
|
//public bool ValidateIssueInfo(ref string sMessage, ref int msgNo)
|
|
//{
|
|
// if (this.LoanCategoryID == null || this.LoanCategoryID.IsUnassigned || this.LoanCategoryID.Integer <= 0)
|
|
// {
|
|
// sMessage = "Please select loan category";
|
|
// msgNo = 1;
|
|
// return false;
|
|
// }
|
|
// if (this.MemberID == null || this.MemberID.IsUnassigned || this.MemberID.Integer <= 0)
|
|
// {
|
|
// sMessage = "Please select Customer";
|
|
// msgNo = 2;
|
|
// return false;
|
|
// }
|
|
// if (this.Description == string.Empty)
|
|
// {
|
|
// sMessage = "Description can not be empty";
|
|
// msgNo = 3;
|
|
// return false;
|
|
// }
|
|
// if (this.LoanNo == string.Empty)
|
|
// {
|
|
// sMessage = "Loan no can not be empty";
|
|
// msgNo = 5;
|
|
// return false;
|
|
// }
|
|
// if (this.LoanAccNo == string.Empty)
|
|
// {
|
|
// sMessage = "Loan A/C no can not be empty";
|
|
// msgNo = 6;
|
|
// return false;
|
|
// }
|
|
// CompanyInfo oCompanyInfo = CompanyInfo.Get();
|
|
// DateTime dt = new DateTime();
|
|
// foreach (ProjectDetail oProjectDetail in oCompanyInfo.ProjectDetailsCollection)
|
|
// {
|
|
// if (oProjectDetail.ProjectID == User.CurrentUser.ProjectID)
|
|
// {
|
|
// dt = oProjectDetail.LastMonthEndDate;
|
|
// }}
|
|
|
|
// if (Global.DateFunctions.LastDateOfMonth(this.IssueDate) != dt )
|
|
// {
|
|
// sMessage = "Issue date must be in current month";
|
|
// msgNo = 7;
|
|
// return false;
|
|
// }
|
|
// if (Global.DateFunctions.LastDateOfMonth(this.StartPayBackMonth) < this.IssueDate)
|
|
// {
|
|
// sMessage = "Pay back month must be greater than Issue date";
|
|
// msgNo = 8;
|
|
// return false;
|
|
// }
|
|
// if (this.InstallmentNo <= 0)
|
|
// {
|
|
// sMessage = "Please select installment no";
|
|
// msgNo = 9;
|
|
// return false;
|
|
// }
|
|
// if (this.InterestRate < 0)
|
|
// {
|
|
// sMessage = "Interest rate must be 0 or greater than 0";
|
|
// msgNo = 10;
|
|
// return false;
|
|
// }
|
|
// if (this.PrincipalAmount <= 0)
|
|
// {
|
|
// sMessage = "Loan amount must be greater than 0";
|
|
// msgNo =11;
|
|
// return false;
|
|
// }
|
|
|
|
// return true;
|
|
//}
|
|
#endregion
|
|
|
|
#region GenerateLoanNo
|
|
|
|
//public string GenerateLoanNo()
|
|
//{
|
|
// string serialNo = string.Empty;
|
|
// try
|
|
// {
|
|
// serialNo = Service.GenerateLoanNo(this);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
// return serialNo;
|
|
//}
|
|
#endregion
|
|
|
|
#region Create schedule
|
|
|
|
//public List<LoanSchedule> CreateSchedule(int noOfInstallment, double interestRate, double loanAmount, DateTime payBackMonth)
|
|
//{
|
|
// try
|
|
// {
|
|
// this.LoanSchedules.Clear();
|
|
// DateTime startDate = DateTime.MinValue;
|
|
// startDate = payBackMonth;
|
|
// double rate = interestRate/1200;
|
|
// double effectiveBalance = loanAmount;
|
|
|
|
// double installmentAmount = Math.Abs(Math.Round(Microsoft.VisualBasic.Financial.Pmt(rate, noOfInstallment, loanAmount, 0.0, 0.0), 0));
|
|
// double interest = 0.0;
|
|
// double totalInterest = 0.0;
|
|
// for (int i = 1; i <= noOfInstallment; i++)
|
|
// {
|
|
// LoanSchedule loanSchedule = new LoanSchedule();
|
|
// interest = effectiveBalance * rate;
|
|
|
|
// //loanSchedule.CalculatedDate = Global.DateFunctions.LastDateOfMonth(startDate);
|
|
// totalInterest = totalInterest + interest;
|
|
// loanSchedule.SerialNo = i;
|
|
// if (i == noOfInstallment)
|
|
// {
|
|
// loanSchedule.InstallmentPrincipal = Math.Round(loanAmount - loanSchedule.GetTotalPrinciple(this.LoanSchedules),2);
|
|
// }
|
|
// else
|
|
// {
|
|
// loanSchedule.InstallmentPrincipal = Math.Round((installmentAmount - interest), 2);
|
|
// }
|
|
// loanSchedule.EffectiveBalance = effectiveBalance;
|
|
// loanSchedule.InstallmentAmount = installmentAmount;
|
|
|
|
// loanSchedule.ScheduledPayDate = Global.DateFunctions.LastDateOfMonth(startDate);
|
|
// loanSchedule.InstallmentInterest = Math.Round(interest, 2);
|
|
// this.LoanSchedules.Add(loanSchedule);
|
|
// effectiveBalance = Math.Round((effectiveBalance - loanSchedule.InstallmentPrincipal),2);
|
|
// startDate = Global.DateFunctions.DateAdd("m", 1, startDate);
|
|
|
|
// }
|
|
// return this.LoanSchedules;
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public List<LoanSchedule> CreateBankSchedule(int noOfInstallment, double interestRate, double loanAmount, DateTime payBackMonth, DateTime issueDate)
|
|
//{
|
|
// try
|
|
// {
|
|
// LoanSchedule oSchedule = null;
|
|
// double nInterest = 0.0, nBalance = 0.0, nTotalInterest = 0.0, nInstPrinciple = 0.0;
|
|
// int nDays = 0;
|
|
// this.LoanSchedules.Clear();
|
|
// DateTime dNextMonth = new DateTime(payBackMonth.Year, payBackMonth.Month, 25);
|
|
|
|
// issueDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(issueDate);
|
|
// nInstPrinciple = loanAmount / noOfInstallment;
|
|
// nInstPrinciple = Math.Round(nInstPrinciple);
|
|
// nBalance = loanAmount;
|
|
|
|
// for (int i = 1; i <= noOfInstallment; i++)
|
|
// {
|
|
// oSchedule = new LoanSchedule();
|
|
// if (i == 1)
|
|
// {
|
|
// nInterest = Math.Round(((loanAmount * this.InterestRate)) / 100 / 12);
|
|
// //oSchedule.CalculatedDate = dNextMonth;
|
|
// }
|
|
// else
|
|
// {
|
|
// nInterest = Math.Round((nBalance * this.InterestRate) / 100 / 12);
|
|
// dNextMonth = dNextMonth.AddMonths(1);
|
|
// //oSchedule.CalculatedDate = dNextMonth;
|
|
// }
|
|
|
|
// nTotalInterest += nInterest;
|
|
|
|
// oSchedule.SerialNo = i;
|
|
// if (i == noOfInstallment)
|
|
// nInstPrinciple = nBalance;
|
|
// oSchedule.InstallmentInterest = nInterest;
|
|
// oSchedule.InstallmentPrincipal = nInstPrinciple;
|
|
// oSchedule.EffectiveBalance = nBalance;
|
|
// oSchedule.InstallmentInterest = oSchedule.InstallmentInterest;
|
|
// oSchedule.ScheduledPayDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(dNextMonth);
|
|
// nBalance = nBalance - (oSchedule.InstallmentPrincipal);
|
|
// oSchedule.InstallmentAmount = nInstPrinciple + nInterest;
|
|
// //oSchedule.ClosingBalance = nBalance;
|
|
|
|
// this.LoanSchedules.Add(oSchedule);
|
|
// }
|
|
// return this.LoanSchedules;
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public List<LoanSchedule> PrepareEMISchedule(int noOfInstallment, double interestRate, double loanAmount, DateTime payBackMonth, DateTime issueDate)
|
|
//{
|
|
// try
|
|
// {
|
|
// LoanSchedule oSchedule = null;
|
|
|
|
// this.LoanSchedules.Clear();
|
|
|
|
// double nInterest = 0.0;
|
|
// double nTotalInterest = 0.0;
|
|
// double nInsPrinciple = 0.0;
|
|
// double nBalance = 0.0;
|
|
// double nTotalInstPrinciple = 0.0;
|
|
// double nRate = this.InterestRate / 1200.0;
|
|
// double nEffectiveBalance = loanAmount;
|
|
// double nInstAmount = Financial.Pmt(nRate, noOfInstallment, -loanAmount, 0, DueDate.EndOfPeriod);
|
|
// DateTime dNextMonth = new DateTime(payBackMonth.Year, payBackMonth.Month, 25);
|
|
|
|
// issueDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(issueDate);
|
|
|
|
// nTotalInterest = 0;
|
|
// for (int i = 0; i < noOfInstallment; i++)
|
|
// {
|
|
// nInterest = nEffectiveBalance * nRate;
|
|
// nTotalInterest = nTotalInterest + nInterest;
|
|
// if (i == noOfInstallment - 1)
|
|
// {
|
|
// nInsPrinciple = loanAmount - nTotalInstPrinciple;
|
|
// }
|
|
// else
|
|
// {
|
|
// nInsPrinciple = nInstAmount - nInterest;
|
|
// }
|
|
// nEffectiveBalance = nEffectiveBalance - nInsPrinciple;
|
|
// nTotalInstPrinciple += nInsPrinciple;
|
|
// }
|
|
|
|
// nBalance = loanAmount + nTotalInterest;
|
|
// nEffectiveBalance = loanAmount;
|
|
// double dPrevInstallmentAmount = 0;
|
|
// //nInstAmount = Financial.Pmt(nRate, noOfInstallment, loanAmount, 0, DueDate.EndOfPeriod);
|
|
// nTotalInterest = 0;
|
|
// nTotalInstPrinciple = 0;
|
|
|
|
// for (int i = 0; i < noOfInstallment; i++)
|
|
// {
|
|
// oSchedule = new LoanSchedule();
|
|
|
|
// nInterest = nEffectiveBalance * nRate;
|
|
// nTotalInterest = nTotalInterest + nInterest;
|
|
// oSchedule.SerialNo = i + 1;
|
|
|
|
// if (oSchedule.SerialNo == 1)
|
|
// {
|
|
// dNextMonth = new DateTime(payBackMonth.Year, payBackMonth.Month, 25);
|
|
// }
|
|
// else
|
|
// {
|
|
// dNextMonth = dNextMonth.AddMonths(1);
|
|
// }
|
|
// //oSchedule.CalculatedDate = dMonth;
|
|
|
|
// if (i == noOfInstallment - 1)
|
|
// {
|
|
// oSchedule.InstallmentPrincipal = loanAmount - nTotalInstPrinciple;
|
|
// }
|
|
// else
|
|
// {
|
|
// oSchedule.InstallmentPrincipal = nInstAmount - nInterest;
|
|
// }
|
|
// //oSchedule.OpeningBalance = nBalance;
|
|
// //oSchedule.ActualInterest = nInterest;
|
|
// oSchedule.ScheduledPayDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(dNextMonth);
|
|
// oSchedule.InstallmentInterest = nInterest;
|
|
|
|
// nEffectiveBalance -= oSchedule.InstallmentPrincipal;
|
|
// if(i > 0)
|
|
// {
|
|
// nBalance = loanAmount - (dPrevInstallmentAmount);//(oSchedule.InstallmentPrincipal + oSchedule.InstallmentInterest);
|
|
// oSchedule.EffectiveBalance = nBalance;
|
|
// }
|
|
// else
|
|
// {
|
|
// oSchedule.EffectiveBalance = loanAmount;
|
|
// }
|
|
|
|
// dPrevInstallmentAmount = dPrevInstallmentAmount + oSchedule.InstallmentPrincipal;
|
|
// nTotalInstPrinciple += oSchedule.InstallmentPrincipal;
|
|
// oSchedule.InstallmentAmount = oSchedule.InstallmentPrincipal + oSchedule.InstallmentInterest;
|
|
// //oSchedule.ClosingBalance = nBalance;
|
|
|
|
// this.LoanSchedules.Add(oSchedule);
|
|
// }
|
|
// int count = this.LoanSchedules.Count;
|
|
// return this.LoanSchedules;
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
// //if (fractionate != EnumLoanFraction.WithFraction)
|
|
// //{
|
|
// // AdjustSchedele(fractionate);
|
|
// //}
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region GetIndexByMonth
|
|
|
|
//public int GetIndexByMonth(DateTime dMonthDate)
|
|
//{
|
|
// try
|
|
// {
|
|
// int i = 0;
|
|
// foreach (LoanSchedule oItem in this.LoanSchedules)
|
|
// {
|
|
// i = i + 1;
|
|
// if (oItem.ScheduledPayDate == dMonthDate)
|
|
// {
|
|
// return i;
|
|
// }
|
|
// }
|
|
// return 0;
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region GetReschedule
|
|
//public List<LoanSchedule> GetSchedule(double loanAmount, double interestRate, int noOfInstallments, DateTime month)
|
|
//{
|
|
// List<LoanSchedule> oSchedules = new List<LoanSchedule>();
|
|
// LoanSchedule oItem = null;
|
|
// double interest = 0.0;
|
|
// double totalInterest = 0.0;
|
|
// double rate = interestRate / 1200;
|
|
// double effectivebalance = loanAmount;
|
|
|
|
// double installmentAmount = Math.Abs(Math.Round(Microsoft.VisualBasic.Financial.Pmt(rate, noOfInstallments, loanAmount, 0.0, 0.0), 0));
|
|
|
|
// for (int i = 1; i <= noOfInstallments; i++)
|
|
// {
|
|
// oItem = new LoanSchedule();
|
|
// interest = effectivebalance * rate;
|
|
|
|
// // oItem.CalculatedDate = LastDayOfMonth(dMonth)
|
|
// totalInterest = totalInterest + interest;
|
|
// oItem.SerialNo = i;
|
|
// if (i == noOfInstallments)
|
|
// {
|
|
// oItem.InstallmentPrincipal = Math.Round((loanAmount - oItem.GetTotalPrinciple(oSchedules)), 2);
|
|
// }
|
|
// else
|
|
// {
|
|
// oItem.InstallmentPrincipal = Math.Round((installmentAmount - interest), 2);
|
|
// }
|
|
|
|
// oItem.EffectiveBalance = Math.Round(effectivebalance, 2);
|
|
// oItem.InstallmentAmount = Math.Round(installmentAmount, 2);
|
|
// // oItem.ActualInterest = nInterest
|
|
// oItem.ScheduledPayDate = Global.DateFunctions.LastDateOfMonth(month);
|
|
// oItem.InstallmentInterest = Math.Round(interest, 2);
|
|
// oSchedules.Add(oItem);
|
|
// effectivebalance = Math.Round((effectivebalance - oItem.InstallmentPrincipal), 2);
|
|
// month = Global.DateFunctions.DateAdd("m", 1, month);
|
|
|
|
// }
|
|
// return oSchedules;
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region GetMonthDiff
|
|
|
|
public int GetMonthDiff(DateTime dt1, DateTime dt2)
|
|
{
|
|
int months = 0;
|
|
months = Math.Abs((dt1.Month + (dt1.Year * 12)) - (dt2.Month + (dt2.Year * 12)));
|
|
return months;
|
|
}
|
|
#endregion
|
|
|
|
#region Bodily shift schedule
|
|
//public void BodilyShift(int noOfMonth)
|
|
//{
|
|
// try
|
|
// {
|
|
|
|
// LoanSchedule loanSchedule = new LoanSchedule();
|
|
// DateTime fromMonth = Global.DateFunctions.LastDateOfMonth(this.NextSchedulePayDate);
|
|
// DateTime toMonth = Global.DateFunctions.LastDateOfMonth(Global.DateFunctions.DateAdd("M", noOfMonth, fromMonth));
|
|
// DateTime startMonth = fromMonth;
|
|
// int i = this.GetIndexByMonth(fromMonth);
|
|
// if (i == 0)
|
|
// {
|
|
// return;
|
|
// }
|
|
// int fromIndex = i;
|
|
// //int monthDef = Global.DateFunctions.DateDiff("M", fromMonth, toMonth) + 1;
|
|
// int monthDef = GetMonthDiff(fromMonth, toMonth);
|
|
// startMonth = toMonth;
|
|
// for (int j = i; j <= this.LoanSchedules.Count(); j++)
|
|
// {
|
|
// this.LoanSchedules[j-1].ScheduledPayDate = toMonth;
|
|
// //this.LoanSchedules[j-1].SerialNo = monthDef + i;
|
|
// toMonth = Global.DateFunctions.LastDateOfMonth(Global.DateFunctions.DateAdd("m", 1, toMonth));
|
|
// i = i + 1;
|
|
// }
|
|
// for (int j = i; j <= this.LoanSchedules.Count; j++)
|
|
// {
|
|
// this.LoanSchedules[j-1].SerialNo = i;
|
|
// i = i + 1;
|
|
// }
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
#endregion
|
|
|
|
#region Reschedule
|
|
|
|
//public void ScheduleRecalculate(DateTime fromMonth)
|
|
//{
|
|
// try
|
|
// {
|
|
// LoanSchedule oSchedule = new LoanSchedule();
|
|
// List<LoanSchedule> oSchedules = new List<LoanSchedule>();
|
|
// List<LoanSchedule> oNewSchedules = new List<LoanSchedule>();
|
|
// fromMonth = Global.DateFunctions.LastDateOfMonth(fromMonth);
|
|
// int i = this.GetIndexByMonth(fromMonth);
|
|
// if (i == 0)
|
|
// {
|
|
// return;
|
|
// }
|
|
// if (Global.DateFunctions.LastDateOfMonth(fromMonth) == this.NextSchedulePayDate)
|
|
// {
|
|
// return;
|
|
// }
|
|
// foreach (LoanSchedule oScheduleobj in this.LoanSchedules)
|
|
// {
|
|
// if (oScheduleobj.PayDate != null)
|
|
// {
|
|
// oNewSchedules.Add(oScheduleobj);
|
|
// }
|
|
// }
|
|
// DateTime lastPayMonthDate = this.NextSchedulePayDate;
|
|
// DateTime lastDuePayDate = this.LastSchedulePayDate;
|
|
// oSchedules = new List<LoanSchedule>();
|
|
|
|
// int nextpayIndex = this.GetIndexByMonth(lastPayMonthDate);
|
|
// oSchedule = this.LoanSchedules.GetItem(nextpayIndex-1);
|
|
// //TimeSpan ts = lastDuePayDate - fromMonth;
|
|
// //int monyh = ts.Days/30
|
|
|
|
// DateTime newdate = DateTime.Now;
|
|
// //int noOfInstallments = GetMonthDiff(fromMonth, lastDuePayDate) + 1;
|
|
|
|
// int noOfInstallments = GetMonthDiff(fromMonth, lastDuePayDate);
|
|
// //double totalPendingInterest = Math.Round((oSchedule.InstallmentInterest * (GetMonthDiff(lastPayMonthDate, fromMonth))), 2);
|
|
|
|
// double totalPendingInterest = Math.Round((oSchedule.InstallmentInterest * (GetMonthDiff(lastPayMonthDate, fromMonth)-1)), 2);
|
|
|
|
// oSchedules = GetSchedule(oSchedule.EffectiveBalance, this.InterestRate, noOfInstallments + 1, fromMonth);
|
|
// double pendingScheduleIntr = (totalPendingInterest) / (noOfInstallments + 1);
|
|
|
|
// foreach (LoanSchedule oScheduleObj in oSchedules)
|
|
// {
|
|
// oScheduleObj.InstallmentInterest = Math.Round((oScheduleObj.InstallmentInterest + pendingScheduleIntr), 2);
|
|
// oNewSchedules.Add(oScheduleObj);
|
|
// }
|
|
// this.LoanSchedules.Clear();
|
|
// int j = 0;
|
|
// foreach (LoanSchedule oScheduleObj in oNewSchedules)
|
|
// {
|
|
// oScheduleObj.SerialNo = j + 1;
|
|
// this.LoanSchedules.Add(oScheduleObj);
|
|
// j++;
|
|
// }
|
|
// int count = this.LoanSchedules.Count();
|
|
// this.InstallmentNo = count;
|
|
// //for (int j = 1; j <= count; j++)
|
|
// //{
|
|
// // this.LoanSchedules[j - 1].SerialNo = j;
|
|
// //}
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region CalculateDelayCharge
|
|
//public void CalculateDelayCharge(DateTime fromMonth, double rate, double flatAmount)
|
|
//{
|
|
// try
|
|
// {
|
|
// LoanSchedule schedule = new LoanSchedule();
|
|
// List<LoanSchedule> newSchedules = new List<LoanSchedule>();
|
|
// List<LoanSchedule> oSchedules = new List<LoanSchedule>();
|
|
// double extra = 0.0;
|
|
// if (Global.DateFunctions.LastDateOfMonth(fromMonth) == this.NextSchedulePayDate)
|
|
// {
|
|
// return;
|
|
// }
|
|
// DateTime lastPayMonthDate = this.NextSchedulePayDate;
|
|
// DateTime lastDuePayDate = this.LastSchedulePayDate;
|
|
// //int noOfInstallments = GetMonthDiff(fromMonth, lastDuePayDate) + 1;
|
|
// int noOfInstallments = GetMonthDiff(fromMonth, lastDuePayDate);
|
|
|
|
// fromMonth = Global.DateFunctions.LastDateOfMonth(fromMonth);
|
|
// int fromIndex = this.GetIndexByMonth(lastPayMonthDate);
|
|
// schedule = this.LoanSchedules.GetItem(fromIndex - 1);
|
|
// //int monthDef = GetMonthDiff(lastPayMonthDate, fromMonth);
|
|
// int monthDef = GetMonthDiff(lastPayMonthDate, fromMonth)-1;
|
|
|
|
// if (rate > 0)
|
|
// {
|
|
// extra = schedule.EffectiveBalance * (rate / 1200) * monthDef;
|
|
// }
|
|
// else
|
|
// {
|
|
// extra = flatAmount;
|
|
// }
|
|
|
|
// schedule.EffectiveBalance = Math.Round((schedule.EffectiveBalance + extra), 2);
|
|
// //int i = this.GetIndexByMonth(fromMonth);
|
|
// //if (i == 0)
|
|
// //{
|
|
// // return;
|
|
// //}
|
|
// newSchedules = new ObjectsTemplate<LoanSchedule>();
|
|
// foreach (LoanSchedule oScheduleobj in this.LoanSchedules)
|
|
// {
|
|
// if (oScheduleobj.PayDate != null)
|
|
// {
|
|
// newSchedules.Add(oScheduleobj);
|
|
// }
|
|
// }
|
|
// oSchedules = GetSchedule(schedule.EffectiveBalance, this.InterestRate, noOfInstallments + 1, fromMonth);
|
|
// foreach (LoanSchedule oScheduleObj in oSchedules)
|
|
// {
|
|
// newSchedules.Add(oScheduleObj);
|
|
// }
|
|
// this.LoanSchedules.Clear();
|
|
// int j = 0;
|
|
// foreach (LoanSchedule oScheduleObj in newSchedules)
|
|
// {
|
|
// oScheduleObj.SerialNo = j + 1;
|
|
// this.LoanSchedules.Add(oScheduleObj);
|
|
// j++;
|
|
// }
|
|
// int count = this.LoanSchedules.Count();
|
|
// this.InstallmentNo = count;
|
|
// //for (int j = 1; j <= count; j++)
|
|
// //{
|
|
// // this.LoanSchedules[j - 1].SerialNo = j;
|
|
// //}
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region Implementation of Public Method of IFASTranObject
|
|
//public IFASTranObject PrepareFASTranObject(int processID, int activityID, int sytemTranType)
|
|
//{
|
|
// IFASTranObject oIFasTran = null;
|
|
// this.forVoucher_ProcessID = processID;
|
|
// this.forVoucher_ActivityID = activityID;
|
|
// this.forVoucher_SystemTranType = sytemTranType;
|
|
// ProjectProcess oPP = new ProjectProcess().Get(ID.FromInteger(processID));
|
|
// this.ForVoucher_ProjectProcess = oPP;
|
|
// this.ForVoucher_ProcessActivity = ProcessActivity.GetbyProcessID(oPP.ID);
|
|
// this.forVoucher_voucherSetups = new ObjectsTemplate<ActivityVoucherSetup>();
|
|
// foreach (ProcessActivity opA in this.ForVoucher_ProcessActivity)
|
|
// {
|
|
// this.ForVoucher_voucherSetups.AddRange(ActivityVoucherSetup.GetbyActivityid(opA.ID));
|
|
// }
|
|
// this.ForVoucher_glTrans = new EaseFAS.BO.GLTrans();
|
|
// this.ForVoucher_glTranURs = new EaseFAS.BO.GLTranUserRecords();
|
|
// oIFasTran = this;
|
|
// return oIFasTran;
|
|
//}
|
|
|
|
//public IFASTranObject PrepareFASTranObject(int processID, int activityID, int sytemTranType, int ActivityRelatedID)
|
|
//{
|
|
// IFASTranObject oIFasTran = null;
|
|
// this.forVoucher_ProcessID = processID;
|
|
// this.forVoucher_ActivityID = activityID;
|
|
// this.forVoucher_SystemTranType = sytemTranType;
|
|
// this.forVoucher_ActivityRelated = ActivityRelatedID;
|
|
|
|
// ProjectProcess oPP = new ProjectProcess().Get(ID.FromInteger(processID));
|
|
// this.ForVoucher_ProjectProcess = oPP;
|
|
// this.ForVoucher_ProcessActivity = ProcessActivity.GetbyProcessID(oPP.ID);
|
|
// this.forVoucher_voucherSetups = new ObjectsTemplate<ActivityVoucherSetup>();
|
|
// foreach (ProcessActivity opA in this.ForVoucher_ProcessActivity)
|
|
// {
|
|
// if (opA.RelatedValue == ActivityRelatedID)
|
|
// this.ForVoucher_voucherSetups.AddRange(ActivityVoucherSetup.GetbyActivityid(opA.ID));
|
|
// }
|
|
// this.ForVoucher_glTrans = new EaseFAS.BO.GLTrans();
|
|
// this.ForVoucher_glTranURs = new EaseFAS.BO.GLTranUserRecords();
|
|
// oIFasTran = this;
|
|
// return oIFasTran;
|
|
//}
|
|
|
|
//public IFASTranObject PrepareFASTranObject(int processID, int ActivityRelatedID)
|
|
//{
|
|
// IFASTranObject oIFasTran = null;
|
|
// this.forVoucher_ProcessID = processID;
|
|
// //this.forVoucher_ActivityID = activityID;
|
|
// ProjectProcess oPP = new ProjectProcess().Get(ID.FromInteger(processID));
|
|
// this.ForVoucher_ProjectProcess = oPP;
|
|
// this.forVoucher_SystemTranType = oPP.TranType.Integer;
|
|
// this.ForVoucher_ProcessActivity = ProcessActivity.GetbyProcessID(oPP.ID);
|
|
// this.forVoucher_voucherSetups = new ObjectsTemplate<ActivityVoucherSetup>();
|
|
// foreach (ProcessActivity opA in this.ForVoucher_ProcessActivity)
|
|
// {
|
|
// if (opA.RelatedValue == ActivityRelatedID)
|
|
// this.ForVoucher_voucherSetups.AddRange(ActivityVoucherSetup.GetbyActivityid(opA.ID));
|
|
// this.forVoucher_ActivityRelated = opA.ActivityRelatedTo.Integer;
|
|
// }
|
|
// this.ForVoucher_glTrans = new EaseFAS.BO.GLTrans();
|
|
// this.ForVoucher_glTranURs = new EaseFAS.BO.GLTranUserRecords();
|
|
// oIFasTran = this;
|
|
// return oIFasTran;
|
|
//}
|
|
|
|
//public List<IFASTranObject> PrepareFASTranObjectCol(int processID, int ActivityRelatedID)
|
|
//{
|
|
// List<IFASTranObject> oIFasTran = new List<IFASTranObject>();
|
|
|
|
// this.forVoucher_ProcessID = processID;
|
|
// ProjectProcess oPP = new ProjectProcess().Get(ID.FromInteger(processID));
|
|
// this.ForVoucher_ProjectProcess = oPP;
|
|
// this.forVoucher_SystemTranType = oPP.TranType.Integer;
|
|
// this.ForVoucher_ProcessActivity = ProcessActivity.GetbyProcessID(oPP.ID);
|
|
// this.ForVoucher_voucherSetups = ActivityVoucherSetup.GetbyProcessid(ID.FromInteger(processID));
|
|
// //this.forVoucher_voucherSetups = new ObjectsTemplate<ActivityVoucherSetup>();
|
|
// foreach (ProcessActivity opA in this.ForVoucher_ProcessActivity)
|
|
// {
|
|
// if (opA.RelatedValue == ActivityRelatedID)
|
|
// {
|
|
// this.ForVoucher_voucherSetups.AddRange(ActivityVoucherSetup.GetbyActivityid(opA.ID));
|
|
// this.forVoucher_ActivityID = opA.ID.Integer;
|
|
// this.forVoucher_ActivityRelated = opA.ActivityRelatedTo.Integer;
|
|
// }
|
|
// }
|
|
// this.ForVoucher_glTrans = new EaseFAS.BO.GLTrans();
|
|
// this.ForVoucher_glTranURs = new EaseFAS.BO.GLTranUserRecords();
|
|
// oIFasTran.Add((IFASTranObject)this);
|
|
// return oIFasTran;
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
//public static DataSet GetLoans(ObjectsTemplate<Member> _members, DateTime fromDate, DateTime toDate)
|
|
//{
|
|
// try
|
|
// {
|
|
// return Loan.Service.GetLoans(_members, fromDate, toDate);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static void UpdateSchedules(List<LoanSchedule> oloanSchedules, EaseFAS.BO.GLTrans otrans)
|
|
//{
|
|
// try
|
|
// {
|
|
// FmLoan.Service.UpdateSchedules(oloanSchedules, otrans);
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public static void UpdateLoanIssueStatus(FmLoan oLoan)
|
|
//{
|
|
// try
|
|
// {
|
|
// FmLoan.Service.UpdateLoanIssueStatus(oLoan);
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
}
|
|
#endregion
|
|
|
|
#region Loan Service
|
|
|
|
/*public interface ILoanService
|
|
{
|
|
void UpdateLoanIssueStatus(FmLoan oLoan);
|
|
void Save(FmLoan oLoan);
|
|
void SetLoanStatus();
|
|
void Save(FmLoan loan, int noOfMonth, DateTime fromMonth, double rate);
|
|
void SaveEarlySettlement(FmLoan loan, LoanLog loanLog);
|
|
void Delete(int loanID);
|
|
FmLoan Get(string LoanNo);
|
|
FmLoan Get(int loanID, bool isGetSchedule, bool isGetCategory, bool isGetCustomer);
|
|
bool GetIsUsedUserObjectName(LoanCategory ioanCategory);
|
|
DataTable GetTable(DateTime fromDate, DateTime toDate);
|
|
List<FmLoan> Get();
|
|
List<FmLoan> Get(int runningLoan, bool isWithSchedule);
|
|
List<FmLoan> GetNotSendLoan(int runningLoan, bool isWithSchedule);
|
|
DataTable GetLoanList(EnumLoanStatus status, int memberID);
|
|
DataTable GetLoanList(int loanCategoryID, string issueOperator, DateTime issueFromDate, DateTime issueToDate, string collectionOperator, DateTime collectionFromDate, DateTime collectionToDate, EnumLoanIssueStatus status, int memberID);
|
|
DataTable GetLoanList(int loanCategoryID, string issueOperator, DateTime issueFromDate, DateTime issueToDate, string collectionOperator, DateTime collectionFromDate, DateTime collectionToDate, EnumLoanStatus status, int memberID);
|
|
string GenerateLoanNo(FmLoan loan);
|
|
DataTable GetLoanMember(int loanCategoryID, string issueOperator, DateTime issueFromDate, DateTime issueToDate, string collectionOperator, DateTime collectionFromDate, DateTime collectionToDate, EnumLoanStatus status, int memberID, int custID);
|
|
//bool ISValidMonth(Loan loan,DateTime dt);
|
|
DataTable GetLoanInfoByMonth(DateTime scheduleMonth);
|
|
DataTable GetTable(string smemberId, DateTime fromDate, DateTime toDate);
|
|
|
|
//DataSet GetLoans(ObjectsTemplate<Member> _members, DateTime fromDate, DateTime toDate);
|
|
|
|
//void UpdateSchedules(List<LoanSchedule> oloanSchedules, EaseFAS.BO.GLTrans otrans);
|
|
}
|
|
*/
|
|
#endregion
|
|
}
|