Prod processs

This commit is contained in:
chapal 2024-10-15 11:15:16 +06:00
parent 1d58361f02
commit 7884bbdd46

View File

@ -646,6 +646,8 @@ namespace HRM.DA
Shift oShift = null;
ProdBonusProcessEmp oProcessEmp = null;
int setupID = 21;
DateTime? bonusIntime = DateTime.MinValue;
DateTime? bonusOuttime = DateTime.MinValue;
ADParameter _ADParam = new ADParameterService().Get(setupID, payrollTypeId);
List<ProdBonusAttn> prodAttns = new ProdBonusAttnService().GetBySetupIDs(_oProductionBonusSetups.CommaSeparatedIDs());
@ -660,10 +662,7 @@ namespace HRM.DA
foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups)
{
if(oProductionBonusSetup.ID == 10302)
{
}
prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate();
ProdBonusProcessItem oProcessItem = null;
foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew)
@ -687,16 +686,6 @@ namespace HRM.DA
foreach (DataRow dr in foundRows)
{
basicSal = Convert.ToDouble(dr["BASICSALARY"]);
//
int empidtest = Convert.ToInt32(dr["EMPLOYEEID"]);
if(oProductionBonusSetup.SalaryMonth == new DateTime(2023, 10, 31))
{
if (empidtest == 27620)
{
basicSal = 5145;
}
}
}
}
@ -717,19 +706,22 @@ namespace HRM.DA
{
DailyAttnProcess dailyAtt = dailyAttm.FirstOrDefault(o => o.AttnDate.Date == tAtt.InTime.Date);
double wh = 0;
if (dailyAtt != null)
{
bonusIntime = dailyAtt.InTime;
bonusOuttime = dailyAtt.OutTime;
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{
oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.InTime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.OutTime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
dailyAtt.InTime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = (TimeSpan)(dailyAtt.OutTime - dailyAtt.InTime);
TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime);
if (ts.Minutes < 16 && ts.Hours < 5)
wh = ts.Hours;
else if (ts.Minutes < 16)
@ -749,22 +741,8 @@ namespace HRM.DA
oProcessItem = new ProdBonusProcessItem();
oProcessItem.EmployeeID = item.Key;
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);
//if(oProcessItem.EmployeeID == 55388)
//{
@ -791,14 +769,16 @@ namespace HRM.DA
{
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{
bonusIntime = dailyAtt.InTime;
bonusOuttime = dailyAtt.OutTime;
oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.InTime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.OutTime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
dailyAtt.InTime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = (TimeSpan)(dailyAtt.OutTime - dailyAtt.InTime);
if (ts.Minutes < 16 && ts.Hours < 5)