feat: preserve exact included VAT fractions and enumerate L1 remainder

This commit is contained in:
2026-10-24 13:20:32 +02:00
parent d89912e579
commit 689e7cbe8b
12 changed files with 1595 additions and 19 deletions
@@ -0,0 +1,9 @@
import fs from 'node:fs';
import {newSalesOperation,recordSales,saveSalesBook} from '../../../resources/js/lib/iva-operations.ts';
export function l1DeltaFixture(){
const draft=JSON.parse(fs.readFileSync(new URL('iva-operations.json',import.meta.url),'utf8'));
draft.context_opportunity='opportunity:310';draft.project_title='SYNTHETIC QA — L1 precisão racional';
const context=JSON.parse(draft.context_applicability_snapshot);context.opportunity_choices.push({opportunity:{key:'opportunity:310',title:'SYNTHETIC QA — segunda oportunidade racional'}});draft.context_applicability_snapshot=JSON.stringify(context);
let book={currency:'MZN',rows:['1','100','0.02'].map((amount,i)=>({...newSalesOperation(`rational-${i}`,'2026-01','MZN'),amount,description:`SYNTHETIC QA periódico ${i+1}`,establishment:'SYNTHETIC QA estabelecimento',basis:'included',treatment:'private_health',confirmed:[0,1],evidence:'SYNTHETIC QA — pressupostos já delimitados do tratamento, preço incluído'})),periods:[{period:'2026-01',complete:true}]};
book=recordSales(draft,book);draft.modelo_a_snapshot=saveSalesBook(draft,book);return {draft,book};
}
File diff suppressed because one or more lines are too long