Reconcile IVA projection with Tempo Modelo A in QA

This commit is contained in:
2026-10-21 14:27:24 +02:00
parent 3f5430c3ce
commit 0b0cf76137
12 changed files with 353 additions and 1 deletions
+2
View File
@@ -1,4 +1,5 @@
import { isApiSimulationResultSnapshotV1 } from "./simulation-contract.ts";
import { modeloAComponentRows } from './iva-modelo-a.ts';
export function fiscalQaRows(value: unknown): Array<[string, string]> {
if (!isApiSimulationResultSnapshotV1(value)) return [];
@@ -21,6 +22,7 @@ export function fiscalQaRows(value: unknown): Array<[string, string]> {
: "não disponível";
const monthly = snapshot.monthly_projection as {rows?: Array<Record<string,unknown>>; cash_treatment?: string} | undefined;
return [
...modeloAComponentRows(snapshot),
...(monthly?.rows ? [
["Projecção mensal", "Vendas tributáveis sem IVA → taxa aplicada → IVA calculado → total com IVA; não é apuramento final"],
...monthly.rows.map((row) => [`Mês ${text(row.date)}`, `Vendas declaradas: ${text(row.sales_declared)}; base líquida: ${text(row.net_sales)}; taxa: ${row.rate == null ? 'não aplicada' : `${text(row.rate)}%`}; IVA: ${text(row.vat)}; total com IVA: ${text(row.gross_sales)}; ${row.status === 'calculated' ? 'calculado' : row.status === 'missing_sales' ? 'sem informação de vendas' : row.status === 'unsupported_basis' ? 'base líquida não determinada' : 'enquadramento ou regra indeterminados'}`]),