From a4108e671d80282909e2f6893d93cdecac92252a Mon Sep 17 00:00:00 2001 From: chapal Date: Wed, 16 Oct 2024 09:10:26 +0600 Subject: [PATCH] Prod Process --- .../Service/Basic/SystemInformationService.cs | 2 +- .../Service/Bonus/ProdBonusProcessService.cs | 75 ++++++++++--------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/HRM.DA/Service/Basic/SystemInformationService.cs b/HRM.DA/Service/Basic/SystemInformationService.cs index e78adb7..5ddf171 100644 --- a/HRM.DA/Service/Basic/SystemInformationService.cs +++ b/HRM.DA/Service/Basic/SystemInformationService.cs @@ -24,7 +24,7 @@ namespace HRM.DA oSystemInformation.factoryAddress = oReader.GetString("FACTORYADDRESS"); oSystemInformation.TelephoneNo = oReader.GetString("TELEPHONE"); oSystemInformation.email = oReader.GetString("EMAIL"); - oSystemInformation.webAddress = oReader.GetString("WEBADDRESS"); + //oSystemInformation.webAddress = oReader.GetString("WEBADDRESS"); oSystemInformation.systemStartDate = oReader.GetDateTime("SYSTEMSTARTDATE").Value; oSystemInformation.TaxYearEndDate = oReader.GetDateTime("TAXYEARENDDATE").Value; oSystemInformation.NextPayProcessDate = oReader.GetDateTime("NEXTPAYPROCESSDATE").Value; diff --git a/HRM.DA/Service/Bonus/ProdBonusProcessService.cs b/HRM.DA/Service/Bonus/ProdBonusProcessService.cs index c345d41..c702e4a 100644 --- a/HRM.DA/Service/Bonus/ProdBonusProcessService.cs +++ b/HRM.DA/Service/Bonus/ProdBonusProcessService.cs @@ -642,7 +642,7 @@ namespace HRM.DA _oProdBonusProcess.ProdBonusProcessEmps = new List(); List prodAttn = null; List oProcessEmps = new List(); - List oShifts = new ShiftService().GetAllShift(); + //List oShifts = new ShiftService().GetAllShift(); Shift oShift = null; ProdBonusProcessEmp oProcessEmp = null; int setupID = 21; @@ -662,8 +662,13 @@ namespace HRM.DA foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups) { - - prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate(); + if (oProductionBonusSetup.DesignNo == "C 24 16-30 Sep P A-Com" || oProductionBonusSetup.DesignNo == "C 24 16-30 Sep P B-Com") + { + } + else + { continue; } + + prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate(); ProdBonusProcessItem oProcessItem = null; foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew) { @@ -694,10 +699,10 @@ namespace HRM.DA bool isSuperVisor = allProdBonusSupervisors.FindIndex(x => x.EmployeeID == item.Key && x.ProdBonusLineID == oLine.ID) == -1 ? false : true; List dailyAttm = alldailyAttm.FindAll(x => x.EmployeeID == item.Key); - //if (oProcessItem.EmployeeID == 36901) - //{ + if (item.Key == 65088) + { - //} + } if (isSuperVisor == false) { @@ -713,13 +718,17 @@ namespace HRM.DA bonusOuttime = dailyAtt.OutTime; 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) bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime; - else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date) + else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay) + bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute); + if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date) bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime; - else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay) - bonusIntime = 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); if (ts.Minutes < 16 && ts.Hours < 5) @@ -771,16 +780,20 @@ namespace HRM.DA { bonusIntime = dailyAtt.InTime; bonusOuttime = dailyAtt.OutTime; - oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID); + //oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID); if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date) bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime; - else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date) + else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay) + bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute); + if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date) bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime; - else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay) - bonusIntime = 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)(dailyAtt.OutTime - dailyAtt.InTime); + TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime); if (ts.Minutes < 16 && ts.Hours < 5) wh = ts.Hours; else if (ts.Minutes < 16) @@ -807,17 +820,17 @@ namespace HRM.DA oLine.ProdBonusSupervisors = allProdBonusSupervisors.FindAll(x => x.ProdBonusSetupID == oProductionBonusSetup.ID && x.ProdBonusLineID == oLine.ID); //Amount mismatch hude ammount - 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 == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041 - || oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388) - { + //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 == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041 + // || oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388) + //{ - } - if(oProcessItem.EmployeeID == 27620) - { - double x = ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100); - } + //} + //if(oProcessItem.EmployeeID == 27620) + //{ + // double x = ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100); + //} oProcessItem.Amount = Math.Round(((double)basicSal / 208 * (double)oth * ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100)) * 2, 2); oProcessItem.AchievePercent = 0; @@ -852,17 +865,7 @@ namespace HRM.DA oProcessEmp = new ProdBonusProcessEmp(); oProcessEmp.EmployeeID = item.EmployeeID; //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.Description = item.Description; _oProdBonusProcess.ProdBonusProcessEmps.Add(oProcessEmp);