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) foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups)
{ {
//if (oProductionBonusSetup.ID != 12583)
//{ continue; }
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)
@ -689,7 +690,8 @@ namespace HRM.DA
} }
} }
//if (item.Key == 2991)
//{ }
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;

View File

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

View File

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