FORMAT==100
SKIPCHECK;

#******************************************************
# Check if rules apply to this scenario
#******************************************************
[]=N:
  IF(ATTRS('Version', !Version, 'Link to Drivers') @= 'Y',
    CONTINUE,
    STET
  );

#******************************************************
#
#******************************************************
['Local', 'Deprec Base']=N:
  ['M0','C/Fwd WDV'];

#******************************************************
#
#******************************************************
['Local', 'M0','Opening WDV']=N:
  ['Deprec Base'];

#******************************************************
#
#******************************************************
['Closing WDV']=N:
  (['Opening WDV']-['Total Deprec & Disp'])+['Acquisition $'];

#******************************************************
#
#******************************************************
['Local', 'M0']=STET;

#******************************************************
#
#******************************************************
['Local', 'M1', 'Opening WDV']=N:
  ['M0', 'Closing WDV'];

#******************************************************
#
#******************************************************
['Local', 'Opening WDV']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,DIMNM('Period', DIMIX('Period', !Period) - 1),!Region,!Department,!AssetType,'Opening WDV');

#******************************************************
#
#******************************************************
['Deprec Est $']=N:
  (['Deprec Base']-['Disposed'])*['Mthly Deprec Rate%'];

#******************************************************
#
#******************************************************
['Deprec Rate %']=N:
  DB('AssetAttributes',!Version,!FiscalYear,!AssetType,'Default Depreciation Rate');

#******************************************************
#
#******************************************************
['Disposed']=N:
  IF(['Disposals WDV'] <> 0,
    ['Disposals WDV'],
    CONTINUE
  );

#******************************************************
#
#******************************************************
['Disposed']=N:
  IF(DB('AssetSummary',!Currency,!Version,!FiscalYear,DIMNM('Period', DIMIX('Period', !Period) - 1),!Region,!Department,!AssetType,'Disposed') <> 0,
    DB('AssetSummary',!Currency,!Version,!FiscalYear,DIMNM('Period', DIMIX('Period', !Period) - 1),!Region,!Department,!AssetType,'Disposed'),
    STET
  );

#******************************************************
#
#******************************************************
['Mthly Deprec Rate%']=N:
  ['Deprec Rate %']\12;

#******************************************************
#
#******************************************************
['Acquisition $']=N:
  IF(ATTRN('Period', !Period, 'Index') <=6,
    DB('AssetNewSummary',!Currency,!Version,
    ATTRS('Period', !Period, 'Description') | STR(NUMBR(!FiscalYear) - 1,4,0),
    !Region,!Department,'TOTAL',!AssetType,'Acquisition $'),
    DB('AssetNewSummary',!Currency,!Version,
    ATTRS('Period', !Period, 'Description') | !FiscalYear,
    !Region,!Department,'TOTAL',!AssetType,'Acquisition $')
  );

#******************************************************
#
#******************************************************
['Depreciation']=N:
  IF(ATTRN('Period', !Period, 'Index') <=6,
    DB('AssetNewSummary',!Currency,!Version,
    ATTRS('Period', !Period, 'Description') | STR(NUMBR(!FiscalYear) - 1,4,0),
    !Region,!Department,'TOTAL',!AssetType,'Depreciation'),
    DB('AssetNewSummary',!Currency,!Version,
    ATTRS('Period', !Period, 'Description') | !FiscalYear,
    !Region,!Department,'TOTAL',!AssetType,'Depreciation')
  );

#******************************************************
#
#******************************************************
['Mvmnt WDV']=N:
  ['Closing WDV']-['Opening WDV'];

FEEDERS;

['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'C/Fwd WDV'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Deprec Base'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Opening WDV'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Deprec Est $'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Deprec Rate %'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Mthly Deprec Rate%'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Acquisition $'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Depreciation'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Closing WDV'];
['Local', 'M0', 'C/Fwd WDV']=>
  ['Total Year', 'Mvmnt WDV'];

['Local', 'M0', 'All Asset Types', 'C/Fwd WDV']=>
  DB('GL',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'7920','Amount');
['Local', 'M0', 'All Asset Types', 'Total Deprec & Disp']=>
  DB('GL',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'7920','Amount');


['Local', 'M0', 'Computers', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Computers','Period Balance');
['Local', 'Computers', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Computers','Period Balance');


['Local', 'M0', 'Furniture', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Furniture','Period Balance');
['Local', 'Furniture', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Furniture','Period Balance');

['Local', 'M0', 'Other Equipment', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Other Equipment','Period Balance');
['Local', 'Other Equipment', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Other Equipment','Period Balance');

['Local', 'M0', 'Vehicles', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Vehicles','Period Balance');
['Local', 'Vehicles', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Vehicles','Period Balance');

['Local', 'M0', 'Fitouts', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Fitouts','Period Balance');
['Local', 'Fitouts', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Fitouts','Period Balance');

['Local', 'M0', 'Capital Projects', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Capital Projects','Period Balance');
['Local', 'Capital Projects', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Capital Projects','Period Balance');

['Local', 'M0', 'Intellectual Property', 'C/Fwd WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Intellectual Property','Period Balance');
['Local', 'Intellectual Property', 'Closing WDV']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,'Intellectual Property','Period Balance');

['Local', 'Deprec Rate %']=>
  ['Acquisition $'];

['Local', 'Deprec Rate %']=>
  ['Depreciation'];


['Local','M0','All Asset Types','C/Fwd WDV']=>
  DB('GL','Local',!Version,!FiscalYear,'Total Year',!Department,!Region,'7920','Amount');
