dev_chapal #6

Merged
chapal merged 2 commits from dev_chapal into devqc 2024-10-21 16:30:08 +06:00
3 changed files with 32 additions and 11 deletions

View File

@ -662,7 +662,8 @@ namespace HRM.DA
foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups)
{
//if (oProductionBonusSetup.ID != 12583)
//{ continue; }
prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate();
ProdBonusProcessItem oProcessItem = null;
foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew)
@ -689,7 +690,8 @@ namespace HRM.DA
}
}
//if (item.Key == 2991)
//{ }
bool isSuperVisor = allProdBonusSupervisors.FindIndex(x => x.EmployeeID == item.Key
&& x.ProdBonusLineID == oLine.ID) == -1 ? false : true;

View File

@ -334,7 +334,8 @@ namespace HRM.Report
List<Shift> oShifts = new ShiftService().GetAllShift();
Shift oShift = null;
DateTime? bonusIntime = DateTime.MinValue;
DateTime? bonusOuttime = DateTime.MinValue;
List<ProdBonusAttn> prodAttn = new ProdBonusAttnService().GetBySetupID(designId);
string empIds = string.Empty;
empIds = prodAttn.Select(x => x.EmployeeID).Distinct().Aggregate(new StringBuilder(), (sb, empid) => sb.Append(empid + ","), sb => sb.ToString().Trim(','));
@ -362,6 +363,7 @@ namespace HRM.Report
double hour = 0;
foreach (ProdBonusAttn tAtt in tempAttn)
{
DailyAttnProcess dailyAtt = oDailyAttnProsess.FirstOrDefault(o => o.AttnDate.Date == tAtt.InTime.Date &&
o.EmployeeID == item.ID &&
(o.AttenType == EnumAttendanceType.Present ||
@ -370,20 +372,36 @@ namespace HRM.Report
o.AttenType == EnumAttendanceType.Early ||
o.AttenType == EnumAttendanceType.Late ||
o.AttenType == EnumAttendanceType.OutSideDuty));
double wh = 0;
if (dailyAtt != null)
{
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{
bonusIntime = dailyAtt.InTime;
bonusOuttime = dailyAtt.OutTime;
oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (design.FromDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.InTime = design.FromDate > dailyAtt.InTime ? design.FromDate : dailyAtt.InTime;
else if (design.ToDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.OutTime = design.ToDate < dailyAtt.OutTime ? design.ToDate : dailyAtt.OutTime;
else if (oShift != null && dailyAtt.InTime.Value.TimeOfDay < oShift.InTime.TimeOfDay)
dailyAtt.InTime = dailyAtt.InTime.Value.Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
//if (design.FromDate.Date == dailyAtt.AttnDate.Date)
// dailyAtt.InTime = design.FromDate > dailyAtt.InTime ? design.FromDate : dailyAtt.InTime;
//else if (design.ToDate.Date == dailyAtt.AttnDate.Date)
// dailyAtt.OutTime = design.ToDate < dailyAtt.OutTime ? design.ToDate : dailyAtt.OutTime;
//else if (oShift != null && dailyAtt.InTime.Value.TimeOfDay < oShift.InTime.TimeOfDay)
// dailyAtt.InTime = dailyAtt.InTime.Value.Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = dailyAtt.OutTime.Value - dailyAtt.InTime.Value;
if (design.FromDate.Date == dailyAtt.AttnDate.Date)
bonusIntime = design.FromDate > dailyAtt.InTime ? design.FromDate : dailyAtt.InTime;
else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay)
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute);
if (design.ToDate.Date == dailyAtt.AttnDate.Date)
bonusOuttime = design.ToDate < dailyAtt.OutTime ? design.ToDate : dailyAtt.OutTime;
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 = dailyAtt.OutTime.Value - dailyAtt.InTime.Value;
TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime);
if (ts.Minutes < 16 && ts.Hours < 5)
wh = ts.Hours;
else if (ts.Minutes < 16)

View File

@ -208,9 +208,10 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!WorkingHour.Value)</Value>
<Value>=Sum(CDBL(Fields!WorkingHour.Value))</Value>
<Style>
<FontSize>8pt</FontSize>
<Format>N2</Format>
</Style>
</TextRun>
</TextRuns>