feat: support public-payer treaty exemption and exact economic adjustments
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-10 13:54:06 +02:00
parent 60b52fc8c7
commit b10b35f308
16 changed files with 472 additions and 78 deletions
+4 -2
View File
@@ -6,7 +6,8 @@ import { normalBook, calculateNormal, recordNormal, saveNormalBook, normalCurren
import { prepareEconomicInclusion } from '../resources/js/lib/irpc-normal-economic.ts';
import { createProjectDossierReport } from '../resources/js/lib/project-dossier-report.ts';
const special = process.argv.includes('special');
const out = new URL(special ? '../outputs/irpc-economic-special-inclusion-20261110/' : '../outputs/irpc-economic-inclusion-20261110/', import.meta.url);
const exact = process.argv.includes('fraction');
const out = new URL(exact ? '../outputs/irpc-economic-fraction-20261110/' : special ? '../outputs/irpc-economic-special-inclusion-20261110/' : '../outputs/irpc-economic-inclusion-20261110/', import.meta.url);
fs.mkdirSync(out, { recursive: true });
if (process.argv[2] === 'recovered') {
const d = JSON.parse(fs.readFileSync(new URL('recovered.json', out), 'utf8'));
@@ -29,11 +30,12 @@ if (process.argv[2] === 'recovered') {
const c=economicCase(), source=structuredClone(c.b.economicCredits.rows[0]);
Object.assign(source,{incomeIncluded:'no',incomeReference:'SYNTHETIC not yet included',grossUpIncluded:'0',grossUpReference:'SYNTHETIC no gross-up yet'});
if (special) Object.assign(source,{kind:'liquidation',income:'150',liquidation:{attributed:'200',paidInCapital:'100',reference:'SYNTHETIC QA capital100/gain50 in total taxable150; exact reconciliation'}});
if(exact) {source.taxAmount=source.proofAmount='20.01';source.attributionReference='SYNTHETIC underlying tax20.01 corresponds to income100';}
const b=recordNormal(c.d,prepareEconomicInclusion(normalBook(c.d),{source,profitAlreadyIncluded:'0',creditAlreadyIncluded:'0',reference:'SYNTHETIC QA explicit reconciliation before this map'}),'2026-11-10T15:00:00+02:00');
const d={...c.d,modelo_a_snapshot:saveNormalBook(c.d,b)};
let annual=reuseAnnualAssessment(d,c.b);
annual.internationalCredits.positions.forEach(p=>{p.assessmentKey=annual.assessmentKey;p.incomeReference='SYNTHETIC reconfirmed foreign component in new L6';});
Object.assign(annual.economicCredits.rows[0],source,{assessmentKey:annual.assessmentKey,incomeIncluded:'yes',incomeReference:'SYNTHETIC reconciled inclusion map in new L6',grossUpIncluded:'12',grossUpReference:'SYNTHETIC reconciled nominal12 in new L6',nationalMethod:'proportional',nationalBasisReference:'SYNTHETIC same112 component in new base4512'});
Object.assign(annual.economicCredits.rows[0],source,{assessmentKey:annual.assessmentKey,incomeIncluded:'yes',incomeReference:'SYNTHETIC reconciled inclusion map in new L6',grossUpIncluded:exact?'12.006':'12',grossUpReference:'SYNTHETIC reconciled nominal12 in new L6',nationalMethod:'proportional',nationalBasisReference:'SYNTHETIC same112 component in new base4512'});
assert.deepEqual(calculateAnnual(d,annual).pending,[]);
annual=recordAnnual(d,annual,'2026-11-10T15:01:00+02:00');
d.modelo_a_snapshot=saveAnnualBook(d,annual);