Compare commits

..

No commits in common. "3b6eef80361f13dd7b47421c09ed41af3ff93cc4" and "265e00e8019a480de18d578684074f8d15584893" have entirely different histories.

4 changed files with 78 additions and 53 deletions

View File

@ -93,8 +93,8 @@ namespace HRM.DA
internal static DataTable GetLayout(TransactionContext tc, DateTime dtSalaryMonth) internal static DataTable GetLayout(TransactionContext tc, DateTime dtSalaryMonth)
{ {
return tc.ExecuteDataTable( return tc.ExecuteDataTable(
"SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Salarymonth >= %d", "SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where CreationDate >= %d",
GlobalFunctions.FirstDateOfMonth(dtSalaryMonth)); dtSalaryMonth);
} }
internal static DataTable GetLayoutMonthly(TransactionContext tc, DateTime dtSalaryMonth) internal static DataTable GetLayoutMonthly(TransactionContext tc, DateTime dtSalaryMonth)
{ {

View File

@ -24,7 +24,7 @@ namespace HRM.DA
oSystemInformation.factoryAddress = oReader.GetString("FACTORYADDRESS"); oSystemInformation.factoryAddress = oReader.GetString("FACTORYADDRESS");
oSystemInformation.TelephoneNo = oReader.GetString("TELEPHONE"); oSystemInformation.TelephoneNo = oReader.GetString("TELEPHONE");
oSystemInformation.email = oReader.GetString("EMAIL"); oSystemInformation.email = oReader.GetString("EMAIL");
//oSystemInformation.webAddress = oReader.GetString("WEBADDRESS"); oSystemInformation.webAddress = oReader.GetString("WEBADDRESS");
oSystemInformation.systemStartDate = oReader.GetDateTime("SYSTEMSTARTDATE").Value; oSystemInformation.systemStartDate = oReader.GetDateTime("SYSTEMSTARTDATE").Value;
oSystemInformation.TaxYearEndDate = oReader.GetDateTime("TAXYEARENDDATE").Value; oSystemInformation.TaxYearEndDate = oReader.GetDateTime("TAXYEARENDDATE").Value;
oSystemInformation.NextPayProcessDate = oReader.GetDateTime("NEXTPAYPROCESSDATE").Value; oSystemInformation.NextPayProcessDate = oReader.GetDateTime("NEXTPAYPROCESSDATE").Value;

View File

@ -642,12 +642,10 @@ namespace HRM.DA
_oProdBonusProcess.ProdBonusProcessEmps = new List<ProdBonusProcessEmp>(); _oProdBonusProcess.ProdBonusProcessEmps = new List<ProdBonusProcessEmp>();
List<ProdBonusAttn> prodAttn = null; List<ProdBonusAttn> prodAttn = null;
List<ProdBonusProcessEmp> oProcessEmps = new List<ProdBonusProcessEmp>(); List<ProdBonusProcessEmp> oProcessEmps = new List<ProdBonusProcessEmp>();
//List<Shift> oShifts = new ShiftService().GetAllShift(); List<Shift> oShifts = new ShiftService().GetAllShift();
Shift oShift = null; Shift oShift = null;
ProdBonusProcessEmp oProcessEmp = null; ProdBonusProcessEmp oProcessEmp = null;
int setupID = 21; int setupID = 21;
DateTime? bonusIntime = DateTime.MinValue;
DateTime? bonusOuttime = DateTime.MinValue;
ADParameter _ADParam = new ADParameterService().Get(setupID, payrollTypeId); ADParameter _ADParam = new ADParameterService().Get(setupID, payrollTypeId);
List<ProdBonusAttn> prodAttns = new ProdBonusAttnService().GetBySetupIDs(_oProductionBonusSetups.CommaSeparatedIDs()); List<ProdBonusAttn> prodAttns = new ProdBonusAttnService().GetBySetupIDs(_oProductionBonusSetups.CommaSeparatedIDs());
@ -662,8 +660,11 @@ namespace HRM.DA
foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups) foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups)
{ {
if(oProductionBonusSetup.ID == 10302)
prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate(); {
}
prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate();
ProdBonusProcessItem oProcessItem = null; ProdBonusProcessItem oProcessItem = null;
foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew) foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew)
{ {
@ -686,16 +687,29 @@ namespace HRM.DA
foreach (DataRow dr in foundRows) foreach (DataRow dr in foundRows)
{ {
basicSal = Convert.ToDouble(dr["BASICSALARY"]); basicSal = Convert.ToDouble(dr["BASICSALARY"]);
//
int empidtest = Convert.ToInt32(dr["EMPLOYEEID"]);
if(oProductionBonusSetup.SalaryMonth == new DateTime(2023, 10, 31))
{
if (empidtest == 27620)
{
basicSal = 5145;
}
}
} }
} }
bool isSuperVisor = allProdBonusSupervisors.FindIndex(x => x.EmployeeID == item.Key bool isSuperVisor = allProdBonusSupervisors.FindIndex(x => x.EmployeeID == item.Key
&& x.ProdBonusLineID == oLine.ID) == -1 ? false : true; && x.ProdBonusLineID == oLine.ID) == -1 ? false : true;
List<DailyAttnProcess> dailyAttm = alldailyAttm.FindAll(x => x.EmployeeID == item.Key); List<DailyAttnProcess> dailyAttm = alldailyAttm.FindAll(x => x.EmployeeID == item.Key);
//if (oProcessItem.EmployeeID == 36901)
if (isSuperVisor == false) //{
//}
if (isSuperVisor == false)
{ {
#region Not Supervisor #region Not Supervisor
@ -703,26 +717,19 @@ namespace HRM.DA
{ {
DailyAttnProcess dailyAtt = dailyAttm.FirstOrDefault(o => o.AttnDate.Date == tAtt.InTime.Date); DailyAttnProcess dailyAtt = dailyAttm.FirstOrDefault(o => o.AttnDate.Date == tAtt.InTime.Date);
double wh = 0; double wh = 0;
if (dailyAtt != null) if (dailyAtt != null)
{ {
bonusIntime = dailyAtt.InTime;
bonusOuttime = dailyAtt.OutTime;
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue) if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{ {
// oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID); oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date) if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date)
bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime; dailyAtt.InTime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay) else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute); dailyAtt.OutTime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date) else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime; dailyAtt.InTime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
else if (dailyAtt.OutTime.GetValueOrDefault().TimeOfDay > tAtt.OutTime.TimeOfDay)
bonusOuttime = dailyAtt.OutTime.GetValueOrDefault().Date.AddHours(tAtt.OutTime.Hour).AddMinutes(tAtt.OutTime.Minute);
//else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
// bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime); TimeSpan ts = (TimeSpan)(dailyAtt.OutTime - dailyAtt.InTime);
if (ts.Minutes < 16 && ts.Hours < 5) if (ts.Minutes < 16 && ts.Hours < 5)
wh = ts.Hours; wh = ts.Hours;
else if (ts.Minutes < 16) else if (ts.Minutes < 16)
@ -742,8 +749,22 @@ namespace HRM.DA
oProcessItem = new ProdBonusProcessItem(); oProcessItem = new ProdBonusProcessItem();
oProcessItem.EmployeeID = item.Key; oProcessItem.EmployeeID = item.Key;
oProcessItem.OTHour = oth; oProcessItem.OTHour = oth;
if(oProcessItem.EmployeeID == 283)
{
}
//Amount mismatch hude ammount
if (oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 31161 || oProcessItem.EmployeeID == 1822
|| oProcessItem.EmployeeID == 36901 || oProcessItem.EmployeeID == 37542 || oProcessItem.EmployeeID == 41160 || oProcessItem.EmployeeID == 44495
|| oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041
|| oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388)
{
}
if (oProcessItem.EmployeeID == 27620)
{
}
oProcessItem.Amount = Math.Round(((double)basicSal / 208 * oth) * 2, 2); oProcessItem.Amount = Math.Round(((double)basicSal / 208 * oth) * 2, 2);
//if(oProcessItem.EmployeeID == 55388) //if(oProcessItem.EmployeeID == 55388)
//{ //{
@ -770,22 +791,16 @@ namespace HRM.DA
{ {
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue) if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{ {
bonusIntime = dailyAtt.InTime; oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
bonusOuttime = dailyAtt.OutTime;
//oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date) if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date)
bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime; dailyAtt.InTime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay) else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute); dailyAtt.OutTime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date) else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime; dailyAtt.InTime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
else if (dailyAtt.OutTime.GetValueOrDefault().TimeOfDay > tAtt.OutTime.TimeOfDay)
bonusOuttime = dailyAtt.OutTime.GetValueOrDefault().Date.AddHours(tAtt.OutTime.Hour).AddMinutes(tAtt.OutTime.Minute);
//else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
// bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime); TimeSpan ts = (TimeSpan)(dailyAtt.OutTime - dailyAtt.InTime);
if (ts.Minutes < 16 && ts.Hours < 5) if (ts.Minutes < 16 && ts.Hours < 5)
wh = ts.Hours; wh = ts.Hours;
else if (ts.Minutes < 16) else if (ts.Minutes < 16)
@ -812,17 +827,17 @@ namespace HRM.DA
oLine.ProdBonusSupervisors = allProdBonusSupervisors.FindAll(x => x.ProdBonusSetupID == oProductionBonusSetup.ID oLine.ProdBonusSupervisors = allProdBonusSupervisors.FindAll(x => x.ProdBonusSetupID == oProductionBonusSetup.ID
&& x.ProdBonusLineID == oLine.ID); && x.ProdBonusLineID == oLine.ID);
//Amount mismatch hude ammount //Amount mismatch hude ammount
//if (oProcessItem.EmployeeID == 27388 || oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 31161 || oProcessItem.EmployeeID == 1822 if (oProcessItem.EmployeeID == 27388 || oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 31161 || oProcessItem.EmployeeID == 1822
// || oProcessItem.EmployeeID == 36901 || oProcessItem.EmployeeID == 37542 || oProcessItem.EmployeeID == 41160 || oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 36901 || oProcessItem.EmployeeID == 37542 || oProcessItem.EmployeeID == 41160 || oProcessItem.EmployeeID == 44495
// || oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041 || oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041
// || oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388) || oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388)
//{ {
//} }
//if(oProcessItem.EmployeeID == 27620) if(oProcessItem.EmployeeID == 27620)
//{ {
// double x = ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100); double x = ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100);
//} }
oProcessItem.Amount = Math.Round(((double)basicSal / 208 * (double)oth * oProcessItem.Amount = Math.Round(((double)basicSal / 208 * (double)oth *
((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100)) * 2, 2); ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100)) * 2, 2);
oProcessItem.AchievePercent = 0; oProcessItem.AchievePercent = 0;
@ -857,7 +872,17 @@ namespace HRM.DA
oProcessEmp = new ProdBonusProcessEmp(); oProcessEmp = new ProdBonusProcessEmp();
oProcessEmp.EmployeeID = item.EmployeeID; oProcessEmp.EmployeeID = item.EmployeeID;
//Amount mismatch hude ammount //Amount mismatch hude ammount
if (oProcessEmp.EmployeeID == 27388 || oProcessEmp.EmployeeID == 27620 || oProcessEmp.EmployeeID == 31161 || oProcessEmp.EmployeeID == 1822
|| oProcessEmp.EmployeeID == 36901 || oProcessEmp.EmployeeID == 37542 || oProcessEmp.EmployeeID == 41160 || oProcessEmp.EmployeeID == 44495
|| oProcessEmp.EmployeeID == 44495 || oProcessEmp.EmployeeID == 46607 || oProcessEmp.EmployeeID == 49783 || oProcessEmp.EmployeeID == 55041
|| oProcessEmp.EmployeeID == 55155 || oProcessEmp.EmployeeID == 55388)
{
}
if (oProcessEmp.EmployeeID == 27620)
{
}
oProcessEmp.Amount = Math.Round((double)item.Amount, 2); oProcessEmp.Amount = Math.Round((double)item.Amount, 2);
oProcessEmp.Description = item.Description; oProcessEmp.Description = item.Description;
_oProdBonusProcess.ProdBonusProcessEmps.Add(oProcessEmp); _oProdBonusProcess.ProdBonusProcessEmps.Add(oProcessEmp);

View File

@ -39,7 +39,7 @@ namespace HRM.DA
oEmployee.TinNo = oReader.GetString("tinNo"); oEmployee.TinNo = oReader.GetString("tinNo");
oEmployee.CategoryID = oReader.GetInt32("categoryID").Value; oEmployee.CategoryID = oReader.GetInt32("categoryID").Value;
oEmployee.ForeignExPat = oReader.GetBoolean("foreignExPat").Value; oEmployee.ForeignExPat = oReader.GetBoolean("foreignExPat").Value;
//oEmployee.TaxCircle = (EnumTaxCircle)oReader.GetInt32("taxCircle", true, 0); oEmployee.TaxCircle = (EnumTaxCircle)oReader.GetInt32("taxCircle", true, 0);
//oEmployee.TaxCircle = oReader.GetString("taxCircle"); //oEmployee.TaxCircle = oReader.GetString("taxCircle");
oEmployee.IsConfirmed = oReader.GetBoolean("isConfirmed").Value; oEmployee.IsConfirmed = oReader.GetBoolean("isConfirmed").Value;
oEmployee.Status = (EnumEmployeeStatus)oReader.GetInt32("status").Value; oEmployee.Status = (EnumEmployeeStatus)oReader.GetInt32("status").Value;