128 lines
4.8 KiB
C#
128 lines
4.8 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
#region FSTranDetailDA
|
|||
|
|
|||
|
internal class FSTranDetailDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private FSTranDetailDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, FSTranDetail item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO FSTranDetail(FSTranDetailID, ChangeTaxAmount, AmountType, ChangedValue, Description, FsTranType, ItemCode, ItemID,Remarks,Side,CreatedBy,CreationDate,TranID)" +
|
|||
|
" VALUES(%n, %n, %n, %n, %s, %n, %n, %n, %s, %n,%n,%d, %n)", item.ID, item.Amount, (int)item.AmountType,
|
|||
|
item.ChangedValue, item.Description, (int)item.FsTranType, (int)item.ItemCode, item.ItemID,
|
|||
|
item.Remarks, (int)item.Side, item.CreatedBy, item.CreatedDate, item.TranID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, FSTranDetail item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE FSTranDetail SET Amount=%n, AmountType=%b, ChangedValue=%n, Description=%s, FsTranType=%b, ItemCode=%b, ItemID=%n,Remarks=%s,Side=%b,TranID=%n" +
|
|||
|
"WHERE FSTranDetailID=%n", item.Amount, item.AmountType, item.ChangedValue, item.Description,
|
|||
|
item.FsTranType, item.ItemCode, item.ItemID, item.Remarks, item.Side, item.TranID, item.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail Order By FSTranDetailID");
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetGratuity(TransactionContext tc, int employeeID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT FSTranDetail.* FROM FSTranDetail INNER JOIN FSTran ON FSTran.FSTranID = FSTranDetail.TranID WHERE FSTranDetail.ItemCode = 3 AND FSTranDetail.ItemID = 3 AND EmployeeID = %n", employeeID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetFinalSettlement(TransactionContext tc, int employeeID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT FSTranDetail.* FROM FSTranDetail INNER JOIN FSTran ON FSTran.FSTranID = FSTranDetail.TranID WHERE FSTranDetail.ItemCode = 1 AND ItemID = 1 AND amounttype = 1 AND EmployeeID = %n", employeeID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|||
|
{
|
|||
|
if (EnumStatus.Active == status)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail where Status=%n order by FSTranDetailID", status);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail order by FSTranDetailID");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetDetailAmountType(TransactionContext tc, int nTranID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail Where TranID = %n order by FsTranType,ItemCode,ItemID,AmountType", nTranID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetDetail(TransactionContext tc, int nTranID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail Where TranID=%n order by ItemCode,ItemID", nTranID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetDetail(TransactionContext tc, DateTime fromDate, DateTime toDate)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail d, FSTran f" +
|
|||
|
" Where f.FSTranID= d.TranID and f.SettlementDate Between %d and %d order by ItemCode,ItemID",
|
|||
|
fromDate, toDate);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetDetail(TransactionContext tc, string nTranIDs)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail d, FSTran f" +
|
|||
|
" Where f.FSTranID in (%q) order by ItemCode,ItemID", nTranIDs);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetDetailByEmp(TransactionContext tc, int nEmpID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM FSTranDetail Where TranID in(select FSTranID from FSTran where employeeid=%n)", nEmpID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FSTranDetail Where FSTranDetailID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM FSTranDetail Where TranID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
internal static void DeleteByUserId(TransactionContext tc, int tranId, int userId)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM FSTranDetail Where TranID=%n and CreatedBy=%n", tranId,userId);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|