117 lines
6.7 KiB
C#
117 lines
6.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using Ease.CoreV35.DataAccess;
|
|
using Payroll.BO;
|
|
using Ease.CoreV35.Model;
|
|
|
|
namespace Payroll.Service
|
|
{
|
|
class ProdBonusProcessDA
|
|
{
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusProcessEmp");
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
internal static IDataReader GetProdBonusProcessEmp(TransactionContext tc,ID nID)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusProcessEmp Where ProdBonusProcessID = %n", nID.Integer);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
internal static IDataReader GetProdBonusProcessItem(TransactionContext tc, ID nID)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusProcessItem Where ProdBonusProcessID = %n", nID.Integer);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, DateTime dtSalaryMonth)
|
|
{
|
|
string sql = SQLParser.MakeSQL("select * from ProdBonusProcess where SalaryMonth=%d", dtSalaryMonth);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
internal static DataSet GetDetailItems(TransactionContext tc, DateTime dtSalaryMonth)
|
|
{
|
|
// string sql = SQLParser.MakeSQL(@"SELECT emp.EMPLOYEENO, pbl.LineName, pbpi.*
|
|
// FROM ProdBonusProcess pbp,ProdBonusProcessItem pbpi,ProdBonusLine pbl,Employee emp
|
|
// WHERE pbp.ProdBonusProcessID=pbpi.ProdBonusProcessID
|
|
// AND pbp.SalaryMonth=%d
|
|
// AND pbpi.ProdBonusLineID=pbl.ProdBonusLineID
|
|
// AND pbpi.EmployeeID=emp.EMPLOYEEID", dtSalaryMonth);
|
|
|
|
string sql = SQLParser.MakeSQL(@"SELECT emp.EMPLOYEENO, pbpe.*
|
|
FROM ProdBonusProcess pbp,ProdBonusProcessEmp pbpe
|
|
,Employee emp
|
|
WHERE pbp.ProdBonusProcessID=pbpe.ProdBonusProcessID
|
|
AND pbpe.EmployeeID=emp.EMPLOYEEID
|
|
AND pbp.SalaryMonth=%d", dtSalaryMonth);
|
|
return tc.ExecuteDataSet(sql);
|
|
}
|
|
internal static IDataReader GetByPMPYear(TransactionContext tc, ID nPmpyearID)
|
|
{
|
|
string sql = SQLParser.MakeSQL("select * from ProdBonusProcess where objectivecategoryid in(select objectivecategoryid from objectivecategory where pmpyearid=%n)", nPmpyearID.Integer);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, ID id)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusProcess WHERE ProdBonusProcessID = %n", id.Integer);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static void Save(TransactionContext tc, ProdBonusProcess item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Insert Into ProdBonusProcess(ProdBonusProcessID, SalaryMonth, ProcessDate) Values(%n, %d, %d)", item.ID.Integer, item.SalaryMonth, item.ProcessDate);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
internal static void SaveEmp(TransactionContext tc, ProdBonusProcessEmp item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Insert Into ProdBonusProcessEmp(ProdBonusProcessEmpID,ProdBonusProcessID,Description, EmployeeID, Amount) Values(%n,%n,%s, %n, %n)", item.ID.Integer, item.ProdBonusProcessID.Integer,item.Description, item.EmployeeID.Integer, item.Amount);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
internal static void SaveItem(TransactionContext tc, ProdBonusProcessItem item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Insert Into ProdBonusProcessItem(ProdBonusProcessItemID,ProdBonusProcessID, ProdBonusSetupID,ProdBonusLineID,EmployeeID, Amount,OTHour,AchievePercent,WorkingHour) Values(%n,%n, %n, %n,%n, %n,%n, %n,%n)", item.ID.Integer, item.ProdBonusProcessID.Integer, item.ProdBonusSetupID.Integer, item.ProdBonusLineID.Integer, item.EmployeeID.Integer, item.Amount, item.OTHour, item.AchievePercent, item.WorkingHour);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
internal static void Update(TransactionContext tc, ProdBonusProcess item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Update ProdBonusProcess Set SalaryMonth = %d, ProcessDate = %d Where ProdBonusProcessID = %n", item.SalaryMonth, item.ProcessDate, item.ID.Integer);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void Delete(TransactionContext tc, ID id)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Delete From ProdBonusProcess Where ProdBonusProcessID = %n", id.Integer);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
internal static void DeleteBySalaryMonth(TransactionContext tc, DateTime dSalaryMonth)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Delete From ProdBonusProcessItem Where ProdBonusProcessID =(select ProdBonusProcessID from ProdBonusProcess where Month(SalaryMonth)=%n AND Year(SalaryMonth)=%n)", dSalaryMonth.Month,dSalaryMonth.Year);
|
|
tc.ExecuteNonQuery(sql);
|
|
sql = SQLParser.MakeSQL("Delete From ProdBonusProcessEmp Where ProdBonusProcessID =(select ProdBonusProcessID from ProdBonusProcess where Month(SalaryMonth)=%n AND Year(SalaryMonth)=%n)", dSalaryMonth.Month, dSalaryMonth.Year);
|
|
tc.ExecuteNonQuery(sql);
|
|
sql = SQLParser.MakeSQL("Delete From ProdBonusProcess where Month(SalaryMonth)=%n AND Year(SalaryMonth)=%n", dSalaryMonth.Month, dSalaryMonth.Year);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static IDataReader GetProdBonusProcess(TransactionContext tc, ID iD)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusProcess WHERE ObjectiveCategoryID = %n", iD.Integer);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static IDataReader GetProdBonusEmp(TransactionContext tc, ID Id, DateTime salaryMonth)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT pbpe.*
|
|
FROM
|
|
ProdBonusProcess pbp,
|
|
ProdBonusProcessEmp pbpe
|
|
WHERE pbp.ProdBonusProcessID = pbpe.ProdBonusProcessID
|
|
AND pbp.SalaryMonth = %d
|
|
AND pbpe.EmployeeID = %n",salaryMonth.LastDateOfMonth(),Id.Integer);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
}
|
|
}
|