559 lines
26 KiB
C#
559 lines
26 KiB
C#
|
|
using Ease.Core;
|
|||
|
|
using Ease.Core.Utility;
|
|||
|
|
using HRM.BO;
|
|||
|
|
using HRM.BO.Configuration;
|
|||
|
|
using HRM.BO.Fund;
|
|||
|
|
using HRM.DA;
|
|||
|
|
using HRM.DA.Fund;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.Data;
|
|||
|
|
//using System.Windows.Forms;
|
|||
|
|
using ESBSlab = HRM.BO.Fund.ESBSlab;
|
|||
|
|
|
|||
|
|
namespace HRM.Report
|
|||
|
|
{
|
|||
|
|
public class PFCalculation
|
|||
|
|
{
|
|||
|
|
Member member = new Member();
|
|||
|
|
bool IsDateRange = false;
|
|||
|
|
bool IsAsOnDate = true;
|
|||
|
|
DateTime fromDate = DateTime.MinValue;
|
|||
|
|
DateTime toDate = DateTime.MinValue;
|
|||
|
|
DateTime asOnDate = DateTime.MinValue;
|
|||
|
|
int fundTypeID = 0;
|
|||
|
|
bool _isCPFReturned = false;
|
|||
|
|
bool _isNeedOthers = false;
|
|||
|
|
bool _hasLoan = false;
|
|||
|
|
double _netPay = 0;
|
|||
|
|
double loanAount = 0;
|
|||
|
|
double LoanEmployee = 0;
|
|||
|
|
double outstandingLoan = 0;
|
|||
|
|
double paidAmount = 0.0;
|
|||
|
|
decimal unpaidAmount = 0;
|
|||
|
|
double dTotal = 0;
|
|||
|
|
int serviceLength = 0;
|
|||
|
|
bool bSelected = false;
|
|||
|
|
string glCode = "";
|
|||
|
|
double deductAmount = 0;
|
|||
|
|
double crDeductAmount = 0;
|
|||
|
|
FundDataSet.FundDataSet.PFStatementDataTable dtPFStatement = null;
|
|||
|
|
FundDataSet.FundDataSet.PFRefundStatementDataTable dtPFRefundStatement = null;
|
|||
|
|
bool IsFromMailSender = false;
|
|||
|
|
bool chkBankPayment = false;
|
|||
|
|
bool chkOthers = false;
|
|||
|
|
double amount = 0;
|
|||
|
|
double lastEpfInterest = 0;
|
|||
|
|
double lastCpfInterest = 0;
|
|||
|
|
double _curEpfInterest = 0;
|
|||
|
|
double _curCpfInterest = 0;
|
|||
|
|
|
|||
|
|
private GL _glPick = null;
|
|||
|
|
GLTran _interestglTran = null;
|
|||
|
|
GLTran _glTran = null;
|
|||
|
|
DateTime dtmonthEnd = DateTime.Now;
|
|||
|
|
DateTime dtYearEnd = DateTime.Now;
|
|||
|
|
DataSet ds = null;
|
|||
|
|
|
|||
|
|
GLTran otran = null;
|
|||
|
|
|
|||
|
|
List<ESBSlab> _eSlabs = null;
|
|||
|
|
double lastYearAmount = 0;
|
|||
|
|
double thisYearAmount = 0;
|
|||
|
|
double netPayable = 0;
|
|||
|
|
List<UserObject> userObjects = null;
|
|||
|
|
UserObject urObject = null;
|
|||
|
|
|
|||
|
|
String txtLstCPFInterest = null, txtCurCPFInterest = null;
|
|||
|
|
DateTime dtpVoucherDate, dtpSettlementDate;
|
|||
|
|
string txtLengthOfService = "", txtLastSalaryMonth = "";
|
|||
|
|
double numEPFContribution = 0, numEPFInterest = 0,
|
|||
|
|
numCrntEPFContribution = 0, numCPFContribution = 0,
|
|||
|
|
numCPFInterest = 0, numCrntCPFContribution = 0,
|
|||
|
|
numCrntLstEPFInterest = 0, numCrntLstCPFInterest = 0,
|
|||
|
|
numCrntEPFInterest = 0, numCrntCPFInterest = 0,
|
|||
|
|
numLastEPFClosing = 0, numLastCPFClosing = 0;
|
|||
|
|
|
|||
|
|
string txtCurCPF = null, txtCPFPrincipal = null, txtCPFInterest = null;
|
|||
|
|
private string lblNetPay;
|
|||
|
|
string lblDebitTotal = null, lblCreditTotal = null;
|
|||
|
|
string txtFundTotal = null;
|
|||
|
|
private string txtCheckNo;
|
|||
|
|
private DateTime dtpCheckDate;
|
|||
|
|
private bool chkHasRightsEmployee = false;
|
|||
|
|
private int fundTypID = 0;
|
|||
|
|
public PFCalculation() { }
|
|||
|
|
public PFCalculation(int FundTypeID)
|
|||
|
|
{
|
|||
|
|
otran = new GLTran();
|
|||
|
|
DateTime operationDate = DateTime.MinValue;
|
|||
|
|
this.fundTypID = FundTypeID;
|
|||
|
|
FundType fundType = new FundTypeService().Get(FundTypeID);
|
|||
|
|
operationDate = fundType.OperationStartDate;
|
|||
|
|
dtmonthEnd = Global.DateFunctions.LastDateOfMonth(DateTime.Now);
|
|||
|
|
dtYearEnd = Global.DateFunctions.LastDateOfMonth(DateTime.Now.AddMonths(1));
|
|||
|
|
dtpVoucherDate = operationDate;
|
|||
|
|
dtpSettlementDate = operationDate;
|
|||
|
|
chkOthers = false;
|
|||
|
|
txtCurCPFInterest = "0";
|
|||
|
|
txtLstCPFInterest = "0";
|
|||
|
|
dtpCheckDate = DateTime.Now;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ServiceLengthWiseNetPayCalculator()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
dt = dtYearEnd;
|
|||
|
|
|
|||
|
|
serviceLength = Global.DateFunctions.DateDiff("Y", Convert.ToDateTime(member.DOJ), dtpSettlementDate.AddDays(1));
|
|||
|
|
_eSlabs = new ESBSlabService().Get();
|
|||
|
|
_netPay = 0;
|
|||
|
|
|
|||
|
|
_netPay += numEPFContribution;
|
|||
|
|
_netPay += numEPFInterest;
|
|||
|
|
_netPay += numCrntEPFContribution;
|
|||
|
|
_netPay += numCrntEPFInterest;
|
|||
|
|
_netPay += numCrntLstEPFInterest;
|
|||
|
|
if (_eSlabs.Count > 0)
|
|||
|
|
{
|
|||
|
|
for (int j = 0; j < _eSlabs.Count; j++)
|
|||
|
|
{
|
|||
|
|
if (serviceLength < _eSlabs[j].ServiceYear)
|
|||
|
|
{
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else if (j + 1 == _eSlabs.Count)
|
|||
|
|
{
|
|||
|
|
txtCPFPrincipal = Convert.ToString(Math.Round(numCPFContribution, 2));
|
|||
|
|
txtCPFInterest = Convert.ToString(Math.Round(numCPFInterest, 2));
|
|||
|
|
|
|||
|
|
txtCurCPF = Convert.ToString(Math.Round(numCrntCPFContribution, 2));
|
|||
|
|
|
|||
|
|
_netPay += numCPFContribution;
|
|||
|
|
_netPay += numCPFInterest;
|
|||
|
|
_netPay += numCrntCPFContribution;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
if (serviceLength == _eSlabs[j].ServiceYear && serviceLength < _eSlabs[j + 1].ServiceYear)
|
|||
|
|
{
|
|||
|
|
txtCPFPrincipal = Convert.ToString(Math.Round((numCPFContribution * Convert.ToInt32(_eSlabs[j].CalculNo)) / 100, 2));
|
|||
|
|
txtCPFInterest = Convert.ToString(Math.Round((numCPFInterest * Convert.ToInt32(_eSlabs[j].CalculNo)) / 100, 2));
|
|||
|
|
txtCurCPF = Convert.ToString(Math.Round(numCrntCPFContribution * Convert.ToInt32(_eSlabs[j].CalculNo) / 100, 2));
|
|||
|
|
|
|||
|
|
_netPay += numEPFContribution;
|
|||
|
|
_netPay += numEPFInterest;
|
|||
|
|
_netPay += numCrntEPFContribution;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool BasicInfo()
|
|||
|
|
{
|
|||
|
|
bool isError = false;
|
|||
|
|
txtLengthOfService = string.Empty;
|
|||
|
|
txtLastSalaryMonth = string.Empty;
|
|||
|
|
Member ctlMember = member;
|
|||
|
|
if (ctlMember != null)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
member = new Member();
|
|||
|
|
member = new MemberService().Get(ctlMember.MemberID);
|
|||
|
|
|
|||
|
|
if (member != null)
|
|||
|
|
{
|
|||
|
|
if (member.MembershipDate != null)
|
|||
|
|
{
|
|||
|
|
if (member.MemberStatus == EnumEmpStatus.Live && member.FinalSettlementDate == null)
|
|||
|
|
{
|
|||
|
|
member.MemberStatus = EnumEmpStatus.Setteled;
|
|||
|
|
member.DOL = dtpSettlementDate.Date;
|
|||
|
|
member.FinalSettlementDate = dtpSettlementDate.Date;
|
|||
|
|
|
|||
|
|
DateTime date = Convert.ToDateTime(member.DOJ);
|
|||
|
|
TimeSpan tSpan = dt.Subtract(date);
|
|||
|
|
|
|||
|
|
txtLengthOfService = Global.DateFunctions.DateDiff(Convert.ToDateTime(member.DOJ), dtpSettlementDate.AddDays(1));
|
|||
|
|
serviceLength = Global.DateFunctions.DateDiff("Y", Convert.ToDateTime(member.DOJ), dtpSettlementDate.AddDays(1));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
isError = true;
|
|||
|
|
bSelected = true;
|
|||
|
|
txtLengthOfService = Global.DateFunctions.DateDiff(Convert.ToDateTime(member.DOJ), dtpSettlementDate.AddDays(1));
|
|||
|
|
dtpSettlementDate = Convert.ToDateTime(member.FinalSettlementDate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
isError = true;
|
|||
|
|
throw new Exception("Error " + e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
isError = true;
|
|||
|
|
}
|
|||
|
|
return isError;
|
|||
|
|
}
|
|||
|
|
private GLTranDetail CreateDetail(GL ogl, double amount, string description, EnumTranSide side,
|
|||
|
|
int userObjectID, int userRecordID)
|
|||
|
|
{
|
|||
|
|
GLTranDetail glTranDetail = new GLTranDetail();
|
|||
|
|
glTranDetail.GL = ogl;
|
|||
|
|
|
|||
|
|
if (ogl == null)
|
|||
|
|
{
|
|||
|
|
throw new Exception("Please check your GLHead!");
|
|||
|
|
}
|
|||
|
|
else if (ogl != null)
|
|||
|
|
{
|
|||
|
|
glTranDetail.GLID = ogl.ID;
|
|||
|
|
glTranDetail.Amount = amount;
|
|||
|
|
glTranDetail.Description = description;
|
|||
|
|
glTranDetail.Transide = side;
|
|||
|
|
glTranDetail.OperationalStatus = EnumOperationalStatus.Add;
|
|||
|
|
|
|||
|
|
if (userObjectID > 0 && userRecordID > 0)
|
|||
|
|
{
|
|||
|
|
GLTranUserRecord gltur = new GLTranUserRecord();
|
|||
|
|
gltur.GLID = ogl.ID;
|
|||
|
|
gltur.UserObject1ID = userObjectID;
|
|||
|
|
gltur.UserRecord1ID = userRecordID;
|
|||
|
|
gltur.Amount = (double)glTranDetail.Amount;
|
|||
|
|
glTranDetail.GLTranUserRecords.Add(gltur);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return glTranDetail;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private GLTranDetail CreateDetail(GL ogl, double amount, string description, EnumTranSide side)
|
|||
|
|
{
|
|||
|
|
GLTranDetail glTranDetail = new GLTranDetail();
|
|||
|
|
glTranDetail.GL = ogl;
|
|||
|
|
glTranDetail.GLID = ogl.ID;
|
|||
|
|
glTranDetail.Amount = amount;
|
|||
|
|
glTranDetail.Description = description;
|
|||
|
|
glTranDetail.Transide = side;
|
|||
|
|
glTranDetail.OperationalStatus = EnumOperationalStatus.Add;
|
|||
|
|
|
|||
|
|
return glTranDetail;
|
|||
|
|
}
|
|||
|
|
private bool FundInfo(Member ctlMember)
|
|||
|
|
{
|
|||
|
|
bool isError = false;
|
|||
|
|
DateTime _lastYearEndDate = DateTime.Now;
|
|||
|
|
DateTime _lastMonthEndDate = DateTime.Now;
|
|||
|
|
ds = new DataSet();
|
|||
|
|
numEPFContribution = 0.0;
|
|||
|
|
numEPFInterest = 0.0;
|
|||
|
|
numCrntEPFContribution = 0.0;
|
|||
|
|
numCPFContribution = 0.0;
|
|||
|
|
numCPFInterest = 0.0;
|
|||
|
|
numCrntCPFContribution = 0.0;
|
|||
|
|
numCrntCPFInterest = 0.0;
|
|||
|
|
numCrntEPFInterest = 0.0;
|
|||
|
|
numCrntLstCPFInterest = 0.0;
|
|||
|
|
numCrntLstEPFInterest = 0.0;
|
|||
|
|
numLastCPFClosing = 0.0;
|
|||
|
|
numLastEPFClosing = 0.0;
|
|||
|
|
|
|||
|
|
if (ctlMember != null)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
// _lastYearEndDate = dtmonthEnd;
|
|||
|
|
// _lastMonthEndDate = dtYearEnd;
|
|||
|
|
//if (IsAsOnDate)
|
|||
|
|
//{
|
|||
|
|
DateTime lastDayOfMonth = new DateTime();
|
|||
|
|
lastDayOfMonth = Global.DateFunctions.LastDateOfMonth(DateTime.Now);
|
|||
|
|
dtYearEnd = lastDayOfMonth;
|
|||
|
|
ds = new MembersTransactionDetailsService().GetTranAmount(ctlMember.ID, dtYearEnd, ctlMember.FundTypeID);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//else if (IsDateRange)
|
|||
|
|
//{
|
|||
|
|
// DateTime fromFirstDayOfMonth = new DateTime();
|
|||
|
|
// DateTime toLastDayOfMonth = new DateTime();
|
|||
|
|
// fromFirstDayOfMonth = Global.DateFunctions.FirstDateOfMonth(fromDate);
|
|||
|
|
// toLastDayOfMonth = Global.DateFunctions.LastDateOfMonth(toDate);
|
|||
|
|
// dtYearEnd = toLastDayOfMonth;
|
|||
|
|
// ds = new MembersTransactionDetailsService().GetTranAmountForCalculate(ctlMember.MemberID, fromFirstDayOfMonth, toLastDayOfMonth, ctlMember.FundTypeID);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow orow in ds.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
if (orow["EPF"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
numEPFContribution = Math.Round(Convert.ToDouble(orow["EPF"].ToString()), 2);
|
|||
|
|
dTotal = dTotal + numEPFContribution;
|
|||
|
|
}
|
|||
|
|
if (orow["EPFINTEREST"].ToString() != "" && orow["CUREPFInterest"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
numEPFInterest = Math.Round(Convert.ToDouble(orow["EPFINTEREST"].ToString()) + Convert.ToDouble(orow["CUREPFInterest"].ToString()), 2);
|
|||
|
|
dTotal += numEPFInterest;
|
|||
|
|
lastEpfInterest = Convert.ToDouble(orow["EPFINTEREST"].ToString());
|
|||
|
|
_curEpfInterest = Convert.ToDouble(orow["CUREPFInterest"].ToString());
|
|||
|
|
}
|
|||
|
|
lastYearAmount = numEPFContribution + numEPFInterest;
|
|||
|
|
numLastEPFClosing = Math.Round(lastYearAmount, 2);
|
|||
|
|
if (orow["CUREPF"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
numCrntEPFContribution = Math.Round(Convert.ToDouble(orow["CUREPF"].ToString()), 2);
|
|||
|
|
dTotal += numCrntEPFContribution;
|
|||
|
|
}
|
|||
|
|
thisYearAmount = numCrntEPFContribution;
|
|||
|
|
if (orow["CPF"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
numCPFContribution = Math.Round(Convert.ToDouble(orow["CPF"].ToString()), 2);
|
|||
|
|
dTotal += numCPFContribution;
|
|||
|
|
}
|
|||
|
|
if (orow["CPFINTEREST"].ToString() != "" && orow["CURCPFInterest"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
numCPFInterest = Math.Round(Convert.ToDouble(orow["CPFINTEREST"].ToString()) + Convert.ToDouble(orow["CURCPFInterest"].ToString()), 2);
|
|||
|
|
dTotal += numCPFInterest;
|
|||
|
|
lastCpfInterest = Convert.ToDouble(orow["CPFINTEREST"].ToString());
|
|||
|
|
_curCpfInterest = Convert.ToDouble(orow["CURCPFInterest"].ToString());
|
|||
|
|
}
|
|||
|
|
numLastCPFClosing = Math.Round(numCPFContribution + numCPFInterest);
|
|||
|
|
if (orow["CURCPF"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
numCrntCPFContribution = Math.Round(Convert.ToDouble(orow["CURCPF"].ToString()), 2);
|
|||
|
|
dTotal += numCrntCPFContribution;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
txtCPFInterest = Convert.ToString(numCPFInterest);
|
|||
|
|
txtCPFPrincipal = Convert.ToString(numCPFContribution);
|
|||
|
|
txtCurCPF = Convert.ToString(numCrntCPFContribution);
|
|||
|
|
ServiceLengthWiseNetPayCalculator();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
isError = true;
|
|||
|
|
dTotal = 0;
|
|||
|
|
int c = 0;
|
|||
|
|
numEPFContribution = c;
|
|||
|
|
numEPFInterest = c;
|
|||
|
|
numCrntEPFContribution = c;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
isError = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return isError;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void SetUserObject()
|
|||
|
|
{
|
|||
|
|
userObjects = new UserObjectService().GetUserObjectByFundTypeID(fundTypeID);
|
|||
|
|
urObject = new UserObject();
|
|||
|
|
foreach (UserObject item in userObjects)
|
|||
|
|
{
|
|||
|
|
if (item.Name == "Member")
|
|||
|
|
{
|
|||
|
|
urObject = item;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
private void CreateFSVoucher(Member ctlMember)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
dtPFStatement = new FundDataSet.FundDataSet.PFStatementDataTable();
|
|||
|
|
dtPFRefundStatement = new FundDataSet.FundDataSet.PFRefundStatementDataTable();
|
|||
|
|
DataRow oRow = dtPFStatement.NewRow();
|
|||
|
|
DataRow oRowRefund = dtPFRefundStatement.NewRow();
|
|||
|
|
oRow["EmpId"] = ctlMember.EmpCode;
|
|||
|
|
oRow["Name"] = ctlMember.Name;
|
|||
|
|
oRow["Designation"] = ctlMember.Designation;
|
|||
|
|
oRow["JoiningDate"] = ctlMember.DOJ.ToString("dd MMM yyyy");
|
|||
|
|
oRow["PFMembershipDate"] = ctlMember.MembershipDate != null ? ((DateTime)ctlMember.MembershipDate).ToString("dd MMM yyyy") : "";
|
|||
|
|
if (IsAsOnDate)
|
|||
|
|
{
|
|||
|
|
oRow["DateString"] = "As On Date : " + asOnDate.ToString("dd MMM yyyy");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
oRow["DateString"] = "From Date : " + fromDate.ToString("dd MMM, yyyy") + " " + " To Date : " + toDate.ToString("dd MMM, yyyy");
|
|||
|
|
}
|
|||
|
|
oRowRefund["EmpId"] = ctlMember.EmpCode;
|
|||
|
|
oRowRefund["Name"] = ctlMember.Name;
|
|||
|
|
oRowRefund["Designation"] = ctlMember.Designation;
|
|||
|
|
oRowRefund["LastMonthSalary"] = ctlMember.CurrentBasic.ToString("N2");
|
|||
|
|
oRowRefund["JoiningDate"] = ctlMember.DOJ.ToString("dd MMM yyyy");
|
|||
|
|
oRowRefund["PFMembershipDate"] = ctlMember.MembershipDate != null ? ((DateTime)ctlMember.MembershipDate).ToString("dd MMM yyyy") : "";
|
|||
|
|
if(ctlMember.FinalSettlementDate != null)
|
|||
|
|
{
|
|||
|
|
oRowRefund["PFSeparationDate"] = ctlMember.FinalSettlementDate != null ? ((DateTime)ctlMember.FinalSettlementDate).ToString("dd MMM yyyy") : "";
|
|||
|
|
oRowRefund["PFLength"] = ctlMember.MembershipDate != null ? Global.DateFunctions.DateDiff(((DateTime)ctlMember.MembershipDate), (DateTime)ctlMember.FinalSettlementDate) : "";
|
|||
|
|
oRowRefund["ServiceLength"] = ctlMember.DOJ != null ? Global.DateFunctions.DateDiff(((DateTime)ctlMember.DOJ), (DateTime)ctlMember.FinalSettlementDate) : "";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
serviceLength = Global.DateFunctions.DateDiff("Y", Convert.ToDateTime(member.DOJ), dtpSettlementDate.AddDays(1));
|
|||
|
|
_interestglTran = new GLTran();
|
|||
|
|
otran = new GLTran();
|
|||
|
|
|
|||
|
|
UserRecord uRMember = new UserRecordService().GetByField1(ctlMember.EmpCode, urObject.ID, ctlMember.FundTypeID);
|
|||
|
|
double dforfeit = 0;
|
|||
|
|
_eSlabs = new ESBSlabService().Get();
|
|||
|
|
#region 3. EPF Contribution
|
|||
|
|
oRow["TotalEmpContribution"] = "0.00";
|
|||
|
|
oRowRefund["TotalEmpContribution"] = "0.00";
|
|||
|
|
if (numCrntEPFContribution + numEPFContribution != 0)
|
|||
|
|
{
|
|||
|
|
netPayable = netPayable + numCrntEPFContribution + numEPFContribution;
|
|||
|
|
oRow["TotalEmpContribution"] = (numCrntEPFContribution + numEPFContribution).ToString("N2");
|
|||
|
|
oRowRefund["TotalEmpContribution"] = (numCrntEPFContribution + numEPFContribution).ToString("N2");
|
|||
|
|
oRow["TotalEmpContribution"] = numEPFContribution.ToString("N2");
|
|||
|
|
oRowRefund["TotalEmpContribution"] = numEPFContribution.ToString("N2");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 4. CPF Contribution
|
|||
|
|
oRow["TotalCompContribution"] = "0.00";
|
|||
|
|
oRowRefund["TotalCompContribution"] = "0.00";
|
|||
|
|
if (Convert.ToDouble(txtCPFPrincipal) + Convert.ToDouble(txtCurCPF) != 0)
|
|||
|
|
{
|
|||
|
|
double cpfCon = Convert.ToDouble(txtCPFPrincipal) + Convert.ToDouble(txtCurCPF);
|
|||
|
|
oRow["TotalCompContribution"] = (Convert.ToDouble(numCPFContribution) + Convert.ToDouble(numCrntCPFContribution)).ToString("N2");
|
|||
|
|
oRowRefund["TotalCompContribution"] = (Convert.ToDecimal(numCPFContribution) + Convert.ToDecimal(numCrntCPFContribution)).ToString("N2");
|
|||
|
|
oRow["TotalCompContribution"] = Convert.ToDouble(numCPFContribution).ToString("N2");
|
|||
|
|
oRowRefund["TotalCompContribution"] = Convert.ToDecimal(numCPFContribution).ToString("N2");
|
|||
|
|
|
|||
|
|
netPayable = netPayable + (Convert.ToDouble(numCPFContribution) + Convert.ToDouble(numCrntCPFContribution));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 5. EPF Interest (Audited Year + currentYear(1))
|
|||
|
|
oRow["TotalEmpProfit"] = "0.00";
|
|||
|
|
oRowRefund["TotalEmpProfit"] = "0.00";
|
|||
|
|
if (numCrntEPFInterest + numEPFInterest != 0)
|
|||
|
|
{
|
|||
|
|
netPayable = netPayable + numCrntEPFInterest + numEPFInterest + numCrntLstEPFInterest;
|
|||
|
|
oRow["TotalEmpProfit"] = (numCrntEPFInterest + numEPFInterest + numCrntLstEPFInterest).ToString("N2");
|
|||
|
|
oRow["TotalEmpProfit"] = lastEpfInterest.ToString("N2");
|
|||
|
|
oRowRefund["TotalEmpProfit"] = (numCrntEPFInterest + numEPFInterest + numCrntLstEPFInterest).ToString("N2");
|
|||
|
|
oRowRefund["TotalEmpProfit"] = lastEpfInterest.ToString("N2");
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
oRow["TotalCompProfit"] = "0.00";
|
|||
|
|
oRowRefund["TotalCompProfit"] = "0.00";
|
|||
|
|
if (numCrntCPFInterest + numCPFInterest != 0)
|
|||
|
|
{
|
|||
|
|
if (Convert.ToDouble(txtCurCPFInterest) + Convert.ToDouble(txtCPFInterest) + Convert.ToDouble(txtLstCPFInterest) != 0)
|
|||
|
|
{
|
|||
|
|
netPayable = netPayable + Convert.ToDouble(txtCurCPFInterest) + Convert.ToDouble(txtCPFInterest) + Convert.ToDouble(txtLstCPFInterest);
|
|||
|
|
oRow["TotalCompProfit"] = (Convert.ToDecimal(txtCurCPFInterest) + Convert.ToDecimal(txtCPFInterest) + Convert.ToDecimal(txtLstCPFInterest)).ToString("N2");
|
|||
|
|
oRowRefund["TotalCompProfit"] = (Convert.ToDecimal(txtCurCPFInterest) + Convert.ToDecimal(txtCPFInterest) + Convert.ToDecimal(txtLstCPFInterest)).ToString("N2");
|
|||
|
|
oRow["TotalCompProfit"] = lastCpfInterest.ToString("N2");
|
|||
|
|
oRowRefund["TotalCompProfit"] = lastCpfInterest.ToString("N2");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
txtFundTotal = (numEPFContribution + numEPFInterest + numCrntEPFContribution + numCPFContribution + numCPFInterest + numCrntCPFContribution + numCrntEPFInterest + numCrntCPFInterest + numCrntLstEPFInterest + numCrntLstCPFInterest).ToString("N2");
|
|||
|
|
txtFundTotal = (numEPFContribution + numCPFContribution + lastEpfInterest + lastCpfInterest).ToString("N2");
|
|||
|
|
oRow["SubTotal"] = txtFundTotal;
|
|||
|
|
oRowRefund["SubTotal"] = txtFundTotal;
|
|||
|
|
|
|||
|
|
#region 7. Loan to Employee
|
|||
|
|
oRow["LoanAmount"] = "0" ;
|
|||
|
|
oRowRefund["LoanAmount"] = "0";
|
|||
|
|
oRowRefund["SubTotalDeduction"] = "0";
|
|||
|
|
unpaidAmount = new LoanScheduleService().GetOutStanding(member.ID);
|
|||
|
|
if (unpaidAmount != 0)
|
|||
|
|
{
|
|||
|
|
netPayable = netPayable - (double)unpaidAmount;
|
|||
|
|
oRow["LoanAmount"] = Convert.ToDouble(unpaidAmount).ToString("N2");
|
|||
|
|
oRowRefund["LoanAmount"] = Convert.ToDouble(unpaidAmount).ToString("N2");
|
|||
|
|
oRowRefund["SubTotalDeduction"] = oRowRefund["LoanAmount"];
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
//Only For KCCL
|
|||
|
|
#region Forfietted Amount
|
|||
|
|
if (chkHasRightsEmployee == false)
|
|||
|
|
{
|
|||
|
|
foreach (ESBSlab oslab in _eSlabs)
|
|||
|
|
{
|
|||
|
|
if (serviceLength < oslab.ServiceYear)
|
|||
|
|
{
|
|||
|
|
if ((Convert.ToDecimal(txtCurCPF) + Convert.ToDecimal(txtCPFPrincipal) + Convert.ToDecimal(txtCPFInterest)) != 0)
|
|||
|
|
{
|
|||
|
|
netPayable = netPayable - (Convert.ToDouble(txtCurCPF) + Convert.ToDouble(txtCPFPrincipal) + Convert.ToDouble(txtCPFInterest) + Convert.ToDouble(txtCurCPFInterest) + Convert.ToDouble(txtLstCPFInterest));
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 10. Bank (Net Payable)
|
|||
|
|
string closingBalance = string.Empty;
|
|||
|
|
if (chkHasRightsEmployee)
|
|||
|
|
{
|
|||
|
|
closingBalance = ((netPayable + deductAmount) - crDeductAmount).ToString("N2");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
closingBalance = ((netPayable - dforfeit + deductAmount) - crDeductAmount).ToString("N2");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
oRow["ClosingBalance"] = (Convert.ToDouble(oRow["SubTotal"].ToString()) - Convert.ToDouble(oRow["LoanAmount"].ToString())).ToString("N2");
|
|||
|
|
oRowRefund["OtherAmount"] = 0;
|
|||
|
|
oRowRefund["TaxAmount"] = 0;
|
|||
|
|
oRowRefund["NetPay"] = closingBalance;
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
dtPFStatement.Rows.Add(oRow);
|
|||
|
|
dtPFRefundStatement.Rows.Add(oRowRefund);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw new Exception("Create Voucher is failed Due to " + ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public FundDataSet.FundDataSet.PFStatementDataTable PFReportCalCulation(Member member)
|
|||
|
|
{
|
|||
|
|
this.member = member;
|
|||
|
|
SetUserObject();
|
|||
|
|
FundInfo(member);
|
|||
|
|
CreateFSVoucher(member);
|
|||
|
|
return dtPFStatement;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public FundDataSet.FundDataSet.PFRefundStatementDataTable PFRefundCalculation(Member member)
|
|||
|
|
{
|
|||
|
|
this.member = member;
|
|||
|
|
SetUserObject();
|
|||
|
|
FundInfo(member);
|
|||
|
|
CreateFSVoucher(member);
|
|||
|
|
return dtPFRefundStatement;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|