FORMAT==100
SKIPCHECK;

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

#******************************************************
#
#******************************************************
['Local','Computers','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Computers','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Furniture','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Furniture','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Other Equipment','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Other Equipment','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Vehicles','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Vehicles','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Fitouts','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Fitouts','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Capital Projects','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Capital Projects','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Intellectual Property','Period Balance']=N:
  DB('AssetSummary',!Currency,!Version,!FiscalYear,!Period,!Region,!Department,'Intellectual Property','Closing WDV');

#******************************************************
#
#******************************************************
['Local','Period Change']=N:
  IF(!Period @= 'M1',
    DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,!AccountsBS,'Period Balance')
    - DB('BalanceSheet',!Currency,!Version,ATTRS('FiscalYear', !FiscalYear, 'Prev'),'M12',!Department,!Region,!AccountsBS,'Period Balance'),
    DB('BalanceSheet',!Currency,!Version,!FiscalYear,!Period,!Department,!Region,!AccountsBS,'Period Balance')
    - DB('BalanceSheet',!Currency,!Version,!FiscalYear,ATTRS('Period', !Period, 'Prev'),!Department,!Region,!AccountsBS,'Period Balance')
  );

FEEDERS;

['Local','Period Balance']=>
  DB('BalanceSheet',!Currency,!Version,!FiscalYear,ATTRS('Period', !Period, 'Next'),!Department,!Region,!AccountsBS,'Period Change');

['Local','M12', 'Period Balance']=>
  DB('BalanceSheet',!Currency,!Version,ATTRS('FiscalYear', !FiscalYear, 'Next'),'M1',!Department,!Region,!AccountsBS,'Period Change');
