diff --git a/Areas/OTcalculate/Services/OvertimeExcel.cs b/Areas/OTcalculate/Services/OvertimeExcel.cs index 90d5db4..b5c86da 100644 --- a/Areas/OTcalculate/Services/OvertimeExcel.cs +++ b/Areas/OTcalculate/Services/OvertimeExcel.cs @@ -36,10 +36,12 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services string? flexiHour = null, byte[]? logoImage = null, bool isSimplifiedExport = false, - OtStatusModel? otStatus = null) + OtStatusModel? otStatus = null, + bool hideSalaryDetails = false) { bool isAdminUser = IsAdmin(user.Id); bool showStationColumn = user.Department?.DepartmentId == 3 || user.Department?.DepartmentId == 2 || isAdminUser; + bool hideSalary = hideSalaryDetails || isHoU || isHoD || isManager; var stream = new MemoryStream(); @@ -100,7 +102,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services } else { - if (isHoU || isHoD || isManager) // If HoU, HoD, or Manager, hide salary details + if (hideSalary) // If HoU, HoD, or Manager, hide salary details { if (showStationColumn) { @@ -263,7 +265,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services decimal otAmtValParsed = 0; string otAmt = ""; - if (!isHoU && !isHoD && !isManager) // Only calculate and show OT amount if not HoU, HoD, or Manager + if (!hideSalary) // Only calculate and show OT amount if not HoU, HoD, or Manager { otAmt = CalculateOtAmount(record, hrp, publicHolidayDates, userSetting?.State?.WeekendId); otAmtValParsed = decimal.TryParse(otAmt, out decimal val) ? val : 0; @@ -291,7 +293,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services grandTotalPh += currentRowTotalPh; grandTotalOtAmount += otAmtValParsed; // Only add if it was calculated - if (!isHoU && !isHoD && !isManager) // Only show if not HoU, HoD, or Manager + if (!hideSalary) // Only show if not HoU, HoD, or Manager { // Basic Salary worksheet.Cell(currentRow, col).Value = !hasPrintedSalaryDetails ? basicSalary.ToString("N2") : ""; @@ -348,7 +350,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services worksheet.Cell(currentRow, col++).Value = currentRowTotalRd > 0 ? currentRowTotalRd.ToString("N2") : ""; worksheet.Cell(currentRow, col++).Value = currentRowTotalPh > 0 ? currentRowTotalPh.ToString("N2") : ""; - if (!isHoU && !isHoD && !isManager) // Only show if not HoU, HoD, or Manager + if (!hideSalary) // Only show if not HoU, HoD, or Manager { worksheet.Cell(currentRow, col++).Value = otAmt == "0.00" ? "" : otAmt; } @@ -415,7 +417,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services int totalLabelStartColumnIndex = 1; int totalLabelEndColumnIndex; - if (!isHoU && !isHoD && !isManager) // If not HoU, HoD, or Manager, include salary columns in merge + if (!hideSalary) // If not HoU, HoD, or Manager, include salary columns in merge { totalLabelEndColumnIndex = 3; } @@ -445,7 +447,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services int colTotalPhIndex = 0; int colOtAmtIndex = 0; - if (!isHoU && !isHoD && !isManager) + if (!hideSalary) { colOfficeBreakIndex = 8; colAfterBreakIndex = 11; @@ -500,7 +502,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services worksheet.Cell(currentRow, colTotalRdIndex).Value = grandTotalRd.ToString("N2"); worksheet.Cell(currentRow, colTotalPhIndex).Value = grandTotalPh.ToString("N2"); - if (!isHoU && !isHoD && !isManager) + if (!hideSalary) { worksheet.Cell(currentRow, colOtAmtIndex).Value = Math.Round(grandTotalOtAmount, MidpointRounding.AwayFromZero).ToString("F2"); } @@ -697,7 +699,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services } else { - if (!isHoU && !isHoD && !isManager) // If not HoU, HoD, or Manager, include salary columns in width adjustment + if (!hideSalary) // If not HoU, HoD, or Manager, include salary columns in width adjustment { worksheet.Column(1).Width = 15; // Basic Salary worksheet.Column(2).Width = 10; // ORP diff --git a/Areas/OTcalculate/Views/ApprovalDashboard/OtReview.cshtml b/Areas/OTcalculate/Views/ApprovalDashboard/OtReview.cshtml index dbb85c9..44bfaf2 100644 --- a/Areas/OTcalculate/Views/ApprovalDashboard/OtReview.cshtml +++ b/Areas/OTcalculate/Views/ApprovalDashboard/OtReview.cshtml @@ -68,8 +68,10 @@ -
| Basic Salary (RM) |
- ORP | -HRP | -Date | -Office Hour | -After Office Hour | -OT Hrs (Office Hour) |
- OT Hrs (After Office Hour) |
- Normal Day | -Off Day | -Rest Day | -Public Holiday | -Total OT Hrs | -Total OT Hrs ND & OD |
- Total OT Hrs RD |
- Total OT Hrs PH |
- OT Amt (RM) | -Station | -Description | -Action | -|||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| From | -To | -Break | -From | -To | -Break | -ND OT after office hrs | -OD Within office hrs < 4hrs | -OD Within office hrs > 4hrs < 8 hrs | -OD After office hrs | -RD Within office hrs < 4hrs | -RD Within office hrs > 4hrs < 8 hrs | -RD After office hrs | -PH Within office hrs < 8 hrs | -PH After office hrs | -||||||||||||||
| {{ calculateBasicSalary() }} | -{{ calculateOrp() }} | -{{ calculateHrp() }} | - -{{ formatDate(record.otDate) }} | -{{ formatTime(record.officeFrom) }} | -{{ formatTime(record.officeTo) }} | -{{ formatBreakToHourMinute(record.officeBreak, false) }} | -{{ formatTime(record.afterFrom) }} | -{{ formatTime(record.afterTo) }} | -{{ formatBreakToHourMinute(record.afterBreak, false) }} | -{{ formatTimeFromDecimal(calculateRawDuration(record.officeFrom, record.officeTo, record.officeBreak)) }} | -{{ formatTimeFromDecimal(calculateRawDuration(record.afterFrom, record.afterTo, record.afterBreak)) }} | +|||||||||||||||||