Legenda

Dia
Semana
Manhã
Tarde
Noite

Resumo do Mês

40H Trabalhadas 0 h
20H Trabalhadas 0 h
Total Horas 0 h
Total a Receber R$ 0,00
CONTRATO H. TRAB. H. PERDA G. GERAL (R$) IMP. RENDA (R$) INSS (R$) UNIMED (R$) G. REAL (R$)
Mês Ganho 40H Ganho 20H I. Renda INSS Unimed G. Real
function calculateMonthlyStats(scheduleData) { let userRate = 32.00; if (scheduleData.hourlyRate !== undefined && scheduleData.hourlyRate !== null) { userRate = parseFloat(scheduleData.hourlyRate); } let hours40 = 0; // Morning + Afternoon let hours20 = 0; // Night let lossHours = 0; const financials = scheduleData.financials || {}; const HOURS_PER_SLOT = 4; Object.keys(scheduleData).forEach(key => { if (key === 'financials' || key === 'hourlyRate') return; const dayShifts = scheduleData[key]; if (!dayShifts) return; ['M', 'T', 'N'].forEach(slot => { if (dayShifts[slot]) { const type = Object.values(SHIFT_TYPES).find(t => t.code === dayShifts[slot]); if (type) { if (slot === 'N') { if (type.work) hours20 += HOURS_PER_SLOT; } else { if (type.work) hours40 += HOURS_PER_SLOT; } if (type.loss) lossHours += HOURS_PER_SLOT; } } }); }); // Earnings Logic: Use manual if present, otherwise calculate let earnings40 = hours40 * userRate; let earnings20 = hours20 * userRate; if (financials.manualEarnings40 !== undefined && financials.manualEarnings40 !== null) { earnings40 = parseFloat(financials.manualEarnings40) || 0; } if (financials.manualEarnings20 !== undefined && financials.manualEarnings20 !== null) { earnings20 = parseFloat(financials.manualEarnings20) || 0; } const totalEarnings = earnings40 + earnings20; const ir40 = parseFloat(financials.ir40) || 0; const inss40 = parseFloat(financials.inss40) || 0; const unimed40 = parseFloat(financials.unimed40) || 0; const ir20 = parseFloat(financials.ir20) || 0; const inss20 = parseFloat(financials.inss20) || 0; const unimed20 = parseFloat(financials.unimed20) || 0; const totalIr = ir40 + ir20; const totalInss = inss40 + inss20; const totalUnimed = unimed40 + unimed20; const real40 = earnings40 - ir40 - inss40 - unimed40; const real20 = earnings20 - ir20 - inss20 - unimed20; const realEarnings = real40 + real20; return { hours40, hours20, totalHours: hours40 + hours20, lossHours, earnings40, earnings20, totalEarnings, ir40, inss40, unimed40, ir20, inss20, unimed20, totalIr, totalInss, totalUnimed, real40, real20, realEarnings }; } function formatCurrency(value) { return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(value); } let currentState = { employeeId: 'emp1', month: 0, year: 2025, schedule: {} }; const els = { employeeSelect: document.getElementById('employee-select'), monthSelect: document.getElementById('month-select'), yearInput: document.getElementById('year-input'), scheduleRows: document.getElementById('schedule-rows'), legendContainer: document.getElementById('legend-container'), stats: { h40: document.getElementById('stat-40h'), h20: document.getElementById('stat-20h'), totalH: document.getElementById('stat-total-h'), totalMoney: document.getElementById('stat-total-money'), financialBody: document.getElementById('financial-body') }, navSchedule: document.getElementById('nav-schedule'), navDashboard: document.getElementById('nav-dashboard'), viewSchedule: document.getElementById('view-schedule'), viewDashboard: document.getElementById('view-dashboard'), // Report Elements navReport: document.getElementById('nav-report'), viewReport: document.getElementById('view-report'), reportEmpSelect: document.getElementById('report-employee-select'), reportMonthSelect: document.getElementById('report-month-select'), reportYearInput: document.getElementById('report-year-input'), btnGenerateReport: document.getElementById('btn-generate-report'), btnPrintReport: document.getElementById('btn-print-report'),