1300 lines
101 KiB
C#
1300 lines
101 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
using System.Configuration;
|
|||
|
using Microsoft.Data.SqlClient;
|
|||
|
using static iTextSharp.text.pdf.AcroFields;
|
|||
|
using NPOI.SS.Formula.Functions;
|
|||
|
using static NPOI.HSSF.Util.HSSFColor;
|
|||
|
using iTextSharp.text.pdf.parser.clipper;
|
|||
|
|
|||
|
namespace HRM.DA.Fund
|
|||
|
{
|
|||
|
#region class MembersTransactionDetailsDA
|
|||
|
|
|||
|
internal class MembersTransactionDetailsDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public MembersTransactionDetailsDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, MembersTransactionDetails oItem)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
sql = SQLParser.MakeSQL(
|
|||
|
"INSERT INTO MembersTransactionDetails(TranID,MemberID,TranTypeID,TranDate,ProjectID,FundTypeID,Amount,Effect,ActivityID,VoucherNo,CreatedBy,CreatedDate)" +
|
|||
|
" VALUES(%n,%n,%n,%d,%n,%n,%n,%n,%n,%s,%n,%D)", oItem.ID, oItem.MemberID, oItem.TranTypeID,
|
|||
|
oItem.TranDate, oItem.ID,
|
|||
|
oItem.FundTypeID, oItem.Amount, oItem.Effect, DataReader.GetNullValue(oItem.ActivityID),
|
|||
|
DataReader.GetNullValue(oItem.VoucherNo),
|
|||
|
oItem.CreatedBy, oItem.CreatedDate);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, MembersTransactionDetails oItem)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE MembersTransactionDetails SET MemberID=%n, TranTypeID=%n, TranDate=%d, ProjectID=%n, FundTypeID = %n, Amount=%n, Effect=%n, ActivityID=%n, VoucherNo=%s, ModifiedBy = %n, ModifiedDate = %D" +
|
|||
|
"where TranID=%n", oItem.MemberID, oItem.TranTypeID, oItem.TranDate, oItem.ID, oItem.FundTypeID,
|
|||
|
oItem.Amount,
|
|||
|
oItem.Effect, oItem.ActivityID, oItem.VoucherNo, oItem.ModifiedBy, oItem.ModifiedDate, oItem.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region int Generation function
|
|||
|
|
|||
|
internal static int GetNewID(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.GenerateID("MembersTransactionDetails", "TranID");
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, EnumMemberTranType type, int fundtypeid)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM MembersTransactionDetails Where ProjectID=%n and TranTypeID=%n",
|
|||
|
fundtypeid, type);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetbyFundType(TransactionContext tc, int fundtypeid)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM MembersTransactionDetails Where ProjectID=%n ", fundtypeid);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int TranID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM MembersTransactionDetails WHERE TranID=%n", TranID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMemberContribution(TransactionContext tc, int memberID, DateTime beforeConOfDate,
|
|||
|
int fundtypeid)
|
|||
|
{
|
|||
|
string sqlString = string.Empty;
|
|||
|
sqlString = SQLParser.MakeSQL(
|
|||
|
"SELECT * FROM MembersTransactionDetails WHERE MemberID = %n AND TranDate < %d AND ProjectID=%n",
|
|||
|
memberID, beforeConOfDate, fundtypeid);
|
|||
|
return tc.ExecuteReader(sqlString);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMemberContribution(TransactionContext tc, int memberID, string searchCondition,
|
|||
|
int fundtypeid)
|
|||
|
{
|
|||
|
string sqlString = string.Empty;
|
|||
|
sqlString = SQLParser.MakeSQL(
|
|||
|
"SELECT * FROM MembersTransactionDetails WHERE MemberID = %n AND ProjectID=%n %q order by TranDate,TranTypeID asc",
|
|||
|
memberID, fundtypeid, searchCondition);
|
|||
|
//sqlString = sqlString + searchCondition;
|
|||
|
return tc.ExecuteReader(sqlString);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMemberContribution(TransactionContext tc, int memberID, string searchCondition)
|
|||
|
{
|
|||
|
string sqlString = string.Empty;
|
|||
|
|
|||
|
sqlString = SQLParser.MakeSQL(
|
|||
|
"SELECT * FROM MembersTransactionDetails WHERE MemberID = %n %q order by TranDate,TranTypeID asc",
|
|||
|
memberID, searchCondition);
|
|||
|
//sqlString = sqlString + searchCondition;
|
|||
|
return tc.ExecuteReader(sqlString);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMemberContribution( int memberID, string searchCondition, string FMConn)
|
|||
|
{
|
|||
|
string sqlString = string.Empty;
|
|||
|
|
|||
|
sqlString = SQLParser.MakeSQL(
|
|||
|
"SELECT * FROM MembersTransactionDetails WHERE MemberID = %n %q order by TranDate,TranTypeID asc",
|
|||
|
memberID, searchCondition);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
SqlConnection connection = new SqlConnection(FMConn);
|
|||
|
connection.Open();
|
|||
|
SqlCommand cmd = new SqlCommand(sqlString, connection);
|
|||
|
|
|||
|
return cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception("An error occurred while fetching the member contribution: " + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//internal static DataSet GetTransactionMembers(TransactionContext tc, DateTime uploadMonth)
|
|||
|
//{
|
|||
|
// DataSet ds = new DataSet();
|
|||
|
// string sql = string.Empty;
|
|||
|
// sql = SQLParser.MakeSQL("SELECT * from %q WHERE TranDate = %d", ConfigurationSettings.AppSettings["vwMembersContribution"], PayrollGlobalFunctions.PayrollLastDateOfMonth(uploadMonth));
|
|||
|
// ds = tc.ExecuteDataSet(sql);
|
|||
|
// ds.Tables[0].TableName = "MembersTransactions";
|
|||
|
// return ds;
|
|||
|
//}
|
|||
|
|
|||
|
//internal static DataSet GetTransactionIAMembers(TransactionContext tc)
|
|||
|
//{
|
|||
|
// DataSet ds = new DataSet();
|
|||
|
// string sql = string.Empty;
|
|||
|
// sql = SQLParser.MakeSQL("SELECT * from %q", ConfigurationSettings.AppSettings["vwIAMemberPFTransaction"]);
|
|||
|
// ds = tc.ExecuteDataSet(sql);
|
|||
|
// ds.Tables[0].TableName = "MembersTransactions";
|
|||
|
// return ds;
|
|||
|
//}
|
|||
|
|
|||
|
//internal static DataSet GetTransactionMembers(TransactionContext tc, string queryString)
|
|||
|
//{
|
|||
|
// DataSet ds = new DataSet();
|
|||
|
// string sql = string.Empty;
|
|||
|
// sql = SQLParser.MakeSQL("SELECT * from %q WHERE %q", ConfigurationSettings.AppSettings["vwMembersContribution"], queryString);
|
|||
|
// ds = tc.ExecuteDataSet(sql);
|
|||
|
// ds.Tables[0].TableName = "MembersTransactions";
|
|||
|
// return ds;
|
|||
|
//}
|
|||
|
|
|||
|
internal static void DeleteYearEndInterestTran(TransactionContext tc, DateTime yearEndDate)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"DELETE FROM MembersTransactionDetails WHERE TranDate BETWEEN %d AND %d AND TranTypeID in (%n,%n) ",
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(yearEndDate),
|
|||
|
yearEndDate, EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest);
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetGFProvissionMember(TransactionContext tc, DateTime month)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
string sql = string.Empty;
|
|||
|
sql = SQLParser.MakeSQL("SELECT * from vw_MonthlyGFProvision WHERE MonthYearDate = %d", month);
|
|||
|
ds = tc.ExecuteDataSet(sql);
|
|||
|
//ds.Tables[0].TableName = "MembersMonthlyGFProvision";
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int TranID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM MembersTransactionDetails WHERE TranID=%n", TranID);
|
|||
|
}
|
|||
|
|
|||
|
internal static void DeleteMemberSettlement(TransactionContext tc, int TranID, int memberID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM MembersTransactionDetails WHERE TranID=%n and MemberID =%n", TranID,
|
|||
|
memberID);
|
|||
|
}
|
|||
|
|
|||
|
internal static void DeleteGFMemberSettlement(TransactionContext tc, int memberID, DateTime tranDate,
|
|||
|
decimal amount, int projectID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"DELETE FROM MembersTransactionDetails WHERE MemberID =%n AND TranDate=%d AND Amount=%n and ProjectID=%n",
|
|||
|
memberID, tranDate, amount, projectID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
internal static bool ISExistMonth(TransactionContext tc, DateTime month, int fundID, int tranID, int fundtypeid)
|
|||
|
{
|
|||
|
string sSQL = SQLParser.MakeSQL(@"SELECT COUNT(*) FROM MembersTransactionDetails WHERE TranDate = %d
|
|||
|
and FundTypeID = %n AND TranTypeID = %n AND ProjectID=%n", month, fundID, tranID, fundtypeid);
|
|||
|
object ob = tc.ExecuteScalar(sSQL);
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
|
|||
|
internal static bool IsExistMemberContribution(TransactionContext tc, int memberID, DateTime month, int fundID,
|
|||
|
int tranID, int fundtypeid)
|
|||
|
{
|
|||
|
object ob = tc.ExecuteScalar(@"SELECT COUNT(*) FROM MembersTransactionDetails WHERE MemberID =%n AND
|
|||
|
TranDate = %d and FundTypeID = %n AND TranTypeID = %n AND ProjectID=%n", memberID, month, fundID, tranID,
|
|||
|
fundtypeid);
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
|
|||
|
internal static bool ISExist(TransactionContext tc, string tableName, int fundtypeid)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
sql = SQLParser.MakeSQL("SELECT COUNT(*) FROM %q WHERE ProjectID=%n", tableName, fundtypeid);
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
|
|||
|
internal static bool IsExist(TransactionContext tc, int projectID)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
//DateTime dt = Convert.ToDateTime("28 Feb 2007"); //("2/28/2007");
|
|||
|
//sql = SQLParser.MakeSQL("SELECT Count(*) FROM MembersTransactionDetails WHERE ProjectID = %n AND TranTypeID = %n and TranDate = %d ", projectID, 3, Convert.ToDateTime("28 Feb 2007"));
|
|||
|
sql = SQLParser.MakeSQL(
|
|||
|
"SELECT Count(*) FROM MembersTransactionDetails WHERE ProjectID = %n AND TranTypeID = %n and TranDate = %d ",
|
|||
|
projectID, 3,
|
|||
|
Convert.ToDateTime("31 Dec 2011"));
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static DataSet GetTranAmount(TransactionContext tc, int EmpID, DateTime dtYearEnd)
|
|||
|
{
|
|||
|
DataSet oBonusPaySlip = new DataSet();
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string trantypeOpeC = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string opeInterestEPF = Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest);
|
|||
|
string opeInterestCPF = Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest);
|
|||
|
|
|||
|
|
|||
|
string sSQL = SQLParser.MakeSQL(
|
|||
|
@"Select (aa.EPF - aa.EPFWithdrawal) EPF,(aa.CPF - aa.CPFWithdrawal) CPF,EPFINTEREST,CPFINTEREST,(aa.CUREPF - aa.CUREPFWithdrawal) CUREPF,
|
|||
|
(aa.CURCPF - aa.CURCPFWithdrawal) CURCPF,CUREPFInterest,CURCPFInterest From
|
|||
|
(SELECT
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) and TranDate <= %d THEN Amount ELSE 0 END) EPF,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) and TranDate <= %d THEN Amount ELSE 0 END) CPF,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId = %n and TranDate <= %d THEN Amount ELSE 0 END) EPFWithdrawal,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId = %n and TranDate <= %d THEN Amount ELSE 0 END) CPFWithdrawal,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) and TranDate <= %d THEN Amount ELSE 0 END) EPFINTEREST,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) and TranDate <= %d THEN Amount ELSE 0 END) CPFINTEREST,
|
|||
|
SUM(CASE WHEN FundTypeID =%n AND TranTypeID in (%q) AND TranDate > %d THEN Amount ELSE 0 END) CUREPF,
|
|||
|
SUM(CASE WHEN FundTypeID =%n AND TranTypeID in (%q) AND TranDate > %d THEN Amount ELSE 0 END) CURCPF,
|
|||
|
SUM(CASE WHEN FundTypeID =%n AND TranTypeID =%n AND TranDate > %d THEN Amount ELSE 0 END) CUREPFWithdrawal,
|
|||
|
SUM(CASE WHEN FundTypeID =%n AND TranTypeID =%n AND TranDate > %d THEN Amount ELSE 0 END) CURCPFWithdrawal,
|
|||
|
SUM(CASE WHEN FundTypeID =%n AND TranTypeID in (%q) AND TranDate > %d THEN Amount ELSE 0 END) CUREPFInterest,
|
|||
|
SUM(CASE WHEN FundTypeID =%n AND TranTypeID in (%q) AND TranDate > %d THEN Amount ELSE 0 END) CURCPFInterest
|
|||
|
from MembersTransactionDetails where MemberID=%n) aa",
|
|||
|
(int)EnumFundType.PF_EPF, tranTypeOpeE,
|
|||
|
dtYearEnd, (int)EnumFundType.PF_CPF, trantypeOpeC, dtYearEnd, (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
dtYearEnd, (int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund, dtYearEnd,
|
|||
|
(int)EnumFundType.PF_EPF,
|
|||
|
opeInterestEPF, dtYearEnd, (int)EnumFundType.PF_CPF, opeInterestCPF, dtYearEnd,
|
|||
|
(int)EnumFundType.PF_EPF,
|
|||
|
tranTypeOpeE, dtYearEnd, (int)EnumFundType.PF_CPF,
|
|||
|
trantypeOpeC, dtYearEnd, (int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
dtYearEnd, (int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund, dtYearEnd,
|
|||
|
(int)EnumFundType.PF_EPF, opeInterestEPF, dtYearEnd,
|
|||
|
(int)EnumFundType.PF_CPF, opeInterestCPF, dtYearEnd, EmpID);
|
|||
|
oBonusPaySlip = tc.ExecuteDataSet(sSQL);
|
|||
|
return oBonusPaySlip;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetTranAmount(TransactionContext tc, string memberID, DateTime dtFirst, DateTime dtLast)
|
|||
|
{
|
|||
|
DataSet rootDataset = new DataSet();
|
|||
|
DataSet tempdataset = new DataSet();
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string trantypeOpeC = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string sSQLLive = SQLParser.MakeSQL(@"
|
|||
|
Select * from
|
|||
|
(SELECT mem.EmpCode,mem.Name,memTran.memberID ,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS EPFINTERESTMon,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CPFINTERESTMon,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CUREPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CURCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CUREPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CURCPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLEPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLCPF
|
|||
|
from MemberDetail mem
|
|||
|
inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
where memTran.MemberID in(%q)
|
|||
|
group by memTran.MemberID,mem.EmpCode,mem.Name)A
|
|||
|
", (int)EnumFundType.PF_EPF, tranTypeOpeE, dtFirst, (int)EnumFundType.PF_CPF, trantypeOpeC,
|
|||
|
dtFirst, (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest, dtFirst, (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
dtFirst, (int)EnumFundType.PF_EPF, EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest, dtFirst,
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest,
|
|||
|
dtFirst, (int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund, dtFirst,
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund,
|
|||
|
dtFirst, (int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest, dtFirst,
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
dtFirst, (int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund, dtFirst,
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund,
|
|||
|
dtFirst, memberID);
|
|||
|
tempdataset = tc.ExecuteDataSet(sSQLLive);
|
|||
|
tempdataset.Tables[0].TableName = "Member";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
#region Old Code
|
|||
|
|
|||
|
// memberID = "";
|
|||
|
// var Resigningmember = (from mem in members
|
|||
|
// where mem.Status == EnumEmpStatus.Setteled
|
|||
|
// select mem);
|
|||
|
|
|||
|
// foreach (var mem in Resigningmember)
|
|||
|
// {
|
|||
|
// if (memberID == "")
|
|||
|
// {
|
|||
|
// memberID = mem.ID.ToString();
|
|||
|
// }
|
|||
|
// else if (memberID != "")
|
|||
|
// {
|
|||
|
// memberID = memberID + "," + mem.ID.ToString();
|
|||
|
// }
|
|||
|
// }
|
|||
|
// if (memberID != "")
|
|||
|
// {
|
|||
|
// string sSQLResigning = SQLParser.MakeSQL(@"
|
|||
|
// SELECT FS.EmpCode,mem.Name,memTran.memberID ,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId= 1 and memTran.TranTypeId in (3,1) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId= 2 and memTran.TranTypeId in (4,2) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId= 1 and memTran.TranTypeId =5 and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId= 2 and memTran.TranTypeId =6 and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeID =1 AND memTran.TranTypeID =1 AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CUREPF,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeID =2 AND memTran.TranTypeID =2 AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CURCPF,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeID =1 AND memTran.TranTypeID =5 AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CUREPFINTEREST,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeID =2 AND memTran.TranTypeID =6 AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS CURCPFINTEREST,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeID =1 AND memTran.TranTypeID =22 AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLEPF,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeID =2 AND memTran.TranTypeID =23 AND memTran.TranDate > %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLCPF
|
|||
|
// from MemberDetail mem
|
|||
|
// inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
// inner join FinalSettlement FS on mem.MemberID = FS.MemberID
|
|||
|
// where FS.MemberID in(%q) and FS.SettlementDate between %d and %d group by memTran.MemberID,mem.EmpCode,mem.Name",
|
|||
|
// dtFirst, dtFirst, dtFirst, dtFirst, dtFirst, dtFirst, dtFirst, dtFirst, dtFirst,
|
|||
|
// dtFirst, memberID,dtFirst,dtLast);
|
|||
|
// tempdataset = tc.ExecuteDataSet(sSQLResigning);
|
|||
|
// tempdataset.Tables[0].TableName = "ResigningMember";
|
|||
|
// rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
// }
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return rootDataset;
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMembersAccount(TransactionContext tc, string smemberId, DateTime fromMonth,
|
|||
|
DateTime toMonth, EnumMemberDvdntDuration divDuration)
|
|||
|
{
|
|||
|
int firstMonth = fromMonth.Month;
|
|||
|
string sSQL = string.Empty;
|
|||
|
int ntoMonth = 0;
|
|||
|
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string trantypeOpeC = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string fundtype =
|
|||
|
Convert.ToString((int)EnumMemberTranType
|
|||
|
.Contribution_Of_Employee_Provident_Fund); // +"," + Convert.ToString((int)EnumMemberTranType.Contribution_Of_CPF);
|
|||
|
string withdrawal = Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund);
|
|||
|
string opeWithdrawalInterest = Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest);
|
|||
|
|
|||
|
if (divDuration == EnumMemberDvdntDuration.Half_Yearly)
|
|||
|
{
|
|||
|
ntoMonth = firstMonth + 5;
|
|||
|
|
|||
|
sSQL = SQLParser.MakeSQL(@"SELECT mem.EmpCode,mem.Name,memTran.memberID ,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS firstCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SecondCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS thiredCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FourthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FifthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SixthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%q)AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate = %d THEN memTran.Amount ELSE 0 END )AS EPFYearEndInterest,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate = %d THEN memTran.Amount ELSE 0 END )AS CPFYearEndInterest
|
|||
|
from MemberDetail mem
|
|||
|
inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
where memTran.MemberID in(%q) group by memTran.MemberID,mem.EmpCode,mem.Name
|
|||
|
order by memTran.MemberID", (int)EnumFundType.PF_EPF, tranTypeOpeE,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth), (int)EnumFundType.PF_CPF, trantypeOpeC,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(1)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(1)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(2)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(2)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(3)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(3)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(4)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(4)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(toMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), fundtype, withdrawal,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), smemberId);
|
|||
|
}
|
|||
|
else if (divDuration == EnumMemberDvdntDuration.Yearly)
|
|||
|
{
|
|||
|
sSQL = SQLParser.MakeSQL(@"SELECT mem.EmpCode,mem.Name,memTran.memberID ,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate <%d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS firstCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SecondCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS thiredCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FourthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FifthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SixthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SeventhCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS EigthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS NinthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS TenthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS EleventhCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS TwelvthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%q)AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate = %d THEN memTran.Amount ELSE 0 END )AS EPFYearEndInterest,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate = %d THEN memTran.Amount ELSE 0 END )AS CPFYearEndInterest
|
|||
|
from MemberDetail mem
|
|||
|
inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
where memTran.MemberID in(%q) group by memTran.MemberID,mem.EmpCode,mem.Name
|
|||
|
order by memTran.MemberID", (int)EnumFundType.PF_EPF, tranTypeOpeE,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth), (int)EnumFundType.PF_CPF, trantypeOpeC,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(1)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(1)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(2)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(2)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(3)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(3)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(4)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(4)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(5)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(5)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(6)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(6)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(7)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(7)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(8)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(8)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(9)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(9)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth.AddMonths(10)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(fromMonth.AddMonths(10)),
|
|||
|
fundtype, (int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(toMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), fundtype, withdrawal,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(toMonth), smemberId);
|
|||
|
}
|
|||
|
|
|||
|
return tc.ExecuteReader(sSQL);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMembersEPFCPF(TransactionContext tc, int EmpID, DateTime dateTime)
|
|||
|
{
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string trantypeOpeC = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string EPFInterest = Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest);
|
|||
|
string CPFInterest = Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest);
|
|||
|
|
|||
|
string sSQL = SQLParser.MakeSQL(
|
|||
|
@" Select (a.EPF - IsNUll(a.EPFWithdrawal,0))as EPF,(a.CPF - IsNull(a.CPFWithdrawal,0)) as CPF,
|
|||
|
(a.EPFInterest - a.EPFInterestWithdrawal)as EPFInterest,(a.CPFInterest - a.CPFInterestWithdrawal)as CPFInterest
|
|||
|
From (SELECT
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%n) and memTran.TranDate <= %d THEN memTran.Amount ELSE 0 END) AS EPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%n) and memTran.TranDate <= %d THEN memTran.Amount ELSE 0 END) AS CPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFInterest,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFInterest,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%n) and memTran.TranDate <= %d THEN memTran.Amount ELSE 0 END) AS EPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%n) and memTran.TranDate <= %d THEN memTran.Amount ELSE 0 END) AS CPFInterestWithdrawal
|
|||
|
from MembersTransactionDetails memTran where memTran.MemberID in(%q)) a",
|
|||
|
(int)EnumFundType.PF_EPF, tranTypeOpeE, PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime),
|
|||
|
(int)EnumFundType.PF_CPF, trantypeOpeC, PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime),
|
|||
|
(int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund, PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime),
|
|||
|
(int)EnumFundType.PF_EPF, EPFInterest, PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime),
|
|||
|
(int)EnumFundType.PF_CPF, CPFInterest,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest, PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime),
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(dateTime), EmpID);
|
|||
|
|
|||
|
return tc.ExecuteReader(sSQL);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMembersAccountBeforeAfterAudit(TransactionContext tc, string smemberId,
|
|||
|
DateTime Fromdate, DateTime Todate, EnumMemberDvdntDuration divDuration)
|
|||
|
{
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string trantypeOpeC = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string fundtype = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string withdrawal = Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund);
|
|||
|
string sSQL = string.Empty;
|
|||
|
|
|||
|
if (divDuration == EnumMemberDvdntDuration.Yearly)
|
|||
|
{
|
|||
|
sSQL = SQLParser.MakeSQL(
|
|||
|
@"Select FS.EmpCode,mem.Name,memTran.memberID ,FS.SettlementDate as ResignationDate,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS firstCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SecondCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS thiredCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FourthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FifthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SixthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SeventhCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS EigthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS NinthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS TenthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS EleventhCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS TwelvthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLEPFPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLCPFPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLEPFInterestPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLCPFInterestPrin
|
|||
|
from MemberDetail mem
|
|||
|
inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
inner join FinalSettlement FS on mem.MemberID = FS.MemberID
|
|||
|
where FS.MemberID in(%q) AND FS.SettlementDate between %d and %d
|
|||
|
group by memTran.MemberID,FS.EmpCode,mem.Name,FS.SettlementDate
|
|||
|
order by memTran.MemberID", (int)EnumFundType.PF_EPF, tranTypeOpeE,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate), (int)EnumFundType.PF_CPF, trantypeOpeC,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(1)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(1)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(2)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(2)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(3)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(3)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(4)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(4)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(5)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(5)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(6)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(6)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(7)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(7)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(8)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(8)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(9)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(9)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(10)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(10)),
|
|||
|
fundtype, (int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Todate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), smemberId,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate));
|
|||
|
}
|
|||
|
else if (divDuration == EnumMemberDvdntDuration.Half_Yearly)
|
|||
|
{
|
|||
|
sSQL = SQLParser.MakeSQL(
|
|||
|
@"Select FS.EmpCode,mem.Name,memTran.memberID ,FS.SettlementDate as ResignationDate,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS firstCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SecondCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS thiredCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FourthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS FifthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID in(%q) AND memTran.TranTypeID in(%n) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS SixthCUREPFCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLEPFPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLCPFPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLEPFInterestPrin,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID =%n AND memTran.TranTypeID =%n AND memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS WITHDRAWLCPFInterestPrin
|
|||
|
from MemberDetail mem
|
|||
|
inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
inner join FinalSettlement FS on mem.MemberID = FS.MemberID
|
|||
|
where FS.MemberID in(%q) AND FS.SettlementDate between %d and %d
|
|||
|
group by memTran.MemberID,FS.EmpCode,mem.Name,FS.SettlementDate
|
|||
|
order by memTran.MemberID", (int)EnumFundType.PF_EPF, tranTypeOpeE,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate), (int)EnumFundType.PF_CPF, trantypeOpeC,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
(int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(1)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(1)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(2)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(2)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(3)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(3)), fundtype,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate.AddMonths(4)),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate.AddMonths(4)),
|
|||
|
fundtype, (int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Todate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate), smemberId,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(Todate));
|
|||
|
}
|
|||
|
|
|||
|
return tc.ExecuteReader(sSQL);
|
|||
|
}
|
|||
|
|
|||
|
internal static double GetOpeningBalance(TransactionContext tc, int memberID, int fundType, DateTime FromDate)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
sql = SQLParser.MakeSQL(@"SELECT SUM(Amount) AS OpeningBalance
|
|||
|
FROM MembersTransactionDetails
|
|||
|
WHERE MemberID = %n AND FundTypeID = %n AND TranDate< %d;", memberID, fundType,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(FromDate));
|
|||
|
|
|||
|
|
|||
|
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
|
|||
|
double amount = 0;
|
|||
|
if (ob != DBNull.Value)
|
|||
|
{
|
|||
|
amount = Convert.ToDouble(ob);
|
|||
|
}
|
|||
|
|
|||
|
return amount;
|
|||
|
}
|
|||
|
|
|||
|
internal static double GetOpeningBalance(int memberID, int fundType, DateTime FromDate, string FMConn)
|
|||
|
{
|
|||
|
object ob = new object();
|
|||
|
double amount = 0;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
using (SqlConnection connection = new SqlConnection(FMConn))
|
|||
|
{
|
|||
|
connection.Open();
|
|||
|
string commandText = @"SELECT SUM(Amount) AS OpeningBalance
|
|||
|
FROM MembersTransactionDetails
|
|||
|
WHERE MemberID = @memberid AND FundTypeID = @fundtype AND TranDate< @trandate; ";
|
|||
|
|
|||
|
SqlCommand cmd = new SqlCommand();
|
|||
|
cmd.CommandText = commandText;
|
|||
|
cmd.Connection = connection;
|
|||
|
|
|||
|
|
|||
|
//cmd.Parameters.Add("memberid", SqlDbType.Int);
|
|||
|
//cmd.Parameters["memberid"].Value = memberID;
|
|||
|
|
|||
|
//cmd.Parameters.Add("fundtype", SqlDbType.Int);
|
|||
|
//cmd.Parameters["fundtype"].Value = fundType;
|
|||
|
|
|||
|
//cmd.Parameters.Add("trandate", SqlDbType.DateTime);
|
|||
|
//cmd.Parameters["trandate"].Value = PayrollGlobalFunctions.PayrollFirstDateOfMonth(FromDate);
|
|||
|
|
|||
|
cmd.Parameters.AddWithValue("@memberid", memberID);
|
|||
|
cmd.Parameters.AddWithValue("@fundtype", fundType);
|
|||
|
cmd.Parameters.AddWithValue("@trandate", PayrollGlobalFunctions.PayrollFirstDateOfMonth(FromDate));
|
|||
|
|
|||
|
|
|||
|
cmd.Connection = connection;
|
|||
|
|
|||
|
ob = cmd.ExecuteScalar();
|
|||
|
cmd.Dispose();
|
|||
|
connection.Close();
|
|||
|
|
|||
|
if (ob != DBNull.Value && ob != null)
|
|||
|
{
|
|||
|
amount = Convert.ToDouble(ob);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return amount;
|
|||
|
}
|
|||
|
|
|||
|
internal static double GetSettledInterest(TransactionContext tc, int memberID)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
sql = SQLParser.MakeSQL(@"select SUM(Amount)as OpeningBalance from dbo.MembersTransactionDetails
|
|||
|
where MemberID = %n and TranTypeID (%n, %n)", memberID,
|
|||
|
EnumMemberTranType.Settlement_Interest_Employee_Provident_Fund, EnumMemberTranType.Settlement_Interest_Company_Provident_Fund);
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
|
|||
|
double amount = 0;
|
|||
|
if (ob != DBNull.Value)
|
|||
|
{
|
|||
|
amount = Convert.ToDouble(ob);
|
|||
|
}
|
|||
|
|
|||
|
return amount;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetOpeningBalance(TransactionContext tc, string memberID, int fundType,
|
|||
|
DateTime FromDate)
|
|||
|
{
|
|||
|
DataSet oOpeningBalance = new DataSet();
|
|||
|
string sSQL = SQLParser.MakeSQL(
|
|||
|
@"select memD.MemberID,mem.EmpCode,mem.Name,SUM(memD.Amount)as OpeningBalance from dbo.MemberDetail mem
|
|||
|
inner join dbo.MembersTransactionDetails memD on mem.MemberID = memD.MemberID
|
|||
|
where mem.MemberID in(%q) and memD.FundTypeID = %n And memD.TranDate < %d
|
|||
|
Group by memD.MemberID,mem.EmpCode,mem.Name order by memD.MemberID",
|
|||
|
memberID, fundType, PayrollGlobalFunctions.PayrollFirstDateOfMonth(FromDate));
|
|||
|
|
|||
|
oOpeningBalance = tc.ExecuteDataSet(sSQL);
|
|||
|
return oOpeningBalance;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetMembersYearlyBalance(TransactionContext tc, DateTime FromDate, DateTime ToDate)
|
|||
|
{
|
|||
|
DataSet rootDataset = new DataSet();
|
|||
|
DataSet tempdataset = new DataSet();
|
|||
|
try
|
|||
|
{
|
|||
|
string opeEPFInterest = Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest)
|
|||
|
+ "," + Convert.ToString((int)EnumMemberTranType.Settlement_Interest_Employee_Provident_Fund);
|
|||
|
string opeCPFInterest = Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest)
|
|||
|
+ "," + Convert.ToString((int)EnumMemberTranType.Settlement_Interest_Company_Provident_Fund);
|
|||
|
string opeEPFQuery = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string OpeCPFQuery = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
string sSQLOpe = SQLParser.MakeSQL(
|
|||
|
@"Select aa.MemberID,(aa.EPF - aa.EPFWithdrawal) EPF,(aa.CPF - aa.CPFWithdrawal) CPF From
|
|||
|
(Select memTran.MemberID,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId in (%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFWithdrawal
|
|||
|
from MembersTransactionDetails memTran
|
|||
|
inner join MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
WHERE memTran.TranDate < %d
|
|||
|
group by memTran.MemberID,md.EmpCode)aa order by aa.MemberID",
|
|||
|
(int)EnumFundType.PF_EPF, opeEPFQuery, FromDate, (int)EnumFundType.PF_CPF, OpeCPFQuery, FromDate,
|
|||
|
(int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund, FromDate,
|
|||
|
(int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund, FromDate, FromDate);
|
|||
|
|
|||
|
tempdataset = tc.ExecuteDataSet(sSQLOpe);
|
|||
|
tempdataset.Tables[0].TableName = "OpeningBalance";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
string OpeEPFInterestQuery = SQLParser.MakeSQL(
|
|||
|
@"Select aa.MemberID,(aa.EPFINTEREST - aa.EPFInterestWithdrawal) EPFINTEREST,(aa.CPFINTEREST - aa.CPFInterestWithdrawal) CPFINTEREST From
|
|||
|
(Select memTran.MemberID,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in(%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in(%q) and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFInterestWithdrawal
|
|||
|
from MembersTransactionDetails memTran
|
|||
|
inner join MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
WHERE memTran.TranDate < %d
|
|||
|
group by memTran.MemberID,md.EmpCode )aa order by aa.MemberID",
|
|||
|
(int)EnumFundType.PF_EPF, opeEPFInterest, FromDate, (int)EnumFundType.PF_CPF, opeCPFInterest,
|
|||
|
FromDate, (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest, FromDate, (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest, FromDate, FromDate);
|
|||
|
|
|||
|
tempdataset = tc.ExecuteDataSet(OpeEPFInterestQuery);
|
|||
|
tempdataset.Tables[0].TableName = "OpeningBalanceInterest";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
string sqlCurEPF = SQLParser.MakeSQL(@"Select memTran.MemberID,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID in (%q) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID in (%q) AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurCPF
|
|||
|
from MembersTransactionDetails memTran
|
|||
|
inner join MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
WHERE memTran.TranDate between %d and %d
|
|||
|
group by memTran.MemberID,md.EmpCode order by md.EmpCode",
|
|||
|
(int)EnumFundType.PF_EPF, opeEPFQuery, FromDate, ToDate, (int)EnumFundType.PF_CPF, OpeCPFQuery,
|
|||
|
FromDate, ToDate, FromDate, ToDate);
|
|||
|
|
|||
|
tempdataset = tc.ExecuteDataSet(sqlCurEPF);
|
|||
|
tempdataset.Tables[0].TableName = "CurBalanceEPF";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
string sqlCurInterest = SQLParser.MakeSQL(@"Select memTran.MemberID,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in(%q) and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in(%q) and memTran.TranDate between %d And %d THEN memTran.Amount ELSE 0 END) AS CurCPFINTEREST
|
|||
|
from MembersTransactionDetails memTran
|
|||
|
inner join MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
WHERE memTran.TranDate between %d and %d
|
|||
|
group by memTran.MemberID,md.EmpCode order by md.EmpCode",
|
|||
|
(int)EnumFundType.PF_EPF, opeEPFInterest, FromDate, ToDate, (int)EnumFundType.PF_CPF,
|
|||
|
opeCPFInterest, FromDate, ToDate
|
|||
|
, FromDate, ToDate);
|
|||
|
|
|||
|
tempdataset = tc.ExecuteDataSet(sqlCurInterest);
|
|||
|
tempdataset.Tables[0].TableName = "CurBalanceInterest";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
// string sqlOpeningWithdrawal = SQLParser.MakeSQL(@"Select memTran.MemberID,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFWithdrawal,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFWithdrawal
|
|||
|
// from MembersTransactionDetails memTran
|
|||
|
// inner join dbo.MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
// group by memTran.MemberID,md.EmpCode order by md.EmpCode",
|
|||
|
// (int)EnumFundType.PF_EPF, (int)EnumMemberTranType.WithdrawlOfEPF, FromDate, (int)EnumFundType.PF_CPF, (int)EnumMemberTranType.WithdrawlOfCPF, FromDate);
|
|||
|
|
|||
|
// tempdataset = tc.ExecuteDataSet(sqlOpeningWithdrawal);
|
|||
|
// tempdataset.Tables[0].TableName = "BalancePFWithdrawal";
|
|||
|
// rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
string sqlCurPFWithdrawal = SQLParser.MakeSQL(@"Select memTran.MemberID,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurCPFWithdrawal
|
|||
|
from MembersTransactionDetails memTran
|
|||
|
inner join MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
WHERE memTran.TranDate between %d and %d
|
|||
|
group by memTran.MemberID,md.EmpCode order by md.EmpCode",
|
|||
|
(int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund, FromDate, ToDate,
|
|||
|
(int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund, FromDate, ToDate, FromDate, ToDate);
|
|||
|
|
|||
|
tempdataset = tc.ExecuteDataSet(sqlCurPFWithdrawal);
|
|||
|
tempdataset.Tables[0].TableName = "CurBalanceWithdrawal";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
// string sqlOpeningInterestWithdrawal = SQLParser.MakeSQL(@"Select memTran.MemberID,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS EPFInterestWithdrawal,
|
|||
|
// SUM(CASE WHEN memTran.FundTypeId = %n and memTran.TranTypeId = %n and memTran.TranDate < %d THEN memTran.Amount ELSE 0 END) AS CPFInterestWithdrawal
|
|||
|
// from MembersTransactionDetails memTran
|
|||
|
// inner join dbo.MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
// group by memTran.MemberID,md.EmpCode order by md.EmpCode",(int)EnumFundType.PF_EPF,
|
|||
|
// (int)EnumMemberTranType.WithdrawlOfEPFInterest, FromDate, (int)EnumFundType.PF_CPF,
|
|||
|
// (int)EnumMemberTranType.WithdrawlOfCPFInterest, FromDate);
|
|||
|
|
|||
|
// tempdataset = tc.ExecuteDataSet(sqlOpeningInterestWithdrawal);
|
|||
|
// tempdataset.Tables[0].TableName = "OpeningInterestBalanceWithdrawal";
|
|||
|
// rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
|
|||
|
string sqlcurpfInterestWithdrawal = SQLParser.MakeSQL(@"Select memTran.MemberID,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurEPFInterestWithdrawal,
|
|||
|
SUM(CASE WHEN memTran.FundTypeID = %n AND memTran.TranTypeID = %n AND memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) AS CurCPFInterestWithdrawal
|
|||
|
from MembersTransactionDetails memTran
|
|||
|
inner join MemberDetail md on memTran.MemberID = md.MemberID
|
|||
|
WHERE memTran.TranDate between %d and %d
|
|||
|
group by memTran.MemberID,md.EmpCode order by md.EmpCode", (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest,
|
|||
|
FromDate, ToDate, (int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest,
|
|||
|
FromDate, ToDate
|
|||
|
, FromDate, ToDate);
|
|||
|
|
|||
|
tempdataset = tc.ExecuteDataSet(sqlcurpfInterestWithdrawal);
|
|||
|
tempdataset.Tables[0].TableName = "curpfInterestBalanceWithdrawal";
|
|||
|
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return rootDataset;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetTranAmountForCalculate(TransactionContext tc, int memberID, DateTime dtYearEnd)
|
|||
|
{
|
|||
|
DataSet oBonusPaySlip = new DataSet();
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
|
|||
|
string sSQL = SQLParser.MakeSQL(@"Select sum(Amount) TranAmount,TranDate from MembersTransactionDetails
|
|||
|
where TranDate > %d And MemberID = %n And TranTypeID in(%q)
|
|||
|
group by TranDate ", dtYearEnd, memberID, tranTypeOpeE);
|
|||
|
|
|||
|
oBonusPaySlip = tc.ExecuteDataSet(sSQL);
|
|||
|
return oBonusPaySlip;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetTranAmountForCalculate(TransactionContext tc, int memberID, DateTime dtYearEnd,
|
|||
|
DateTime dtMonthEnd)
|
|||
|
{
|
|||
|
DataSet oBonusPaySlip = new DataSet();
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
|
|||
|
string sSQL = SQLParser.MakeSQL(@"Select sum(Amount) TranAmount,TranDate from MembersTransactionDetails
|
|||
|
where TranDate Between %d And %d And MemberID = %n And TranTypeID in(%q)
|
|||
|
group by TranDate ", dtYearEnd, dtMonthEnd, memberID, tranTypeOpeE);
|
|||
|
|
|||
|
oBonusPaySlip = tc.ExecuteDataSet(sSQL);
|
|||
|
return oBonusPaySlip;
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetSettledInterest(TransactionContext tc, DateTime Trandate, string tranType,
|
|||
|
int memberID)
|
|||
|
{
|
|||
|
string sqlString = string.Empty;
|
|||
|
sqlString = SQLParser.MakeSQL(
|
|||
|
"SELECT * FROM MembersTransactionDetails WHERE TranDate = %d AND TranTypeID in(%q) AND MemberID = %n ",
|
|||
|
Trandate, tranType, memberID);
|
|||
|
return tc.ExecuteReader(sqlString);
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetIndividualPFBalance(TransactionContext tc, DateTime Fromdate, DateTime dtYearEnd,
|
|||
|
DateTime tillDate, string sEmpID)
|
|||
|
{
|
|||
|
DateTime dtFrom = PayrollGlobalFunctions.PayrollFirstDateOfMonth(dtYearEnd.AddMonths(1));
|
|||
|
DataSet oIndividualPFBalance = new DataSet();
|
|||
|
string tranTypeOpeE = Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund);
|
|||
|
string trantypeOpeC = Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund);
|
|||
|
Fromdate = PayrollGlobalFunctions.PayrollFirstDateOfMonth(Fromdate);
|
|||
|
string sSQL = SQLParser.MakeSQL(
|
|||
|
@"SELECT mem.EmpCode,mem.Name,memTran.memberID ,mem.CurrentDesig,mem.DOJ,Max(memTran.TranDate)as Trandate,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) EPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId in (%q) and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) CPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) EPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) CPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) CurEPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) CurCPF,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) CurEPFINTEREST,
|
|||
|
SUM(CASE WHEN memTran.FundTypeId= %n and memTran.TranTypeId =%n and memTran.TranDate between %d and %d THEN memTran.Amount ELSE 0 END) CurCPFINTEREST
|
|||
|
from MemberDetail mem
|
|||
|
inner join MembersTransactionDetails memTran on mem.MemberID = memTran.MemberID
|
|||
|
where memTran.MemberID in(%q)
|
|||
|
group by memTran.MemberID,mem.EmpCode,mem.Name,mem.CurrentDesig,mem.DOJ
|
|||
|
order by memTran.MemberID", (int)EnumFundType.PF_EPF, tranTypeOpeE, Fromdate, dtYearEnd,
|
|||
|
(int)EnumFundType.PF_CPF, trantypeOpeC, Fromdate, dtYearEnd, (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest, Fromdate, dtYearEnd, (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest,
|
|||
|
Fromdate, dtYearEnd, (int)EnumFundType.PF_EPF, (int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund, dtFrom,
|
|||
|
tillDate, (int)EnumFundType.PF_CPF,
|
|||
|
(int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund, dtFrom, tillDate, (int)EnumFundType.PF_EPF,
|
|||
|
(int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest,
|
|||
|
dtFrom, tillDate, (int)EnumFundType.PF_CPF, (int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest, dtFrom,
|
|||
|
tillDate, sEmpID);
|
|||
|
|
|||
|
oIndividualPFBalance = tc.ExecuteDataSet(sSQL);
|
|||
|
return oIndividualPFBalance;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetFunds(TransactionContext tc, int MembersID)
|
|||
|
{
|
|||
|
string ssql = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest);
|
|||
|
string sSQL =
|
|||
|
SQLParser.MakeSQL("SELECT * FROM MembersTransactionDetails WHERE MemberID=%n And TranTypeID in(%q)",
|
|||
|
MembersID, ssql);
|
|||
|
DataSet ds = tc.ExecuteDataSet(sSQL);
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetMemberContribution2(TransactionContext tc, int memberID, string Date)
|
|||
|
{
|
|||
|
DataSet oIndividualPFBalance = new DataSet();
|
|||
|
|
|||
|
string sEpf = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund);
|
|||
|
string sCpf = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund);
|
|||
|
string sEpfInterest = Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest)
|
|||
|
+ "," + Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType
|
|||
|
.Settlement_Interest_Employee_Provident_Fund));
|
|||
|
string sCpfInterest = Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest)
|
|||
|
+ "," + Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType
|
|||
|
.Settlement_Interest_Company_Provident_Fund));
|
|||
|
|
|||
|
string sSQL = SQLParser.MakeSQL(@"SELECT
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) %q THEN Amount ELSE 0 END) AS EPF,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) %q THEN Amount ELSE 0 END) AS CPF,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) %q THEN Amount ELSE 0 END) AS EPFINTEREST,
|
|||
|
SUM(CASE WHEN FundTypeId= %n and TranTypeId in (%q) %q THEN Amount ELSE 0 END) AS CPFINTEREST
|
|||
|
from MembersTransactionDetails where MemberID=%n",
|
|||
|
(int)EnumFundType.PF_EPF, sEpf, Date, (int)EnumFundType.PF_CPF, sCpf, Date, (int)EnumFundType.PF_EPF,
|
|||
|
sEpfInterest,
|
|||
|
Date, (int)EnumFundType.PF_CPF, sCpfInterest, Date, memberID);
|
|||
|
|
|||
|
oIndividualPFBalance = tc.ExecuteDataSet(sSQL);
|
|||
|
return oIndividualPFBalance;
|
|||
|
}
|
|||
|
|
|||
|
internal static DateTime GetMonth(TransactionContext tc, int memberID)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
sql = SQLParser.MakeSQL(@"Select Max(TranDate)as TranDate from MembersTransactionDetails where MemberID=%n",
|
|||
|
memberID);
|
|||
|
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
DateTime dt = DateTime.MinValue;
|
|||
|
if (ob != DBNull.Value)
|
|||
|
{
|
|||
|
dt = Convert.ToDateTime(ob);
|
|||
|
}
|
|||
|
|
|||
|
return dt;
|
|||
|
}
|
|||
|
|
|||
|
internal static double GetCurBalance(TransactionContext tc, int memberID, DateTime balanceMonth)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
string sBalance = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest);
|
|||
|
//+"," + Convert.ToString((int)EnumMemberTranType.Yearly_Actual_EPF_Interest) + "," + Convert.ToString((int)EnumMemberTranType.Yearly_Actual_CPF_Interest);
|
|||
|
|
|||
|
string sDeductBalance = Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Settlement_Interest_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Settlement_Interest_Company_Provident_Fund);
|
|||
|
|
|||
|
sql = SQLParser.MakeSQL(@"SELECT (Balance - DeductBalance)AS OpeningBalance from
|
|||
|
(select
|
|||
|
SUM(Case when TranTypeID in(%q) AND TranDate between %d And %d THEN Amount ELSE 0 End)as Balance ,
|
|||
|
SUM(CASE WHEN TranTypeID IN(%q) AND TranDate between %d And %d THEN Amount ELSE 0 End)AS DeductBalance
|
|||
|
from dbo.MembersTransactionDetails
|
|||
|
where MemberID = %n)AS tab1", sBalance,
|
|||
|
PayrollGlobalFunctions.PayrollFirstDateOfMonth(balanceMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(balanceMonth),
|
|||
|
sDeductBalance, PayrollGlobalFunctions.PayrollFirstDateOfMonth(balanceMonth),
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(balanceMonth),
|
|||
|
memberID);
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
|
|||
|
double amount = 0;
|
|||
|
if (ob != DBNull.Value)
|
|||
|
{
|
|||
|
amount = Convert.ToDouble(ob);
|
|||
|
}
|
|||
|
|
|||
|
return amount;
|
|||
|
}
|
|||
|
|
|||
|
internal static double GetOpeningBalance(TransactionContext tc, int memberID, DateTime balanceMonth)
|
|||
|
{
|
|||
|
string sql = string.Empty;
|
|||
|
string sBalance = Convert.ToString((int)EnumMemberTranType.Contribution_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Contribution_Of_Company_Provident_Fund) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Opening_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Company_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Opening_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Opening_Actual_Company_Provident_Fund_Interest) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Yearly_Actual_Company_Provident_Fund_Interest);
|
|||
|
|
|||
|
string sDeductBalance = Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Employee_Provident_Fund_Interest) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Withdrawl_Of_Company_Provident_Fund_Interest) +
|
|||
|
"," + Convert.ToString((int)EnumMemberTranType.Settlement_Interest_Employee_Provident_Fund) + "," +
|
|||
|
Convert.ToString((int)EnumMemberTranType.Settlement_Interest_Company_Provident_Fund);
|
|||
|
|
|||
|
sql = SQLParser.MakeSQL(@"SELECT (Balance - DeductBalance)AS OpeningBalance from
|
|||
|
(select
|
|||
|
SUM(Case when TranTypeID in(%q) AND TranDate <=%d THEN Amount ELSE 0 End)as Balance ,
|
|||
|
SUM(CASE WHEN TranTypeID IN(%q) AND TranDate <=%d THEN Amount ELSE 0 End)AS DeductBalance
|
|||
|
from dbo.MembersTransactionDetails
|
|||
|
where MemberID = %n)AS tab1", sBalance,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(balanceMonth), sDeductBalance,
|
|||
|
PayrollGlobalFunctions.PayrollLastDateOfMonth(balanceMonth),
|
|||
|
memberID);
|
|||
|
object ob = tc.ExecuteScalar(sql);
|
|||
|
|
|||
|
double amount = 0;
|
|||
|
if (ob != DBNull.Value)
|
|||
|
{
|
|||
|
amount = Convert.ToDouble(ob);
|
|||
|
}
|
|||
|
|
|||
|
return amount;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|