2024-10-14 10:01:49 +06:00
|
|
|
|
using HRM.BO;
|
|
|
|
|
using Ease.Core.DataAccess;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace HRM.DA
|
|
|
|
|
{
|
|
|
|
|
#region ProductionBonusSetupDA
|
|
|
|
|
|
|
|
|
|
internal class ProductionBonusSetupDA
|
|
|
|
|
{
|
|
|
|
|
#region Constructor
|
|
|
|
|
|
|
|
|
|
private ProductionBonusSetupDA()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Insert function
|
|
|
|
|
|
|
|
|
|
internal static void Insert(TransactionContext tc, ProductionBonusSetup item)
|
|
|
|
|
{
|
|
|
|
|
string sql = SQLParser.MakeSQL(
|
2024-11-19 14:47:45 +06:00
|
|
|
|
"INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent,BreakHour, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, MaxPerson, CreatedBy, CreationDate, Status,ProductionBonusType)" +
|
|
|
|
|
" VALUES(%n, %s, %n, %n,%n, %d, %s, %d, %d, %n, %n, %d, %n,%n)", item.ID, item.ProgramName, item.AchivedPercent, item.BreakHour, item.OTHour,
|
2024-10-29 14:51:13 +06:00
|
|
|
|
item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.MaxPerson, item.CreatedBy, item.CreatedDate,
|
2024-11-03 12:31:54 +06:00
|
|
|
|
item.Status, (int)item.ProductionBonusType);
|
2024-10-14 10:01:49 +06:00
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Update function
|
|
|
|
|
|
|
|
|
|
internal static void Update(TransactionContext tc, ProductionBonusSetup item)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery(
|
2024-11-19 14:47:45 +06:00
|
|
|
|
"UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n,BreakHour=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, MaxPerson=%n, Status=%n,ProductionBonusType=%n " +
|
|
|
|
|
" WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.BreakHour, item.OTHour, item.SalaryMonth, item.DesignNo,
|
2024-11-03 12:31:54 +06:00
|
|
|
|
item.FromDate, item.ToDate, item.MaxPerson, item.Status,(int)item.ProductionBonusType, item.ID);
|
2024-10-14 10:01:49 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Get Function
|
|
|
|
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc, DateTime dtSalaryMonth)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader(
|
|
|
|
|
"SELECT * FROM ProductionBonusSetup where Month(SalaryMonth)=%n AND Year(SalaryMonth)=%n",
|
|
|
|
|
dtSalaryMonth.Month, dtSalaryMonth.Year);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumBonusStatus status)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup Where Status=%n", status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc, string DesignNo)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE DesignNo=%s", DesignNo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IDataReader GetProductionBonusLine(TransactionContext tc, int id)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID=%n", id);
|
|
|
|
|
}
|
|
|
|
|
internal static IDataReader GetProductionBonusLine(TransactionContext tc, string ids)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID in (%q)", ids);
|
|
|
|
|
}
|
|
|
|
|
internal static IDataReader GetProdBonusWorkSchedules(TransactionContext tc, int id)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule WHERE ProdBonusSetupID=%n", id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IDataReader GetProdBonusParameters(TransactionContext tc, int id)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", id);
|
|
|
|
|
}
|
|
|
|
|
internal static DataTable GetLayout(TransactionContext tc, DateTime dtSalaryMonth)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteDataTable(
|
2024-10-14 16:49:56 +06:00
|
|
|
|
"SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Salarymonth >= %d",
|
|
|
|
|
GlobalFunctions.FirstDateOfMonth(dtSalaryMonth));
|
2024-10-14 10:01:49 +06:00
|
|
|
|
}
|
|
|
|
|
internal static DataTable GetLayoutMonthly(TransactionContext tc, DateTime dtSalaryMonth)
|
|
|
|
|
{
|
|
|
|
|
return tc.ExecuteDataTable(
|
|
|
|
|
"SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Month(SalaryMonth) = %n and YEAR(SalaryMonth) = %n",
|
|
|
|
|
dtSalaryMonth.Month, dtSalaryMonth.Year);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Delete function
|
|
|
|
|
|
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery("DELETE FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
internal static void DeleteAttn(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusSetupID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void DeleteSupervisor(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusSupervisor WHERE ProdBonusSetupID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void DeleteParameter(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void DeleteSchedule(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusWorkSchedule WHERE ProdBonusWorkScheduleID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void DeleteLine(TransactionContext tc, int nID)
|
|
|
|
|
{
|
|
|
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusLine WHERE ProdBonusLineID=%n", nID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|