feat: preparar lote IVA exacto em QA sem activacao
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { csvCell } from './csv.js';
|
||||
import { fiscalQaRows } from './fiscal-qa-preview.ts';
|
||||
import { isApiSimulationResultSnapshotV1 } from './simulation-contract.ts';
|
||||
|
||||
export type SimulationDraft = Record<string, string | string[]>;
|
||||
@@ -1848,6 +1849,13 @@ export function exportCompletedArithmeticCsv(
|
||||
);
|
||||
}
|
||||
const result = simulation.result_snapshot as Record<string, unknown>;
|
||||
if (result.scenario_kind === 'fiscal_rule_qa_preview') {
|
||||
const rows = fiscalQaRows(result);
|
||||
const report = readVersionedArithmeticReportReference(simulation);
|
||||
if (!rows.length || !report) throw new Error('A pré-visualização fiscal não corresponde ao relatório preservado.');
|
||||
return `\uFEFF${[...rows, ['ID do relatório', report.id], ['Hash do relatório', report.report_sha256], ['Data de exportação', exportedAt]]
|
||||
.map((field) => field.map(csvCell).join(',')).join('\r\n')}`;
|
||||
}
|
||||
const decimal = (value: unknown, label: string) => {
|
||||
if (typeof value !== 'string' || !/^(?:\d+)(?:\.\d+)?$/.test(value))
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user