{book.rows.map(row=><detailskey={row.id}className="rounded border p-3"><summary>{row.description||'Operação por identificar'}—{row.period||'mês por indicar'}</summary>
{([['description','Operação identificada'],['operationRef','Referência da operação existente'],['period','Mês do contexto'],['documentRef','Documento / referência da previsão'],['documentDate','Data do documento'],['scope','Âmbito e parcelas abrangidas'],['evidence','Factos ou pressupostos expressos'],['amount','Montante total do âmbito identificado'],['currency','Moeda do montante / destino da conversão']]asconst).map(([field,label])=><labelclassName="block"key={field}>{label}<inputvalue={row[field]}type={field==='period'?'month':field==='documentDate'?'date':'text'}onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
{([['sourceCurrency','Moeda original'],['fxRate','Taxa de conversão indicada'],['fxDate','Data efectiva da taxa'],['fxSource','Fonte e exemplar da taxa'],['fxRuleRef','Regra/pressuposto da escolha da taxa e data']]asconst).map(([field,label])=><labelclassName="block"key={field}>{label}<inputvalue={row[field]}type={field==='fxDate'?'date':'text'}onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
{([['eventDate','Data própria do evento escolhido'],['eventRef','Referência e factos do evento7/8'],['reviewDate','Data até à qual os eventos foram conferidos']]asconst).filter(([field])=>field!=='eventDate'||!['advance_payment','consignment_deadline'].includes(row.treatment)).map(([field,label])=><labelclassName="block"key={field}>{label}<inputvalue={row[field]}type={field==='eventRef'?'text':'date'}onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
{['consignment_deadline','service_early_charge','contract_effects'].includes(row.treatment)&&<label>{row.treatment==='consignment_deadline'?'Entrega ao destinatário da consignação':row.treatment==='service_early_charge'?'Data de realização do serviço posterior à cobrança/débito':'Disponibilização anterior aos efeitos translativos'}<inputtype="date"value={row.otherDate}onChange={e=>change(row.id,{otherDate:e.target.value})}/></label>}
{([['legalDeadline','Termo legal do prazo de emissão aplicável'],['deadlineRef','Disposição,calendário e âmbito que fundamentam esse prazo']]asconst).map(([field,label])=><labelclassName="block"key={field}>{label}<inputvalue={row[field]}type={field==='legalDeadline'?'date':'text'}onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
{row.invoiceState==='issued'&&<>{([['invoiceDate','Data de emissão da factura'],['invoiceRef','Referência da factura']]asconst).map(([field,label])=><labelkey={field}>{label}<inputvalue={row[field]}type={field==='invoiceDate'?'date':'text'}onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}</>}
{row.paymentState==='received'&&<>{([['paymentDate','Data de recebimento'],['paymentAmount','Montante recebido'],['paymentRef','Referência e âmbito do recebimento']]asconst).map(([field,label])=><labelclassName="block"key={field}>{label}<inputvalue={row[field]}type={field==='paymentDate'?'date':'text'}onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}</>}
exportconstcurrencyEventSource='CIVA Lei13/2016,7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272).Lei22/2022 eLei10/2025 não alteram7/8,15(8)mantido.RIVA21/2008PDF4:regra histórica5dias úteis,não prazo automático vigente;usar prazo e disposição aplicáveis identificados. P104:Lei2/2006 ainda por corresponder;conversão apenas cenário condicionado,sem base fiscal confirmada.';
if(store.currencyEvents!==undefined&&(!store.currencyEvents||typeofstore.currencyEvents!=='object'||Array.isArray(store.currencyEvents)))thrownewError('Moeda/eventos não recuperáveis;originais preservados.');
constfields=Object.keys(newCurrencyEvent('',''));
for(constbofObject.values(store.currencyEvents??{}))if(!b||!Array.isArray(b.rows)||(b.history!==undefined&&!Array.isArray(b.history))||b.rows.some(r=>!r||fields.some(k=>typeofr[kaskeyofCurrencyEventRow]!=='string')))thrownewError('Linhas de moeda/eventos não recuperáveis;sem lista vazia por defeito.');returnstore;}
if(!currencyEventTreatments.some(t=>t.id===row.treatment))returnstop('Identifique percurso de moeda/evento.');
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||date(row.documentDate)===null||![row.description,row.operationRef,row.documentRef,row.scope,row.evidence].every(v=>!!v.trim()))returnstop('Identifique mês de contexto2026,operação,documento/data,âmbito e factos ou pressupostos expressos.');
if(row.factsConfirmed==='no')returnstop('Os factos declarados afastam este percurso;sem isenção ou IVA zero por defeito.','not_applicable');
if(row.factsConfirmed!=='yes')returnstop('Factos do percurso por esclarecer;não usar datas ou câmbio por defeito.');
if(row.currency!=='MZN'||!['USD','EUR','ZAR','GBP','CNY','BRL','JPY','CHF','AUD','CAD'].includes(row.sourceCurrency)||amount===null||fx===null||fx===0n||date(row.fxDate)===null||![row.fxSource,row.fxRuleRef].every(v=>!!v.trim())||!['mzn_per_unit','units_per_mzn'].includes(row.fxDirection))returnstop('Indique moeda original,valor,taxa positiva,direcção,data,fonte e regra/pressuposto expresso.Sem substituir moeda original porMZN ou reutilizar taxa de apresentação como regra fiscal.');
returnstop(`P104:cenário condicionado=${result.scenarioAmount}MZN,origem${row.sourceCurrency},taxa${row.fxRate},${row.fxDirection},data${row.fxDate}. Regra fiscal15(8)/Lei2/2006 ainda por corresponder;referência indicada é pressuposto,não validação da taxa legal.Base fiscal permanece indeterminada.Sem IVA ou activação nos livros anteriores.`,`conditional`);
}
constreview=date(row.reviewDate),event=date(row.eventDate);if(review===null||!row.eventRef.trim())returnstop('Identifique data de conferência e documento/âmbito do evento específico.');
if(row.treatment==='consignment_deadline'){
constdelivery=date(row.otherDate);if(delivery===null)returnstop('Identifique entrega das mercadorias à consignação3(3)d;7(6) exige termo180dias,não embalagensP102.');
if(date(row.paymentDate)===null)returnstop('Identifique recebimento anterior à factura para8c.');result.eventDate=null;
}else{
if(event===null)returnstop('Identifique a data própria do evento7,sem inferir da emissão do documento.');result.eventDate=row.eventDate;
if(row.treatment==='service_early_charge'&&(date(row.otherDate)===null||event>=date(row.otherDate)!))returnstop('Indique realização do serviço posterior à cobrança/débito;aplique o evento apenas ao montante respectivo.');
if(row.treatment==='contract_effects'&&(date(row.otherDate)===null||event<date(row.otherDate)!))returnstop('Indique disponibilização anterior ou simultânea aos efeitos translativos;este7(7) exclui3(3)a/b,que têm percursos próprios.');
if(date(result.eventDate!)!>review)returnstop('Evento aduaneiro futuro na conferência;sem exigibilidade declarada.');
result.dueEvents=[{date:result.eventDate!,amount:decimal(row.amount)===null?null:money(decimal(row.amount)!),reason:'7(1)c:desembaraço/arrematação/venda na importação;factura comercial não desloca o evento aduaneiro'}];returnstop('Importação7(1)c:facto gerador/exigibilidade pelo evento aduaneiro identificado;sem aplicar8 por factura comercial,nem calcular base/IVA.','determined');
}
if(row.invoiceRequired==='')returnstop('Identifique se esta operação dá lugar à obrigação de factura25;7 e8 são estados separados.');
if(row.invoiceRequired==='no'){
if(result.eventDate&&date(result.eventDate)!>review)returnstop('Evento futuro na conferencia;sem exigibilidade declarada.');
if(row.treatment==='advance_payment')returnstop('Percurso8c exige operação com obrigação de factura;conferir enquadramento.','not_applicable');
result.dueEvents=[{date:result.eventDate!,amount:decimal(row.amount)===null?null:money(decimal(row.amount)!),reason:'Exigibilidade segundo evento7,sem obrigação de factura declarada'}];returnstop('Facto gerador e exigibilidade7 identificados no âmbito declarado;sem calcular IVA,base ou dedução.','determined');
}
constdeadline=date(row.legalDeadline);if(deadline===null||!row.deadlineRef.trim()||(result.eventDate&&deadline<date(result.eventDate)!))returnstop('Facto gerador identificado;indique prazo legal de emissão e disposição/calendário aplicáveis.Sem presumir automaticamente cinco dias úteis2008 ou feriados.');
if(!['issued','not_issued'].includes(row.invoiceState)||!['none','received'].includes(row.paymentState))returnstop('Identifique emissão e recebimentos;desconhecido não é ausência de pagamento.');
if(row.invoiceState==='issued'&&(invoice===null||invoice>review||!row.invoiceRef.trim()))returnstop('Identifique factura efectivamente emitida/data/referência até à conferência.');
if(payment===null||payment>review||amount===null||total===null||amount>total||!row.paymentRef.trim())returnstop('Identifique recebimento,parcela e total do âmbito na mesma moeda;pagamento não pode exceder o total.Sem duplicar parcelas nem substituir montante desconhecido porzero.');
if((invoice===null||payment<invoice)&&payment<date(normalDate)!){paid=amount;result.dueEvents.push({date:row.paymentDate,amount:money(amount),reason:'8c:montante recebido antes da factura,sem prejuízo do termo do prazo8b'});}
elseif(row.treatment==='advance_payment')returnstop('Pagamento não é anterior à factura/termo aplicável;não antecipar por8c.','not_applicable');
}
if(row.treatment==='advance_payment'&&row.paymentState!=='received')returnstop('Identifique o recebimento anterior à factura.');
constremainder=total===null?null:total-paid;
if(date(normalDate)!<=review){if(remainder===null||remainder>0n)result.dueEvents.push({date:normalDate,amount:remainder===null?null:money(remainder),reason:invoice!==null&&invoice<=deadline?'8a:factura emitida dentro do prazo':'8b:termo do prazo de emissão'});}
returnstop('Exigibilidade separada em parcelas8a/b/c,sem dupla contagem do recebimento e restante. Facto gerador7 conservado;prazo legal parametrizado com referência aplicável.Sem IVA,base fiscal,nova dedução ou totaisModeloA.','determined');
@@ -656,6 +657,7 @@ export function buildProjectDossierRows(
rows.push(...secondhandReportRows(draft));
rows.push(...goodsPresumptionReportRows(draft));
rows.push(...propertyTransferReportRows(draft));
rows.push(...currencyEventReportRows(draft));
rows.push(...offerPreparationReportRows(draft));
constoperationRows=salesReportRows(draft);
rows.push(...operationRows);
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.