FORMAT==100
#****************************************************************************
# Thanks to Kevin Jessop for the s curve logic
#****************************************************************************

['Budget Entry', 'Time Parameter','Month Ratio']=0;
['Budget Entry', 'Time Parameter','Month Count']=0;
['Budget Entry', 'Time Parameter']=STET;

['Budget Entry', 'Local', 'Month Count']=N:
IF(DIMIX('SL_Time', !SL_Time) = DIMIX('SL_Time', DB('S Curve',!Currency,!Version,'Time Parameter',!Project,!Region,'Start Month')),
  1,
  CONTINUE
);

['Budget Entry', 'Local', 'Month Count']=N:
IF((DIMIX('SL_Time', !SL_Time) > DIMIX('SL_Time', DB('S Curve',!Currency,!Version,'Time Parameter',!Project,!Region,'Start Month'))),
  CONTINUE,
  STET
);

['Budget Entry', 'Local', 'Month Count']=N:
IF((DIMIX('SL_Time', !SL_Time) < (DIMIX('SL_Time', DB('S Curve',!Currency,!Version,'Time Parameter',!Project,!Region,'Start Month')) + ['Time Parameter','Number of Months'])),
  DB('S Curve',!Currency,!Version,DIMNM('SL_Time', DIMIX('SL_Time', !SL_Time) - 1),!Project,!Region,'Month Count') + 1,
  STET
);

['Budget Entry', 'Local', 'Month ratio']= N:
  (1 / ['Time Parameter', 'Number of Months'])*['Month Count'];

['Budget Entry', 'Amount'] = N:
  (-2 * ['Month Ratio'] * ['Month Ratio'] * ['Month Ratio'] + 3 * ['Month Ratio'] * ['Month Ratio']) *  (['Time Parameter', 'Amount'] - 0);
