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 @@ -
-
+
+ +
+
Employee Name: {{ userInfo.fullName }}
Department: {{ userInfo.departmentName || 'N/A' }}
@@ -83,158 +85,165 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+
Basic Salary
(RM)
ORPHRPDateOffice HourAfter Office HourOT Hrs
(Office Hour)
OT Hrs
(After Office Hour)
Normal DayOff DayRest DayPublic HolidayTotal OT HrsTotal OT Hrs
ND & OD
Total OT Hrs
RD
Total OT Hrs
PH
OT Amt (RM)StationDescriptionAction
FromToBreakFromToBreakND OT after office hrsOD Within office hrs < 4hrsOD Within office hrs > 4hrs < 8 hrsOD After office hrsRD Within office hrs < 4hrsRD Within office hrs > 4hrs < 8 hrsRD After office hrsPH Within office hrs < 8 hrsPH After office hrs
{{ 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)) }}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - - - + - - - + + + - - + + + - + + - - - + - + + + - - - - - - - - - - - - + - - - + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + + - - - - + + - + + + + - + - - - -
Basic Salary
(RM)
ORPHRPDateOffice HourAfter Office HourOT Hrs
(Office Hour)
OT Hrs
(After Office Hour)
Normal DayOff DayRest DayPublic HolidayTotal OT HrsTotal OT Hrs
ND & OD
Total OT Hrs
RD
Total OT Hrs
PH
OT Amt (RM)StationDescriptionAction
FromToBreakFromToBreakND OT after office hrsOD Within office hrs < 4hrsOD Within office hrs > 4hrs < 8 hrsOD After office hrsRD Within office hrs < 4hrsRD Within office hrs > 4hrs < 8 hrsRD After office hrsPH Within office hrs < 8 hrsPH After office hrs
{{ classifyOt(record).ndAfter }}{{ 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)) }}{{ classifyOt(record).odUnder4 }}{{ classifyOt(record).odBetween4And8 }}{{ classifyOt(record).odAfter }}{{ classifyOt(record).ndAfter }}{{ classifyOt(record).rdUnder4 }}{{ classifyOt(record).rdBetween4And8 }}{{ classifyOt(record).rdAfter }}{{ classifyOt(record).odUnder4 }}{{ classifyOt(record).odBetween4And8 }}{{ classifyOt(record).odAfter }}{{ classifyOt(record).phUnder8 }}{{ classifyOt(record).phAfter }}{{ classifyOt(record).rdUnder4 }}{{ classifyOt(record).rdBetween4And8 }}{{ classifyOt(record).rdAfter }}{{ calculateTotalOtHrs(record) }}{{ classifyOt(record).phUnder8 }}{{ classifyOt(record).phAfter }}{{ calculateNdOdTotal(record) }}{{ calculateRdTotal(record) }}{{ calculatePhTotal(record) }}{{ calculateTotalOtHrs(record) }}{{ calculateOtAmount(record) }}{{ calculateNdOdTotal(record) }}{{ calculateRdTotal(record) }}{{ calculatePhTotal(record) }}{{ record.stationName || 'N/A' }} -
- {{ record.otDescription }} -
-
- - -
No overtime details found for this submission.
TOTALTOTAL{{ calculateOtAmount(record) }}{{ formatBreakToHourMinute(totals.officeBreak) }}{{ record.stationName || 'N/A' }} +
+ {{ record.otDescription }} +
+
+ + +
No overtime details found for this submission.
TOTALTOTAL{{ formatBreakToHourMinute(totals.afterBreak) }}{{ formatBreakToHourMinute(totals.officeBreak) }}{{ totals.ndAfter }}{{ formatBreakToHourMinute(totals.afterBreak) }}{{ totals.odUnder4 }}{{ totals.odBetween4And8 }}{{ totals.odAfter }}{{ totals.ndAfter }}{{ totals.rdUnder4 }}{{ totals.rdBetween4And8 }}{{ totals.rdAfter }}{{ totals.odUnder4 }}{{ totals.odBetween4And8 }}{{ totals.odAfter }}{{ totals.phUnder8 }}{{ totals.phAfter }}{{ totals.rdUnder4 }}{{ totals.rdBetween4And8 }}{{ totals.rdAfter }}{{ totals.totalOtHrs }}{{ totals.totalNdOd }}{{ totals.totalRd }}{{ totals.totalPh }}{{ totals.phUnder8 }}{{ totals.phAfter }}{{ totals.otAmt }}{{ totals.totalOtHrs }}{{ totals.totalNdOd }}{{ totals.totalRd }}{{ totals.totalPh }}{{ totals.otAmt }}
+ + + + + + +
- - - + + + +
+
+ + +
-