|
@@ -736,7 +736,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
int leaveType = leave_item.TypeId;
|
|
|
decimal new_duration = leave_item.New_Duration;
|
|
|
|
|
|
- CalculateTypeFee(leaveDetails,leaveType, leave_item.DtType, leave_item.StartDt, leave_item.EndDt, amountPayable, work_days,
|
|
|
+ CalculateTypeFee1(leaveDetails,leaveType, leave_item.DtType, leave_item.StartDt, leave_item.EndDt, amountPayable, work_days,
|
|
|
new_duration,out leave_meals, out thisTypeDeduction);
|
|
|
if (leave_meals != 0)
|
|
|
{
|
|
@@ -1276,6 +1276,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1289,7 +1290,261 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
|
|
|
|
|
|
- public static void CalculateTypeFee(List<LeaveDetails> leaveDetails,int leaveType, string date_Range_type, DateTime startTime, DateTime endTime,
|
|
|
+ public static void CalculateTypeFee1(List<LeaveDetails> leaveDetails, int leaveType, string date_Range_type, DateTime startTime, DateTime endTime,
|
|
|
+ decimal amountPayable, int work_days, decimal duration, out decimal mealDeduction, out decimal typeDeduction)
|
|
|
+ {
|
|
|
+ typeDeduction = 0;
|
|
|
+ mealDeduction = 0;
|
|
|
+
|
|
|
+ string am_starttime = "08:59";
|
|
|
+ string am_endtime = "13:01";
|
|
|
+
|
|
|
+ decimal personalkLeave_dailywage_day = amountPayable / work_days;
|
|
|
+
|
|
|
+
|
|
|
+ decimal halfHour = 7.50M / 0.50M;
|
|
|
+
|
|
|
+ switch (leaveType)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+
|
|
|
+ if (date_Range_type == "halfday")
|
|
|
+ {
|
|
|
+ if (duration >= 0.5M && duration <= 1M)
|
|
|
+ {
|
|
|
+ var njItem = leaveDetails.Where(it => it.StartDt.ToString("yyyy-MM-dd") == startTime.ToString("yyyy-MM-dd") &&
|
|
|
+ it.EndDt.ToString("yyyy-MM-dd") == endTime.ToString("yyyy-MM-dd")).ToList();
|
|
|
+ if (njItem.Count > 1)
|
|
|
+ {
|
|
|
+ if (njItem[0].StartDt == startTime)
|
|
|
+ {
|
|
|
+ mealDeduction = 10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var njManyDaysItem = leaveDetails.Where(it => it.StartDt.ToString("yyyy-MM-dd") == startTime.ToString("yyyy-MM-dd")).ToList();
|
|
|
+ if (njManyDaysItem.Count > 1)
|
|
|
+ {
|
|
|
+ var njManyDaysItem1 = njManyDaysItem.Where(it => it.StartDt != startTime).ToList();
|
|
|
+ if (njManyDaysItem1.Count > 0)
|
|
|
+ {
|
|
|
+ if (njManyDaysItem1[0].Unit.Equals("天"))
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Math.Floor(duration);
|
|
|
+ }
|
|
|
+ else if (njManyDaysItem1[0].Unit.Equals("小时") && njManyDaysItem1[0].New_Duration >= 3)
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Math.Floor(duration);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Math.Ceiling(duration);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Math.Ceiling(duration);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+
|
|
|
+ decimal personalkLeave_dailywage_halfhour = personalkLeave_dailywage_day / 7.50M;
|
|
|
+
|
|
|
+ if (date_Range_type == "halfday")
|
|
|
+ {
|
|
|
+ mealDeduction = 10.00M * Math.Floor(duration);
|
|
|
+ if (duration % 1 == 0)
|
|
|
+ {
|
|
|
+ typeDeduction = ConvertToDecimal(personalkLeave_dailywage_day * duration);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ decimal sj_wholeDay = Math.Floor(duration);
|
|
|
+ decimal sj_halfDay = duration % 1;
|
|
|
+
|
|
|
+ if (sj_halfDay > 0)
|
|
|
+ {
|
|
|
+ typeDeduction = (personalkLeave_dailywage_day / 0.50M) * duration;
|
|
|
+
|
|
|
+ LeaveDetails sjDetailsMeal = leaveDetails.Where(it => it.EndDt == startTime).FirstOrDefault();
|
|
|
+ if (sjDetailsMeal == null)
|
|
|
+ {
|
|
|
+ mealDeduction += 10.00M;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ typeDeduction = personalkLeave_dailywage_day * sj_wholeDay;
|
|
|
+ }
|
|
|
+ typeDeduction = ConvertToDecimal(typeDeduction);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (date_Range_type == "hour")
|
|
|
+ {
|
|
|
+ decimal leave_halfHour = Convert.ToDecimal(duration) / Convert.ToDecimal(0.5);
|
|
|
+ typeDeduction = ConvertToDecimal(personalkLeave_dailywage_halfhour * leave_halfHour);
|
|
|
+
|
|
|
+ if (duration >= 3 && duration < 7.5M)
|
|
|
+ {
|
|
|
+ mealDeduction = 10;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (duration >= 7.5M)
|
|
|
+ {
|
|
|
+ decimal leave_halfHour1 = Convert.ToDecimal(duration) / Convert.ToDecimal(0.5);
|
|
|
+
|
|
|
+
|
|
|
+ decimal leaveDays = duration / 7.5M;
|
|
|
+ if (leaveDays % 1 == 0)
|
|
|
+ {
|
|
|
+ typeDeduction = ConvertToDecimal(personalkLeave_dailywage_day * leaveDays);
|
|
|
+ mealDeduction = 10 * leaveDays;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ typeDeduction = personalkLeave_dailywage_day * Convert.ToInt32(leaveDays);
|
|
|
+ decimal sy_shijiaunit = leave_halfHour1 - Convert.ToDecimal(15.00M * Convert.ToInt32(leaveDays));
|
|
|
+ if (sy_shijiaunit > 0)
|
|
|
+ {
|
|
|
+ typeDeduction += ConvertToDecimal(personalkLeave_dailywage_halfhour * sy_shijiaunit);
|
|
|
+ }
|
|
|
+ mealDeduction = 10 * Convert.ToInt32(leaveDays);
|
|
|
+
|
|
|
+
|
|
|
+ int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
|
|
|
+ if (lastHours >= 3)
|
|
|
+ {
|
|
|
+ mealDeduction += 10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+
|
|
|
+ decimal chengDuMinimumWage_Day = _chengDuMinimumWage / work_days;
|
|
|
+ decimal chengDuMinimumWage_halrHour = chengDuMinimumWage_Day / 7.50M;
|
|
|
+ decimal sickLeave_dailywage_halfhour_deduction1 = (personalkLeave_dailywage_day / 7.50M) - chengDuMinimumWage_halrHour;
|
|
|
+
|
|
|
+ if (date_Range_type == "halfday")
|
|
|
+ {
|
|
|
+ mealDeduction = 10.00M * Math.Ceiling(duration);
|
|
|
+
|
|
|
+ decimal pl_dailywage_day = personalkLeave_dailywage_day - chengDuMinimumWage_Day;
|
|
|
+ if (duration % 1 == 0)
|
|
|
+ {
|
|
|
+ typeDeduction = ConvertToDecimal(pl_dailywage_day * duration);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (duration % 1 > 0)
|
|
|
+ {
|
|
|
+ typeDeduction = (pl_dailywage_day / 0.50M) * duration;
|
|
|
+
|
|
|
+ LeaveDetails bjDetailsMeal = leaveDetails.Where(it => it.EndDt == startTime).FirstOrDefault();
|
|
|
+ if (bjDetailsMeal == null)
|
|
|
+ {
|
|
|
+ mealDeduction += 10.00M;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ typeDeduction = ConvertToDecimal(typeDeduction);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (date_Range_type == "hour")
|
|
|
+ {
|
|
|
+ decimal sickLeave_halfHour = duration / 0.5M;
|
|
|
+ typeDeduction = ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * sickLeave_halfHour);
|
|
|
+
|
|
|
+ if (duration >= 3 && duration < 7.5M)
|
|
|
+ {
|
|
|
+ mealDeduction = 10;
|
|
|
+ }
|
|
|
+ else if (duration >= 7.5M)
|
|
|
+ {
|
|
|
+ decimal sickLeave_halfHour1 = duration / 0.5M;
|
|
|
+
|
|
|
+ decimal leaveDays = Convert.ToDecimal(duration / 7.5M);
|
|
|
+
|
|
|
+ typeDeduction = ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * sickLeave_halfHour1);
|
|
|
+ if (leaveDays % 1 == 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * leaveDays;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Convert.ToInt32(leaveDays);
|
|
|
+
|
|
|
+ typeDeduction = ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * Convert.ToInt32(leaveDays));
|
|
|
+
|
|
|
+ decimal sy_bingjiaunit = sickLeave_halfHour1 - Convert.ToDecimal(15.00M * Convert.ToInt32(leaveDays));
|
|
|
+ if (sy_bingjiaunit > 0)
|
|
|
+ {
|
|
|
+ typeDeduction += ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * sy_bingjiaunit);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
|
|
|
+ if (lastHours >= 3)
|
|
|
+ {
|
|
|
+ mealDeduction += 10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void CalculateTypeFee2(List<LeaveDetails> leaveDetails,int leaveType, string date_Range_type, DateTime startTime, DateTime endTime,
|
|
|
decimal amountPayable,int work_days, decimal duration, out decimal mealDeduction, out decimal typeDeduction)
|
|
|
{
|
|
|
typeDeduction = 0;
|