Correction simulateur
This commit is contained in:
parent
24f4cff4e8
commit
2497a80f4d
1 changed files with 24 additions and 8 deletions
|
|
@ -245,8 +245,21 @@ function getSelectedDatesArray() {
|
|||
}
|
||||
|
||||
function getPrevoyanceBase(brutTotal) {
|
||||
const nbJours = getSelectedDatesArray().length || 0;
|
||||
return Math.min(brutTotal, PLAFOND_JOUR_SS * nbJours);
|
||||
const dates = getSelectedDatesArray();
|
||||
const nbDates = dates.length || 0;
|
||||
if (nbDates === 0) return 0;
|
||||
|
||||
// Nombre de jours « retenus » pour la prévoyance :
|
||||
// - Si des cachets sont saisis (artistes), on retient le nombre de jours avec cachet,
|
||||
// donc min(cachets, nbDates).
|
||||
// - Sinon (heures), on retient toutes les dates sélectionnées.
|
||||
const cachetsRaw = parseInt(document.getElementById('cachetsInput')?.value, 10);
|
||||
const cachets = (isNaN(cachetsRaw) || cachetsRaw < 0 || isTechnicien()) ? 0 : cachetsRaw;
|
||||
|
||||
const daysCounted = (cachets > 0) ? Math.min(cachets, nbDates) : nbDates;
|
||||
|
||||
const plafond = PLAFOND_JOUR_SS * daysCounted;
|
||||
return Math.min(brutTotal, plafond);
|
||||
}
|
||||
|
||||
/* ===== Abattement (Artiste uniquement) ===== */
|
||||
|
|
@ -322,23 +335,26 @@ function getAssietteChomageMaxPourMoisCourant() {
|
|||
.split(",")
|
||||
.map(s => new Date(s.trim()))
|
||||
.filter(d => !isNaN(d))
|
||||
.sort((a,b)=>a-b);
|
||||
.sort((a, b) => a - b);
|
||||
|
||||
if (!dates.length) return Infinity;
|
||||
|
||||
const first = dates[0], last = dates[dates.length-1];
|
||||
const diffDays = Math.round((last - first) / (1000*60*60*24)) + 1;
|
||||
const first = dates[0], last = dates[dates.length - 1];
|
||||
const diffDays = Math.round((last - first) / (1000 * 60 * 60 * 24)) + 1;
|
||||
const nbJours = dates.length;
|
||||
const y = dates[0].getFullYear();
|
||||
const m = dates[0].getMonth();
|
||||
const daysInMonth = new Date(y, m + 1, 0).getDate();
|
||||
|
||||
// Règle attendue :
|
||||
// - < 5 jours : plafond chômage = 4 × plafond URSSAF de la période
|
||||
// (ex. Artiste: 4 × (12×PHSS×nbJours) => 4×348=1392 pour 1 jour)
|
||||
// - ≥ 5 jours : plafond chômage = 4 × PMSS (mensuel, sans prorata à l'intervalle)
|
||||
// - ≥ 5 jours : plafond chômage = 4 × PMSS × (nbJours / daysInMonth)
|
||||
if (diffDays < 5) {
|
||||
const plafUrssaf = getPlafondUrssaf();
|
||||
return 4 * plafUrssaf;
|
||||
}
|
||||
|
||||
return 4 * PMSS;
|
||||
return 4 * PMSS * (nbJours / daysInMonth);
|
||||
}
|
||||
|
||||
// Taux complémentaires selon catégorie
|
||||
|
|
|
|||
Loading…
Reference in a new issue