feat: add dynamic deductions to checkout model and enhance roll call difference calculations

This commit is contained in:
2025-11-19 10:45:40 +03:30
parent 76666b3da7
commit 2035b6fff8
4 changed files with 30 additions and 12 deletions

View File

@@ -111,6 +111,9 @@ namespace CompanyManagment.App.Contracts.CustomizeCheckout
public bool HasAmountConflict { get; set; }
// New: up to three dynamic deduction items (title -> amount string)
public IDictionary<string, string> DynamicDeductions { get; set; } = new Dictionary<string, string>();
//public bool HasLeft { get; set; }
//public string IsBlockCantracingParty { get; set; }
//public string IsActiveString { get; set; }

View File

@@ -2641,8 +2641,12 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
{
var checkoutEnd = contractEnd;
var checkoutStart = contractStart;
if (workshopId == 170)
return CustomizeCheckoutMandatoryComputeForKebabMahdi(employeeId, workshopId, contractStart, contractEnd);
if (workshopId is 367 or 368)
return CustomizeCheckoutMandatoryComputeForPizzaAmir(employeeId, workshopId, contractStart, contractEnd);
var firstDayOfMonth = $"{(contractStart.ToFarsi())[..8]}/01".ToGeorgianDateTime();
@@ -4721,11 +4725,13 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
{
leavePermittedDays -= absenceDays;
leavePayAmount = leavePermittedDays * dailyWage;
absentsDeductionAmount = 0;
}
else
{
absenceDays -= leavePermittedDays;
absentsDeductionAmount = absenceDays * dailyWage;
leavePayAmount = 0;
}
#endregion

View File

@@ -412,17 +412,23 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
DateTimeGr = x.Key.Date,
IsSliced = x.Count() > 2,
IsAbsent = false,
EnterDifferencesMinutes1 = firstRollCall != null && firstRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170
EnterDifferencesMinutes1 = firstRollCall != null && firstRollCall.LateEntryDuration > TimeSpan.Zero
? CalculateEntryMinuteDifference(firstRollCall.EarlyEntryDuration,
firstRollCall.LateEntryDuration)
: "",
ExitDifferencesMinutes1 = "",
ExitDifferencesMinutes1 = firstRollCall != null && firstRollCall.EarlyExitDuration > TimeSpan.Zero
? CalculateExitMinuteDifference(firstRollCall.EarlyExitDuration,
firstRollCall.LateExitDuration)
: "",
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170 && hasSecondTimeDiff
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && hasSecondTimeDiff
? CalculateEntryMinuteDifference(secondRollCall.EarlyEntryDuration,
secondRollCall.LateEntryDuration)
: "",
ExitDifferencesMinutes2 = ""
ExitDifferencesMinutes2 = secondRollCall != null && secondRollCall.EarlyExitDuration > TimeSpan.Zero && hasSecondTimeDiff
? CalculateExitMinuteDifference(secondRollCall.EarlyExitDuration,
secondRollCall.LateExitDuration)
: ""
};
});
presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel
@@ -1736,17 +1742,23 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
IsSliced = x.Count() > 2,
IsAbsent = false,
EnterDifferencesMinutes1 = firstRollCall != null && firstRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170
EnterDifferencesMinutes1 = firstRollCall != null && firstRollCall.LateEntryDuration > TimeSpan.Zero
? CalculateEntryMinuteDifference(firstRollCall.EarlyEntryDuration,
firstRollCall.LateEntryDuration)
: "",
ExitDifferencesMinutes1 = "",
ExitDifferencesMinutes1 = firstRollCall != null && firstRollCall.EarlyExitDuration > TimeSpan.Zero
? CalculateExitMinuteDifference(firstRollCall.EarlyExitDuration,
firstRollCall.LateExitDuration)
: "",
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170&& hasSecondTimeDiff
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && hasSecondTimeDiff
? CalculateEntryMinuteDifference(secondRollCall.EarlyEntryDuration,
secondRollCall.LateEntryDuration)
: "",
ExitDifferencesMinutes2 = ""
ExitDifferencesMinutes2 = secondRollCall != null && secondRollCall.EarlyExitDuration > TimeSpan.Zero && hasSecondTimeDiff
? CalculateExitMinuteDifference(secondRollCall.EarlyExitDuration,
secondRollCall.LateExitDuration)
: ""
};
});
presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel
@@ -1801,9 +1813,6 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
//حضور غیاب گروهی از پرسنل برای پرینت گروهی فیش حقوقی غیر رسمی نهایی
public List<PersonnelCheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonthForKababMahdi(IEnumerable<long> employeeIds, long workshopId, DateTime start, DateTime end)
{
var rollCalls = _context.RollCalls.Where(x =>
employeeIds.Contains(x.EmployeeId) && workshopId == x.WorkshopId && x.StartDate != null &&
x.EndDate != null && x.RollCallModifyType != RollCallModifyType.Undefined &&

View File

@@ -254,7 +254,7 @@
<td style="padding-right: 8px; border-left: 1px solid #000;"> عیدی </td>
<td style="text-align: center; border-left: 1px solid #000;"> - </td>
<td style="text-align: center; border-left: 2px solid #000;"> @(Model.BonusesPay == "0" ? "-" : Model.BonusesPay) </td>
<td style="padding-right: 8px; border-left: 1px solid #000;"> </td>
<td style="padding-right: 8px; border-left: 1px solid #000;">تتتتتتت</td>
<td style="text-align: center; border-left: 1px solid #000;"> </td>
<td style="text-align: center;"> </td>
</tr>