fix(qa): review package one deficits and print layout pending acceptance

This commit is contained in:
2026-11-20 11:53:16 +02:00
parent 64f282c341
commit febb5b0b94
6 changed files with 116 additions and 31 deletions
+25 -3
View File
@@ -12,6 +12,29 @@ export type InvestmentReportTable = {
notes: string[];
issues: string[];
};
/** Shared print/Word layout: repeat the rubric beside at most four periods. */
export function investmentReportTableSlices(table: InvestmentReportTable) {
return Array.from(
{ length: Math.ceil((table.headers.length - 1) / 4) },
(_, chunk) => {
const start = 1 + chunk * 4;
const indices = [
0,
...Array.from(
{ length: Math.min(4, table.headers.length - start) },
(_, i) => start + i,
),
];
return {
headers: indices.map((i) => table.headers[i]),
rows: table.rows.map((row) =>
indices.map((i) => displayReportMoney(row[i] ?? '')),
),
};
},
);
}
const cents = (value: string): bigint => {
if (!/^-?\d+(?:\.\d{1,2})?$/.test(value))
throw new Error(
@@ -383,7 +406,7 @@ export function buildIntegralFinancialTables(
`Mês ${i + 1}: depreciação superior aos activos ou reembolso superior à dívida; confira os dados.`,
);
const assets =
positive(cash) +
cash +
positive(receivables) +
(inventory ?? 0n) +
fixed -
@@ -392,7 +415,6 @@ export function buildIntegralFinancialTables(
positive(-obligations) +
positive(-taxDue);
const liabilities =
positive(-cash) +
positive(-receivables) +
positive(obligations) +
positive(taxDue) +
@@ -535,7 +557,7 @@ export function buildIntegralFinancialTables(
'Existem períodos não reconciliados; reveja as rubricas indicadas.',
);
table('balance').notes.push(
'Caixa negativa é necessidade de tesouraria no passivo; recebíveis negativos são adiantamentos de clientes; obrigações negativas são adiantamentos a fornecedores. Não são fontes mobilizadas.',
'Caixa negativa conserva-se como défice projectado de tesouraria; não cria dívida, crédito aprovado ou financiamento mobilizado. Recebíveis negativos são adiantamentos de clientes; obrigações negativas são adiantamentos a fornecedores.',
'Capital inicial e activos anteriores são declarados. Depreciação e reembolsos provêm do motor existente. Subvenções: ' +
(a.grantsTreatment || 'sem montante declarado') +
'.',