Skip to content

Instantly share code, notes, and snippets.

@webbyworks
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webbyworks/d77c7af9b3384afcf3a8 to your computer and use it in GitHub Desktop.
Save webbyworks/d77c7af9b3384afcf3a8 to your computer and use it in GitHub Desktop.
Calculates the closing balance for each week. Uses the previous months' closing balance as the seed (otherwise circular reference errors are thrown?!).
if ( isBlank( ASSUM.CF.WeekNum ), 0,
if ( ASSUM.CF.WeekNum <= ASSUM.WksMonth,
if ( ASSUM.CF.WeekNum >= 2,
ACCT.CF.NetCashWeekly[Weeks=Week 1], 0 ) +
if ( ASSUM.CF.WeekNum >= 3,
ACCT.CF.NetCashWeekly[Weeks=Week 2]
, 0 ) +
if ( ASSUM.CF.WeekNum >= 4,
ACCT.CF.NetCashWeekly[Weeks=Week 3]
, 0 ) +
if ( ASSUM.CF.WeekNum = 5 and ASSUM.WksMonth = 5,
ACCT.CF.NetCashWeekly[Weeks=Week 4]
, 0 ) +
if ( isblank( ACCT.CF.OBal ), if ( ASSUM.WksMonth[time=this-1] = 5, ACCT.CF.CBalWeekly[time=this-1, Weeks=Week 5], ACCT.CF.CBalWeekly[time=this-1, Weeks=Week 4] ), ACCT.CF.OBal ) + ACCT.CF.NetCashWeekly
,
0
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment