FORMAT==100
SKIPCHECK;

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

#********************************************
# Stets
#********************************************
['Actual']=STET;
['2006']=STET;
['2007']=STET;
['2008']=STET;

['Local','FTE']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Department') @= !Department,
    IF((DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'StartMonth') @= ''
      % ATTRN('Period', DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'StartMonth'), 'Index')
      <= ATTRN('Period', !Period, 'Index'))
      &
      (DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'EndMonth') @= ''
      % ATTRN('Period', !Period, 'Index') <= ATTRN('Period',DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'EndMonth'),'Index')),
        DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'FTE'),
        CONTINUE
    ),
  CONTINUE
  );

['Local','Monthly Salary']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Department') @= !Department,
    IF((DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'StartMonth') @= ''
      % ATTRN('Period', DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'StartMonth'), 'Index')
      <= ATTRN('Period', !Period, 'Index'))
      &
      (DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'EndMonth') @= ''
      % ATTRN('Period', !Period, 'Index') <= ATTRN('Period',DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'EndMonth'),'Index')),
        DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Monthly Salary') * ['Local','FTE'],
        CONTINUE
    ),
  CONTINUE
  );

['Local','Monthly Salary After Inc']=N:
  ['Local','Monthly Salary'];

#********************************************
# Superannuation based off assumption cube
#********************************************
['Local','Superannuation', {'HONG KONG','SINGAPORE'}]=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Superannuation %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    !Region,
    'Superannuation %')
  );

['Local','Superannuation']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Superannuation %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    ELPAR('Region', !Region, 1),
    'Superannuation %')
  );

#********************************************
# Workforce based off assumption cube
#********************************************
['Local','Workcover', {'HONG KONG','SINGAPORE'}]=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Workcover %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    !Region,
    'Workcover %')
  );

['Local','Workcover']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Workcover %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    ELPAR('Region', !Region, 1),
    'Workcover %')
  );

#********************************************
# LSL based off assumption cube
#********************************************
['Local','LSL', {'HONG KONG','SINGAPORE'}]=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'LSL %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    !Region,
    'LSL %')
  );

['Local','LSL']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'LSL %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    ELPAR('Region', !Region, 1),
    'LSL %')
  );

#********************************************
# Payroll Tax based off assumption cube
#********************************************
['Local','Payroll Tax', {'HONG KONG','SINGAPORE'}]=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Payroll Tax %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    !Region,
    'Payroll Tax %')
  );

['Local','Payroll Tax']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Payroll Tax %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    ELPAR('Region', !Region, 1),
    'Payroll Tax %')
  );

#********************************************
# Other based off assumption cube
#********************************************
['Local','Other', {'HONG KONG','SINGAPORE'}]=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Other %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    !Region,
    'Other %')
  );

['Local','Other']=N:
  IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
    ['Monthly Salary After Inc']
    * DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Other %'),
    ['Monthly Salary After Inc']
    *
    DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
    DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
    ELPAR('Region', !Region, 1),
    'Other %')
  );

#********************************************
# Comm Costs - based off assumption cube
#********************************************
['Local','Communication Costs', {'HONG KONG','SINGAPORE'}]=N:
  IF(['Local','Monthly Salary'] <> 0,
    IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Comm Costs Per Person'),
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
      DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
      !Region,
      'Comm Costs Per Person')
    ),
  STET
  );

['Local','Communication Costs']=N:
  IF(['Local','Monthly Salary'] <> 0,
    IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Comm Costs Per Person'),
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
      DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
      ELPAR('Region', !Region, 1),
      'Comm Costs Per Person')
    ),
  STET
  );

#********************************************
# Motor Vehicle Costs - based off assumption cube
#********************************************
['Local','Motor Vehicle Costs', {'HONG KONG','SINGAPORE'}]=N:
  IF(['Local','Monthly Salary'] <> 0,
    IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Motor Vehicle Costs Per Person'),
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
      DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
      !Region,
      'Motor Vehicle Costs Per Person')
    ),
  STET
  );

['Local','Motor Vehicle Costs']=N:
  IF(['Local','Monthly Salary'] <> 0,
    IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Motor Vehicle Costs Per Person'),
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
      DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
      ELPAR('Region', !Region, 1),
      'Motor Vehicle Costs Per Person')
    ),
  STET
  );

#********************************************
# Staff Expenses - based off assumption cube
#********************************************
['Local','Staff Expenses', {'HONG KONG','SINGAPORE'}]=N:
  IF(['Local','Monthly Salary'] <> 0,
    IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Staff Expenses Per Person'),
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
      DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
      !Region,
      'Staff Expenses Per Person')
    ),
  STET
  );

['Local','Staff Expenses']=N:
  IF(['Local','Monthly Salary'] <> 0,
    IF(DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade') @= '',
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,'No Position',ELPAR('Region', !Region, 1),'Staff Expenses Per Person'),
      DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
      DB('LabourNewInputs',!Currency,!Version,!FiscalYear,!Region,!Item,'Position Grade'),
      ELPAR('Region', !Region, 1),
      'Staff Expenses Per Person')
    ),
  STET
  );
