import { ispcEligibilityBook } from '@/lib/ispc-eligibility'; import { ispcWithholdingBook, saveIspcWithholdingBook, recordIspcWithholding, ispcWithholdingReportRows, type IspcWithholdingInput, } from '@/lib/ispc-withholding'; export function SimulationIspcWithholding({ draft, onChange, }: { draft: Record; onChange: (field: string, value: string) => void; }) { if (draft.fiscal_component !== 'ispc') return null; try { if (ispcEligibilityBook(draft).input.mode === 'occasional') return (

Retenções do adquirente:entradas preservadas. Neste percurso de vendedor ocasional,registe a retenção recebida no quadro próprio abaixo.

); } catch { /* Existing recovery error stays explicit. */ } try { const b = ispcWithholdingBook(draft), i = b.input, change = (p: Partial) => onChange( 'modelo_a_snapshot', saveIspcWithholdingBook(draft, { ...b, input: { ...i, ...p }, }), ); return (

ISPC — retenção em aquisições ocasionais

{i.applicable === 'yes' && ( <>

Registe apenas aquisições do mesmo trimestre. O acumulado anterior cobre todas as aquisições desta via no ano e evita reutilizar o limite por fornecedor ou oportunidade.

{( [ 'quarter', 'base', 'priorAnnualPurchases', 'reference', ] as const ).map((k) => ( ))} {( [ 'naturalOccasional', 'unregistered', 'related', ] as const ).map((k) => ( ))} )} {ispcWithholdingReportRows(draft).map((r, n) => (

{r[1]}: {r[2]} {r[3]}

))}
); } catch (e) { return

{String(e)}

; } }