feat: apply owner warning decisions and add editable annual planning example
This commit is contained in:
@@ -83,6 +83,7 @@ function validCurrency(value: string): boolean {
|
||||
|
||||
export type BusinessFinancialPlanInput = {
|
||||
currency: string;
|
||||
annualGrowthPercent?: string;
|
||||
presentationCurrency?: string;
|
||||
fxRate?: string;
|
||||
fxDate?: string;
|
||||
@@ -523,6 +524,7 @@ export function restoreBusinessPlanSnapshot(
|
||||
return null;
|
||||
}
|
||||
for (const field of [
|
||||
'annualGrowthPercent',
|
||||
'presentationCurrency',
|
||||
'fxRate',
|
||||
'fxDate',
|
||||
@@ -1252,6 +1254,15 @@ export function compareBusinessScenarios(input: BusinessFinancialPlanInput) {
|
||||
|
||||
/** Forecast separates invoiced sales, collections, accounting expenses and cash payments. */
|
||||
export function forecastBusinessPlan(input: BusinessFinancialPlanInput) {
|
||||
if (input.annualGrowthPercent?.trim()) {
|
||||
if (
|
||||
percentMicro(
|
||||
input.annualGrowthPercent,
|
||||
'Crescimento anual pretendido',
|
||||
) < 0n
|
||||
)
|
||||
throw new Error('Este valor não pode ser negativo.');
|
||||
}
|
||||
if (!validCurrency(input.currency))
|
||||
throw new Error('Seleccione um código de moeda ISO suportado.');
|
||||
const periods = input.periods ?? 12;
|
||||
@@ -2748,6 +2759,9 @@ export function exportBusinessPlanCsv(
|
||||
],
|
||||
['Data de exportação', generatedAt],
|
||||
['Horizonte', `${input.periods ?? 12} meses`],
|
||||
...(input.annualGrowthPercent?.trim()
|
||||
? [['Crescimento anual pretendido (%)', input.annualGrowthPercent]]
|
||||
: []),
|
||||
['Moeda de cálculo', result.currency],
|
||||
['Moeda de apresentação', result.presentationCurrency],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user