Correction CSG CRDS et suppression card debug simulateur

This commit is contained in:
odentas 2025-10-16 00:11:39 +02:00
parent dd4e8d17b1
commit 68cbe3bc6e

View file

@ -644,32 +644,21 @@ function employerContribsForCSGBase(brut){
if (!dates.length) return 0;
const prevBase = getPrevoyanceBase(brut);
const assietteChomageMax = getAssietteChomageMaxPourMoisCourant();
let total = 0;
for (const e of emp){
let amount = 0;
switch (e.code){
// ✅ Inclure : chômage / maj. chômage / AGS sur leur assiette plafonnée
case 'chomage':
case 'maj_chomage':
case 'ags': {
const base = Math.min(brut, assietteChomageMax);
amount = base * (e.taux / 100);
break;
}
// ✅ Inclure : prévoyance TA (sur base plafonnée jour)
case 'prevoyance_ta':
amount = prevBase * (e.taux / 100);
break;
// ✅ Inclure : contributions conventionnelles simples
case 'cfpc_conv':
// ✅ Inclure : Paritarisme et APEC (si cadre)
case 'paritarisme':
case 'apec':
amount = brut * (e.taux / 100);
break;
// ❌ Exclure : IRC (AGIRC-ARRCO) T1/T2 (retraite & CEG), FNAL, maladie, vieillesse, AF, AT, etc.
// ❌ Exclure : chômage / maj_chomage / ags, IRC (T1/T2/CEG), FNAL, maladie, vieillesse, AF, AT, CFPC conv, etc.
default:
break;
}
@ -1428,16 +1417,17 @@ document.getElementById('calcBtn').addEventListener('click', function() {
}
}
// Ajout du debug chômage
const dbg = getChomageDebugInfo();
const dbgHtml = dbg ? `
<div style="margin-top:12px;padding:8px;border:1px dashed #cbd5e1;border-radius:8px;background:#f8fafc">
<div style="font-weight:600;margin-bottom:4px">Debug chômage</div>
<div>Branche: <strong>${dbg.branch}</strong> — Jours sélectionnés: <strong>${dbg.nbJours}</strong>, Cachets: <strong>${dbg.cachets}</strong>, Jours retenus chômage: <strong>${dbg.nbJoursChomage}</strong></div>
<div>Jours dans le mois: <strong>${dbg.daysInMonth}</strong>, DiffDays (span): <strong>${dbg.diffDays}</strong></div>
<div>Assiette chômage max calculée: <strong>${fmtEuro(dbg.assiette)}</strong></div>
</div>` : '';
// // Ajout du debug chômage (masqué)
// const dbg = getChomageDebugInfo();
// const dbgHtml = dbg ? `
// <div style="margin-top:12px;padding:8px;border:1px dashed #cbd5e1;border-radius:8px;background:#f8fafc">
// <div style="font-weight:600;margin-bottom:4px">Debug chômage</div>
// <div>Branche: <strong>${dbg.branch}</strong> — Jours sélectionnés: <strong>${dbg.nbJours}</strong>, Cachets: <strong>${dbg.cachets}</strong>, Jours retenus chômage: <strong>${dbg.nbJoursChomage}</strong></div>
// <div>Jours dans le mois: <strong>${dbg.daysInMonth}</strong>, DiffDays (span): <strong>${dbg.diffDays}</strong></div>
// <div>Assiette chômage max calculée: <strong>${fmtEuro(dbg.assiette)}</strong></div>
// </div>` : '';
// Table de résultats sans debug chômage ni ligne Plafond URSSAF
const resultTable = `
<table class="result-table">
<tr>
@ -1451,8 +1441,6 @@ document.getElementById('calcBtn').addEventListener('click', function() {
<td>${fmtEuro(costEmployer)} €</td>
</tr>
</table>
<p>Plafond URSSAF : ${fmtEuro(plafondUrssaf)} €</p>
${dbgHtml}
`;
document.getElementById('result').innerHTML = resultTable;
document.getElementById('detailTable').innerHTML = generateDetailTable(brut, cachets, heures, plafondUrssaf);