Sunday: SU,
Monday: MO,
Tuesday: TU,
Wednesday: WE,
Thursday: TH,
Friday: FR,
Saturday: SA
// Get all rows in the attendance sheet
var rows = document.getElementsByTagName('tr');
// Loop through each row
for (var i = 1; i < rows.length; i++) {
// Get the employee's total attendance
var totalAttendance = 0;
// Loop through each cell in the row (excluding the first cell)
for (var j = 1; j < rows[i].cells.length; j++) {
// Check if the cell contains the attendance status (e.g., Present, Absent)
if (rows[i].cells[j].innerText === 'Present') {
totalAttendance++;
}
}
// Update the total attendance for the employee in cell C7:AG14
rows[0].cells[i].innerText = totalAttendance;
}
// Get the current month
var currentMonth = new Date().getMonth() + 1;
// Function to update the total attendance for each employee
function updateTotalAttendance() {
// Loop through each row in the attendance sheet
for (var i = 1; i < rows.length; i++) {
// Update the total attendance for the employee in cell C7:AG14
rows[0].cells[i].innerText = 0;
// Loop through each cell in the row (excluding the first cell)
for (var j = 1; j < rows[i].cells.length; j++) {
// Check if the cell contains the attendance status (e.g., Present, Absent)
if (rows[i].cells[j].innerText === 'Present') {
// Increment the total attendance for the employee
rows[0].cells[i].innerText++;
}
}
}
}
// Call the updateTotalAttendance function when the month changes
window.onresize = updateTotalAttendance;